/* ---------- Theme tokens ---------- */
:root, :root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f5f5f4;
  --card: #ffffff;
  --ink: #0c0c0d;
  --muted: #7a7a80;
  --line: #ececec;
  --brand: #0284c7;
  --brand-ink: #ffffff;
  --brand-soft: #e3f4fe;
  --hot: #d97706;
  --hot-soft: #fff4dc;
  --bad: #e11d48;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --nav: rgba(255,255,255,.86);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0a0b;
  --surface: #141416;
  --card: #141416;
  --ink: #f4f4f5;
  --muted: #8b8b92;
  --line: #232327;
  --brand: #38bdf8;
  --brand-ink: #03131d;
  --brand-soft: #0b2535;
  --hot: #fbbf24;
  --hot-soft: #2b2108;
  --bad: #fb7185;
  --shadow: none;
  --nav: rgba(10,10,11,.86);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body {
  font-family: Inter, system-ui, -apple-system, "PingFang HK", "Microsoft JhengHei", sans-serif;
  color: var(--ink); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background .35s ease, color .35s ease;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.025em; line-height: 1.15; }
h1 { font-size: 34px; font-weight: 800; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.rise { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
.stagger > * { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; }
.stagger > *:nth-child(n+6) { animation-delay: .26s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--nav);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -.03em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; display: block; }
.duck-hero { width: 84px; height: 84px; border-radius: 24px; display: block; box-shadow: 0 10px 30px rgba(0,163,238,.3); animation: pop .6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes waddle { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-4px); } }
.duck-hero.waddle { animation: pop .6s cubic-bezier(.2,.8,.2,1) both, waddle 2.4s .6s ease-in-out infinite; }
.top-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--surface);
  display: grid; place-items: center; cursor: pointer; transition: transform .2s;
}
.icon-btn:active { transform: scale(.92); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px;
  border-radius: 999px; font-size: 14px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand);
}
.pill.neg { background: var(--hot-soft); color: var(--hot); }

