:root {
    --bg: #f5f5f7;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-strong: rgba(255, 255, 255, 0.94);
    --line: rgba(0, 0, 0, 0.08);
    --text: #1d1d1f;
    --muted: #6e6e73;
    --blue: #0071e3;
    --blue-soft: rgba(0, 113, 227, 0.12);
    --green: #2f8f5b;
    --warning: #b26a00;
    --shadow: 0 28px 70px rgba(0, 0, 0, 0.11);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 12%, rgba(0, 113, 227, 0.12), transparent 30%),
        radial-gradient(circle at 84% 18%, rgba(52, 199, 89, 0.1), transparent 28%),
        linear-gradient(180deg, #fbfbfd 0%, var(--bg) 54%, #eceff3 100%);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.65), transparent 42%),
        radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.9), transparent 36%);
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 52px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 46px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(22px) saturate(180%);
}

.brand,
.nav-actions a,
.switch-link a {
    color: var(--blue);
    text-decoration: none;
}

.brand {
    color: var(--text);
    font-size: 17px;
    font-weight: 700;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--muted);
    font-size: 14px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 52px;
    align-items: center;
    min-height: 66vh;
}

.chat-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1fr);
    gap: 42px;
    align-items: center;
    min-height: 64vh;
}

.hero-copy,
.auth-copy {
    padding: 24px 0;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--blue);
    font-size: 14px;
    font-weight: 600;
}

h1 {
    margin: 0;
    max-width: 680px;
    font-size: clamp(52px, 8vw, 92px);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.03;
}

.subtitle {
    max-width: 560px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 21px;
    line-height: 1.6;
}

.nutrition-panel,
.result-panel {
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(26px) saturate(180%);
}

.nutrition-panel {
    display: grid;
    gap: 20px;
    padding: 30px;
}

.chat-panel {
    gap: 16px;
}

.chat-messages {
    display: grid;
    gap: 12px;
    max-height: 440px;
    overflow: auto;
    padding-right: 4px;
}

.chat-message {
    display: flex;
}

.chat-message p {
    max-width: 82%;
    margin: 0;
    padding: 12px 14px;
    border-radius: 20px;
    line-height: 1.65;
}

.chat-message.assistant {
    justify-content: flex-start;
}

.chat-message.assistant p {
    color: var(--text);
    background: rgba(242, 242, 247, 0.92);
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.user p {
    color: #ffffff;
    background: var(--blue);
}

.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 10px;
}

.secondary-button {
    width: 100%;
    color: var(--blue);
    background: rgba(0, 113, 227, 0.1);
    box-shadow: none;
}

