/* 완니 trip — night scenes: one warm near-black ramp, amber as the only accent, the paper card as the bright object. */
:root {
  color-scheme: dark;
  --bg: #12100E;
  --card: #1B1814;
  --raised: #25211B;
  --text: #F6EFE2;
  --text-2: rgba(246, 239, 226, 0.78);
  --muted: rgba(246, 239, 226, 0.58);
  --line: rgba(246, 239, 226, 0.12);
  --line-strong: rgba(246, 239, 226, 0.24);
  --ink: #F5B841;
  --ink-hover: #FFC758;
  --on-ink: #1A1305;
  --ok: #8FD19E;
  --day: #D9A800; /* set per weekday by JS */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  --font-serif: "Noto Serif KR", "Apple SD Gothic Neo", serif;
  --font-foreign: "Noto Sans Thai", "Noto Sans SC", "Noto Sans KR", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.65;
  word-break: keep-all; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
h1, h3, p, ul, dl, dd, fieldset, legend { margin: 0; padding: 0; }
ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--ink); color: var(--on-ink); }
.num { font-variant-numeric: tabular-nums; }

.top { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 16px; max-width: 1152px; margin: 0 auto; }
.wordmark { display: inline-flex; align-items: baseline; gap: 8px; color: var(--text); font-size: 18px; font-weight: 700; text-decoration: none; }
.wordmark span { font-family: var(--font-foreign); font-size: 13px; font-weight: 500; color: var(--muted); }
.dday { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.dday:not(:empty)::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); margin-right: 8px; }

.view { max-width: 1152px; margin: 0 auto; padding: 0 16px 32px; outline: none; }
.view h1 { font-family: var(--font-serif); font-size: 28px; line-height: 1.3; font-weight: 700; letter-spacing: -0.02em; }
.lead { margin-top: 12px; color: var(--text-2); }
.hint { margin-top: 8px; font-size: 14px; color: var(--muted); }
.fine { margin-top: 24px; font-size: 13px; color: var(--muted); }
.warn { position: relative; z-index: 1; margin: 12px 0 16px; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--card); font-size: 14px; }

/* Every screen: the place on one side, what you do there on the other */
/* phone: the picture sits on top and the words start in its dark lower edge, clear of the face */
.scene { position: relative; overflow: hidden; margin: 0 -16px; padding-top: 150px; background: var(--bg); isolation: isolate; }
.scene.compact { padding-top: 104px; }
.scene img { position: absolute; top: 0; left: 0; width: 100%; height: 232px; object-fit: cover; object-position: 86% 28%; transition: opacity 320ms var(--ease); }
.scene.compact img { height: 156px; }
.scene::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 232px; z-index: 1; background: linear-gradient(0deg, rgba(18,16,14,1) 0%, rgba(18,16,14,0.7) 26%, rgba(18,16,14,0) 62%); }
.scene.compact::after { height: 156px; }
.scene-text { position: relative; z-index: 2; padding: 0 16px; }
.scene-text:empty { height: 40px; }
.scene .lead { max-width: 32rem; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.scene-title { font-family: var(--font-serif); font-size: 26px; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; }
.scene.bare { margin: 0; padding-top: 16px; }
.scene.bare::after { display: none; }
.scene.bare .scene-text { padding: 0; }
.pane { padding-top: 20px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 24px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-size: 16px; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: background-color 160ms var(--ease), transform 160ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn-primary { background: var(--ink); color: var(--on-ink); font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--ink-hover); }
.btn-dark { background: var(--text); color: var(--bg); }
.btn-dark:hover:not(:disabled) { background: #fff; }
.btn-quiet { background: rgba(246, 239, 226, 0.08); color: var(--text); border-color: var(--line); }
.btn-quiet:hover:not(:disabled) { background: rgba(246, 239, 226, 0.14); }
.btn-sm { min-height: 40px; padding: 0 18px; font-size: 14px; }
.btn-wide { width: 100%; margin-top: 16px; }
.btn-row { display: flex; gap: 8px; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.btn-row.sticky { position: sticky; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 3; padding: 28px 0 12px; margin-top: 12px; background: linear-gradient(0deg, var(--bg) 62%, rgba(18,16,14,0)); }

/* Setup */
.setup fieldset { margin-top: 32px; }
.setup .pane > fieldset:first-child { margin-top: 4px; }
.setup legend { font-size: 15px; font-weight: 500; margin-bottom: 12px; color: var(--text); }
.setup input[type="date"], .setup select {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--text); font: inherit; font-size: 16px;
}
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice { position: relative; display: block; cursor: pointer; border-radius: 16px; overflow: hidden; isolation: isolate; background: var(--card); }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span {
  position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; gap: 2px; min-height: 68px; justify-content: center; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 16px;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}
.choice b { font-weight: 500; }
.choice small { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.choice input:checked ~ span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: rgba(245, 184, 65, 0.08); }
.choice input:focus-visible ~ span { outline: 2px solid var(--ink); outline-offset: 2px; }
/* a situation is picked by its place: dim until chosen */
.tile-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 88% 26%; filter: brightness(0.74) saturate(0.85); transition: filter 240ms var(--ease), transform 600ms var(--ease); }
.tile span { min-height: 116px; justify-content: flex-end; padding: 12px 14px; background: linear-gradient(0deg, rgba(18,16,14,0.92) 0%, rgba(18,16,14,0.3) 58%, rgba(18,16,14,0) 100%); }
.tile small { color: var(--text-2); }
.tile:hover .tile-img { transform: scale(1.04); }
.tile input:checked ~ .tile-img { filter: none; }
.tile input:checked ~ span { background: linear-gradient(0deg, rgba(18,16,14,0.92) 0%, rgba(18,16,14,0.2) 58%, rgba(18,16,14,0) 100%); }
.tile input:checked ~ span::before { content: ""; position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); }
.tile input:checked ~ span::after { content: ""; position: absolute; top: 17px; right: 17px; width: 10px; height: 6px; border-left: 2px solid var(--on-ink); border-bottom: 2px solid var(--on-ink); transform: rotate(-45deg); }
.setup-foot { position: sticky; bottom: 0; z-index: 3; margin-top: 16px; padding: 28px 0 16px; background: linear-gradient(0deg, var(--bg) 70%, rgba(18,16,14,0)); }
.summary { font-size: 15px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.setup-foot .btn-wide { margin-top: 12px; }

/* Progress */
.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 14px; color: var(--text-2); }
.progress-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--ink); transition: width 400ms var(--ease); }