/* ---------- Layout ---------- */
.view { padding: 8px 20px 120px; }
.view.enter { animation: fade .35s ease both; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.section-title h2 { font-size: 20px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; background: var(--surface); border-color: transparent; }

/* Unlock progress */
.unlock { display: flex; align-items: center; gap: 14px; }
.unlock .ring { position: relative; width: 56px; height: 56px; flex: none; }
.unlock .ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.unlock .ring circle { fill: none; stroke-width: 6; }
.unlock .ring .track { stroke: var(--line); }
.unlock .ring .fill { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.unlock .ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; }

/* Survey card */
.s-card { position: relative; cursor: pointer; transition: transform .2s ease; }
.s-card:active { transform: scale(.985); }
.s-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.s-earn { flex: none; height: 30px; padding: 0 10px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--brand-soft); color: var(--brand); }
.s-sub { margin-top: 4px; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 9px; background: var(--surface); font-size: 13px; font-weight: 500; color: var(--muted); }
.chip .svg { width: 14px; height: 14px; }
.chip.hot { background: var(--hot-soft); color: var(--hot); font-weight: 600; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width 1s cubic-bezier(.2,.8,.2,1); }
.s-count { margin-top: 6px; font-size: 13px; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 16px; border: 0;
  font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none;
  background: var(--ink); color: var(--bg); transition: transform .15s ease, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn.brand { background: var(--brand); color: var(--brand-ink); }
.btn.soft { background: var(--surface); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { background: transparent; color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: 14px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* Forms */
.field { margin-top: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid transparent; border-radius: 14px; padding: 0 14px; min-height: 52px;
  transition: border-color .2s, background .2s; appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { padding: 14px; min-height: 120px; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background: var(--card); }
.btn:focus-visible, .icon-btn:focus-visible, .nav button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 16px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 7px; flex: none; appearance: auto; -webkit-appearance: checkbox; accent-color: var(--brand); }
.error { color: var(--bad); font-size: 14px; margin-top: 10px; min-height: 0; }
.error:empty { display: none; }

/* Code */
.code-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 32px; font-weight: 700;
  letter-spacing: .1em; text-align: center; padding: 22px 12px; border-radius: 18px;
  background: var(--brand-soft); color: var(--brand); user-select: all; animation: pop .5s cubic-bezier(.2,.8,.2,1) both;
}
.steps-ico { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.steps-ico div { text-align: center; font-size: 13px; color: var(--muted); }
.steps-ico i { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 6px; border-radius: 14px; background: var(--surface); color: var(--ink); font-style: normal; }

/* Big numbers */
.big { font-size: 48px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.big small { font-size: 18px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border-radius: 20px; padding: 18px; }
.tile .label { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.tile .big { font-size: 36px; }

.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--surface); color: var(--muted); }
.tag.hot { background: var(--hot-soft); color: var(--hot); }
.tag.good { background: var(--brand-soft); color: var(--brand); }
.tag.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.live .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.list-row:last-child { border-bottom: 0; }
.list-row .sub { font-size: 13px; color: var(--muted); }
.amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.amt.pos { color: var(--brand); }
.amt.neg { color: var(--hot); }

.empty { text-align: center; padding: 48px 12px; color: var(--muted); }
.empty .em-ico { width: 64px; height: 64px; border-radius: 22px; background: var(--surface); display: grid; place-items: center; margin: 0 auto 14px; color: var(--ink); }
.empty .em-ico .svg { width: 28px; height: 28px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

.tip { display: flex; gap: 10px; align-items: center; background: var(--hot-soft); color: var(--ink); border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }

/* ---------- Bottom nav ---------- */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: center;
  background: var(--nav); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav-inner { display: flex; width: 100%; max-width: 520px; position: relative; }
.nav button {
  flex: 1; background: none; border: 0; font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 10px 4px 10px; min-height: 60px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; transition: color .25s;
}
.nav button .svg { width: 22px; height: 22px; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.nav button[aria-current="page"] { color: var(--ink); }
.nav button[aria-current="page"] .svg { transform: translateY(-2px); }
.nav .post-btn .svg { width: 26px; height: 26px; }
.nav .indicator { position: absolute; top: 0; height: 2px; width: 25%; background: var(--ink); border-radius: 2px; transition: transform .4s cubic-bezier(.2,.8,.2,1); }

/* ---------- Sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .3s; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 520px; margin: 0 auto;
  max-height: 92dvh; overflow: auto; background: var(--card); border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .45s cubic-bezier(.2,.8,.2,1); visibility: hidden;
}
.sheet.open { transform: none; visibility: visible; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 16px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); z-index: 30;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s cubic-bezier(.2,.8,.2,1); max-width: calc(100% - 40px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tutorial ---------- */
.tour { min-height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.tour-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; }
.tour-viewport { flex: 1; overflow: hidden; touch-action: pan-y; }
.tour-track { display: flex; height: 100%; transition: transform .6s cubic-bezier(.65,0,.2,1); }
.slide { flex: 0 0 100%; display: flex; flex-direction: column; justify-content: center; padding: 0 28px; }
.art { height: 260px; display: grid; place-items: center; margin-bottom: 28px; }
.slide h1 { font-size: 38px; }
.slide p { margin-top: 12px; font-size: 18px; color: var(--muted); }
.slide h1, .slide p { opacity: 0; transform: translateY(16px); transition: opacity .6s .15s, transform .6s .15s cubic-bezier(.2,.8,.2,1); }
.slide p { transition-delay: .25s; }
.slide.active h1, .slide.active p { opacity: 1; transform: none; }
.tour-foot { padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); }
.tour-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 20px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 99px; background: var(--line); transition: width .4s cubic-bezier(.2,.8,.2,1), background .4s; }
.tour-dots i.on { width: 26px; background: var(--ink); }
.tour-foot .alt { text-align: center; margin-top: 14px; font-size: 14px; color: var(--muted); }
.tour-foot .alt button { background: none; border: 0; color: var(--ink); font-weight: 600; cursor: pointer; padding: 6px; }

/* Art 1: chat bubbles */
.bubbles { width: 240px; }
.bubble { padding: 12px 16px; border-radius: 18px 18px 18px 6px; background: var(--surface); margin-bottom: 10px; font-size: 15px; width: fit-content; opacity: 0; transform: translateY(10px) scale(.95); }
.bubble.me { margin-left: auto; border-radius: 18px 18px 6px 18px; background: var(--ink); color: var(--bg); }
.slide.active .bubble { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
.slide.active .bubble:nth-child(2) { animation-delay: .5s; }
.slide.active .bubble:nth-child(3) { animation-delay: 1s; }
.slide.active .bubble:nth-child(4) { animation-delay: 1.5s; }

/* Art 2: three checks */
.checks { display: flex; gap: 16px; }
.checks i { width: 64px; height: 64px; border-radius: 22px; background: var(--surface); display: grid; place-items: center; color: var(--brand-ink); position: relative; overflow: hidden; }
.checks i::before { content: ""; position: absolute; inset: 0; background: var(--brand); transform: scale(0); border-radius: inherit; }
.checks i .svg { position: relative; width: 30px; height: 30px; stroke-width: 3; opacity: 0; }
.slide.active .checks i::before { animation: pop .5s cubic-bezier(.2,.8,.2,1) both; }
.slide.active .checks i .svg { animation: fade .3s both; }
.slide.active .checks i:nth-child(1)::before { animation-delay: .3s; } .slide.active .checks i:nth-child(1) .svg { animation-delay: .5s; }
.slide.active .checks i:nth-child(2)::before { animation-delay: .8s; } .slide.active .checks i:nth-child(2) .svg { animation-delay: 1s; }
.slide.active .checks i:nth-child(3)::before { animation-delay: 1.3s; } .slide.active .checks i:nth-child(3) .svg { animation-delay: 1.5s; }
.slide.active .checks i::before { transform: scale(1); }

/* Art 3: card jumps to top */
.stackart { width: 230px; position: relative; height: 210px; }
.stackart div { position: absolute; left: 0; right: 0; height: 56px; border-radius: 16px; background: var(--surface); display: flex; align-items: center; padding: 0 14px; gap: 10px; }
.stackart div::before { content: ""; width: 26px; height: 26px; border-radius: 8px; background: var(--line); }
.stackart div::after { content: ""; height: 8px; width: 90px; border-radius: 4px; background: var(--line); }
.stackart .a { top: 0; } .stackart .b { top: 72px; } .stackart .c { top: 144px; }
.stackart .you { top: 144px; background: var(--brand); box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 40%, transparent); z-index: 2; }
.stackart .you::before { background: rgba(255,255,255,.35); } .stackart .you::after { background: rgba(255,255,255,.55); }
@keyframes jump { 0%, 20% { top: 144px; } 60%, 100% { top: 0; } }
@keyframes push1 { 0%, 25% { top: 0; } 65%, 100% { top: 72px; } }
@keyframes push2 { 0%, 25% { top: 72px; } 65%, 100% { top: 144px; } }
.slide.active .stackart .you { animation: jump 1.6s .3s cubic-bezier(.2,.8,.2,1) both; }
.slide.active .stackart .a { animation: push1 1.6s .3s cubic-bezier(.2,.8,.2,1) both; }
.slide.active .stackart .b { animation: push2 1.6s .3s cubic-bezier(.2,.8,.2,1) both; }
.stackart .c { opacity: 0; }

/* Art 4: loop */
.loopart { position: relative; width: 210px; height: 210px; }
.loopart svg.ring { width: 210px; height: 210px; }
.loopart .ring circle { fill: none; stroke: var(--line); stroke-width: 10; }
.loopart .ring path { fill: none; stroke: var(--brand); stroke-width: 10; stroke-linecap: round; }
.slide.active .loopart .ring { animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loopart .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.loopart .center b { font-size: 34px; font-weight: 800; letter-spacing: -.03em; display: block; }
.loopart .center span { color: var(--muted); font-size: 14px; }

/* Auth screen */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px 40px; }
.auth h1 { margin: 24px 0 6px; }
.auth .switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth .switch button { background: none; border: 0; color: var(--ink); font-weight: 600; cursor: pointer; padding: 6px; }

/* expandable section (button + body; works on every browser) */
.disclose { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 40px; margin-top: 8px; padding: 0; background: none; border: 0; font-weight: 600; font-size: 14px; text-align: left; cursor: pointer; color: var(--ink); }
.disclose .svg { width: 16px; height: 16px; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.disclose[aria-expanded="true"] .svg { transform: rotate(90deg); }
.disclose-body:not([hidden]) { animation: rise .35s cubic-bezier(.2,.8,.2,1) both; }
ol.mini { padding-left: 18px; margin: 8px 0 0; font-size: 14px; color: var(--muted); }
ol.mini li { margin-bottom: 6px; }
ol.mini b { color: var(--ink); }

/* ---------- Duck animations ---------- */
.duck { position: relative; display: inline-block; margin: 0 auto; }
.duck img { display: block; image-rendering: auto; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.duck .body { position: relative; transform-origin: 50% 100%; }
.duck .shadow { display: block; height: calc(8px * var(--s)); width: 70%; margin: calc(-6px * var(--s)) auto 0; border-radius: 50%; background: rgba(0,0,0,.10); }
:root[data-theme="dark"] .duck .shadow { background: rgba(255,255,255,.07); }
.empty .duck { margin-bottom: 10px; }

.duck-idle .body img { width: calc(107px * var(--s)); }
.duck-idle .body { animation: d-breathe 3.2s ease-in-out infinite; }
.duck-idle .blink { position: absolute; inset: 0; opacity: 0; animation: d-blink 4.4s steps(1) infinite; }
.duck-idle .shadow { animation: d-shadow 3.2s ease-in-out infinite; }
@keyframes d-breathe { 0%,100% { transform: translateY(0) scale(1,1); } 50% { transform: translateY(-3px) scale(1.01,.985); } }
@keyframes d-blink { 0%, 90%, 94%, 100% { opacity: 0; } 91%, 93% { opacity: 1; } }
@keyframes d-shadow { 0%,100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.9); opacity: .7; } }

.duck-sleep .body img { width: calc(107px * var(--s)); }
.duck-sleep .body { animation: d-snore 3.6s ease-in-out infinite; }
@keyframes d-snore { 0%,100% { transform: scale(1,1) rotate(0); } 45% { transform: scale(1.035,.975) rotate(-1.5deg); } }
.duck-sleep .z { position: absolute; left: 62%; top: 4%; font-weight: 800; color: var(--brand); opacity: 0; font-size: calc(14px * var(--s)); animation: d-z 3.6s ease-out infinite; }
.duck-sleep .z2 { animation-delay: 1.2s; font-size: calc(17px * var(--s)); }
.duck-sleep .z3 { animation-delay: 2.4s; font-size: calc(21px * var(--s)); }
@keyframes d-z { 0% { opacity: 0; transform: translate(0,0) rotate(-10deg); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(26px * var(--s)), calc(-40px * var(--s))) rotate(12deg); } }

.duck-work .body img { width: calc(147px * var(--s)); }
.duck-work .body { animation: d-type .5s ease-in-out infinite; }
@keyframes d-type { 0%,100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-1.5px) rotate(-.8deg); } 75% { transform: translateY(-.5px) rotate(.6deg); } }

