@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;600;700;800&display=swap');

:root {
    color-scheme: light;
    --bg: #f7f5ef;
    --surface: #ffffff;
    --surface-strong: #fff8eb;
    --text: #1f2933;
    --muted: #64707d;
    --line: #ded8ce;
    --primary: #d6422b;
    --primary-strong: #ad2e1c;
    --accent: #0f766e;
    --gold: #e7a33e;
    --shadow: 0 18px 45px rgba(54, 42, 30, 0.12);
}

body.dark-mode {
    color-scheme: dark;
    --bg: #151719;
    --surface: #22262a;
    --surface-strong: #2b2620;
    --text: #f4efe8;
    --muted: #b8b0a6;
    --line: #3b3f43;
    --primary: #ff6b4a;
    --primary-strong: #ff8a6f;
    --accent: #4fd1c5;
    --gold: #f6bf62;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 10%, rgba(214, 66, 43, 0.12), transparent 28%),
        linear-gradient(180deg, var(--bg), var(--surface-strong));
    color: var(--text);
    font-family: 'Noto Sans KR', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
}

button,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    padding: 16px clamp(18px, 4vw, 48px);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.brand {
    color: var(--primary);
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.header-classifier-link {
    justify-self: end;
}

.select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

select,
.mode-btn {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

select {
    padding: 0 34px 0 12px;
}

.mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface) 72%, var(--bg));
}

.mode-btn {
    min-width: 74px;
    padding: 0 12px;
    font-weight: 800;
}

.mode-btn.is-active {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
}

.nav-pill.is-active {
    background: transparent;
    color: var(--primary);
}

.app-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 56px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: clamp(24px, 5vw, 58px);
    align-items: center;
    min-height: 430px;
    padding: clamp(28px, 6vw, 72px) 0;
}

.eyebrow,
.result-kicker {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 760px;
    margin-bottom: 18px;
    font-size: clamp(2.3rem, 7vw, 5.4rem);
    line-height: 1.04;
    letter-spacing: 0;
}

.subtitle {
    max-width: 640px;
    color: var(--muted);
    font-size: clamp(1rem, 2.2vw, 1.25rem);
}

.hero-dish {
    display: grid;
    place-items: center;
    min-height: 330px;
}

.plate {
    position: relative;
    width: min(78vw, 330px);
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #fff 0 42%, #f0e7d9 43% 60%, #d8c8b3 61% 100%);
    box-shadow: var(--shadow);
}

.plate span {
    position: absolute;
    display: block;
    border-radius: 50%;
}

.rice {
    left: 28%;
    top: 25%;
    width: 35%;
    height: 35%;
    background: #faf7ef;
    box-shadow: inset 0 -12px 0 rgba(220, 214, 205, 0.75);
}

.soup {
    right: 20%;
    top: 27%;
    width: 30%;
    height: 30%;
    background: radial-gradient(circle, #b83422 0 45%, #7f2119 46% 100%);
}

.side {
    bottom: 22%;
    width: 24%;
    height: 24%;
}

.side-a {
    left: 24%;
    background: var(--accent);
}

.side-b {
    right: 26%;
    background: var(--gold);
}

.recommender {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 18px;
    align-items: stretch;
}

.panel,
.controls,
.result-panel,
.quick-list {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 24px;
}

.intro-panel {
    grid-column: 1 / -1;
    box-shadow: none;
}

.intro-panel h2,
.quick-list h2 {
    margin-bottom: 6px;
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.intro-panel p {
    margin-bottom: 0;
    color: var(--muted);
}

.controls {
    display: grid;
    gap: 20px;
    padding: 24px;
}

fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

legend {
    margin-bottom: 10px;
    font-weight: 800;
}

.chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 8px;
}

.chip {
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 82%, var(--bg));
    color: var(--text);
    font-weight: 800;
}

.chip.is-selected {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.primary-btn,
.secondary-btn {
    min-height: 52px;
    border-radius: 8px;
    font-weight: 900;
}

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

.secondary-btn {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
}

.result-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 28px;
}

.result-panel h2 {
    margin-bottom: 0;
    color: var(--primary);
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.1;
}

