/* 냥심사. Ported from mockup/index.html (.phone and everything inside it).
   One phone-width column that scrolls, one primary button pinned to the bottom. Certificates and
   per-person cards sit in sideways strips. Three visible states for every item: open, half-shown with a
   yellow "send to open" chip, half-shown or blurred with a grey "pay" chip. Items that have not arrived
   yet are grey bars the size of the text they will become. */
:root {
  --page: #EEF0F2;
  --bg: #FFFFFF;
  --surface: #F3F5F7;
  --ink: #16191D;
  --muted: #69717C;
  --line: #E4E7EB;
  --stamp: #D43B2A;
  --gold: #A8791C;
  --kakao: #FEE500;
  --kakao-ink: #191600;
  --photo: #DCE2E7;
  --scrim: rgba(12, 14, 17, .45);
  --lf-fur: #CFC6BA;
  --lf-line: #2B2723;
  --lf-eye: #FFFFFF;
  --gutter: 16px;
  --font-body: 'Noto Sans KR', -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-display: 'Gowun Batang', 'Noto Serif KR', 'AppleMyungjo', serif;
  --font-pen: 'Nanum Pen Script', 'Gaegu', cursive;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0C0E10; --bg: #15181B; --surface: #1E2226; --ink: #F1F3F5; --muted: #949CA6;
    --line: #2A2F35; --stamp: #FF6A58; --gold: #D7AE55; --photo: #2A3037;
    --scrim: rgba(0, 0, 0, .6);
    --lf-fur: #B9AFA2; --lf-line: #1A1714; --lf-eye: #F4F1EC;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0C0E10; --bg: #15181B; --surface: #1E2226; --ink: #F1F3F5; --muted: #949CA6;
  --line: #2A2F35; --stamp: #FF6A58; --gold: #D7AE55; --photo: #2A3037;
  --scrim: rgba(0, 0, 0, .6);
  --lf-fur: #B9AFA2; --lf-line: #1A1714; --lf-eye: #F4F1EC;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
p { margin: 0; }

/* the product column. On a phone it is the page; on a wide screen it sits in the middle like the mockup. */
.phone {
  background: var(--bg); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  overflow-x: clip; max-width: 430px; margin-inline: auto;
}
@media (min-width: 470px) {
  body { background: var(--page); padding-block: 20px 32px; }
  .phone { border: 1px solid var(--line); border-radius: 28px; min-height: calc(100dvh - 52px); overflow: clip; }
  :root { --gutter: 20px; }
}
.body {
  flex: 1; display: flex; flex-direction: column; gap: 30px; min-width: 0;
  padding: 22px max(var(--gutter), env(safe-area-inset-right, 0px)) 28px max(var(--gutter), env(safe-area-inset-left, 0px));
}
.brand { font-family: var(--font-display); font-size: 15px; }
.brand a { text-decoration: none; }

.cta {
  position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); z-index: 5;
  padding: 12px var(--gutter) calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px;
}
.cta small { font-size: 12.5px; color: var(--muted); text-align: center; }
.cta small a { text-underline-offset: 3px; }
.cta .err { color: var(--stamp); font-size: 13.5px; font-weight: 500; text-align: center; }
.btn { width: 100%; height: 54px; border-radius: 14px; font-size: 16px; font-weight: 700; text-align: center; }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-kakao { background: var(--kakao); color: var(--kakao-ink); }
.btn-ghost { color: var(--muted); font-weight: 500; height: 44px; }
/* neutral rather than faded: a faded yellow turns olive on the dark sheet */
.btn:disabled { background: var(--surface); color: var(--muted); cursor: default; }
.prog { height: 4px; border-radius: 2px; background: var(--surface); overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--ink); border-radius: 2px; transition: width .4s ease; }