.duck-walk .walk-win { width: calc(102px * var(--s)); height: calc(108px * var(--s)); overflow: hidden; animation: d-bob .45s ease-in-out infinite alternate; }
.duck-walk .walk-win img { height: 100%; width: 800%; max-width: none; animation: d-walk .9s steps(8) infinite; }
@keyframes d-walk { to { transform: translateX(-100%); } }
@keyframes d-bob { to { transform: translateY(-2px); } }

.duck-submit .body img { width: calc(128px * var(--s)); }
.duck-submit .body { animation: d-hop 1.4s cubic-bezier(.3,.7,.3,1) infinite; }
.duck-submit .shadow { animation: d-hop-shadow 1.4s cubic-bezier(.3,.7,.3,1) infinite; }
@keyframes d-hop { 0%,100% { transform: translateY(0) scale(1,1); } 12% { transform: translateY(0) scale(1.06,.92); } 40% { transform: translateY(-18px) scale(.97,1.04) rotate(-3deg); } 62% { transform: translateY(0) scale(1.05,.94); } 75% { transform: scale(1,1); } }
@keyframes d-hop-shadow { 0%,100%,62% { transform: scaleX(1); opacity: 1; } 40% { transform: scaleX(.65); opacity: .45; } }

.duck-celebrate .body img { width: calc(148px * var(--s)); }
.duck-celebrate .body { animation: d-jump .7s cubic-bezier(.2,.9,.3,1.3) both, d-flap 1s .7s ease-in-out infinite; }
@keyframes d-jump { 0% { transform: translateY(20px) scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes d-flap { 0%,100% { transform: rotate(0) translateY(0); } 25% { transform: rotate(-4deg) translateY(-4px); } 75% { transform: rotate(4deg) translateY(-4px); } }
.confetti { position: absolute; left: 50%; top: 40%; width: 0; height: 0; }
.confetti b { position: absolute; width: 7px; height: 11px; border-radius: 2px; opacity: 0;
  background: hsl(calc(var(--k) * 47deg + 190deg) 90% 58%);
  animation: d-conf 1.4s calc(.15s + var(--k) * .02s) cubic-bezier(.15,.7,.3,1) forwards; }
@keyframes d-conf {
  0% { opacity: 1; transform: rotate(calc(var(--k) * 25.7deg)) translateY(0) rotate(0); }
  100% { opacity: 0; transform: rotate(calc(var(--k) * 25.7deg)) translateY(calc(-90px - var(--k) * 3px)) rotate(540deg); } }

/* tutorial art with ducks */
.art-stack { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.small-checks i { width: 44px; height: 44px; border-radius: 15px; }
.small-checks i .svg { width: 22px; height: 22px; }
.pond { position: relative; display: grid; place-items: center; }
.pond .ripple { position: absolute; bottom: 4px; left: 50%; width: 220px; height: 26px; margin-left: -110px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); animation: d-ripple 2s ease-out infinite; z-index: -1; }
@keyframes d-ripple { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
.loading-duck { display: grid; place-items: center; padding: 70px 0; }

/* full-screen moment */
.fx { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .3s; }
.fx.open { opacity: 1; pointer-events: auto; }
.fx-card { text-align: center; padding: 24px; transform: scale(.9); transition: transform .4s cubic-bezier(.2,.8,.2,1.2); }
.fx.open .fx-card { transform: none; }
.fx-card h2 { margin-top: 10px; font-size: 28px; }
.fx-card p { margin-top: 6px; }

/* turnaround spin (8 views) */
.duck-spin .spin-win { width: calc(129px * var(--s)); height: calc(125px * var(--s)); overflow: hidden; }
.duck-spin .spin-win img { height: 100%; width: 800%; max-width: none; animation: d-walk 2s steps(8) infinite; }

/* head close-ups */
.duck-face .body img { width: calc(142px * var(--s)); }
.face-surprised .body { animation: d-shake .6s .2s ease-in-out both; }
@keyframes d-shake { 0%,100% { transform: none; } 20% { transform: translateX(-5px) rotate(-3deg); } 40% { transform: translateX(5px) rotate(3deg); } 60% { transform: translateX(-3px) rotate(-1deg); } 80% { transform: translateX(2px); } }
.face-thinking .body { animation: d-ponder 3s ease-in-out infinite; }
@keyframes d-ponder { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-4deg) translateY(-2px); } }
.face-happy .body, .face-neutral .body, .face-excited .body { animation: d-breathe 2.6s ease-in-out infinite; }
.face-wink .body { animation: d-jump .5s cubic-bezier(.2,.9,.3,1.3) both, d-flap 1.2s .5s ease-in-out infinite; }

/* ---------- Smoothness ---------- */
html { scroll-behavior: smooth; }
img { -webkit-user-drag: none; }
/* every coloured surface eases between light and dark */
.theming, .theming *, .theming *::before, .theming *::after {
  transition: background-color .4s ease, color .4s ease, border-color .4s ease, fill .4s ease, stroke .4s ease, box-shadow .4s ease !important;
}
/* full-screen swaps */
.app.screen-in > * { animation: screen-in .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.app.screen-in > .nav, .app.screen-in > .top { animation-name: fade; }
/* tab content: dim while the next tab loads instead of going blank */
.view { transition: opacity .18s ease; }
.view.leaving { opacity: .35; pointer-events: none; }
/* cards and buttons respond smoothly */
.card, .btn, .icon-btn, .chip, .pill { transition: transform .18s ease, box-shadow .25s ease, background-color .25s ease, color .25s ease, border-color .25s ease, opacity .2s; }
@media (hover: hover) {
  .s-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.04), 0 14px 32px rgba(0,0,0,.08); }
  .btn:hover:not(:disabled) { filter: brightness(1.06); }
  .icon-btn:hover { background: var(--line); }
}
.btn:disabled { cursor: progress; }
.pill { transition: background-color .3s, color .3s, transform .3s cubic-bezier(.2,.8,.2,1.4); }