.result-panel > p:not(.result-kicker) {
    color: var(--muted);
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.result-meta span {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 800;
}

.reason-box {
    margin-top: auto;
    padding: 18px;
    border-left: 4px solid var(--gold);
    border-radius: 8px;
    background: var(--surface-strong);
}

.reason-box p {
    margin: 6px 0 0;
    color: var(--muted);
}

.quick-list {
    margin-top: 28px;
    padding: 26px;
}

.feature-link-card {
    display: block;
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--text);
    text-decoration: none;
}

.feature-link-card strong {
    display: block;
    margin-bottom: 6px;
    color: var(--primary);
    font-size: 1.1rem;
}

.feature-link-card span {
    color: var(--muted);
}

.classifier-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 22px;
    align-items: end;
    padding: clamp(28px, 6vw, 64px) 0 28px;
}

.classifier-status {
    min-width: 210px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    font-weight: 900;
    text-align: center;
    box-shadow: var(--shadow);
}

.classifier-panel {
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
    gap: 20px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.camera-panel {
    display: grid;
    gap: 14px;
}

.camera-box,
.upload-preview {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    overflow: hidden;
}

.camera-box {
    display: grid;
    place-items: center;
}

.camera-box canvas,
.upload-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-placeholder {
    display: grid;
    gap: 6px;
    padding: 20px;
    color: var(--muted);
    text-align: center;
}

.camera-placeholder strong {
    color: var(--text);
}

.upload-preview {
    display: none;
}

.classifier-controls {
    display: grid;
    gap: 16px;
    align-content: start;
}

.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.upload-control {
    display: grid;
    gap: 8px;
    font-weight: 900;
}

.upload-control input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 82%, var(--bg));
    color: var(--text);
}

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

.prediction-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: var(--surface-strong);
}

.prediction-row span {
    color: var(--muted);
}

.classifier-result {
    padding: 18px;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    background: var(--surface-strong);
}

.classifier-result h2 {
    margin-bottom: 8px;
    color: var(--primary);
    font-size: clamp(1.8rem, 4vw, 3rem);
}

.classifier-result p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.partner-section {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
    gap: 22px;
    align-items: start;
    margin-top: 28px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.partner-copy h2 {
    margin-bottom: 12px;
    font-size: clamp(1.45rem, 3vw, 2rem);
    line-height: 1.2;
}

.partner-copy p:not(.eyebrow) {
    color: var(--muted);
}

.partner-form {
    display: grid;
    gap: 14px;
}

.partner-form label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-weight: 800;
}

.partner-form input,
.partner-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 82%, var(--bg));
    color: var(--text);
    font: inherit;
}

.partner-form input {
    min-height: 46px;
    padding: 0 13px;
}

.partner-form textarea {
    min-height: 132px;
    padding: 12px 13px;
    resize: vertical;
}

.partner-form input:focus,
.partner-form textarea:focus {
    border-color: var(--primary);
    outline: 3px solid color-mix(in srgb, var(--primary) 22%, transparent);
}

.comments-section {
    margin-top: 28px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.comments-heading h2 {
    margin-bottom: 22px;
    font-size: clamp(1.45rem, 3vw, 2rem);
}

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

.menu-card {
    min-height: 158px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 86%, var(--surface-strong));
    text-align: left;
}

.menu-card strong {
    display: block;
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 1.08rem;
}

.menu-card span {
    color: var(--muted);
    font-size: 0.92rem;
}

.footer {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 26px 0 42px;
    color: var(--muted);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-bottom: 10px;
}

.footer a {
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
}

.copyright {
    margin-bottom: 0;
    font-size: 0.86rem;
}

@media (max-width: 860px) {
    .hero,
    .recommender,
    .classifier-hero,
    .classifier-panel {
        grid-template-columns: 1fr;
    }

    .topbar {
        grid-template-columns: 1fr auto;
        align-items: flex-start;
    }

    .toolbar {
        grid-column: 1 / -1;
        width: 100%;
    }

    .hero {
        min-height: auto;
        padding-top: 28px;
    }

    .hero-dish {
        min-height: 240px;
    }

    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .partner-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .topbar {
        padding: 14px 16px;
    }

    .toolbar,
    .select-wrap,
    .actions {
        width: 100%;
    }

    .select-wrap select {
        flex: 1;
    }

    .actions,
    .card-grid,
    .control-row {
        grid-template-columns: 1fr;
    }

    .mode-switch {
        width: 100%;
    }

    .mode-btn {
        min-width: 0;
    }
}
