/* 进制转换器 - 极简工具风格 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1976d2;
    --primary-hover: #1565c0;
    --text: #1a1a1a;
    --text-muted: #666;
    --border: #e0e0e0;
    --bg: #f5f5f5;
    --surface: #fff;
    --input-bg: #fafafa;
    --success: #2e7d32;
    --error: #c62828;
    --radius: 6px;
}

/* 暗色主题 */
body.dark-theme {
    --primary: #42a5f5;
    --primary-hover: #64b5f6;
    --text: #e8e8e8;
    --text-muted: #b0b0b0;
    --border: #404040;
    --bg: #1a1a1a;
    --surface: #252525;
    --input-bg: #2d2d2d;
    --error: #ef5350;
}

.theme-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
body.dark-theme .theme-icon.sun { display: none; }
body.dark-theme .theme-icon.moon { display: inline-flex; }
body .theme-icon.sun { display: inline-flex; }
body .theme-icon.moon { display: none; }

body {
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px;
    width: 100%;
}

/* 头部：克制、工具感 */
header {
    margin-bottom: 24px;
    position: relative;
    display: flex;
    align-items: center;
}

.theme-toggle {
    position: fixed;
    right: 12px;
    top: 12px;
    z-index: 100;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
    color: var(--text);
    background: var(--input-bg);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    opacity: 0.9;
}

.header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* 主区域：扁平、细边框 */
main {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 32px;
    border: 1px solid var(--border);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.converter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 32px;
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 500;
}

.label-title {
    font-size: 0.875rem;
    color: var(--text);
}

.label-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.15s ease, background-color 0.2s ease, color 0.2s ease;
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.input-group input::placeholder {
    color: #999;
}

.input-group input.error {
    border-color: var(--error);
    background: #ffebee;
}

.input-group input.success {
    border-color: var(--success);
}

.error-message {
    min-height: 18px;
    font-size: 0.75rem;
    color: var(--error);
    margin-top: 4px;
}

/* 按钮 */
.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
}

.btn {
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
    background: var(--input-bg);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* 说明区域：文档式 */
.info-section {
    background: var(--input-bg);
    border-radius: var(--radius);
    padding: 16px 18px;
    border: 1px solid var(--border);
}

.info-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section ul li {
    padding: 4px 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    position: relative;
    padding-left: 1rem;
}

.info-section ul li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: var(--primary);
}

.steps-section, .examples-section, .faq-section {
    margin-top: 20px;
}

.steps-section h3, .examples-section h3, .faq-section h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.steps-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text);
    font-size: 0.8125rem;
    line-height: 1.6;
}

.steps-list li { margin-bottom: 4px; }

.examples-grid { display: grid; gap: 8px; }

.example-item {
    background: var(--input-bg);
    border-radius: var(--radius);
    padding: 10px 12px;
    border: 1px solid var(--border);
}

.example-title {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text);
    margin-bottom: 4px;
}

.example-expr {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.example-result {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
}

.faq-list { display: grid; gap: 8px; }

.faq-item {
    background: var(--input-bg);
    border-radius: var(--radius);
    padding: 10px 12px;
    border: 1px solid var(--border);
}

.faq-q {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text);
    margin-bottom: 4px;
}

.faq-a {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 28px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
}

footer a:hover { color: var(--text); }

.footer-sep { margin: 0 6px; color: var(--border); }

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--text);
    color: #fff;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { background: var(--success); color: #fff; }

.toast.error { background: var(--error); color: #fff; }

@media (max-width: 768px) {
    .container { padding: 16px 12px; }
    main { padding: 18px; }
    .converter-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .button-group { flex-direction: row; flex-wrap: wrap; justify-content: center; }
    .btn { flex: 1; min-width: 120px; }
}

@media (max-width: 480px) {
    .header-content { gap: 8px; }
    .logo { width: 32px; height: 32px; }
    header h1 { font-size: 1.1rem; }
    .subtitle { font-size: 0.75rem; }
    .input-group input { padding: 8px 10px; font-size: 0.875rem; }
}