/* first-load splash (shown by index.html before the app starts) */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 6px; animation: fade .4s ease both; }
.boot p { font-weight: 800; letter-spacing: -.03em; font-size: 18px; color: var(--ink); margin-top: 4px; }
.loading-duck { display: grid; justify-items: center; gap: 8px; padding: 64px 0; animation: fade .3s ease both; }

/* waddling overlay during actions */
.busy { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 45%, transparent);
  opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.busy.open { opacity: 1; pointer-events: auto; }
.busy-card { display: grid; justify-items: center; gap: 6px; padding: 18px 26px 16px; border-radius: 22px; background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0,0,0,.12); font-size: 14px; font-weight: 600; color: var(--muted); transform: scale(.94); transition: transform .3s cubic-bezier(.2,.8,.2,1.3); }
.busy.open .busy-card { transform: none; }

/* ---------- v0.5 pieces ---------- */
.lang-btn { height: 40px; min-width: 40px; padding: 0 12px; border-radius: 12px; border: 0; background: var(--surface); font-weight: 700; font-size: 14px; cursor: pointer; transition: transform .2s, background-color .25s; }
.lang-btn:active { transform: scale(.94); }
.auth-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.top-right { flex-wrap: nowrap; }

/* tutorial slide 4: how time credits work */
.credit-art { display: grid; justify-items: center; gap: 18px; }
.credits { display: grid; gap: 10px; width: 250px; }
.credit { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-radius: 16px; font-weight: 600; font-size: 15px; opacity: 0; transform: translateY(10px); }
.credit b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.credit.plus { background: var(--brand-soft); color: var(--brand); }
.credit.minus { background: var(--hot-soft); color: var(--hot); }
.slide.active .credit { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
.slide.active .credit.plus { animation-delay: .35s; }
.slide.active .credit.minus { animation-delay: .75s; }

/* post: setup with copy bars */
.setup-step { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; margin-top: 12px; line-height: 1.5; }
.setup-step:first-of-type { margin-top: 0; }
.setup-step > div { flex: 1; min-width: 0; }
.setup-step .n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-size: 13px; margin-top: 1px; }
.copy-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 6px 6px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.copy-label { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); }
.copy-label:empty { display: none; }
.copy-bar code { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 12px; border-radius: 9px; border: 0; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 13px; cursor: pointer; transition: transform .15s, background-color .25s; }
.copy-btn .svg { width: 15px; height: 15px; }
.copy-btn:active { transform: scale(.94); }
.copy-btn .c-done { display: none; }
.copy-btn.copied { background: var(--brand); color: var(--brand-ink); }
.copy-btn.copied > .svg, .copy-btn.copied .c-copy { display: none; }
.copy-btn.copied .c-done { display: inline-flex; animation: pop .35s cubic-bezier(.2,.8,.2,1) both; }
.check { align-items: flex-start; line-height: 1.45; }
.check input { margin-top: 1px; }

