:root {
    --bg: #f3f6fb;
    --card-bg: #ffffff;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.12);
    --accent-dark: #1d4ed8;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #b91c1c;
    --chip-bg: #eef2ff;
    --chip-border: #c7d2fe;
}

/* Dark theme overrides */
body.dark-theme {
    --bg: #020617;
    --card-bg: #020617;
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.12);
    --accent-dark: #0ea5e9;
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --border: #1f2937;
    --danger: #f97373;
    --chip-bg: #020617;
    --chip-border: #1f2937;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #e0edff, #f9fafb 50%);
    color: var(--text-main);
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark-theme {
    background: radial-gradient(circle at top left, #020617, #020617 50%);
}

.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

body.dark-theme header.site-header {
    background: rgba(15, 23, 42, 0.92);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.35);
}

.brand-text-main {
    font-size: 16px;
    font-weight: 650;
}

.brand-text-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.motto-block {
    flex: 1;
    text-align: center;
    max-width: 650px;
}

.motto-line-hi {
    font-size: 12px;
    color: var(--text-main);
}

.motto-line-en {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-nav {
    display: inline-flex;
    align-items: center;
    background: #eef2ff;
    border-radius: 999px;
    padding: 3px;
    gap: 3px;
    font-size: 12px;
    border: 1px solid var(--chip-border);
}

body.dark-theme .header-nav {
    background: #020617;
}

.header-nav a {
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.header-nav a.active {
    background: var(--accent);
    color: #ffffff;
}

.theme-toggle-btn {
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 12px;
    padding: 5px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle-btn span.icon {
    font-size: 14px;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.language-switcher label {
    margin: 0;
}

.language-switcher select {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
}

main.page {
    flex: 1;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.card {
    width: 100%;
    max-width: 1100px;
    background: var(--card-bg);
    border-radius: 18px;
    padding: 22px 24px;
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.14),
        0 0 0 1px rgba(148, 163, 184, 0.25);
}

/* Common card layout that children views use */
.card-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.title {
    font-size: 22px;
    font-weight: 650;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-badge {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 3px 9px;
    border-radius: 999px;
}

.subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.header-local-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.local-nav {
    display: inline-flex;
    align-items: center;
    background: #f3f4ff;
    border-radius: 999px;
    padding: 3px;
    gap: 3px;
    font-size: 13px;
}

body.dark-theme .local-nav {
    background: #020617;
}

.local-nav a {
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.local-nav a.active {
    background: var(--accent);
    color: #ffffff;
}

.card-body {
    margin-top: 10px;
}

pre {
    margin: 10px 0 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: #020617;
    color: #e5e7eb;
    font-size: 13px;
    line-height: 1.5;
    max-height: 70vh;
    overflow: auto;
    white-space: pre-wrap;
}

body.dark-theme pre {
    background: #020617;
    color: #e5e7eb;
}

/* Responsive */
@media (max-width: 800px) {
    header.site-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .motto-block {
        text-align: left;
    }
    .header-right {
        align-self: stretch;
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    main.page {
        padding: 16px;
    }
    .card {
        padding: 18px;
        border-radius: 14px;
    }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
