:root {
    color-scheme: light;
    --ink: #1d2924;
    --muted: #68736e;
    --paper: #f5f1e9;
    --card: #fffdf9;
    --line: #dcd8cf;
    --accent: #147558;
    --accent-dark: #0f5e47;
    --accent-soft: #e3f1eb;
    --warm: #d87d47;
    --danger: #a94e3f;
    --danger-soft: #faebe6;
    --shadow: 0 16px 38px rgba(33, 48, 41, 0.08);
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
    background: var(--paper);
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 100% 0, rgba(216, 125, 71, 0.15), transparent 28rem),
        var(--paper);
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.mode-is-open { overflow: hidden; }
button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-shell {
    width: min(100%, 780px);
    margin: 0 auto;
    padding: max(26px, env(safe-area-inset-top)) 18px max(26px, env(safe-area-inset-bottom));
}

.hero { padding: 10px 2px 26px; }

.hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 0.71rem;
    font-weight: 850;
    letter-spacing: 0.14em;
}

.brand span {
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--accent);
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border: 1px solid rgba(20, 117, 88, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.52);
}

.language-switcher a {
    display: grid;
    min-width: 31px;
    height: 31px;
    padding: 0 6px;
    place-items: center;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    text-decoration: none;
}

.language-switcher a[aria-current="page"] {
    color: white;
    background: var(--accent);
}