/* segmented controls in settings */
.seg { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 12px; }
.seg .btn { min-height: 34px; }

/* groups */
.member-list { margin: 14px 0 4px; }
.member { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 15px; border-top: 1px solid var(--line); }
.avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 14px; }
.invite-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.code-chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; font-weight: 800; letter-spacing: .14em; margin-top: 2px; }
.btn .svg { width: 18px; height: 18px; }

/* =================================================================
   LAYOUTS — html[data-layout] is set by app.js: phone / tablet / desktop
   Phone = the default styles above.
   ================================================================= */

/* ---------- iPad / tablet ---------- */
html[data-layout="tablet"] .app { max-width: 860px; }
html[data-layout="tablet"] .view { padding: 12px 32px 130px; }
html[data-layout="tablet"] .top { padding: 16px 32px; }
html[data-layout="tablet"] .feed,
html[data-layout="tablet"] .grid-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
html[data-layout="tablet"] .feed > .card,
html[data-layout="tablet"] .grid-list > .card { margin: 0; }
html[data-layout="tablet"] .form-wrap { max-width: 620px; margin: 0 auto; }
html[data-layout="tablet"] .me-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; align-items: start; }
html[data-layout="tablet"] .nav-inner { max-width: 620px; }
html[data-layout="tablet"] .nav button { min-height: 66px; font-size: 12.5px; }
html[data-layout="tablet"] .nav button .svg { width: 24px; height: 24px; }
html[data-layout="tablet"] .auth { max-width: 520px; margin: 0 auto; padding: 40px 24px; }
html[data-layout="tablet"] .tour { max-width: 680px; margin: 0 auto; }
html[data-layout="tablet"] .slide h1 { font-size: 44px; }
html[data-layout="tablet"] .slide p { font-size: 20px; }
html[data-layout="tablet"] .art { height: 320px; transform: scale(1.15); }
/* centred dialog instead of a bottom sheet */
html[data-layout="tablet"] .sheet,
html[data-layout="desktop"] .sheet {
  top: 50%; bottom: auto; left: 50%; right: auto; width: min(480px, calc(100% - 48px)); max-height: 86vh;
  border-radius: 26px; padding: 26px 24px 22px; margin: 0;
  transform: translate(-50%, -46%) scale(.96); opacity: 0;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .25s ease, visibility 0s .35s;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
}
html[data-layout="tablet"] .sheet.open,
html[data-layout="desktop"] .sheet.open { transform: translate(-50%, -50%); opacity: 1; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .25s ease; }
html[data-layout="tablet"] .grabber,
html[data-layout="desktop"] .grabber { display: none; }

