:root {
    --primary-blue: #2c3e50;
    --agree-green: #27ae60;
    --disagree-purple: #c0392b;
    --neutral-gray: #7f8c8d;
    --border-gray: #bdc3c7;
    --text-dark: #333333;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --white: #ffffff;
    --font-main: 'Montserrat', sans-serif;
}

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

body {
    font-family: var(--font-main);
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===================== */
/*       NAVBAR          */
/* ===================== */
.navbar {
    height: 56px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-gray);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-blue);
    background: linear-gradient(135deg, var(--primary-blue), #34495e);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.85rem;
}

/* ===================== */
/*        HERO           */
/* ===================== */
.hero {
    padding: 40px 24px 24px;
    text-align: center;
    background-color: var(--bg-light);
}

.hero-logo-box {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.circle-part {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.cp1 { background-color: var(--primary-blue); }
.cp2 { background-color: var(--agree-green); }
.cp3 { background-color: var(--disagree-purple); }

.hero h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ===================== */
/*     QUESTIONNAIRE     */
/* ===================== */
.test-wrapper {
    max-width: 800px;
    padding: 16px 0 60px;
}

.questions {
    padding: 0 4px;
}

.progress-bar {
    height: 6px;
    background-color: var(--border-gray);
    border-radius: 3px;
    margin-bottom: 40px;
    position: relative;
    margin-left: 4px;
    margin-right: 4px;
}

.progress-fill {
    height: 100%;
    background-color: var(--agree-green);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-text {
    position: absolute;
    top: -24px;
    right: 0;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Question Items */
.question-item {
    padding: 20px 16px;
    margin-bottom: 16px;
    background: var(--white);
    border: 1px solid var(--border-gray);
    border-radius: 12px;
}

.question-item:last-child {
    margin-bottom: 0;
}

.question-header {
    margin-bottom: 24px;
    text-align: center;
}

.dim-badge {
    display: inline-block;
    padding: 2px 8px;
    background-color: var(--neutral-gray);
    color: var(--white);
    font-size: 0.7rem;
    border-radius: 4px;
    margin-bottom: 8px;
}

.question-text {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
}

/* ===================== */
/*   LIKERT 5-POINT      */
/* ===================== */
.likert5 {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.circles-group {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.circles-group label {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-light);
    gap: 4px;
    cursor: pointer;
}

.circle-input {
    appearance: none;
    -webkit-appearance: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid var(--border-gray);
    background: var(--white);
    margin: 0;
}

/* Likert Circle Sizes & Colors (Mobile First) */
.likert5 .c1, .likert5 .c5 { width: 44px; height: 44px; }
.likert5 .c2, .likert5 .c4 { width: 36px; height: 36px; }
.likert5 .c3 { width: 30px; height: 30px; }

.likert5 .c1, .likert5 .c2 { border-color: var(--disagree-purple); }
.likert5 .c4, .likert5 .c5 { border-color: var(--agree-green); }

.likert5 .c1:hover, .likert5 .c2:hover { background-color: rgba(192, 57, 43, 0.05); }
.likert5 .c3:hover { background-color: rgba(189, 195, 199, 0.1); }
.likert5 .c4:hover, .likert5 .c5:hover { background-color: rgba(39, 174, 96, 0.05); }

.likert5 .c1:checked, .likert5 .c2:checked { background-color: var(--disagree-purple); border-color: var(--disagree-purple); }
.likert5 .c3:checked { background-color: var(--neutral-gray); border-color: var(--neutral-gray); }
.likert5 .c4:checked, .likert5 .c5:checked { background-color: var(--agree-green); border-color: var(--agree-green); }


.circle-input:checked {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>');
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center;
}

.label-agree, .label-disagree {
    font-weight: 600;
    font-size: 0.75rem;
    white-space: nowrap;
}

.label-agree { color: var(--agree-green); }
.label-disagree { color: var(--disagree-purple); }

/* ===================== */
/*    CHOICE OPTIONS     */
/* ===================== */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.option-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 14px;
    border: 2px solid var(--border-gray);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

.option-item:hover {
    background-color: #f5f5f5;
    border-color: #95a5a6;
}

.option-item:active {
    transform: scale(0.98);
}

.option-item.selected {
    border-color: transparent;
    background: linear-gradient(var(--white), var(--white)) padding-box,
                linear-gradient(135deg, #2c3e50, #27ae60) border-box;
    border: 2px solid transparent;
    box-shadow: 0 2px 12px rgba(44, 62, 80, 0.1);
}

.opt-label {
    width: 26px;
    height: 26px;
    min-width: 26px;
    background-color: var(--border-gray);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 12px;
    margin-top: 1px;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 0.8rem;
}

.option-item.selected .opt-label {
    background: linear-gradient(135deg, #2c3e50, #27ae60);
    box-shadow: 0 2px 6px rgba(39, 174, 96, 0.3);
}

.opt-text {
    font-size: 0.85rem;
    color: var(--text-dark);
    line-height: 1.5;
}

/* ===================== */
/*       BUTTONS         */
/* ===================== */
.nav-btns {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    gap: 12px;
}

.btn {
    padding: 10px 24px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn.primary {
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
}

.btn.primary:active {
    background-color: #1a252f;
}

.btn.secondary {
    background-color: var(--white);
    color: var(--text-light);
    border: 1px solid var(--border-gray);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===================== */
/*       FOOTER          */
/* ===================== */
.main-footer {
    background-color: var(--bg-light);
    padding: 24px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border-gray);
}

.footer-bottom {
    color: var(--text-light);
    font-size: 0.75rem;
    text-align: center;
}

.author-links {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.author-links a {
    color: var(--agree-green);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.author-links a:hover {
    color: var(--primary-blue);
    text-decoration: underline;
}

.separator {
    color: var(--border-gray);
    opacity: 0.5;
}

/* =========================================================================
   RESULTS PAGE (结算页面)
========================================================================= */

.results-section {
    padding-top: 30px;
    padding-bottom: 40px;
}

.result-hero {
    background: #fff;
    text-align: center;
    border-top: 6px solid #33a474;
    padding: 30px 20px;
    margin-bottom: 24px;
}

.result-title {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.result-score {
    font-size: 1.2rem;
    font-weight: 600;
    color: #888;
    margin-bottom: 12px;
}

#final-score {
    color: #33a474;
    font-size: 2rem;
    font-weight: 800;
    margin-left: 8px;
}

.result-verdict {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-gray);
    margin: 0 auto;
    max-width: 800px;
    text-align: left;
}

.result-verdict strong {
    display: block;
    font-size: 1.4rem;
    color: var(--text-dark);
    margin-bottom: 12px;
    text-align: center;
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.analysis-report-container {
    margin-top: 30px;
    padding: 30px 40px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
}

.report-title {
    font-size: 1.4rem;
    color: var(--text-dark);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--agree-green);
    display: inline-block;
}

.report-content {
    font-size: 1.05rem;
    line-height: 2;
    color: var(--text-gray);
    text-align: justify;
}

.report-content p {
    margin-bottom: 20px;
}

.report-content p:last-child {
    margin-bottom: 0;
}

.chart-container {
    width: 100%;
    position: relative;
    padding: 0; /* Remove padding to maximize chart size inside 1:1 box */
    background: #fff;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    overflow: hidden; /* Crucial: stop chart from expanding parent during hover */
}

#radarChart {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 96% !important;
    height: 96% !important;
}

.chart-title {
    text-align: center;
    margin-bottom: 16px;
    font-size: 1.2rem;
    color: var(--text-dark);
}

.dimension-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dim-stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px 24px; /* Reduced to prevent text wrapping while staying premium */
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dim-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.dim-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px; /* Tighter for compact layout */
}

.dim-label {
    font-size: 1rem;
}

.dim-score {
    font-size: 0.9rem;
    color: var(--text-gray);
    font-weight: 600;
}

.sp-progressbar-mini {
    height: 14px; /* Thicker bars for premium look */
    border-radius: 14px;
    background-color: var(--bg-light);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.sp-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy entrance */
}

/* =========================================================================
   HISTORY PAGE (最近记录)
========================================================================= */

.history-section {
    padding-top: 30px;
    padding-bottom: 60px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.btn-text {
    background: none;
    border: none;
    color: #e46562;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 8px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid transparent;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    border-color: #33a474;
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-date {
    font-size: 0.85rem;
    color: #999;
}

.history-verdict {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.history-score {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #888;
}

.score-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: #33a474;
}

.empty-history {
    text-align: center;
    padding: 80px 20px;
    color: #999;
    background: #fdfdfd;
    border-radius: 16px;
    border: 2px dashed #eee;
}

.history-footer {
    margin-top: 40px;
    text-align: center;
}

/* ============================================================ */
/*                   TABLET (>= 600px)                          */
/* ============================================================ */
@media (min-width: 600px) {
    .container {
        padding: 0 24px;
    }

    .navbar {
        height: 64px;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .hero {
        padding: 56px 24px 32px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .test-wrapper {
        padding: 20px 0 80px;
    }

    .question-item {
        padding: 32px 0;
    }

    .question-text {
        font-size: 1.05rem;
    }

    .circle-input {
        /* Base border removed to rely on c1-c5 sizes */
    }

    .likert5 .c1, .likert5 .c5 { width: 52px; height: 52px; }
    .likert5 .c2, .likert5 .c4 { width: 42px; height: 42px; }
    .likert5 .c3 { width: 34px; height: 34px; }

    .circles-group {
        gap: 20px;
    }

    .likert5 {
        gap: 16px;
    }

    .label-agree, .label-disagree {
        font-size: 0.8rem;
    }

    .circles-group label {
        font-size: 0.8rem;
        gap: 6px;
    }

    .option-item {
        padding: 14px 18px;
        align-items: center;
    }

    .opt-label {
        width: 30px;
        height: 30px;
        min-width: 30px;
        margin-right: 14px;
        font-size: 0.85rem;
    }

    .opt-text {
        font-size: 0.9rem;
    }

    .options-group {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }

    .btn {
        padding: 12px 32px;
    }

    .nav-btns {
        margin-top: 40px;
    }
}

/* ============================================================ */
/*                  DESKTOP (>= 900px)                          */
/* ============================================================ */
@media (min-width: 900px) {
    .navbar {
        height: 80px;
    }

    .logo-text {
        font-size: 1.25rem;
    }

    .nav-links a {
        font-size: 0.95rem;
    }

    .hero {
        padding: 80px 0 40px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-logo-box {
        gap: 10px;
        margin-bottom: 24px;
    }

    .circle-part {
        width: 15px;
        height: 15px;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .question-item {
        padding: 40px 0;
    }

    .question-header {
        margin-bottom: 24px;
    }

    .question-text {
        font-size: 1.15rem;
    }

    .dim-badge {
        font-size: 0.75rem;
        padding: 3px 10px;
        margin-bottom: 12px;
    }

    .circle-input {
        /* Inherits */
    }

    .circles-group {
        gap: 30px;
    }

    .likert5 {
        gap: 20px;
    }

    .label-agree, .label-disagree {
        font-size: 0.9rem;
        padding-bottom: 25px;
    }

    .circles-group label {
        font-size: 0.85rem;
        gap: 8px;
    }

    .option-item {
        padding: 14px 20px;
        border-radius: 12px;
    }

    .opt-text {
        font-size: 0.95rem;
    }

    .footer-bottom {
        font-size: 0.85rem;
    }

    .main-footer {
        padding: 40px 0;
        margin-top: 80px;
    }

    /* Results section desktop layout */
    .results-section {
        padding-top: 60px;
    }

    .result-hero {
        padding: 40px 60px;
        margin-bottom: 40px;
    }

    .result-title {
        font-size: 2rem;
    }

    .results-grid {
        display: grid;
        grid-template-columns: 1.25fr 1fr; /* Radar chart slightly larger */
        align-items: stretch;
        gap: 24px;
        width: 100%;
    }

    .chart-container {
        height: auto;
        margin: 0;
        min-height: 0;
    }

    .dimension-cards {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 16px; /* Consistent with previous spacing */
    }

    .dim-stat-card {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 16px 20px;
    }
}

/* =========================================================================
   LEGAL DISCLAIMER MODAL (Premium Glassmorphism)
========================================================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    z-index: 99999;
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    max-width: 680px;
    width: 100%;
    max-height: 85vh;
    border-radius: 24px;
    padding: 48px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: modalSpring 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalSpring {
    from { opacity: 0; transform: scale(0.9) translateY(30px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-content h3 {
    color: #0f172a;
    font-size: 1.6rem;
    margin-bottom: 32px;
    text-align: center;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.modal-body {
    color: #334155;
    line-height: 1.8;
    font-size: 0.95rem;
}

.modal-body strong {
    color: #0f172a;
    font-weight: 600;
}

.modal-body p {
    margin-bottom: 20px;
}

.modal-body hr {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 24px 0;
}

.modal-footer {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.btn-agree {
    background: linear-gradient(135deg, #33A474 0%, #2b8c63 100%);
    color: white;
    padding: 18px;
    border-radius: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(51, 164, 116, 0.2);
}

.btn-agree:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(51, 164, 116, 0.3);
    filter: brightness(1.1);
}

.btn-agree:active {
    transform: translateY(0);
}

.btn-refuse {
    background: transparent;
    color: #64748b;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-refuse:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

/* Custom Scrollbar for Modal content */
.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@media (max-width: 600px) {
    .modal-content {
        padding: 32px 24px;
        border-radius: 16px;
    }
    .modal-content h3 {
        font-size: 1.3rem;
    }
}
