:root {
  --paper: #f3efe7;
  --card: #fffdf8;
  --ink: #1d1b1a;
  --soft: rgba(29, 27, 26, .55);
  --line: rgba(29, 27, 26, .14);
  --c: #FF6A2B;
  --ci: #1d1b1a;
  --sans: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "Space Mono", ui-monospace, Menlo, monospace;
  --pad: 16px;
  --bottom: calc(54px + env(safe-area-inset-bottom));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before { /* paper grain */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .35 0 0 0 0 .3 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.ico { width: 1.25em; height: 1.25em; flex: none; display: block; }
[data-ico] { display: inline-flex; }

.app { position: fixed; inset: 0; }
.view {
  position: absolute; inset: 0; display: none; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) var(--pad) var(--bottom);
}
.view.on { display: flex; animation: viewIn .38s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- type ---------- */
.mark { margin: 0; line-height: .86; letter-spacing: -.02em; text-align: center; }
.mark .w1 { display: block; font-family: var(--sans); font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: clamp(54px, 17vw, 112px); }
.mark .w2 { display: block; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(50px, 15.5vw, 104px); margin-top: -.06em; }
.lede { margin: 10px 0 0; text-align: center; font-family: var(--mono); font-size: 13px; letter-spacing: .02em; color: var(--soft); }
.legal { font-family: var(--mono); font-size: 10px; color: var(--soft); opacity: .7; text-decoration: none; }
.legal:hover { text-decoration: underline; }

.big {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 58px; width: 100%; border-radius: 999px; background: var(--ink); color: var(--paper);
  font-size: 18px; font-weight: 700; letter-spacing: .01em; flex: none;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .14); transition: transform .15s, box-shadow .15s;
}
.big:hover { transform: translateY(-2px); box-shadow: 0 8px 0 rgba(0, 0, 0, .14); }
.big:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .14); }
.round {
  width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--ink); background: var(--card); font-size: 20px; transition: transform .15s;
}
.round:active { transform: scale(.92); }

/* ---------- intro ---------- */
#intro { align-items: center; }
.meta { width: 100%; display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.fan { position: relative; flex: 1; min-height: 0; width: 100%; max-width: 640px; margin-bottom: 10px; }
.fan__sway { position: absolute; inset: 0; transform-origin: 50% var(--pivot); }
.fan.ready .fan__sway { animation: sway 6s ease-in-out 1.6s infinite; }
@keyframes sway { 50% { transform: rotate(2.2deg); } }
.strip {
  position: absolute; left: 50%; top: calc(var(--pivot) - var(--h) + var(--w) / 2);
  width: var(--w); height: var(--h); margin-left: calc(var(--w) / -2);
  transform-origin: 50% calc(100% - var(--w) / 2);
  transform: rotate(0deg) scale(.96);
  background: var(--card); border-radius: 6px; padding: 5px 5px 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08), 0 8px 18px -10px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column;
  transition: transform .9s cubic-bezier(.2, 1.5, .35, 1);
  transition-delay: calc(var(--i) * 45ms + .25s);
}
.fan.open .strip { transform: rotate(var(--a)); }
.fan.shut .strip { transition-duration: .35s; transition-delay: calc((11 - var(--i)) * 18ms); transform: rotate(0deg) scale(.96); }
.strip__c { flex: 1; border-radius: 3px; background: var(--sc); display: grid; place-items: center; overflow: hidden; }
.strip__c .face { width: 86%; height: auto; }
.strip__l { height: var(--w); display: flex; justify-content: center; padding-top: 3px; font-family: var(--mono); font-size: max(7px, calc(var(--w) * .13)); letter-spacing: .02em; }
.strip__l i { position: absolute; left: 50%; bottom: calc(var(--w) * .37); width: calc(var(--w) * .26); height: calc(var(--w) * .26); margin-left: calc(var(--w) * -.13); border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #b9b3aa 60%, #8a847c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
#intro .mark { opacity: 0; transform: translateY(16px); transition: opacity .6s .9s, transform .8s .9s cubic-bezier(.2, 1.3, .4, 1); }
#intro .lede, #intro .big { opacity: 0; transition: opacity .5s 1.25s, transform .5s 1.25s; transform: translateY(10px); }
#intro.go .mark, #intro.go .lede, #intro.go .big { opacity: 1; transform: none; }
#intro .big { margin-top: 18px; max-width: 420px; }
#intro .legal { position: absolute; left: var(--pad); bottom: calc(14px + env(safe-area-inset-bottom)); }
#intro.leave { animation: leave .5s .3s cubic-bezier(.6, 0, .8, .4) both; }
@keyframes leave { to { opacity: 0; transform: translateY(-24px) scale(.98); } }

/* ---------- home ---------- */
.bar { position: absolute; left: 0; right: 0; top: 0; height: 6px; display: flex; }
.bar i { flex: 1; }
.head { position: relative; padding-top: 6px; }
.mark--sm { display: flex; align-items: baseline; justify-content: center; gap: .16em; }
.mark--sm .w1 { font-size: clamp(30px, 10vw, 52px); }
.mark--sm .w2 { font-size: clamp(30px, 10vw, 52px); margin: 0; }
.head .lede { margin-top: 4px; }
.legal--head { position: absolute; right: 0; top: -2px; }
.grid {
  flex: 1; min-height: 0; margin: 14px 0 12px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 9px;
}
.chip {
  display: flex; flex-direction: column; min-height: 0; text-align: left;
  background: var(--card); border-radius: 6px; padding: 4px 4px 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .07), 0 6px 14px -9px rgba(0, 0, 0, .4);
  transition: transform .25s cubic-bezier(.2, 1.4, .4, 1), box-shadow .25s;
}
.chip:hover { transform: translateY(-3px) rotate(-1.2deg); box-shadow: 0 1px 0 rgba(0, 0, 0, .07), 0 12px 20px -10px rgba(0, 0, 0, .45); }
.chip:active { transform: scale(.96); }
.chip__c { flex: 1; min-height: 0; border-radius: 3px; background: var(--sc); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.chip__c .face { height: 92%; width: auto; max-width: 92%; }
.chip__l { padding: 5px 3px 6px; flex: none; }
.chip__code { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: .04em; color: var(--soft); }
.chip__name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.12; font-weight: 700; min-height: 2.24em; }
.grid.pop .chip { animation: pop .55s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(var(--i) * 40ms); }
@keyframes pop { from { opacity: 0; transform: translateY(18px) rotate(var(--r)) scale(.8); } }
.face .eyes { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; animation-delay: var(--bd, 0s); }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }

