/* Tokaboo Social: an Instagram-like review page. Light and dark follow the phone. */
:root {
  --bg: #ffffff; --fg: #000000; --muted: #737373; --line: #dbdbdb; --soft: #efefef; --sheet: #ffffff;
  --blue: #0095f6; --blue-ink: #ffffff; --tag: #00376b; --ok: #2e7d32; --ok-soft: #e7f4e4; --warn: #a15c00;
  --warn-soft: #fff1d6; --bad: #c62828; --bad-soft: #fde7e7; --info: #1565c0; --info-soft: #e3f0fd;
  --ring: conic-gradient(from 200deg, #7fb447, #ffd45c, #ff9c7a, #a893f2, #7fb447);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --fg: #f5f5f5; --muted: #a8a8a8; --line: #262626; --soft: #1a1a1a; --sheet: #000000;
    --tag: #e0f1ff; --ok: #8bd07d; --ok-soft: #13280f; --warn: #ffc56b; --warn-soft: #2e2106; --bad: #ff8a80;
    --bad-soft: #2c0d0d; --info: #90c4ff; --info-soft: #0c2038; --shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.4 var(--font); -webkit-text-size-adjust: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
img, video { display: block; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- top bar */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; }
.top-in { max-width: 935px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.handle { font-weight: 700; font-size: 20px; display: flex; align-items: center; gap: 6px; }
.handle .icon { width: 16px; height: 16px; }
.grow { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--soft);
  font-weight: 600; font-size: 13px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.pill.paused .dot { background: var(--warn); }
.iconbtn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.iconbtn:hover { background: var(--soft); }

/* ---------------------------------------------------------------- profile */
main { max-width: 935px; margin: 0 auto; padding: 0 0 calc(40px + env(safe-area-inset-bottom)); }
.profile { padding: 16px 16px 4px; display: grid; grid-template-columns: auto 1fr; gap: 6px 24px; align-items: center; }
.avatar { width: 86px; height: 86px; border-radius: 50%; padding: 3px; background: var(--ring); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--bg); object-fit: cover; background: #f6edd5; }
.stats { display: flex; justify-content: space-around; gap: 8px; text-align: center; }
.stats b { display: block; font-size: 17px; }
.stats span { color: var(--muted); font-size: 13px; }
.bio { grid-column: 1 / -1; padding-top: 8px; }
.bio .name { font-weight: 700; }
.bio .cat { color: var(--muted); }
.bio a { color: var(--tag); font-weight: 600; text-decoration: none; }
.note { grid-column: 1 / -1; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--soft); color: var(--muted); font-size: 13px; }
@media (min-width: 736px) {
  .profile { grid-template-columns: 220px 1fr; padding: 32px 16px 12px; }
  .avatar { width: 150px; height: 150px; justify-self: center; grid-row: span 2; }
  .stats { justify-content: flex-start; gap: 40px; text-align: start; }
  .stats b { display: inline; margin-inline-end: 4px; }
  .bio { grid-column: 2; }
  .note { grid-column: 2; }
}

/* ---------------------------------------------------------------- story circles */
.tray { display: flex; gap: 14px; overflow-x: auto; padding: 14px 16px 12px; scrollbar-width: none; }
.tray::-webkit-scrollbar { display: none; }
.bubble { display: grid; justify-items: center; gap: 6px; width: 70px; flex: none; }
.bubble .ring { width: 66px; height: 66px; border-radius: 50%; padding: 2.5px; background: var(--ring); position: relative; }
.bubble .ring img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; border: 3px solid var(--bg); }
.bubble span { font-size: 12px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { position: absolute; inset-inline-end: -2px; top: -2px; min-width: 20px; height: 20px; border-radius: 999px; padding: 0 5px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }

/* ---------------------------------------------------------------- tabs and grid */
.tabs { display: flex; border-top: 1px solid var(--line); }
.tabs button { flex: 1; display: flex; justify-content: center; align-items: center; gap: 6px; padding: 12px 0; color: var(--muted);
  border-top: 1px solid transparent; margin-top: -1px; font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.tabs button[aria-selected="true"] { color: var(--fg); border-top-color: var(--fg); }
.tabs .label { display: none; }
@media (min-width: 736px) { .tabs { justify-content: center; gap: 60px; } .tabs button { flex: none; } .tabs .label { display: inline; } }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
@media (min-width: 736px) { .grid { gap: 4px; } }
.tile { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: var(--soft); text-align: start; }
.grid.reels .tile { aspect-ratio: 9 / 16; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile:hover img { filter: brightness(.92); }
.tile .kind { position: absolute; top: 8px; inset-inline-end: 8px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.tile .kind .icon { width: 20px; height: 20px; }
.tile .when { position: absolute; inset-inline-start: 6px; bottom: 6px; font-size: 11px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,.55); padding: 3px 7px; border-radius: 999px; backdrop-filter: blur(4px); }
.tile .flag { position: absolute; inset-inline-start: 6px; top: 6px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.tile .talk { position: absolute; inset-inline-end: 6px; bottom: 6px; display: flex; align-items: center; gap: 3px; font-size: 11px;
  font-weight: 700; color: #fff; background: var(--bad); padding: 3px 7px; border-radius: 999px; }
.tile .talk .icon { width: 13px; height: 13px; stroke-width: 2.4; }
.tile.empty { display: grid; place-content: center; padding: 10px; text-align: center; border: 1px dashed var(--line); }
.tile.empty b { font-size: 13px; }
.tile.empty small { color: var(--muted); }
.flag.ok { background: var(--ok-soft); color: var(--ok); }
.flag.warn { background: var(--warn-soft); color: var(--warn); }
.flag.bad { background: var(--bad-soft); color: var(--bad); }
.flag.info { background: var(--info-soft); color: var(--info); }
.flag.mute { background: var(--soft); color: var(--muted); }
.tile .flag { display: inline-flex; align-items: center; gap: 5px; }
.tile .flag i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
@media (max-width: 735px) {
  .tile .flag { padding: 4px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
  .tile .flag .ft { display: none; }
}
.pin { position: absolute; top: 8px; inset-inline-end: 34px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.pin .icon { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- the plan list */
.plan { padding: 8px 16px 24px; display: grid; gap: 18px; }
.plan h3 { margin: 6px 0 0; font-size: 15px; }
.row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; }
.row:hover { background: var(--soft); }
.row img, .row .ph { width: 56px; height: 70px; border-radius: 8px; object-fit: cover; background: var(--soft); }
.row .t { font-weight: 600; }
.row small { color: var(--muted); display: block; }
.row .go { display: grid; gap: 6px; justify-items: end; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 10px;
  background: var(--soft); font-weight: 600; white-space: nowrap; }
.btn.primary { background: var(--blue); color: var(--blue-ink); }
.btn.ok { background: var(--ok-soft); color: var(--ok); }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------------------------------------------------------------- post view */
.viewer { position: fixed; inset: 0; z-index: 20; background: var(--sheet); overflow-y: auto; overscroll-behavior: contain; }
.viewer-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 6px) 8px 6px;
  background: var(--sheet); border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px; }
.card { display: block; }
.media { position: relative; background: #000; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slides img { flex: none; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; scroll-snap-align: center; }
.media video { width: 100%; max-height: 80vh; aspect-ratio: 9 / 16; object-fit: contain; background: #000; }
.count { position: absolute; top: 12px; inset-inline-end: 12px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 600;
  padding: 4px 9px; border-radius: 999px; }
.arrow { position: absolute; top: 50%; translate: 0 -50%; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.85);
  color: #000; display: none; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.arrow .icon { width: 18px; height: 18px; stroke-width: 2.4; }
.arrow.prev { inset-inline-start: 10px; } .arrow.next { inset-inline-end: 10px; }
@media (hover: hover) { .arrow { display: grid; } }
.dots { display: flex; justify-content: center; gap: 4px; padding: 10px 0 0; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--blue); }
.placeholder { aspect-ratio: 4 / 5; display: grid; align-content: center; gap: 10px; padding: 24px; background: var(--soft); }
.placeholder ol { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; }
.panel { padding: 12px 16px 120px; display: grid; gap: 12px; align-content: start; }
.head { display: flex; align-items: center; gap: 10px; }
.head img { width: 32px; height: 32px; border-radius: 50%; background: #f6edd5; }
.head b { display: block; }
.head small { color: var(--muted); }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cap { white-space: pre-wrap; overflow-wrap: anywhere; }
.cap .tag { color: var(--tag); }
details.more { border-top: 1px solid var(--line); padding-top: 10px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--muted); }
details.more p, details.more ol { margin: 8px 0 0; color: var(--muted); }
.thread { display: grid; gap: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.thread h4 { margin: 0; font-size: 14px; }
.c { display: grid; gap: 4px; }
.c .who { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.c .who b { color: var(--fg); }
.c .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.c .reply { margin-inline-start: 14px; padding: 8px 10px; border-inline-start: 3px solid var(--ok); background: var(--ok-soft); border-radius: 8px; }
.c .x { color: var(--muted); font-size: 12px; text-decoration: underline; }
.empty-note { color: var(--muted); }
.compose { position: fixed; z-index: 3; inset-inline: 0; bottom: 0; background: var(--sheet); border-top: 1px solid var(--line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.compose .seg { display: flex; gap: 6px; flex-wrap: wrap; }
.compose .seg button { padding: 4px 10px; border-radius: 999px; background: var(--soft); font-size: 12px; font-weight: 600; }
.compose .seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.compose form { display: flex; gap: 8px; align-items: flex-end; }
.compose textarea { flex: 1; resize: none; max-height: 140px; min-height: 40px; padding: 9px 14px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--bg); outline: none; }
.compose textarea:focus { border-color: var(--muted); }
.compose .send { color: var(--blue); font-weight: 700; padding: 10px 6px; }
.compose .send:disabled { opacity: .4; }
@media (min-width: 900px) {
  .viewer { background: rgba(0,0,0,.65); display: grid; place-items: center; padding: 24px; }
  .viewer-bar { display: none; }
  .card { display: grid; grid-template-columns: minmax(0, 1fr) 400px; width: min(1180px, 100%); height: min(92vh, 900px);
    background: var(--sheet); border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); }
  .media { display: grid; place-items: center; height: 100%; min-height: 0; }
  .slides { height: 100%; width: 100%; }
  .slides img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; }
  .media video { height: 100%; max-height: none; width: auto; }
  .placeholder { height: 100%; aspect-ratio: auto; }
  .side { display: grid; grid-template-rows: 1fr auto; min-height: 0; border-inline-start: 1px solid var(--line); }
  .panel { overflow-y: auto; padding-bottom: 16px; }
  .compose { position: static; }
  .close-x { position: fixed; top: 14px; inset-inline-end: 18px; color: #fff; z-index: 30; }
  .close-x .icon { width: 30px; height: 30px; }
  .dots { position: absolute; bottom: 14px; inset-inline: 0; padding: 0; }
  .dots i { background: rgba(255,255,255,.5); } .dots i.on { background: #fff; }
}
@media (max-width: 899px) { .close-x { display: none; } }

/* ---------------------------------------------------------------- stories */
.story { position: fixed; inset: 0; z-index: 30; background: #111; display: grid; place-items: center; }
.frame { position: relative; height: 100dvh; max-width: 100vw; aspect-ratio: 9 / 16; background: #000; overflow: hidden; }
@media (min-width: 600px) { .frame { height: min(94dvh, 900px); border-radius: 10px; } }
.frame > img { width: 100%; height: 100%; object-fit: cover; }
.bars { position: absolute; top: calc(env(safe-area-inset-top) + 8px); inset-inline: 8px; display: flex; gap: 3px; z-index: 3; }
.bars i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255,255,255,.4); }
.bars i.on { background: #fff; }
.story-head { position: absolute; top: calc(env(safe-area-inset-top) + 18px); inset-inline: 10px; z-index: 3; display: flex; align-items: center; gap: 8px;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); font-size: 13px; }
.story-head img { width: 32px; height: 32px; border-radius: 50%; background: #f6edd5; }
.story-head .iconbtn { color: #fff; }
.story-head .iconbtn:hover { background: rgba(255,255,255,.15); }
.tap { position: absolute; top: 70px; bottom: 140px; width: 35%; z-index: 2; }
.tap.prev { inset-inline-start: 0; } .tap.next { inset-inline-end: 0; }
.sticker { position: absolute; z-index: 2; left: 50%; top: 40%; translate: -50% 0; width: 70%; background: #fff; color: #111;
  border-radius: 18px; box-shadow: 0 8px 24px rgba(0,0,0,.25); padding: 14px; text-align: center; font-weight: 700; }
.sticker .q { font-size: 15px; margin-bottom: 10px; }
.sticker .opt { display: block; padding: 10px; border-radius: 12px; background: #f1f1f1; margin-top: 6px; font-size: 14px; }
.sticker .opt.right { background: #e3f4dc; }
.sticker .slider { height: 8px; border-radius: 6px; background: linear-gradient(90deg, #ff9c7a, #ffd45c); position: relative; margin: 18px 8px 8px; }
.sticker .slider span { position: absolute; top: 50%; left: 35%; translate: -50% -50%; font-size: 30px; }
.sticker .ask { padding: 12px; border-radius: 12px; background: #f1f1f1; color: #8e8e8e; font-weight: 500; }
.sticker.link { width: auto; padding: 10px 16px; color: #0095f6; display: inline-flex; gap: 6px; align-items: center; }
.sticker.count .big { font-size: 26px; letter-spacing: .05em; }
.sticker-note { position: absolute; z-index: 2; left: 50%; top: calc(40% - 30px); translate: -50% 0; font-size: 11px; color: #fff; background: rgba(0,0,0,.55);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.story-foot { position: absolute; inset-inline: 0; bottom: 0; z-index: 3; padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,.7)); display: grid; gap: 8px; }
.story-foot .hint { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #fff; font-size: 12px; }
.story-foot .hint a { color: #fff; font-weight: 700; }
.story-foot form { display: flex; gap: 8px; align-items: flex-end; }
.story-foot textarea { flex: 1; resize: none; min-height: 42px; max-height: 120px; padding: 10px 16px; border-radius: 22px; border: 1px solid rgba(255,255,255,.6);
  background: transparent; color: #fff; outline: none; }
.story-foot textarea::placeholder { color: rgba(255,255,255,.8); }
.story-foot .send { color: #fff; font-weight: 700; padding: 10px 4px; }
.story-thread { max-height: 26dvh; overflow-y: auto; display: grid; gap: 8px; color: #fff; }
.story-thread .c .who, .story-thread .c .who b { color: rgba(255,255,255,.85); }
.story-thread .c .reply { background: rgba(255,255,255,.12); }
.story-thread .c .x { color: rgba(255,255,255,.8); }

/* ---------------------------------------------------------------- sign in and messages */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate form { width: min(360px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center; padding: 32px 28px;
  border: 1px solid var(--line); border-radius: 12px; }
.gate .avatar { width: 96px; height: 96px; }
.gate h1 { margin: 0; font-size: 22px; }
.gate p { margin: 0; color: var(--muted); }
.gate input { width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); outline: none; }
.gate .btn { width: 100%; }
.err { color: var(--bad); font-size: 13px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); translate: -50% 0; background: var(--fg); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.loading { min-height: 60vh; display: grid; place-items: center; color: var(--muted); }
