*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0d1117;
    --card-bg: #161b22;
    --card-border: #21262d;
    --card-shadow: rgba(0,255,160,0.04);
    --text: #c9d1d9;
    --heading: #e6edf3;
    --tagline: #8b949e;
    --label: #8b949e;
    --field-bg: #0d1117;
    --field-border: #30363d;
    --accent-green: #00ffa0;
    --accent-blue: #0080ff;
    --accent-blue-text: #58a6ff;
    --badge-green-bg: rgba(0,255,160,0.08);
    --badge-green-border: rgba(0,255,160,0.2);
    --badge-blue-bg: rgba(0,128,255,0.08);
    --badge-blue-border: rgba(0,128,255,0.2);
    --badge-gray-bg: rgba(255,255,255,0.04);
    --badge-gray-text: #8b949e;
    --badge-gray-border: #30363d;
    --file-label-bg: #21262d;
    --status-error: #f85149;
    --divider: #21262d;
    --notice: #8b949e;
    --notice-span: #c9d1d9;
    --footer: #7d8590;
    --btn-text: #0d1117;
    --toggle-bg: #21262d;
    --toggle-border: #30363d;
    --toggle-color: #8b949e;
}

html[data-theme="light"] {
    --bg: #f6f8fa;
    --card-bg: #ffffff;
    --card-border: #d0d7de;
    --card-shadow: rgba(0,0,0,0.06);
    --text: #24292f;
    --heading: #1b1f24;
    --tagline: #6e7781;
    --label: #57606a;
    --field-bg: #f6f8fa;
    --field-border: #d0d7de;
    --accent-green: #067d4f;
    --accent-blue: #0969da;
    --accent-blue-text: #0969da;
    --badge-green-bg: rgba(6,125,79,0.08);
    --badge-green-border: rgba(6,125,79,0.25);
    --badge-blue-bg: rgba(9,105,218,0.08);
    --badge-blue-border: rgba(9,105,218,0.25);
    --badge-gray-bg: rgba(0,0,0,0.04);
    --badge-gray-text: #57606a;
    --badge-gray-border: #d0d7de;
    --file-label-bg: #eaeef2;
    --status-error: #cf222e;
    --divider: #d0d7de;
    --notice: #8c959f;
    --notice-span: #57606a;
    --footer: #afb8c1;
    --btn-text: #ffffff;
    --toggle-bg: #eaeef2;
    --toggle-border: #d0d7de;
    --toggle-color: #57606a;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Courier New', Courier, monospace;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    transition: background-color 0.15s, color 0.15s;
}

.card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 580px;
    box-shadow: 0 0 40px var(--card-shadow);
    transition: background-color 0.15s, border-color 0.15s;
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: var(--toggle-bg);
    border: 1px solid var(--toggle-border);
    border-radius: 6px;
    color: var(--toggle-color);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, color 0.2s;
}

.theme-toggle:hover { border-color: var(--accent-blue-text); color: var(--accent-blue-text); }

.logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.5rem;
    padding-right: 2.5rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--bg);
    font-weight: bold;
}

h1 {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--heading);
    letter-spacing: 0.15em;
}

.tagline {
    font-size: 0.72rem;
    color: var(--tagline);
    margin-bottom: 2rem;
    letter-spacing: 0.03em;
}

.badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    letter-spacing: 0.05em;
    font-weight: bold;
}

.badge-green { background: var(--badge-green-bg); color: var(--accent-green); border: 1px solid var(--badge-green-border); }
.badge-blue  { background: var(--badge-blue-bg); color: var(--accent-blue-text); border: 1px solid var(--badge-blue-border); }
.badge-gray  { background: var(--badge-gray-bg); color: var(--badge-gray-text); border: 1px solid var(--badge-gray-border); }

label {
    display: block;
    font-size: 0.72rem;
    color: var(--label);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

textarea {
    width: 100%;
    height: 160px;
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    padding: 0.9rem;
    resize: vertical;
    margin-bottom: 1.4rem;
    transition: border-color 0.2s, background-color 0.15s, color 0.15s;
    outline: none;
}

textarea:focus { border-color: var(--accent-green); box-shadow: 0 0 0 2px var(--badge-green-bg); }

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.message-header label { margin-bottom: 0.4rem; }

.preview-toggle {
    background: var(--file-label-bg);
    border: 1px solid var(--field-border);
    border-radius: 6px;
    color: var(--label);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.preview-toggle:hover { border-color: var(--accent-blue-text); color: var(--accent-blue-text); }

.md-preview {
    width: 100%;
    min-height: 160px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.6;
    padding: 0.9rem;
    margin-bottom: 1.4rem;
    box-sizing: border-box;
}

.md-preview .md-empty { color: var(--tagline); font-style: italic; }
.md-preview h1, .md-preview h2, .md-preview h3 { color: var(--heading); margin: 0.6rem 0 0.4rem; line-height: 1.3; }
.md-preview h1 { font-size: 1.2rem; }
.md-preview h2 { font-size: 1.08rem; }
.md-preview h3 { font-size: 0.98rem; }
.md-preview p { margin-bottom: 0.7rem; }
.md-preview p:last-child { margin-bottom: 0; }
.md-preview ul, .md-preview ol { margin: 0 0 0.7rem 1.4rem; }
.md-preview blockquote {
    border-left: 3px solid var(--field-border);
    color: var(--tagline);
    margin: 0 0 0.7rem;
    padding: 0.1rem 0 0.1rem 0.8rem;
}
.md-preview code {
    background: var(--file-label-bg);
    border-radius: 3px;
    padding: 0.1rem 0.3rem;
    font-size: 0.85em;
}
.md-preview pre {
    background: var(--file-label-bg);
    border: 1px solid var(--field-border);
    border-radius: 6px;
    padding: 0.7rem;
    overflow-x: auto;
    margin-bottom: 0.7rem;
}
.md-preview pre code { background: none; padding: 0; }
.md-preview a { color: var(--accent-blue-text); }
.md-preview hr { border: none; border-top: 1px solid var(--field-border); margin: 0.8rem 0; }

.file-section { margin-bottom: 1.8rem; }

.file-label {
    display: inline-block;
    background: var(--file-label-bg);
    border: 1px solid var(--field-border);
    border-radius: 6px;
    color: var(--label);
    font-size: 0.78rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.file-label:hover { border-color: var(--accent-blue-text); color: var(--accent-blue-text); }

.file-limit {
    font-size: 0.68rem;
    color: var(--tagline);
    margin-left: 0.6rem;
    vertical-align: middle;
}

#file { display: none; }

#filename {
    font-size: 0.72rem;
    color: var(--accent-blue-text);
    margin-left: 0.6rem;
    vertical-align: middle;
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-blue) 100%);
    border: none;
    border-radius: 6px;
    color: var(--btn-text);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    padding: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    text-transform: uppercase;
}

.submit-btn:hover { opacity: 0.9; }
.submit-btn:active { transform: scale(0.99); }

#status {
    margin-top: 1rem;
    font-size: 0.78rem;
    min-height: 1.2rem;
    text-align: center;
    color: var(--accent-green);
}

#status.error { color: var(--status-error); }

.divider {
    border: none;
    border-top: 1px solid var(--divider);
    margin: 2rem 0 1.2rem;
}

.notice {
    font-size: 0.68rem;
    color: var(--notice);
    line-height: 1.7;
}

.notice span { color: var(--notice-span); }

.footer {
    margin-top: 1.5rem;
    font-size: 0.62rem;
    color: var(--footer);
    text-align: center;
    letter-spacing: 0.05em;
}