.route-loading {
    display: grid;
    min-height: 100vh;
    place-items: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.scene-tag {
    display: inline-block;
    margin: 22px 0 0 !important;
    padding: 6px 10px;
    border: 1px solid rgba(20, 117, 88, 0.2);
    border-radius: 999px;
    color: var(--accent) !important;
    background: rgba(255, 255, 255, 0.48);
    font-size: 0.7rem !important;
    font-weight: 700;
}

.hero h1 {
    margin: 14px 0 10px;
    font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
    font-size: clamp(2.55rem, 12vw, 4.5rem);
    line-height: 1.05;
    letter-spacing: -0.055em;
}

html[lang="ja"] .hero h1 {
    font-size: clamp(2.15rem, 9vw, 4rem);
    letter-spacing: -0.04em;
}

.hero > p:last-child {
    max-width: 34rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.7;
}

.progress-wrap {
    position: sticky;
    z-index: 4;
    top: 0;
    margin: 0 -4px 16px;
    padding: 12px 4px 10px;
    background: rgba(245, 241, 233, 0.93);
    backdrop-filter: blur(10px);
}

.progress-copy {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.progress-copy span { color: var(--muted); font-size: 0.72rem; }
.progress-copy strong { font-size: 0.82rem; }

.progress-track {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #ddd9d0;
}

.progress-track span {
    display: block;
    width: 12.5%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 220ms ease;
}

.notice {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid #e9c2b5;
    border-radius: 12px;
    color: #7d392f;
    background: var(--danger-soft);
    font-size: 0.78rem;
    line-height: 1.55;
}

.step-panel {
    padding: 22px 18px;
    border: 1px solid rgba(220, 216, 207, 0.9);
    border-radius: 24px;
    background: rgba(255, 253, 249, 0.91);
    box-shadow: var(--shadow);
}

.step-panel[hidden] { display: none; }

.step-heading { margin-bottom: 24px; }
.step-heading > span {
    color: var(--warm);
    font-family: Georgia, serif;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.step-heading h2 {
    margin: 8px 0;
    font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
    font-size: clamp(1.6rem, 7vw, 2.25rem);
    line-height: 1.25;
}

.step-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 0.83rem;
    line-height: 1.65;
}

.option-list { display: grid; gap: 10px; }

.option-card {
    position: relative;
    display: flex;
    min-height: 66px;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: 15px;
    background: var(--card);
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.option-card:active, .choice-chip:active { transform: scale(0.985); }
.option-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option-card input, .choice-chip input, .segmented-options input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.option-card > span { display: grid; flex: 1; gap: 3px; }
.option-card strong { font-size: 0.94rem; }
.option-card small { color: var(--muted); font-size: 0.72rem; }
.option-card i {
    display: grid;
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: transparent;
    background: white;
    font-size: 0.76rem;
    font-style: normal;
    font-weight: 800;
}

.option-card:has(input:checked) i { border-color: var(--accent); color: white; background: var(--accent); }

.question-group, .adjustment-form fieldset {
    min-width: 0;
    margin: 0;
    padding: 20px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.question-group:first-of-type { border-top: 0; }

.question-group legend, .adjustment-form legend {
    width: 100%;
    margin-bottom: 12px;
    padding: 0;
    font-size: 0.93rem;
    font-weight: 800;
}

.question-group legend small {
    margin-left: 6px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 500;
}

.chip-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.choice-chip {
    position: relative;
    display: flex;
    min-height: 51px;
    align-items: center;
    justify-content: center;
    padding: 9px 10px;
    border: 1.5px solid var(--line);
    border-radius: 13px;
    background: var(--card);
    cursor: pointer;
    text-align: center;
    transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.choice-chip span { font-size: 0.8rem; font-weight: 650; line-height: 1.35; }
.choice-chip:has(input:checked) { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }
.choice-chip.danger:has(input:checked) { border-color: var(--danger); color: #83372d; background: var(--danger-soft); }

.option-card:has(input:focus-visible),
.choice-chip:has(input:focus-visible),
.segmented-options label:has(input:focus-visible) {
    outline: 3px solid rgba(20, 117, 88, 0.22);
    outline-offset: 2px;
}

.danger-group, .prohibition-group {
    margin-top: 5px;
    padding-right: 12px;
    padding-left: 12px;
    border: 1px solid #edcfc6 !important;
    border-radius: 15px;
    background: rgba(250, 235, 230, 0.55);
}

.danger-group legend, .prohibition-group legend { color: var(--danger); padding-top: 17px; }

.segmented-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--card);
}

.segmented-options.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.segmented-options label { position: relative; cursor: pointer; }
.segmented-options label + label { border-left: 1px solid var(--line); }
.segmented-options span {
    display: grid;
    min-height: 50px;
    padding: 8px;
    place-items: center;
    font-size: 0.76rem;
    font-weight: 650;
    text-align: center;
}

.segmented-options label:has(input:checked) span { color: white; background: var(--accent); }
.conditional[hidden] { display: none; }

.compact-list .option-card { min-height: 58px; }

.photo-uploader input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.photo-uploader label {
    display: grid;
    min-height: 190px;
    place-items: center;
    align-content: center;
    gap: 7px;
    border: 1.5px dashed #aeb9b3;
    border-radius: 18px;
    background: rgba(227, 241, 235, 0.4);
    cursor: pointer;
    text-align: center;
}

.photo-uploader label > span {
    display: grid;
    width: 46px;
    height: 46px;
    margin-bottom: 5px;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--accent);
    font-size: 1.5rem;
}

.photo-uploader label small { color: var(--muted); font-size: 0.72rem; }
.photo-uploader input:focus-visible + label { outline: 3px solid rgba(20, 117, 88, 0.22); outline-offset: 2px; }

.photo-preview { position: relative; overflow: hidden; border-radius: 18px; background: #dedbd4; }
.photo-preview img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.photo-preview button {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 8px 12px;
    border: 0;
    border-radius: 999px;
    color: white;
    background: rgba(29, 41, 36, 0.82);
    cursor: pointer;
    font-size: 0.72rem;
}

.summary-list, .barber-summary { margin: 0; border-top: 2px solid var(--ink); }
.summary-list > div, .barber-summary > div {
    display: grid;
    grid-template-columns: 4.8rem minmax(0, 1fr);
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.summary-list dt, .barber-summary dt { color: var(--muted); font-size: 0.73rem; font-weight: 800; }
.summary-list dd, .barber-summary dd { margin: 0; font-size: 0.9rem; font-weight: 650; line-height: 1.55; overflow-wrap: anywhere; }

.sentence-card, .barber-sentence, .adjustment-result-card {
    margin-top: 24px;
    padding: 18px;
    border-radius: 16px;
    color: white;
    background: var(--ink);
}

.sentence-card > p, .barber-sentence > p, .adjustment-result-card > p {
    margin: 0 0 9px;
    color: #86ceb6;
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.1em;
}

.sentence-card div, .barber-sentence div, .adjustment-result-card div {
    font-family: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 1rem;
    line-height: 1.9;
}

.summary-panel > .primary-button { width: 100%; margin-top: 14px; }

.wizard-actions {
    display: grid;
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
    gap: 10px;
    margin-top: 14px;
}

.primary-button, .secondary-button {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 18px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 800;
}

.primary-button {
    justify-content: space-between;
    border: 1px solid var(--accent);
    color: white;
    background: var(--accent);
    box-shadow: 0 10px 23px rgba(20, 117, 88, 0.18);
}

.secondary-button { border: 1px solid var(--line); background: rgba(255, 253, 249, 0.8); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.wizard-actions .secondary-button[hidden], .wizard-actions .primary-button[hidden] { display: none; }
.wizard-actions:has(.secondary-button[hidden]) { grid-template-columns: 1fr; }
.wizard-actions:has(.primary-button[hidden]) { grid-template-columns: 1fr; }

.privacy-note { margin: 14px 0 0; color: var(--muted); font-size: 0.7rem; text-align: center; }
.privacy-note span { color: var(--accent); font-size: 0.45rem; vertical-align: 0.12rem; }

.fullscreen-mode {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: none;
    min-height: 100dvh;
    overflow-y: auto;
    padding: max(16px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
    background: #fffefb;
}

.fullscreen-mode.is-open { display: flex; flex-direction: column; }
.adjustment-mode { z-index: 20; }

.mode-toolbar {
    display: flex;
    width: min(100%, 720px);
    align-items: center;
    justify-content: space-between;
    margin: 0 auto;
}

.mode-toolbar > p { margin: 0; color: var(--accent); font-size: 0.68rem; font-weight: 850; letter-spacing: 0.14em; }
.mode-toolbar > div { display: flex; align-items: center; gap: 8px; }
.mode-toolbar button { min-height: 42px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
#font-size-button { padding: 0 13px; border-radius: 999px; font-size: 0.72rem; font-weight: 750; }
.round-button { display: grid; width: 42px; padding: 0; place-items: center; border-radius: 50%; font-size: 1.6rem; line-height: 1; }

.mode-content { width: min(100%, 720px); margin: auto; padding: 45px 0 30px; }
.barber-kicker { margin: 0 0 10px; color: var(--warm); font-size: 0.9rem; font-weight: 800; }
.mode-content > h2 {
    margin: 0;
    font-family: "Noto Serif JP", "Yu Mincho", "Noto Serif SC", serif;
    font-size: clamp(1.8rem, 8vw, 3.1rem);
    line-height: 1.3;
}

.photo-toggle { margin: 24px 0 0; padding: 9px 13px; border: 1px solid var(--accent); border-radius: 999px; color: var(--accent); background: transparent; cursor: pointer; font-size: 0.75rem; font-weight: 750; }
.barber-photo { width: 100%; max-height: 48vh; margin-top: 14px; border-radius: 16px; object-fit: contain; background: var(--paper); }
.barber-summary { margin-top: 32px; }
.barber-summary dd { font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: clamp(1.05rem, 4.6vw, 1.45rem); }
.barber-sentence { color: var(--ink); background: var(--paper); }
.barber-sentence > p { color: var(--accent); }

.mode-actions {
    display: grid;
    width: min(100%, 720px);
    flex: 0 0 auto;
    gap: 9px;
    margin: 0 auto;
}

.barber-mode.large-type .barber-summary dd { font-size: clamp(1.4rem, 6.2vw, 2rem); }
.barber-mode.large-type .barber-sentence div { font-size: 1.2rem; }

.adjustment-intro { margin: 10px 0 25px; color: var(--muted); font-size: 0.8rem; line-height: 1.6; }
.adjustment-form fieldset:first-child { border-top: 2px solid var(--ink); }
.adjustment-result-card { color: white; background: var(--accent-dark); }
.adjustment-result-card div { font-size: 1.2rem; }
.mode-bottom-button { width: min(100%, 720px); flex: 0 0 auto; margin: 0 auto; }

@media (min-width: 640px) {
    .app-shell { padding-right: 28px; padding-left: 28px; }
    .step-panel { padding: 30px; }
    .option-list:not(.compact-list) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .chip-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .compact-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