/* ---------- computer ---------- */
html[data-layout="desktop"], html[data-layout="desktop"] body { background: var(--surface); }
html[data-layout="desktop"] .app { max-width: none; min-height: 100vh; padding-left: 248px; background: var(--bg); }
/* left sidebar */
html[data-layout="desktop"] .nav {
  top: 0; bottom: 0; left: 0; right: auto; width: 248px; display: block; padding: 88px 16px 24px;
  border-top: 0; border-right: 1px solid var(--line); background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none;
}
html[data-layout="desktop"] .nav-inner { flex-direction: column; gap: 4px; max-width: none; }
html[data-layout="desktop"] .nav button {
  flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 0 14px;
  border-radius: 12px; font-size: 15px; transition: background-color .2s, color .2s;
}
html[data-layout="desktop"] .nav button .svg { width: 20px; height: 20px; transform: none !important; }
html[data-layout="desktop"] .nav button:hover { background: var(--surface); color: var(--ink); }
html[data-layout="desktop"] .nav button[aria-current="page"] { background: var(--surface); color: var(--ink); }
html[data-layout="desktop"] .nav .indicator { display: none; }
/* header: logo sits at the top of the sidebar */
html[data-layout="desktop"] .top { padding: 20px 40px; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 8; backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-layout="desktop"] .top .logo { position: fixed; top: 24px; left: 28px; z-index: 7; font-size: 20px; }
html[data-layout="desktop"] .top .logo-mark { width: 34px; height: 34px; }
html[data-layout="desktop"] .top { justify-content: flex-end; min-height: 72px; }
html[data-layout="desktop"] .view { max-width: 1120px; margin: 0 auto; padding: 24px 48px 64px; }
html[data-layout="desktop"] .top-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
html[data-layout="desktop"] .top-cards > .card { margin: 0; }
html[data-layout="desktop"] .feed,
html[data-layout="desktop"] .grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
html[data-layout="desktop"] .feed > .card,
html[data-layout="desktop"] .grid-list > .card { margin: 0; }
html[data-layout="desktop"] .form-wrap { max-width: 640px; }
html[data-layout="desktop"] .me-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; align-items: start; max-width: 980px; }
html[data-layout="desktop"] .toast { bottom: 32px; left: calc(50% + 124px); }
/* sign up, quick bio and tutorial: a centred card */
html[data-layout="desktop"] .app:has(> .auth),
html[data-layout="desktop"] .app:has(> .tour),
html[data-layout="desktop"] .app:has(> .boot) { padding-left: 0; background: transparent; }
html[data-layout="desktop"] .auth {
  min-height: auto; max-width: 460px; margin: 6vh auto; padding: 36px 40px 40px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.08);
}
html[data-layout="desktop"] .tour {
  min-height: auto; height: min(780px, 92vh); max-width: 560px; margin: 4vh auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.08);
}
html[data-layout="desktop"] .s-card:hover { transform: translateY(-3px); }

/* v0.6: cost preview */
.cost-free { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--brand); font-weight: 600; }
.cost-free .svg { width: 16px; height: 16px; }
.auth .chips { margin-top: 12px; }

/* v0.7: consent, disclaimers, legal pages */
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.consent { margin-top: 16px; }
.consent span { color: var(--muted); }
.privacy-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--brand-soft); color: var(--ink); font-size: 13.5px; line-height: 1.5; }
.privacy-note .svg { color: var(--brand); width: 18px; height: 18px; margin-top: 1px; }
.legal-foot { text-align: center; }
.legal h3 { font-size: 15px; margin: 16px 0 4px; }
.legal p { font-size: 14px; line-height: 1.6; color: var(--muted); }
.legal p b { color: var(--ink); }

/* v0.8: sharing with friends */
.msg-preview { padding: 14px 16px; border-radius: 16px; background: var(--surface); font-size: 14px; line-height: 1.5; word-break: break-word; }
.friend-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; font-weight: 600; color: var(--brand); }
.friend-line .svg { width: 16px; height: 16px; }

/* ---------- Post: picture guide for the code question ---------- */
.guide-card { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); transition: transform .15s; }
.guide-card:active { transform: scale(.98); }
.guide-card h3 { margin: 0; }
.guide-card .btn { margin-top: 10px; gap: 4px; pointer-events: none; }
.guide-card .btn .svg { width: 16px; height: 16px; }
.guide-thumb { flex: none; width: 104px; height: 92px; overflow: hidden; border-radius: 12px; }
.guide-thumb .gf { width: 230px; height: 200px; transform: scale(.452); transform-origin: 0 0; }
.guide-thumb .gf .tap::after, .guide-thumb .gf .finger { animation: none !important; display: none; }
.paste-row { display: flex; gap: 8px; }
.paste-row input { flex: 1; min-width: 0; }
.paste-row .btn { flex: none; min-height: 52px; }
input.flash { border-color: var(--brand); background: var(--brand-soft); }

