:root {
    --law-primary: #00479D;
    --law-primary-light: #2959B2;
    --law-primary-soft: #eff6ff;
    --law-ribbon-bg: linear-gradient(180deg, #00479D 0%, #003A82 100%);
    --law-gradient: linear-gradient(135deg, #00479D 0%, #2959B2 100%);
    --bg-canvas: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
}

body[data-law-theme="constitution"] {
    --law-primary: #00479D;
    --law-primary-light: #2959B2;
    --law-primary-soft: #eff6ff;
    --law-ribbon-bg: linear-gradient(180deg, #00479D 0%, #003A82 100%);
    --law-gradient: linear-gradient(135deg, #00479D 0%, #2959B2 100%);
}

body[data-law-theme="administrative"] {
    --law-primary: #F28C28;
    --law-primary-light: #FDAE43;
    --law-primary-soft: #fff7ed;
    --law-ribbon-bg: linear-gradient(180deg, #F58E2E 0%, #E07B1E 100%);
    --law-gradient: linear-gradient(135deg, #E07B1E 0%, #FDAE43 100%);
}

body[data-law-theme="procedure"] {
    --law-primary: #EB4245;
    --law-primary-light: #FD6F6B;
    --law-primary-soft: #fef2f2;
    --law-ribbon-bg: linear-gradient(180deg, #F04548 0%, #D93437 100%);
    --law-gradient: linear-gradient(135deg, #D93437 0%, #FD6F6B 100%);
}

body {
    background-color: var(--bg-canvas);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Admin Top Navbar (kept for layout_admin.html) */
.law-navbar {
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.15);
    padding: 0.6rem 1.25rem;
}

.law-navbar .navbar-brand {
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.law-navbar .navbar-brand img {
    height: 36px;
    width: auto;
    border-radius: 8px;
    background: #fff;
    padding: 2px 6px;
}

.nav-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

.nav-icon-btn:hover, .nav-icon-btn:focus {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Classic-Modernized Two-Tier Site Header */
.law-site-header {
    background: #ffffff;
    position: relative;
    z-index: 1030;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
}

.law-utility-bar {
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    padding: 0.42rem 0;
}

.law-utility-tagline {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.law-tagline-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--law-primary);
    display: inline-block;
    transition: background 0.3s ease;
}

.law-util-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32rem 0.68rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 600;
    color: #334155;
    background: transparent;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.18s ease;
}

.law-util-btn:hover,
.law-util-btn:focus,
.law-util-btn.show {
    background: #f1f5f9;
    color: var(--law-primary);
    border-color: #e2e8f0;
}

.law-util-btn.dropdown-toggle::after,
.law-user-pill.dropdown-toggle::after {
    margin-left: 0.15rem;
    opacity: 0.55;
}

.law-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.32rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    text-decoration: none;
    transition: all 0.18s ease;
}

.law-user-pill:hover,
.law-user-pill:focus,
.law-user-pill.show {
    background: var(--law-primary);
    color: #ffffff;
    border-color: var(--law-primary);
}

.law-brand-menu {
    position: relative;
    background: #ffffff;
}

.law-menu-upper {
    position: relative;
    z-index: 2;
    padding-top: 10px;
}

.law-menu-inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 62px;
}

.law-logo-link {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 4;
    margin-bottom: -24px;
    transition: transform 0.2s ease;
}

.law-logo-link:hover {
    transform: translateY(-1px);
}

.law-main-logo {
    height: 84px;
    width: auto;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.12));
}

.law-subject-tabs {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex: 1;
    gap: 1.15rem;
}

.law-tab {
    border: 0;
    min-width: 156px;
    height: 46px;
    padding: 0 1.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #1e293b;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    background-size: 100% 200%;
    background-position: 0 0;
    transition: background-position 0.32s cubic-bezier(0.22, 1, 0.36, 1), color 0.22s ease;
}

.law-tab-constitution {
    background-image: linear-gradient(to bottom, #ffffff 0%, #ffffff 42%, #00479D 42%, #00479D 50%, #2959B2 50%, #2959B2 82%, #00479D 82%, #00479D 100%);
}

.law-tab-administrative {
    background-image: linear-gradient(to bottom, #ffffff 0%, #ffffff 42%, #F58E2E 42%, #F58E2E 50%, #FDAE43 50%, #FDAE43 82%, #F58E2E 82%, #F58E2E 100%);
}

.law-tab-procedure {
    background-image: linear-gradient(to bottom, #ffffff 0%, #ffffff 42%, #F04548 42%, #F04548 50%, #FD6F6B 50%, #FD6F6B 82%, #F04548 82%, #F04548 100%);
}

.law-tab:hover:not(.active) {
    background-position: 0 8%;
}

.law-tab.active {
    background-position: 0 100%;
    color: #ffffff;
}

.law-menu-ribbon {
    height: 34px;
    background: var(--law-ribbon-bg);
    transition: background 0.35s ease;
    position: relative;
    z-index: 1;
}

@media (max-width: 767.98px) {
    .law-menu-inner {
        flex-direction: column;
        align-items: center;
        gap: 0.45rem;
        min-height: auto;
    }

    .law-logo-link {
        margin-bottom: 0;
    }

    .law-main-logo {
        height: 60px;
    }

    .law-subject-tabs {
        width: 100%;
        gap: 0.4rem;
    }

    .law-tab {
        flex: 1;
        min-width: 0;
        height: 42px;
        padding: 0 0.5rem;
        font-size: 0.92rem;
    }

    .law-menu-ribbon {
        height: 14px;
    }
}

/* Clean Sub-Page Header */
.law-page-header {
    padding: 1.5rem 0 1rem;
}

.law-page-eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--law-primary);
    background: var(--law-primary-soft);
    padding: 0.22rem 0.7rem;
    border-radius: 999px;
    margin-bottom: 0.35rem;
}

.law-page-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0;
}

/* Cards */
.law-card {
    background: var(--card-bg);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.mode-action-card {
    cursor: pointer;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
    padding: 1.35rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.15rem;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.mode-action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
    border-color: var(--law-primary);
}

.mode-icon-box {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--law-primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mode-icon-box img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

/* Experience Bar */
.exp-progress {
    height: 22px;
    background-color: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.exp-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b 0%, #ea580c 100%);
    border-radius: 999px;
    transition: width 0.6s ease;
}

.exp-progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #1e293b;
}

/* Battle & Quiz Arena */
.question-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    padding: 2rem;
}

#Q {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.65;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.answer-btn {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    text-align: left;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    background: #ffffff;
    color: #1e293b;
    font-size: 1.05rem;
    font-weight: 600;
    transition: all 0.15s ease;
    margin-bottom: 0.85rem;
    white-space: normal !important;
}

.answer-btn:hover:not(:disabled) {
    border-color: var(--law-primary);
    background: var(--law-primary-soft);
    transform: translateY(-1px);
}

.answer-btn .opt-badge {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.answer-btn.is-correct {
    border-color: #16a34a !important;
    background: #dcfce7 !important;
    color: #14532d !important;
}

.answer-btn.is-correct .opt-badge {
    background: #16a34a;
    color: #ffffff;
}

.answer-btn.is-wrong {
    border-color: #dc2626 !important;
    background: #fee2e2 !important;
    color: #7f1d1d !important;
}

.answer-btn.is-wrong .opt-badge {
    background: #dc2626;
    color: #ffffff;
}

/* VS Scoreboard for Computer & Friend Battles */
.vs-scoreboard {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    border-radius: 16px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
}

.vs-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    padding: 4px;
    object-fit: contain;
}

.score-number {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.1;
}

/* Auth Pages */
.auth-backdrop {
    min-height: 100vh;
    background: url("/images/003_1_compressed.jpg") center/cover no-repeat fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-radius: 22px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    padding: 2.25rem;
}

/* Review Cards on /statistics/single */
.review-card {
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.1rem;
    background: #ffffff;
    border: 2px solid #e2e8f0;
}

.review-card.correct {
    border-color: #22c55e;
    background: #f0fdf4;
}

.review-card.wrong {
    border-color: #ef4444;
    background: #fef2f2;
}

.law-footer {
    margin-top: auto;
    padding: 1.25rem 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.9rem;
}
