:root {
  /* Card tone: latte paper, pastel fills, thin ink lines, one cherry accent. Light only, like the cards. */
  --paper: #F7F1E8;
  --paper-2: #EFE6D8;
  --ink: #1A1918;
  --muted: #8C857D;
  --line: rgba(26, 25, 24, 0.18);
  --danger: #C62A29;
  --surface: #FFFBF5;
  /* One hue for the whole home screen, plus cherry. Same as THEME in js/hero.js. */
  --tint: #FBDDB8;
  --tone: #F2B36B;
  /* Each mode's own hue and its complementary point (MODE_THEMES in js/portrait.js). */
  --solo: #FBDDB8;
  --couple: #F9D5CA;
  --group: #DCE8C8;
  --couple-point: #2A8C82;
  --group-point: #B0457A;
  /* The one point colour, used sparingly: highlight, button shadow, picked mode. Same as POINT in js/hero.js. */
  --point: #5A5FC8;
  --sans: "Inter Tight", "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  --kr: "Noto Sans KR", "Inter Tight", "Apple SD Gothic Neo", system-ui, sans-serif;
  /* No more serif: anything still asking for it gets the gothic. */
  --serif: var(--kr);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); }
body { line-height: 1.6; -webkit-font-smoothing: antialiased; word-break: keep-all; }
main { max-width: 480px; margin: 0 auto; padding: 20px 16px 32px; min-height: 100dvh; display: flex; flex-direction: column; }

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.brand-wrap { display: flex; align-items: center; gap: 7px; }
.brand { font: 700 22px var(--sans); letter-spacing: -0.02em; margin: 0; line-height: 1.2; }
.brand-dot { color: var(--point); margin: 0 1px; }
button.lang { font: 600 12px var(--sans); background: var(--surface); border: 1.2px solid var(--ink); border-radius: 99px; padding: 4px 12px; }