.guide-vp { overflow: hidden; margin: 0 -20px; touch-action: pan-y; }
.guide-track { display: flex; transition: transform .5s cubic-bezier(.65,0,.2,1); }
.gslide { flex: 0 0 100%; padding: 0 20px 18px; min-width: 0; }
.gstage { display: grid; place-items: center; padding: 14px 0 18px; background: var(--surface); border-radius: 22px; margin-bottom: 16px; }
.gstep { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.gslide h2 { margin-top: 4px; }
.gsub { margin-top: 6px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.gsub b { color: var(--ink); }
.gslide .gstep, .gslide h2, .gslide .gsub, .gslide .copy-bar { opacity: 0; transform: translateY(10px); }
.gslide.active .gstep, .gslide.active h2, .gslide.active .gsub, .gslide.active .copy-bar { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.gslide.active h2 { animation-delay: .06s; } .gslide.active .gsub { animation-delay: .12s; } .gslide.active .copy-bar { animation-delay: .2s; }

/* drawn "Google Forms" screen: always light, like the real thing */
.gf { position: relative; width: 230px; height: 200px; border-radius: 16px; background: #f0ebf8; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,.12); color: #202124; font-size: 12px; text-align: left; }
.gf-top { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; background: #fff; border-bottom: 1px solid #e0e0e0; }
.gf-dot { width: 16px; height: 16px; border-radius: 4px; background: #7248b9; }
.gf-more { margin-left: auto; font-size: 18px; font-weight: 700; color: #5f6368; line-height: 1; padding: 2px 4px; }
.gf-body { padding: 10px 10px 0; }
.gf-title { height: 30px; border-radius: 8px; background: #fff; border-top: 6px solid #7248b9; margin-bottom: 8px; }
.gf-q { position: relative; background: #fff; border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.gf-q.on { border-left: 5px solid #4285f4; }
.gf-line { display: block; height: 8px; border-radius: 4px; background: #dadce0; }
.gf-line.thin { height: 5px; margin-top: 7px; }
.w30 { width: 30%; } .w40 { width: 40%; } .w50 { width: 50%; } .w60 { width: 60%; }
.gf-tools { position: absolute; right: 8px; top: 52px; display: grid; gap: 6px; padding: 6px; background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.gf-tools > i { width: 22px; height: 18px; border-radius: 4px; background: #eceff1; }
.gf-tools b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #5f6368; font-size: 14px; line-height: 1; color: #5f6368; }
.gf-menu { display: grid; margin-top: 8px; border-radius: 8px; box-shadow: 0 3px 12px rgba(0,0,0,.18); background: #fff; overflow: visible; }
.gf-menu > span, .gf-menu .tap > span { display: block; padding: 8px 10px; white-space: nowrap; }
.gf-input { margin-top: 2px; padding: 8px; background: #f8f9fa; border-bottom: 2px solid #7248b9; font-size: 13px; font-weight: 600; min-height: 32px; }
.gf-input .type { display: inline-block; overflow: hidden; white-space: nowrap; vertical-align: bottom; border-right: 2px solid #202124; max-width: 0; }
.gslide.active .gf-input .type { animation: gf-type 1.2s .5s steps(14) forwards, gf-caret .7s 1.7s step-end 3; }
.gf-short { margin-top: 8px; color: #80868b; border-bottom: 1px dotted #c4c7c5; padding-bottom: 4px; width: 60%; }
.gf-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 8px; border-top: 1px solid #e0e0e0; justify-content: flex-end; color: #5f6368; }
.gf-foot .gf-more { margin-left: 0; }
.gf-switch { width: 26px; height: 14px; border-radius: 7px; background: #bdc1c6; position: relative; }
.gf-switch::after { content: ""; position: absolute; left: -2px; top: -2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.gf-drop { position: absolute; right: 8px; top: 30px; display: grid; background: #fff; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); opacity: 0; transform: scale(.9); transform-origin: top right; }
.gf-drop > span, .gf-drop .tap > span { display: block; padding: 9px 12px; white-space: nowrap; }
.gslide.active .gf-drop { animation: gf-pop .3s 1.1s cubic-bezier(.2,.8,.2,1) forwards; }
.gf-label { display: block; margin-bottom: 6px; font-size: 13px; }
.gf-row { display: flex; padding: 4px 0 0; }
.gf-btn { display: inline-block; padding: 7px 14px; border-radius: 6px; background: #7248b9; color: #fff; font-weight: 600; }
.gf-snack { position: absolute; left: 10px; right: 10px; bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 6px; background: #323232; color: #fff; transform: translateY(70px); }
.gf-snack b { color: #c8b3f5; font-size: 12px; letter-spacing: .02em; text-transform: uppercase; padding: 2px 4px; }
.gslide.active .gf-snack { animation: gf-snack .4s .3s cubic-bezier(.2,.8,.2,1) forwards; }
.gf .hl { background: #fff4dc; font-weight: 700; }

/* the "tap here" ring + finger */
.tap { position: relative; display: inline-block; }
.tap.row { display: block; }
.tap::after { content: ""; position: absolute; inset: -5px; border-radius: 12px; border: 2.5px solid #f59e0b; opacity: 0; }
.tap .finger { position: absolute; right: -6px; bottom: -12px; width: 20px; height: 20px; border-radius: 50%; background: rgba(245,158,11,.55); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); opacity: 0; pointer-events: none; }
.tap.row .finger { right: 18px; }
.gslide.active .tap::after { animation: gf-ring 1.6s .7s ease-out infinite; }
.gslide.active .tap .finger { animation: gf-finger 1.6s .7s ease-in-out infinite; }
.gslide.active .tap.late::after { animation-delay: 1.8s; }
.gslide.active .tap.late .finger { animation-delay: 1.8s; }
@keyframes gf-ring { 0% { opacity: 0; transform: scale(1.15); } 30% { opacity: 1; transform: scale(1); } 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes gf-finger { 0% { opacity: 0; transform: translate(12px, 14px); } 30% { opacity: 1; transform: none; } 40% { transform: scale(.8); } 50%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes gf-type { to { max-width: 160px; } }
@keyframes gf-caret { 50% { border-right-color: transparent; } }
@keyframes gf-pop { to { opacity: 1; transform: none; } }
@keyframes gf-snack { to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .gslide.active .gf-input .type { animation: none; max-width: 160px; }
  .gf-drop, .gf-snack { opacity: 1; transform: none; animation: none !important; }
}
.gf-pub { margin-left: auto; padding: 4px 10px; border-radius: 6px; background: #7248b9; color: #fff; font-size: 11px; font-weight: 600; }
.gf-top .gf-pub + .gf-more, .gf-top .gf-pub + .tap { margin-left: 2px; }
.gf-top .gf-pub + .tap .gf-more { margin-left: 0; }
.gf-input.done { color: #202124; }
.gf-drop.up { top: 58px; right: 40px; }
.gf-cap { color: #80868b; font-size: 11px; padding-bottom: 2px !important; }
.gf-drop .no { color: #b3261e; text-decoration: line-through; }
.gwarn { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--hot-soft); color: var(--hot); font-size: 13.5px; line-height: 1.45; font-weight: 600; opacity: 0; }
.gslide.active .gwarn { animation: rise .45s .3s cubic-bezier(.2,.8,.2,1) both; }

/* ---------- duck buddy (buddy.js) ---------- */
.buddy { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 5; pointer-events: none; will-change: transform; transition: opacity .3s ease; }
.buddy.gone { opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s .2s; }
.b-body { position: absolute; left: 0; bottom: 0; transform: translateX(-50%) scaleX(var(--flip, 1)); pointer-events: auto; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.b-anim { position: absolute; inset: 0; transform-origin: 50% 100%; }
.b-img { display: block; position: absolute; left: 0; bottom: 0; filter: drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
:root[data-theme="dark"] .b-img, :root[data-theme="dark"] .b-sprite { filter: drop-shadow(0 0 1px rgba(255,255,255,.25)); }
.b-sprite { display: none; position: absolute; left: 0; bottom: 0; overflow: hidden; filter: drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
.b-sprite img { display: block; height: 100%; width: 800%; max-width: none; animation: d-walk .9s steps(8) infinite; }
.b-z { position: absolute; left: 58%; top: -6px; font-weight: 800; font-size: 12px; color: var(--brand); opacity: 0; transform: scaleX(var(--flip, 1)); pointer-events: none; }
.buddy.zz .b-z { animation: d-z 3.6s ease-out infinite; --s: .6; }
.buddy.zz .b-z.z2 { animation-delay: 1.2s; font-size: 14px; }
.buddy.zz .b-z.z3 { animation-delay: 2.4s; font-size: 17px; }

.b-anim.breathe { animation: d-breathe 3.2s ease-in-out infinite; }
.b-anim.typing { animation: d-type .5s ease-in-out infinite; }
.b-anim.bob { animation: d-bob .45s ease-in-out infinite alternate; }
.b-anim.hop { animation: b-hop .7s cubic-bezier(.3,.7,.3,1) both; }
.b-anim.hop2 { animation: b-hop .7s cubic-bezier(.3,.7,.3,1) infinite; animation-delay: .2s; }
.b-anim.land { animation: b-land .5s cubic-bezier(.2,.8,.2,1.4) both; }
.b-anim.swing { transform-origin: 50% 0; animation: b-swing 1.2s ease-in-out infinite; }
.b-anim.snore { animation: d-snore 3.6s ease-in-out infinite; }
.b-anim.wobble { animation: b-wobble .5s ease-in-out 4; }
.b-anim.jolt { animation: b-jolt .55s cubic-bezier(.2,.8,.2,1) both; }
@keyframes b-hop { 0%,100% { transform: none; } 15% { transform: scale(1.08,.9); } 45% { transform: translateY(-16px) scale(.96,1.05); } 70% { transform: scale(1.06,.93); } 85% { transform: none; } }
@keyframes b-land { 0% { transform: scale(1.18,.78); } 60% { transform: scale(.96,1.05); } 100% { transform: none; } }
@keyframes b-swing { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes b-wobble { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes b-jolt { 0% { transform: translateY(0) scale(1); } 30% { transform: translateY(-14px) scale(1.06); } 100% { transform: none; } }

.b-say { position: fixed; left: 0; top: 0; z-index: 7; display: flex; align-items: center; gap: 8px; max-width: min(280px, calc(100vw - 16px)); padding: 8px 12px 8px 8px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.35; text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); opacity: 0; transform: translateY(6px) scale(.92); transform-origin: var(--tail, 50%) 100%; pointer-events: none; cursor: default;
  transition: opacity .2s ease, transform .25s cubic-bezier(.2,.8,.2,1.3); }
.b-say.on { opacity: 1; transform: none; pointer-events: auto; }
.b-say.act { cursor: pointer; border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.b-say.act:active { transform: scale(.97); }
.b-say img { flex: none; width: 28px; height: 28px; object-fit: contain; }
.b-say b { flex: none; color: var(--brand); font-size: 18px; line-height: 1; margin-left: 2px; }
.b-say::after { content: ""; position: absolute; left: var(--tail, 50%); bottom: -6px; width: 10px; height: 10px; margin-left: -5px; background: var(--card); border: 1px solid var(--line); border-top: 0; border-left: 0; transform: rotate(45deg); }
.b-say.act::after { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
@media (prefers-reduced-motion: reduce) { .b-anim { animation: none !important; } .b-sprite img { animation: none; } }
.b-body { touch-action: none; }
.buddy.dragging { z-index: 9; transition: none; }
.buddy.dragging .b-body { cursor: grabbing; }
.buddy.dragging .b-anim { transition: transform .12s ease-out; }
.b-body { -webkit-touch-callout: none; }
.b-body img { pointer-events: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.b-body::before { content: ""; position: absolute; inset: -12px -10px -4px; } /* bigger area for fingers */
.friend-steps { margin-bottom: 14px; }
.friend-steps h3 { margin-bottom: 12px; }
.friend-thanks { margin-top: 12px; text-align: center; font-weight: 600; color: var(--brand); animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
#answer-area { margin-top: 10px; }
/* guide: Settings tab + confirmation message drawings */
.gf-tabs { display: flex; justify-content: center; gap: 14px; height: 26px; align-items: center; background: #fff; border-bottom: 1px solid #e0e0e0; font-size: 11px; color: #5f6368; }
.gf-tabs .hl { color: #7248b9; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.gf-sect { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.gf .tap.row .gf-sect { margin-bottom: 8px; background: #fff4dc; }
.gf-conf { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 8px; font-size: 11.5px; color: #5f6368; }
.gf-link { color: #7248b9; font-weight: 700; padding: 1px 4px; }
.gf-row.end { justify-content: flex-end; padding-top: 8px; }
.gslide.active .tap.later::after, .gslide.active .tap.later .finger { animation-delay: 2.6s; }
/* my surveys: people who couldn't find the finish link */
.claims { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: var(--hot-soft); color: var(--hot); font-size: 13.5px; font-weight: 600; }
.claims .btn { flex: none; }
.gf-chain { font-size: 14px; }
.link.small { font-size: 13px; }