/* home */
.hero { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.hero .cat-loaf { display: block; width: 128px; height: auto; overflow: visible; }
.hero h1 { font-family: var(--font-display); font-size: 31px; line-height: 1.3; margin: 0; text-wrap: balance; }
.hero p { color: var(--muted); max-width: 22em; }
.foot { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.foot a { text-underline-offset: 3px; }
.file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* the judge: loaf-pose cat. Every fill and stroke comes from a token. */
.lf-fur { fill: var(--lf-fur); stroke: var(--lf-line); stroke-linejoin: round; }
.lf-dark { fill: var(--lf-line); }
.lf-eye { fill: var(--lf-eye); }
.lf-line { fill: none; stroke: var(--lf-line); stroke-linecap: round; stroke-linejoin: round; }
.lf-tube { fill: none; stroke: var(--lf-fur); stroke-linecap: round; }
.lf-stamp { fill: var(--stamp); }
.cat-head { display: block; flex: none; overflow: visible; }

/* photo and the judge's red pen */
.photo { position: relative; border-radius: 16px; overflow: hidden; background: var(--photo); }
.photo img { display: block; width: 100%; height: auto; }
.photo svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pen { fill: none; stroke: var(--stamp); stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.pen-text { font-family: var(--font-pen); font-weight: 400; fill: var(--stamp); paint-order: stroke; stroke: var(--photo); stroke-linejoin: round; pointer-events: none; }
.scan { stroke-dasharray: 1; stroke-dashoffset: 1; animation: scan .4s ease-out forwards; }
@keyframes scan { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .scan { animation: none; stroke-dashoffset: 0; } }
.stamp {
  position: absolute; bottom: 10px; left: 10px; width: 62px; height: 62px; border-radius: 50%;
  border: 2px solid var(--stamp); color: var(--stamp); display: grid; place-items: center;
  font-family: var(--font-display); font-size: 14px; transform: rotate(-12deg); background: var(--bg);
}
.opened { font-size: 12.5px; color: var(--stamp); font-weight: 500; padding-top: 8px; }
.notice { font-size: 13px; color: var(--muted); padding-top: 8px; }

/* not arrived yet: a grey bar the shape of the coming text, so nothing below moves when it lands */
.ghost {
  color: transparent !important; background: var(--surface); border-radius: 4px; user-select: none;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; animation: breathe 1.6s ease-in-out infinite;
}
.pcard .ghost, .think-bubble .ghost { background: var(--line); }
@keyframes breathe { 50% { opacity: .55; } }
.wait { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; vertical-align: middle; }
.wait::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--stamp); animation: pulse 1s ease-in-out infinite; }
.wait .cat-head { order: -1; width: 24px; height: 24px; margin-block: -4px; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .ghost, .wait::before { animation: none; } }
.soon { color: var(--muted); }

/* a part that could not be made */
.fail { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.fail button { font-weight: 700; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.fail button:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.fail small { flex-basis: 100%; font-size: 12.5px; }

/* sections */
.sec { display: flex; flex-direction: column; min-width: 0; }
.sec h2 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 8px; }
.sub { font-size: 13px; font-weight: 500; color: var(--muted); margin: 22px 0 2px; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 14px 0; border-top: 1px solid var(--line); width: 100%;
}
.row > span { min-width: 0; }
.award { font-family: var(--font-display); font-size: 20px; line-height: 1.35; }
.why { display: block; color: var(--muted); font-size: 14px; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: block; font-size: 12px; color: var(--muted); }
.top { color: var(--stamp); font-weight: 700; font-style: normal; }
.hook-q { color: var(--ink); font-weight: 700; }
.act { display: block; color: var(--ink); font-weight: 700; font-size: 15px; }
.ans { display: block; padding-top: 2px; }

/* small faces cut from the photo */
.av {
  width: 26px; height: 26px; border-radius: 50%; display: inline-block; flex: none; overflow: hidden; vertical-align: middle;
  background-color: var(--photo); background-repeat: no-repeat;
}
.av.lg { width: 44px; height: 44px; }
.av.in { width: 20px; height: 20px; vertical-align: -4px; margin-inline: 1px; }
.av.q { display: inline-grid; place-items: center; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 700; }
.pcard .av.q { background: var(--bg); }
.pair { display: inline-flex; flex: none; }
.pair .av + .av { margin-left: -8px; box-shadow: 0 0 0 2px var(--bg); }
.pair.many .av + .av { margin-left: -14px; }
.pair.crowd .av + .av { margin-left: -17px; }

/* hidden text: a blurred filler of the right length, never the real words.
   The filler has no spaces, so it must be allowed to break anywhere (body uses keep-all). */
.blur { filter: blur(5px); opacity: .75; user-select: none; word-break: break-all; overflow-wrap: anywhere; }
.chip { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; vertical-align: 1px; line-height: 1.5; }
.chip.share { background: var(--kakao); color: var(--kakao-ink); }
.chip.pay { background: var(--bg); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }

/* first look */
.fl-row { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.fl-row > span { min-width: 0; }
.fl-line { display: block; font-weight: 500; }

/* before sending: the sections the person will get, in their real layout, words and numbers blurred */
.pv { cursor: pointer; }
.pv h2 .chip { margin-left: 6px; }
.lk { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); width: 100%; }
.lk > span:first-child { min-width: 0; }
.lk-name { display: block; font-weight: 500; }

/* sideways strips. touch-action and overscroll keep the swipe inside the strip in in-app browsers. */
.strip {
  display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; touch-action: pan-x pan-y;
  margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter) 10px; scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip > * { flex: 0 0 86%; scroll-snap-align: start; min-width: 0; }

/* certificate: a double frame like a printed award, gold when the award is rare */
.cert {
  border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: -6px; border-radius: 4px;
  padding: 20px 20px 18px; display: flex; flex-direction: column; gap: 14px;
}
.cert.rare { border-color: var(--gold); outline-color: var(--gold); }
.cert-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cert.rare .cert-top span:last-child { color: var(--gold); font-weight: 700; }
.cert-head { display: flex; align-items: center; gap: 12px; }
.kicker { font-family: var(--font-display); font-size: 12px; letter-spacing: .5em; color: var(--muted); }
.cert-cite { font-family: var(--font-display); font-size: 15px; line-height: 1.7; }
.cert-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); margin-top: auto; }
.cert-judge { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cert-judge .cat-head { width: 32px; height: 32px; }
.pawseal { width: 50px; height: 50px; flex: none; display: block; }
.pawseal svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* own thoughts */
.think { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; width: 100%; }
.think-bubble { background: var(--surface); border-radius: 4px 16px 16px 16px; padding: 9px 14px; font-weight: 500; min-width: 0; }

/* group chemistry */
.type { padding-bottom: 6px; }
.big { display: flex; align-items: baseline; gap: 6px; padding: 6px 0 12px; flex-wrap: wrap; }
.big b { font-family: var(--font-display); font-size: 58px; line-height: 1; font-variant-numeric: tabular-nums; }
.big span { color: var(--muted); font-size: 14px; }

/* who looked at whom */
.pcard { background: var(--surface); border-radius: 16px; padding: 16px 16px 6px; display: flex; flex-direction: column; }
.pcard-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; }
.seen-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); width: 100%; align-items: start; }
.seen-row > span:last-child { min-width: 0; }
.line { display: block; font-weight: 500; }