/* ---------- kid ---------- */
#kid { padding: 0; }
.panel {
  position: relative; flex: 0 0 46%; min-height: 0; background: var(--c); color: var(--ci);
  display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) var(--pad) 16px;
  border-radius: 0 0 22px 22px; transition: background-color .35s;
}
.ptop { display: flex; align-items: center; gap: 10px; }
.round--ghost { width: 44px; height: 44px; background: transparent; border-color: currentColor; color: inherit; font-size: 18px; }
.code { font-family: var(--mono); font-size: 13px; letter-spacing: .06em; }
.pill { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; border: 1.5px solid currentColor; border-radius: 999px; padding: 3px 8px; animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes stamp { from { transform: scale(1.8) rotate(-8deg); opacity: 0; } }
.threat { margin-left: auto; display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.threat b { font-weight: 400; margin-right: 3px; }
.threat i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; }
.threat i.on { background: currentColor; }
.pface { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 4px 0; }
.pface .face { height: 100%; max-height: 260px; width: auto; max-width: 70%; }
.pname { flex: none; }
.cname { margin: 0; font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1; }
.who { margin: 2px 0 0; font-weight: 800; font-stretch: 80%; font-size: clamp(28px, 8.6vw, 54px); line-height: .95; letter-spacing: -.015em; }
.panel.slide-l .pface, .panel.slide-l .pname { animation: slideL .35s cubic-bezier(.2, .9, .3, 1); }
.panel.slide-r .pface, .panel.slide-r .pname { animation: slideR .35s cubic-bezier(.2, .9, .3, 1); }
@keyframes slideL { from { opacity: 0; transform: translateX(40px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(-40px); } }

.sheet { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px var(--pad) var(--bottom); }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--card); border-radius: 999px; padding: 4px; border: 1.5px solid var(--line); flex: none; }
.tabs button { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 42px; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: var(--soft); transition: background .2s, color .2s; white-space: nowrap; }
.tabs button .ico { width: 16px; height: 16px; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.content { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 2px 10px; overscroll-behavior: contain; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.list li { display: flex; align-items: center; gap: 12px; font-size: 18px; line-height: 1.2; font-weight: 600; animation: rowIn .4s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(var(--i) * 60ms); }
.list li span.dot { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--c); color: var(--ci); font-size: 18px; }
.list--no li span.dot { background: var(--ink); color: var(--paper); }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }
.say { margin: 0; font-family: var(--serif); font-style: italic; font-size: clamp(28px, 8vw, 40px); line-height: 1.06; animation: rowIn .4s both; }
.say::before { content: "\201C"; } .say::after { content: "\201D"; }
.say-tip { margin: 12px 0 0; font-family: var(--mono); font-size: 12px; color: var(--soft); }
.kbar { display: flex; gap: 10px; align-items: center; flex: none; padding-top: 6px; }
.big--save { min-height: 52px; font-size: 16px; width: auto; flex: 1; min-width: 0; }