.secondary-button:hover {
    color: #ffffff;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 52px;
    align-items: center;
    width: min(1040px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 48px 0;
}

.auth-panel h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.form-message {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(178, 106, 0, 0.18);
    border-radius: 16px;
    color: var(--warning);
    background: rgba(255, 204, 0, 0.14);
}

.switch-link {
    margin: 0;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

label {
    display: grid;
    gap: 9px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.11);
    border-radius: 16px;
    padding: 14px 15px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.78);
    font: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea {
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #9a9aa0;
}

input:focus,
textarea:focus {
    border-color: rgba(0, 113, 227, 0.7);
    background: #ffffff;
    box-shadow: 0 0 0 4px var(--blue-soft);
}

button {
    min-height: 50px;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    background: var(--blue);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0, 113, 227, 0.24);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:hover {
    background: #0077ed;
    box-shadow: 0 16px 38px rgba(0, 113, 227, 0.28);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.result-panel {
    margin-top: 30px;
    padding: 30px;
    background: var(--surface-strong);
}

.result-panel h2 {
    margin: 0 0 18px;
    font-size: 24px;
    font-weight: 700;
}

.result-panel ul {
    display: grid;
    gap: 12px;
    margin: 0;
    padding-left: 20px;
    color: #3a3a3c;
    line-height: 1.75;
}

.result-panel li::marker {
    color: var(--green);
}

.compact-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.food-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.food-item {
    min-height: 142px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.food-item span {
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.food-item h3 {
    margin: 10px 0 8px;
    font-size: 17px;
}

.food-item p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.food-item .micro-text {
    margin-top: 8px;
    color: #3a3a3c;
}

@media (max-width: 860px) {
    .page-shell {
        padding-top: 18px;
    }

    .hero,
    .chat-hero,
    .auth-shell {
        grid-template-columns: 1fr;
        gap: 28px;
        min-height: auto;
    }

    .auth-shell {
        align-content: center;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        border-radius: 20px;
    }

    .nav-actions {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    h1 {
        font-size: clamp(44px, 14vw, 64px);
    }

    .subtitle {
        font-size: 18px;
    }

    .nutrition-panel,
    .result-panel {
        border-radius: 24px;
        padding: 22px;
    }

    .chat-form {
        grid-template-columns: 1fr;
    }

    .chat-message p {
        max-width: 92%;
    }

    .food-grid {
        grid-template-columns: 1fr;
    }
}

.questionnaire-page {
    min-height: 100vh;
    color: #211817;
    background: #f2f2f2;
    font-family: "Comic Sans MS", "STKaiti", "KaiTi", "Kaiti SC", "PingFang SC", cursive;
}

.questionnaire-page::before {
    display: none;
}

.questionnaire-shell {
    width: min(460px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 20px 48px;
    background: #f2f2f2;
}

.progress-band {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    margin: 28px 0 72px;
    font-size: 18px;
    font-weight: 700;
}

.progress-track {
    height: 22px;
    overflow: hidden;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.04);
}

.progress-track i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: #bfeeff;
}

.questionnaire-cover {
    padding: 0 34px 36px;
}

.cover-line {
    width: 170px;
    height: 4px;
    margin-bottom: 46px;
    background: #211817;
}

.questionnaire-cover .eyebrow {
    margin: 0;
    color: #211817;
    font-size: 44px;
    font-weight: 900;
    line-height: 1.05;
}

.questionnaire-cover h1 {
    margin: 14px 0 18px;
    max-width: none;
    font-size: 34px;
    line-height: 1.35;
    font-weight: 900;
}

.questionnaire-cover h1 span,
.questionnaire-cover mark {
    padding: 0 8px;
    color: #111111;
    background: #bfeeff;
}

.questionnaire-cover h2 {
    margin: 0 0 28px;
    font-size: 36px;
    font-weight: 900;
}

.questionnaire-cover ul {
    display: grid;
    gap: 20px;
    margin: 0;
    padding-left: 20px;
    font-size: 23px;
    line-height: 1.65;
    font-weight: 800;
}

.qa-board,
.paper-panel {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.qa-board {
    display: grid;
    gap: 20px;
    padding: 0 14px 30px;
}

.questionnaire-page .chat-messages {
    gap: 18px;
    max-height: none;
    overflow: visible;
    padding: 0;
}

.questionnaire-page .chat-message {
    display: flex;
}

.questionnaire-page .chat-message p {
    max-width: 92%;
    margin: 0;
    padding: 18px 22px;
    border-radius: 30px;
    font-size: 20px;
    line-height: 1.55;
    font-weight: 700;
}

.questionnaire-page .chat-message.assistant p {
    color: #211817;
    background: #ffffff;
}

.questionnaire-page .chat-message.user {
    justify-content: flex-end;
}

.questionnaire-page .chat-message.user p {
    color: #1d1d1f;
    background: #dff5ff;
}

.questionnaire-page .chat-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
}

.questionnaire-page input {
    min-height: 76px;
    border: 0;
    border-radius: 999px;
    padding: 0 26px;
    color: #211817;
    background: #ffffff;
    box-shadow: none;
    font-size: 19px;
    font-weight: 700;
}

.questionnaire-page input:focus {
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(191, 238, 255, 0.85);
}

.questionnaire-page button {
    min-height: 70px;
    border-radius: 999px;
    color: #151515;
    background: #bfeeff;
    box-shadow: none;
    font-size: 25px;
    font-weight: 900;
}

.questionnaire-page button:hover {
    color: #151515;
    background: #aee8fb;
    box-shadow: none;
    transform: translateY(-1px);
}

.questionnaire-page .secondary-button {
    min-height: 54px;
    color: #211817;
    background: #ffffff;
    font-size: 18px;
}

.paper-panel {
    margin-top: 28px;
    padding: 28px 24px;
}

.paper-panel h2 {
    margin: 0 0 18px;
    font-size: 27px;
    font-weight: 900;
}

.paper-panel p,
.paper-panel li {
    color: #211817;
    font-size: 20px;
    line-height: 1.65;
    font-weight: 700;
}

.paper-panel ul {
    display: grid;
    gap: 14px;
    margin: 0;
    padding-left: 24px;
}

.paper-panel li::marker {
    color: #8bdcf6;
}

.plain-link,
.logout-inline {
    color: #211817;
    text-decoration: none;
}

.plain-link:hover,
.logout-inline:hover {
    text-decoration: underline;
}

.home-shell {
    width: min(760px, 100%);
    padding-top: 88px;
}

.dashboard-cover {
    padding-bottom: 28px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    padding: 0 28px 32px;
}

.module-card {
    display: grid;
    align-content: start;
    min-height: 260px;
    padding: 28px 24px;
    color: #211817;
    text-decoration: none;
    border-radius: 34px;
    background: #ffffff;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.module-card:hover {
    background: #fdfefe;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.module-card span {
    width: fit-content;
    margin-bottom: 30px;
    padding: 6px 10px;
    color: #111111;
    background: #bfeeff;
    font-size: 17px;
    font-weight: 900;
}

.module-card h3 {
    margin: 0 0 16px;
    font-size: 34px;
    line-height: 1.15;
    font-weight: 900;
}

.module-card p {
    margin: 0;
    color: #2c2c2c;
    font-size: 19px;
    line-height: 1.6;
    font-weight: 700;
}

.module-card-left {
    border-top: 8px solid #bfeeff;
}

.module-card-right {
    border-top: 8px solid #211817;
}

.logout-inline {
    display: block;
    width: fit-content;
    margin: 0 auto 42px;
    font-size: 18px;
    font-weight: 800;
}

.record-nav {
    grid-template-columns: auto 1fr auto;
    margin-bottom: 58px;
}

.record-nav strong {
    text-align: center;
}

.record-form {
    display: grid;
    gap: 18px;
}

.record-form label {
    display: grid;
    gap: 10px;
    color: #211817;
    font-size: 21px;
    font-weight: 900;
}

.questionnaire-page textarea {
    width: 100%;
    resize: vertical;
    border: 0;
    border-radius: 30px;
    padding: 20px 22px;
    color: #211817;
    background: #ffffff;
    font-size: 19px;
    line-height: 1.55;
    font-weight: 700;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

.questionnaire-page textarea:focus {
    box-shadow: 0 0 0 4px rgba(191, 238, 255, 0.85);
}

.form-message {
    margin: 0;
    padding: 16px 20px;
    border-radius: 24px;
    color: #211817;
    background: #dff5ff;
    font-size: 18px;
    line-height: 1.5;
    font-weight: 800;
}

.records-list {
    padding-left: 0;
    list-style: none;
}

.records-list li {
    padding: 16px 0;
    border-bottom: 1px solid rgba(33, 24, 23, 0.12);
}

.records-list li:last-child {
    border-bottom: 0;
}

.records-list strong {
    display: inline-block;
    margin-right: 10px;
    padding: 3px 8px;
    background: #bfeeff;
}

.records-list span {
    color: #666666;
    font-size: 15px;
}

.records-list p {
    margin: 8px 0 0;
}

.structured-panel h3,
.history-panel h3 {
    margin: 22px 0 10px;
    font-size: 21px;
    font-weight: 900;
}

.structured-list {
    padding-left: 0;
    list-style: none;
}

.structured-list li {
    padding: 16px 0;
    border-bottom: 1px solid rgba(33, 24, 23, 0.12);
}

.structured-list li:last-child {
    border-bottom: 0;
}

.structured-list strong {
    display: block;
}

.structured-list span {
    display: inline-block;
    margin: 6px 0;
    padding: 3px 8px;
    background: #bfeeff;
    font-size: 15px;
    font-weight: 900;
}

@media (min-width: 861px) {
    .questionnaire-page {
        background: #e7e7e7;
    }

    .questionnaire-shell {
        margin-top: 24px;
        margin-bottom: 24px;
        border-radius: 34px;
        box-shadow: 0 30px 90px rgba(0, 0, 0, 0.12);
        overflow: hidden;
    }
}

@media (max-width: 620px) {
    .home-shell {
        padding-top: 48px;
    }

    .module-grid {
        grid-template-columns: 1fr;
        padding-right: 20px;
        padding-left: 20px;
    }

    .module-card {
        min-height: 220px;
    }

    .record-nav {
        gap: 10px;
        font-size: 16px;
    }
}