/* two-person breakdown */
.rel { font-family: var(--font-display); font-size: 20px; line-height: 1.4; padding-bottom: 6px; }
.meter { display: block; height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.axis { grid-template-columns: 4.6em 1fr auto; }
.tug { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); width: 100%; }
.tug-top { display: flex; justify-content: space-between; font-size: 14px; }
.tug-row { display: flex; align-items: center; gap: 8px; }
.tug-bar { flex: 1; display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface); }
.tug-bar i, .lean-bar i { display: block; height: 100%; }
.talk { padding: 12px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.talk-head { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.talk button { width: 100%; }
/* the two people's sides of a bar: the first person ink, the second muted */
.c1 { background: var(--ink); }
.c2 { background: var(--muted); opacity: .45; }
.cg { background: var(--muted); }
.cl { background: var(--line); }

/* heart scale */
.lead { font-family: var(--font-display); font-size: 18px; line-height: 1.45; padding-bottom: 10px; text-wrap: balance; }
.lean { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); width: 100%; }
.lean-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dir { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.arr { color: var(--stamp); font-weight: 700; }
.ratio { font-family: var(--font-display); font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lean-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface); }

/* award collection */
.dex { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; padding-top: 4px; }
.dex i { aspect-ratio: 1; border-radius: 50%; border: 1.5px solid var(--line); }
.dex i.on { border-color: transparent; }
.dex svg { display: block; width: 100%; height: 100%; overflow: visible; }

.more { padding: 12px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; font-weight: 500; text-align: center; width: 100%; }

.fine { font-size: 12px; color: var(--muted); }
.fine button { text-decoration: underline; text-underline-offset: 3px; }
.fine .confirm { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; color: var(--ink); font-size: 13px; }
.fine .confirm span { display: flex; gap: 16px; }
.fine .confirm .danger { color: var(--stamp); font-weight: 700; }

/* gone, not found */
.plain { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.plain h1 { font-family: var(--font-display); font-size: 24px; line-height: 1.35; margin: 0; }
.plain p { color: var(--muted); }

/* pay sheet */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; }
.sheet {
  position: fixed; z-index: 21; left: 50%; transform: translateX(-50%); bottom: 0;
  width: min(430px, 100%); max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 24px 24px 0 0;
  padding-top: 26px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 14px;
}
.sheet h3 { margin: 0; font-family: var(--font-display); font-size: 22px; }
.sheet ul { margin: 0; padding-left: 1.1em; color: var(--muted); }
.sheet .fine a { text-underline-offset: 3px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; }
.field input {
  height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 0 14px; font: inherit; font-size: 17px; letter-spacing: .02em; width: 100%;
}
.field input:focus { outline: 2px solid var(--ink); outline-offset: 0; }
.field small { font-size: 12px; color: var(--muted); }
.sheet .err { color: var(--stamp); font-size: 13.5px; font-weight: 500; }

/* legal pages */
.legal { padding: 28px var(--gutter) 48px; display: flex; flex-direction: column; gap: 14px; }
.legal h1 { font-family: var(--font-display); font-size: 26px; margin: 0; }
.legal h2 { font-size: 16px; margin: 14px 0 0; }
.legal p, .legal li { color: var(--muted); font-size: 14px; }
.legal h3 { font-size: 14.5px; margin: 4px 0 0; }
.legal ul, .legal ol { margin: 0; padding-left: 1.2em; }
.legal li + li { margin-top: 4px; }
.legal strong { color: var(--ink); font-weight: 600; }
.legal table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13.5px; color: var(--muted); }
.legal th, .legal td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.legal th { color: var(--ink); font-weight: 600; background: var(--surface); }
.legal tr > :first-child { width: 34%; }