/* ---------- quiz ---------- */
.qtop { display: flex; align-items: center; gap: 12px; }
.step { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.q { margin: 18px 0 14px; font-weight: 800; font-stretch: 80%; font-size: clamp(34px, 10vw, 60px); line-height: .95; letter-spacing: -.015em; }
.tiles { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 10px; max-height: 560px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 8px; min-height: 0; text-align: left;
  background: var(--card); border-radius: 18px; padding: 12px; border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink); transition: transform .15s, box-shadow .15s;
  animation: pop .5s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(var(--i) * 50ms); --r: 0deg;
}
.tile:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.tile:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.tile__i { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: var(--sc); color: var(--si); font-size: 32px; flex: none; }
.tile__t { font-size: 17px; font-weight: 700; line-height: 1.1; }
.tile__b { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 8px; flex: 1; min-height: 0; height: 100%; }
.tiles--wide { grid-template-columns: 1fr; grid-auto-rows: minmax(0, 150px); }
.tiles--wide .tile { flex-direction: row; align-items: stretch; padding: 8px; gap: 14px; }
.tiles--wide .tile__b { justify-content: center; padding: 4px 0; }
.tile__sw { flex: none; height: 100%; aspect-ratio: 1; border-radius: 10px; background: var(--sc); display: grid; place-items: center; overflow: hidden; }
.tile__sw .face { width: 92%; height: 92%; }
.tiles--wide .tile__i { width: 44px; height: 44px; font-size: 22px; background: none; color: var(--ink); border: 2px solid var(--ink); }
.tiles--wide .tile__t { font-size: 19px; }
/* chip → panel morph */
.morph { position: fixed; z-index: 40; pointer-events: none; border-radius: 3px; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60; max-width: calc(100% - 32px); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- short phones ---------- */
@media (max-height: 700px) {
  .mark .w1 { font-size: clamp(46px, 14vw, 90px); }
  .mark .w2 { font-size: clamp(42px, 13vw, 84px); }
  .mark--sm .w1, .mark--sm .w2 { font-size: clamp(28px, 9vw, 44px); }
  .grid { margin: 10px 0 10px; gap: 7px; }
  .list { gap: 8px; }
  .list li { font-size: 16.5px; }
  .list li span.dot { width: 32px; height: 32px; font-size: 16px; }
  .q { margin: 12px 0 10px; }
  .tile { padding: 10px; }
  .tile__i { width: 50px; height: 50px; font-size: 26px; }
  .tile__t { font-size: 16px; }
  .panel { flex-basis: 44%; }
}
@media (max-height: 600px) {
  :root { --bottom: calc(46px + env(safe-area-inset-bottom)); }
  .panel { flex-basis: 40%; }
  .who { font-size: 26px; }
  .cname { font-size: 18px; }
  .sheet { padding-top: 10px; }
  .tabs button { min-height: 36px; }
  .content { padding-top: 10px; }
  .list { gap: 6px; }
  .list li { font-size: 15px; gap: 10px; }
  .list li span.dot { width: 28px; height: 28px; font-size: 14px; }
  .say { font-size: 26px; }
  .round { width: 46px; height: 46px; }
  .big { min-height: 50px; font-size: 16px; }
  .big--save { min-height: 46px; }
  .lede { font-size: 12px; }
  .grid { gap: 6px; margin: 8px 0; }
  .chip__l { padding: 3px 2px 4px; }
  .chip__name { font-size: 11px; }
  .chip__code { font-size: 8px; }
}
@media (max-width: 350px) {
  .tabs button { font-size: 12px; gap: 3px; }
  .tabs button .ico { width: 14px; height: 14px; }
}

/* ---------- big screens ---------- */
@media (min-width: 900px) {
  :root { --pad: 32px; --bottom: 28px; }
  #home { max-width: 1240px; margin: 0 auto; }
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 24px 0 22px; }
  .chip { padding: 7px 7px 0; }
  .chip__l { padding: 8px 4px 10px; }
  .chip__code { font-size: 10.5px; }
  .chip__name { font-size: 15px; }
  #home .big { max-width: 420px; margin: 0 auto; }
  #kid { flex-direction: row; }
  .panel { flex: 0 0 50%; border-radius: 0 28px 28px 0; padding: 28px 36px 36px; }
  .pface .face { max-height: 420px; }
  .cname { font-size: 30px; }
  .sheet { justify-content: center; padding: 40px 48px; max-width: 640px; margin: 0 auto; }
  .content { flex: 0 1 auto; min-height: 220px; padding: 22px 2px; }
  .list li { font-size: 21px; }
  #whoView { max-width: 900px; margin: 0 auto; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles--wide { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(0, 360px); }
  .tiles--wide .tile { flex-direction: column; }
  .tile__sw { width: 100%; height: auto; flex: 1; min-height: 0; aspect-ratio: auto; }
  .tiles--wide .tile__b { flex: none; height: auto; padding: 4px; }
}
@media (min-width: 900px) and (max-height: 640px) {
  .grid { margin: 14px 0; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}