/* The card: same proportions as the original 1080-wide card, sized in container units. It stays paper. */
.card-frame { border-radius: 20px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.wcard { container-type: inline-size; background: #FFFDF6; color: #241F14; display: flex; flex-direction: column; }
.wcard-band { height: 3.33cqw; display: flex; flex-direction: column; flex: none; }
.wcard-band i { display: block; }
.wcard-page { padding: 5.2cqw 7.4cqw 6cqw; }
.wcard-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.wcard-head .l { font-size: 3.2cqw; font-weight: 500; letter-spacing: 0.08em; color: #736A5D; }
.wcard-head .r { font-size: 3.2cqw; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; flex: none; }
.wcard-ko { margin-top: 5.2cqw; font-size: 6.48cqw; font-weight: 700; line-height: 1.35; }
.wcard-main { margin-top: 2cqw; font-family: var(--font-foreign); font-weight: 700; line-height: 1.4; color: #2E3A87; }
.wcard-pron { margin-top: 1.7cqw; font-size: 5.1cqw; font-weight: 500; color: #6B6455; }
.wcard-pron b { color: var(--accent); font-weight: 700; }
.wcard-div { margin-top: 3.5cqw; border-top: 0.28cqw dashed #E2DBC8; }
.wcard-vocab { margin-top: 3.3cqw; }
.wcard-vocab .row { display: flex; align-items: baseline; gap: 2.4cqw; margin-bottom: 2cqw; }
.wcard-vocab .tw { font-family: var(--font-foreign); font-size: 5.1cqw; font-weight: 600; flex: none; }
.wcard-vocab .m { font-size: 4.26cqw; color: #4C4636; }
.wcard-vocab .note { font-size: 3.7cqw; color: #736A5D; }

/* Practice blocks */
.block { margin-top: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: rgba(27, 24, 20, 0.82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.block:first-of-type { margin-top: 20px; }
.block h3 { font-size: 16px; font-weight: 500; }
.block .btn { margin-top: 12px; }
.speak-status { margin-top: 12px; font-size: 15px; color: var(--text-2); min-height: 24px; }
.speak-status.is-ok { color: var(--ok); font-weight: 500; }
.replies { margin-top: 4px; }
.replies li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.replies li:last-child { border-bottom: 0; }
.reply-row { display: flex; gap: 8px; }
.reply-row .btn { margin-top: 0; }
.reply-meaning { margin-top: 12px; display: grid; gap: 4px; font-size: 15px; color: var(--text-2); }
.reply-text { font-family: var(--font-foreign); font-size: 22px; font-weight: 700; color: var(--ink); }

.scene-cap { display: none; }

/* Done */
.done { text-align: left; }
.stamp {
  --accent: var(--ink);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 104px; height: 104px; margin: 16px 0 20px; border: 4px solid var(--accent); border-radius: 50%;
  color: var(--accent); transform: rotate(-10deg);
}
.stamp b { font-size: 24px; font-weight: 900; line-height: 1; }
.stamp span { font-size: 13px; font-weight: 500; }

/* Trip */
.sit { border-bottom: 1px solid var(--line); }
.pane > .sit:first-of-type { border-top: 1px solid var(--line); }
.sit summary { display: flex; justify-content: space-between; align-items: center; min-height: 60px; cursor: pointer; font-weight: 500; list-style: none; }
.sit summary::-webkit-details-marker { display: none; }
.sit summary small { color: var(--muted); font-weight: 400; }
.sit ul { padding-bottom: 12px; display: grid; gap: 6px; }
.row-btn {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; width: 100%; min-height: 60px; padding: 10px 16px;
  border: 0; border-radius: 14px; background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: background-color 160ms var(--ease);
}
.row-btn:hover { background: var(--raised); }
.row-ko { grid-column: 1; }
.row-th { grid-column: 1; font-family: var(--font-foreign); font-size: 14px; color: var(--muted); }
.row-pass { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 12px; color: var(--ink); }

/* Shown to the other person, often outdoors: paper, not night */
.big { --text: #241F14; --text-2: #5E554A; --muted: #736A5D; --line: rgba(36, 31, 20, 0.1); --line-strong: rgba(36, 31, 20, 0.24); --ink: #2E3A87; --ok: #1F6B33; }
.big { color-scheme: light; border: 0; padding: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #FFFDF6; color: #241F14; overflow-y: auto; }
.big::backdrop { background: #FFFDF6; }
.big-inner { min-height: 100%; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; justify-content: center; padding: 64px 20px 32px; }
.big-ko { font-size: 18px; color: #5E554A; }
.big-main { margin-top: 12px; font-family: var(--font-foreign); font-size: clamp(40px, 13vw, 96px); font-weight: 700; line-height: 1.3; color: #2E3A87; }
.big-pron { margin-top: 12px; font-size: 20px; color: #5E554A; }
.big-inner .btn-row { margin-top: 24px; }
.big .btn-dark { background: #241F14; color: #fff; }
.big .btn-quiet { background: #EFE9DF; color: #241F14; border-color: rgba(36, 31, 20, 0.1); }
.big :focus-visible { outline-color: #2E3A87; }
.big-close { position: fixed; top: 12px; right: 12px; }

/* Settings */
.facts { border-top: 1px solid var(--line); }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--text-2); }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center;
  background: rgba(18, 16, 14, 0.86); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; max-width: 173px; height: 56px; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--muted); cursor: pointer;
}
.tabbar button[aria-current="page"] { color: var(--text); font-weight: 500; box-shadow: inset 0 2px 0 var(--ink); }

/* wide screens: the scene fills the window with the person on the right, and the work sits in its dark left side */
@media (min-width: 960px) {
  .top { position: relative; z-index: 2; height: 72px; max-width: 1344px; padding: 0 32px; }
  .view { max-width: 1344px; padding: 0 32px 48px; }
  .split { max-width: 500px; }
  .scene, .scene.compact { position: static; overflow: visible; isolation: auto; margin: 0; padding: 0; background: none; }
  .scene img, .scene.compact img { position: fixed; top: 0; left: 0; z-index: 0; width: 100vw; height: 100vh; object-position: 84% center; }
  .scene::after, .scene.compact::after {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; height: auto; z-index: 0;
    background: linear-gradient(90deg, rgba(18,16,14,0.97) 0%, rgba(18,16,14,0.94) 34%, rgba(18,16,14,0.55) 50%, rgba(18,16,14,0) 68%),
                linear-gradient(0deg, rgba(18,16,14,0.9) 0%, rgba(18,16,14,0) 30%);
  }
  .scene-text { position: relative; z-index: 1; padding: 20px 0 0; }
  .scene-text:empty { height: 0; }
  .scene h1 { font-size: 40px; line-height: 1.22; letter-spacing: -0.03em; }
  .scene .lead { font-size: 17px; }
  .scene-title { font-size: 40px; line-height: 1.22; }
  .scene.bare .scene-text { padding-top: 20px; }
  .pane { position: relative; z-index: 1; padding-top: 24px; }
  .scene-cap {
    display: block; position: fixed; z-index: 1; bottom: 104px; right: max(32px, calc((100vw - 1280px) / 2)); width: min(40vw, 520px);
    text-align: right; pointer-events: none; animation: capIn 480ms var(--ease) both;
  }
  .scene-cap .who { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 6px; background: var(--ink); color: var(--on-ink); font-size: 13px; font-weight: 700; }
  .scene-cap .line { margin-top: 10px; font-family: var(--font-foreign); font-size: clamp(30px, 3vw, 48px); font-weight: 700; line-height: 1.25; color: var(--ink); text-shadow: 0 2px 0 rgba(0,0,0,0.6), 0 0 28px rgba(0,0,0,0.6); }
  .scene-cap .gloss { margin-top: 6px; font-size: 18px; color: var(--text); text-shadow: 0 1px 0 rgba(0,0,0,0.7), 0 0 16px rgba(0,0,0,0.7); }
}
@keyframes capIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .btn, .choice span, .progress-bar i, .scene img, .tile-img, .row-btn { transition: none; }
  .scene-cap { animation: none; }
}