.screen { display: flex; flex-direction: column; gap: 16px; }
.screen[hidden] { display: none; }
#screen-home { gap: 0; }
.hero { margin: -14px -6px 0; }
.hero svg { display: block; width: 100%; height: auto; }
.hero text { font-family: var(--kr); }
/* Dictionary-style entry under the artwork: teaches the name's sound and meaning. */
.define { font-size: 12.5px; line-height: 1.5; color: #4a4744; margin: 2px 0 14px; padding-top: 8px; border-top: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); }
.define b { font: 700 13px var(--sans); color: var(--ink); }
.define span { display: block; }
.headline { font: 700 28px/1.25 var(--kr); letter-spacing: -0.02em; margin: 4px 0 6px; }
html[lang^="en"] .headline { font-family: var(--sans); font-size: 30px; letter-spacing: -0.03em; }
.headline em { font-style: normal; background: linear-gradient(transparent 58%, color-mix(in srgb, var(--point) 45%, transparent) 58%); }
.intro { font-size: 14px; line-height: 1.6; color: #4a4744; margin: 0 0 16px; }
.modes { display: grid; gap: 8px; }
.mode { display: grid; grid-template-columns: 44px 1fr 20px; align-items: center; gap: 12px; padding: 10px 12px; border: 1.2px solid var(--ink); border-radius: 14px; background: var(--surface); cursor: pointer; }
.mode-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.mode-ic svg { width: 34px; height: 34px; }
.mode-ic { color: var(--point); }
.mode-ic[data-icon="solo"] { background: var(--solo); }
.mode-ic[data-icon="couple"] { background: var(--couple); color: var(--couple-point); }
.mode-ic[data-icon="group"] { background: var(--group); color: var(--group-point); }
/* The radio sits last in the row (grid order), drawn as an ink ring with a cherry dot. */
.mode input { order: 3; appearance: none; -webkit-appearance: none; margin: 0; width: 20px; height: 20px; border: 1.2px solid var(--ink); border-radius: 50%; background: var(--surface); }
.mode input:checked { background: radial-gradient(var(--point) 0 4.5px, var(--surface) 5px); }
.mode input:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
.mode-text { order: 2; display: grid; }
.mode:has(input:checked) { box-shadow: 3px 3px 0 var(--ink); }
.mode-title { font: 700 15px var(--kr); }
html[lang^="en"] .mode-title { font-family: var(--sans); }
.mode-sub { color: var(--muted); font-size: 12.5px; }
.count-pick { display: grid; gap: 8px; font-size: 14px; margin-top: 12px; }
.count-pick[hidden] { display: none; }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: block; text-align: center; padding: 10px 0; border: 1.2px solid var(--ink); border-radius: 99px; background: var(--surface); font-weight: 500; }
.chip input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip input:focus-visible + span { outline: 2px solid var(--seal); outline-offset: 2px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row[hidden] { display: none; }
select, #nickname { font: inherit; color: var(--ink); background: var(--surface); border: 1.2px solid var(--ink); border-radius: 12px; padding: 10px 12px; }
.checks { display: grid; gap: 8px; font-size: 13.5px; margin: 16px 0 14px; }
.checks label, .check-line { display: flex; gap: 10px; align-items: flex-start; }
/* Square ink boxes that fill black with a paper tick. */
.checks input, .check-line input { appearance: none; -webkit-appearance: none; flex: none; margin: 2px 0 0; width: 18px; height: 18px; border: 1.2px solid var(--ink); border-radius: 5px; background: var(--surface); position: relative; }
.checks input:checked, .check-line input:checked { background: var(--ink); }
.checks input:checked::after, .check-line input:checked::after { content: ""; position: absolute; left: 5px; top: 1.5px; width: 4px; height: 9px; border: solid var(--paper); border-width: 0 2px 2px 0; transform: rotate(42deg); }
.checks input:focus-visible, .check-line input:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
.photo-opt { border: 1.2px dashed var(--ink); border-radius: 14px; padding: 12px 14px; }
.photo-opt .note { margin: 4px 0 0 26px; }
.field { display: grid; gap: 6px; font-size: 15px; }
.error { color: var(--danger); font-size: 13px; margin: 0; min-height: 1em; }

button { font: inherit; font-weight: 600; color: var(--ink); background: var(--surface); border: 1.2px solid var(--ink); border-radius: 99px; padding: 13px 16px; cursor: pointer; }
button.primary { background: var(--ink); color: var(--paper); font-weight: 700; font-size: 16px; padding: 15px 16px; box-shadow: 4px 4px 0 var(--point); }
button.ghost { border-color: transparent; }
button.small { padding: 6px 10px; font-size: 14px; }
button:active { transform: scale(0.98); }
.center-btn { align-self: center; }
.note { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.fine { display: grid; grid-template-columns: 14px 1fr; gap: 6px; font-size: 12px; margin-top: 14px; }
.fine svg { width: 14px; height: 14px; margin-top: 2px; }
.center { text-align: center; }
.eyebrow { color: var(--muted); margin: 0; letter-spacing: 0.04em; }

.viewfinder { position: relative; aspect-ratio: 3 / 4; border-radius: 18px; border: 1.2px solid var(--ink); overflow: hidden; background: #000; }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
/* Cues sit at the top, near the lens, where people are already looking. */
.cue { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 16px 30px; background: linear-gradient(rgba(0, 0, 0, 0.72) 60%, transparent); color: #fff; font-size: 24px; font-weight: 500; text-align: center; pointer-events: none; }
/* The blink cue sits right on the eye line of the oval, so it can't be missed while looking straight ahead. */
.cue.blink { top: 27%; left: 8%; right: 8%; padding: 12px 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.62); gap: 6px; }
.cue[hidden] { display: none; }
.cue-eye { display: none; width: 64px; height: 30px; border: 3px solid #fff; border-radius: 50% / 50%; position: relative; }
.cue-eye::after { content: ''; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px; border-radius: 50%; background: #fff; }
.cue.blink .cue-eye { display: block; animation: cue-blink 1.6s ease-in-out infinite; }
.cue.blink { font-size: 21px; word-break: keep-all; }
.cue.blink .cue-eye { flex: none; width: 48px; height: 24px; }
.cue.blink .cue-eye::after { width: 12px; height: 12px; margin: -6px; }
#cam-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#cam-still[hidden] { display: none; }
.confirm { display: flex; flex-direction: column; gap: 8px; }
.confirm[hidden] { display: none; }
.confirm-ask { text-align: center; font-size: 20px; font-weight: 500; margin: 0; }
.confirm-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
@keyframes cue-blink { 0%, 40%, 100% { transform: scaleY(1); } 50%, 60% { transform: scaleY(0.08); } }
@media (prefers-reduced-motion: reduce) { .cue.blink .cue-eye { animation: none; } }
.oval { position: absolute; inset: 10% 18% 14%; border: 2px dashed rgba(255, 255, 255, 0.85); border-radius: 50%; pointer-events: none; }
.status { text-align: center; font-weight: 500; margin: 0; min-height: 1.6em; }
.progress { height: 6px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--seal); transition: width 0.15s; }

/* reveal */
.reveal { position: relative; aspect-ratio: 3 / 4; border-radius: 18px; border: 1.2px solid var(--ink); overflow: hidden; background: #111; }
.reveal canvas { width: 100%; height: 100%; display: block; }
.reveal-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 18px 22px; text-align: center; color: #FBF8F2; background: linear-gradient(transparent, rgba(20, 18, 16, 0.85) 40%); opacity: 0; transform: translateY(12px); transition: opacity 0.5s, transform 0.5s; }
.reveal-title.show { opacity: 1; transform: none; }
.reveal-title .t-main { font: 700 32px/1.2 var(--kr); letter-spacing: -0.02em; display: block; }
.reveal-title .t-sub { font-size: 14px; color: var(--tint); display: block; margin-top: 4px; }
.reveal-title .stamp { display: inline-grid; place-items: center; width: 44px; height: 62px; border-radius: 6px; background: var(--seal); color: var(--paper); box-shadow: inset 0 0 0 3px var(--seal), inset 0 0 0 4.5px var(--paper); font: 700 17px/1.05 var(--kr); margin-bottom: 10px; transform: rotate(-6deg) scale(2.2); opacity: 0; }
.reveal-title.show .stamp { animation: stamp 0.45s 0.15s cubic-bezier(0.3, 1.6, 0.5, 1) forwards; }
@keyframes stamp { to { transform: rotate(-6deg) scale(1); opacity: 1; } }

/* --seal follows whatever the current point colour is; set on body so the mode overrides below
   reach it. Errors stay cherry (--danger). */
body { --seal: var(--point); --seal-bg: var(--tint); }
/* Once a mode is under way, its own hue and point take over (MODE_THEMES in js/portrait.js). */
body[data-mode="couple"] { --tint: var(--couple); --point: var(--couple-point); }
body[data-mode="group"] { --tint: var(--group); --point: var(--group-point); }

/* footer links + legal pages */
.legal-links { margin-top: 6px; font-size: 13px; }
.legal-links a, .legal a { color: inherit; }
.legal { gap: 0; }
.legal h1 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 18px 0 4px; }
.legal h2 { font-size: 17px; font-weight: 500; margin: 22px 0 6px; }
.legal p, .legal li { line-height: 1.7; font-size: 15px; }
.legal ul { padding-left: 20px; }
.legal hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0 12px; }

/* detailed reading */
.detail { border-top: 1px solid var(--line); padding-top: 18px; }
.detail > h2 { font: 700 22px var(--kr); margin: 0 0 12px; }
.detail .tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
.detail .tabs[hidden] { display: none; }
.detail .tabs button { padding: 8px 14px; font-size: 14px; border-color: var(--line); white-space: nowrap; }
.detail .tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.detail .d-title { font: 700 22px var(--kr); letter-spacing: -0.02em; margin: 0 0 4px; }
.detail .d-mod { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.detail h3 { font-size: 15px; font-weight: 700; margin: 18px 0 6px; color: var(--seal); }
.detail p, .detail li { font-size: 15px; line-height: 1.7; margin: 0; }
.detail .d-line { font-family: var(--serif); font-size: 17px; }
.detail ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* flip card */
.flip { perspective: 1600px; cursor: pointer; outline: none; }
.flip-inner { position: relative; aspect-ratio: 4 / 5; transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1); transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(30, 28, 26, 0.18); }
.face img { width: 100%; height: 100%; display: block; }
.back { transform: rotateY(180deg); background: var(--surface); color: var(--ink); padding: 22px 20px; overflow-y: auto; border: 1.2px solid var(--ink); }
.back h2 { font: 700 21px var(--kr); letter-spacing: -0.02em; margin: 0 0 2px; }
.back .ko-sub { color: var(--seal); font-size: 13px; margin: 0 0 12px; }
.back h3 { font-size: 15px; font-weight: 500; margin: 14px 0 2px; }
.back p { margin: 0; font-size: 14px; line-height: 1.6; }
.back .basis { color: var(--muted); font-size: 12px; margin-top: 2px; }
.back .combo { margin-top: 14px; padding: 10px 12px; background: var(--seal-bg); border-radius: 12px; }
.hint { text-align: center; color: var(--muted); font-size: 13px; margin: -4px 0 0; }

.actions { display: grid; gap: 10px; }
.report { font-size: 13px; color: var(--muted); }
.report summary { cursor: pointer; }
.foot { margin-top: auto; padding-top: 28px; color: var(--muted); font-size: 12px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .flip-inner, .reveal-title { transition: none; }
  .reveal-title.show .stamp { animation: none; transform: rotate(-6deg); opacity: 1; }
}

.debug { font: 12px/1.4 ui-monospace, monospace; white-space: pre-wrap; opacity: .8; margin: 24px 0; }
