/* JethaVerse (formerly Jethiya, Gokuldham Guide) v3.
   Phone: three views behind a bottom bar. HOME = the building fills the screen (12 characters behind their doors) and a
   button shows the episodes; LIST = the episodes as one page that scrolls; MINE = saved and watched.
   Wide screens (900px+) = building and search on the left, episodes on the right. Tokens come from tokens.css.
   Colour roles: blue = sky/page, sand = the building and quiet surfaces, YELLOW = only "tap here" and "picked",
   green = watched / episode numbers, dark pill = the chosen filter. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--c-sand); color: var(--c-ink); font-family: var(--font); font-size: var(--t-md); line-height: var(--lh-body);
  -webkit-text-size-adjust: 100%; overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }
svg.i { width: 1.25em; height: 1.25em; flex: none; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- night: a full dark theme (the sheet and toasts sit outside .app, so the colours change on <body>) ---------- */
body.night {
  --c-paper: #272B44; --c-sand: #1A1D30; --c-sand-2: #323857; --c-ink: #F3EBDA; --c-ink-2: #D2CBBD; --c-ink-3: #ABA6BC;
  --c-line: #3D4263; --c-line-strong: #5C628A; --c-warning-soft: #3E3620; --c-warning: #FFD98A; --c-green-soft: #1E3B2F;
  --c-pill: #F3EBDA; --c-pill-ink: #22201E; --c-scrim: rgba(6, 7, 14, .68);
}

/* ---------- the app frame and the sky ---------- */
.app {
  --sky-a: var(--c-sky-top); --sky-b: var(--c-sky-low);
  --bldg: #EBD7AC; --bldg-edge: #C9A96B; --roof: #B5653A; --frame: #B98A4B; --ground: #8FA06A; --room-a: #F2F6FB; --room-b: #C9D8EA;
  position: relative; display: flex; flex-direction: column; height: 100%; max-width: 520px; margin: 0 auto; overflow: hidden; overflow: clip; isolation: isolate;
  background: var(--sky-a);
  padding-top: env(safe-area-inset-top, 0px);
}
.app.night { --sky-a: #1D2342; --sky-b: #3B3F78; --bldg: #5F5446; --bldg-edge: #453B30; --roof: #4A2F24; --frame: #7A5A33; --ground: #2F3A2C; --room-a: #6A76AC; --room-b: #48528A; }
.sky { position: absolute; inset: 0; background: linear-gradient(180deg, var(--sky-a), var(--sky-b)); z-index: -3; }
.stars { position: absolute; inset: 0 0 50% 0; opacity: 0; transition: opacity .6s; z-index: -2; pointer-events: none; }
.night .stars { opacity: 1; }
.stars i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; animation: twinkle 2.4s ease-in-out infinite; animation-delay: var(--d); }
@keyframes twinkle { 50% { opacity: .2; transform: scale(.6); } }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
.buddy { display: none; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- top bar and search ---------- */
.appbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: 10px 14px 4px 16px; min-height: 58px; flex: none; color: var(--c-asphalt); }
.night .appbar { color: #F4E7CC; }
.brand { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: -.01em; line-height: 1; }
.brand small { display: block; font-family: var(--font); font-weight: var(--w-med); font-size: var(--t-sm); letter-spacing: 0; color: #2F4A5C; margin-top: 2px; }
.night .brand small { color: #C3BEDD; }
.bar-actions { display: flex; gap: var(--s-2); }
.iconbtn {
  width: var(--tap); height: var(--tap); border-radius: 50%; border: var(--bw) solid var(--c-line); background: var(--c-paper); color: var(--c-ink);
  display: grid; place-items: center; transition: transform .2s var(--ease-spring);
}
.iconbtn:active { transform: scale(.88); }

.search { margin: 2px 16px 0; position: relative; display: flex; align-items: center; flex: none; }
.search > .i { position: absolute; left: 14px; color: var(--c-ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 52px; border-radius: var(--r-md); border: var(--bw) solid var(--c-line-strong); background: var(--c-paper); padding: 0 48px 0 44px;
  font: inherit; font-size: 17px; color: var(--c-ink); transition: border-color .16s, box-shadow .2s;
}
.search input::placeholder { color: var(--c-ink-3); }
.search input:focus { outline: none; border-color: var(--c-yellow-deep); box-shadow: 0 0 0 4px rgba(255, 201, 40, .45); }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear { position: absolute; right: 2px; width: var(--tap); height: var(--tap); border: 0; background: none; color: var(--c-ink-3); display: grid; place-items: center; animation: pop .2s var(--ease-spring); }
/* who is picked, as chips you tap to remove (list view on phones) */
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 16px 8px; flex: none; }
.tag { min-height: 36px; padding: 0 10px 0 14px; border-radius: var(--r-pill); background: var(--c-yellow); border: var(--bw) solid var(--c-yellow-deep); color: var(--c-asphalt); font-weight: var(--w-semi); font-size: var(--t-sm); display: inline-flex; align-items: center; gap: 6px; animation: pop .26s var(--ease-spring); }
.tag .i { width: 15px; height: 15px; }

/* ---------- the building: every character behind a door; the doors open and each steps out in a random pose ---------- */
.scene { flex: none; }
.scene-in { padding: 0 14px; }
.building { margin-top: 26px; background: var(--bldg); border: 3px solid var(--bldg-edge); border-top: 10px solid var(--roof); border-bottom: 0; border-radius: 12px 12px 0 0; padding: 14px 10px 4px; position: relative; transition: background-color .6s, border-color .6s; }
.building::before {
  content: "GOKULDHAM SOCIETY"; position: absolute; top: -24px; left: 50%; transform: translateX(-50%); background: var(--c-green); color: #fff; font-family: var(--font-display); font-weight: 700;
  font-size: 13px; letter-spacing: .12em; padding: 3px 14px 1px; border-radius: var(--r-xs); white-space: nowrap; outline: 2px solid #fff; outline-offset: -3px;
}
/* floor lines between the three storeys */
.grid3 {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 10px;
  background: linear-gradient(var(--bldg-edge), var(--bldg-edge)) 0 33% / 100% 2px no-repeat, linear-gradient(var(--bldg-edge), var(--bldg-edge)) 0 66.6% / 100% 2px no-repeat;
}
.flat { border: 0; background: none; padding: 0; display: grid; grid-template-rows: 1fr auto; gap: 3px; justify-items: center; min-width: 0; position: relative; }
.win { position: relative; width: 100%; aspect-ratio: 3 / 4; border: 4px solid var(--frame); border-radius: 50% 50% 6px 6px / 28% 28% 6px 6px; background: linear-gradient(var(--room-a), var(--room-b)); overflow: hidden; transition: box-shadow .4s, border-color .4s, transform .2s var(--ease-spring); }
/* the golden light is only for a picked character */
.win .light { position: absolute; inset: 0; background: radial-gradient(circle at 50% 70%, #FFF6C9 0%, #FFD966 55%, #FFB637 100%); opacity: 0; transition: opacity .3s; }
.win .peek { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; }
.win .peek img { height: 94%; width: auto; max-width: none; transform: translateY(104%); transition: transform .75s var(--ease-spring); transition-delay: calc(var(--i, 0) * 70ms + 260ms); }
.flat.open .peek img { transform: none; }
.win .peek img.pop { animation: pose-pop .55s var(--ease-spring); }
@keyframes pose-pop { from { transform: translateY(34%) scale(.8); opacity: .2; } to { transform: none; opacity: 1; } }
.win .cur { position: absolute; top: 0; bottom: 0; width: 52%; background: repeating-linear-gradient(90deg, #C0392B 0 5px, #D9594A 5px 10px); transition: transform .7s var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
.win .cur.l { left: 0; transform-origin: left; }
.win .cur.r { right: 0; transform-origin: right; }
.flat.open .cur { transform: scaleX(.13); }
.flat .cnt { position: absolute; top: -7px; right: -4px; z-index: 3; min-width: 24px; text-align: center; transform: scale(0); transform-origin: 70% 30%; background: var(--c-asphalt); color: #fff; font-size: 11px; font-weight: var(--w-semi); border: 2px solid var(--bldg); border-radius: var(--r-pill); padding: 0 5px; line-height: 16px; transition: transform .3s var(--ease-spring), border-color .6s; font-variant-numeric: tabular-nums; pointer-events: none; }
.flat[aria-pressed="true"] .win { box-shadow: 0 0 0 3px var(--c-yellow), 0 0 18px 4px rgba(255, 201, 40, .75); border-color: var(--c-yellow-deep); }
.night .flat[aria-pressed="true"] .win { box-shadow: 0 0 0 3px var(--c-yellow), 0 0 26px 8px rgba(255, 201, 40, .85); }
.flat[aria-pressed="true"] .light { animation: tube .62s steps(1, end) forwards; }
@keyframes tube { 0% { opacity: 0; } 12% { opacity: .9; } 22% { opacity: .1; } 34% { opacity: 1; } 46% { opacity: .35; } 60% { opacity: 1; } 100% { opacity: 1; } }
.flat[aria-pressed="true"] .cnt { transform: scale(1); }
/* not picked, while something else is: "adding me gives this many"; nothing left = dimmed */
.flat[data-add] .cnt { transform: scale(1); background: var(--c-paper); color: var(--c-ink); border-color: var(--c-line-strong); }
.flat[data-add="0"] .win, .flat[data-add="0"] .plate { opacity: .45; filter: grayscale(.7); }
.flat[data-add="0"] .cnt { opacity: .8; }
.flat:active .win { transform: scale(.94); }
.flat:focus-visible { outline-offset: 0; border-radius: var(--r-sm); }
.plate { font-size: var(--t-sm); font-weight: var(--w-semi); background: var(--c-paper); color: var(--c-ink); border-radius: 5px; padding: 0 7px; line-height: 20px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flat[aria-pressed="true"] .plate { background: var(--c-yellow); color: var(--c-asphalt); }
.ground { height: 10px; background: var(--ground); margin: 0 -10px; transition: background-color .6s; }

/* the "Show episodes" button (phones, home screen) */
.cta { display: none; flex: none; gap: 8px; padding: 10px 16px 10px; }
.btn.go { flex: 1; min-height: 56px; font-size: 18px; box-shadow: var(--sh-soft); }
.gotx { display: grid; justify-items: start; line-height: 1.15; text-align: left; min-width: 0; }
.gotx small { font-size: var(--t-sm); font-weight: var(--w-med); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.unpick { min-height: 56px; }

/* ---------- the panel: count, filters, episodes ---------- */
.panel { position: relative; z-index: 2; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--c-sand); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -8px 22px rgba(0, 0, 0, .16); overflow: hidden; overflow: clip; margin-top: -1px; }
.ptitle { display: none; margin: 14px 16px 0; font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1.1; }
.phead { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px 6px 16px; min-height: 48px; width: 100%; }
.phead .tx { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--t-md); }
.phead b { font-family: var(--font-display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.phead small { color: var(--c-ink-2); font-size: var(--t-sm); }
.dice2 { width: 40px; height: 40px; flex: none; }
.filters { flex: none; }
.seg { --n: 4; --k: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 4px; margin: 0 14px 10px; padding: 3px; background: var(--c-sand-2); border-radius: var(--r-pill); position: relative; }
.seg button { min-height: 40px; border: 0; background: none; border-radius: var(--r-pill); font-size: var(--t-sm); font-weight: var(--w-semi); color: var(--c-ink-2); position: relative; z-index: 1; transition: color .2s; }
.seg button[aria-pressed="true"] { color: var(--c-pill-ink); }
.seg .pillbg { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px - (var(--n) - 1) * 4px) / var(--n)); background: var(--c-pill); border-radius: var(--r-pill); transform: translateX(calc(var(--k) * (100% + 4px))); transition: transform .3s var(--ease-spring); }
.plist { position: relative; flex: 1; min-height: 0; overflow: hidden; overflow: clip; }
.results { position: absolute; inset: 0; overflow-y: auto; padding: 0 14px calc(16px + env(safe-area-inset-bottom, 0px)); overscroll-behavior: contain; }
.doors { position: absolute; inset: 0; z-index: 4; display: flex; pointer-events: none; }
.doors i { flex: 1; background: repeating-linear-gradient(90deg, #C9CDD3 0 3px, #DDE0E4 3px 7px); border: 2px solid #9AA0A8; }
.doors i:first-child { transform: translateX(-100%); }
.doors i:last-child { transform: translateX(100%); }

.results.slide-l { animation: slide-l .26s var(--ease-out); }
.results.slide-r { animation: slide-r .26s var(--ease-out); }
@keyframes slide-l { from { transform: translateX(34px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes slide-r { from { transform: translateX(-34px); opacity: .3; } to { transform: none; opacity: 1; } }
.notice { margin: 0 0 10px; padding: 10px 12px; background: var(--c-warning-soft); border-radius: var(--r-sm); color: var(--c-warning); font-size: var(--t-sm); line-height: 1.4; animation: rise .3s var(--ease-out) both; }
/* an episode: the video's picture (tap = play), then the title and the story */
.ecard {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; padding: 10px; margin-bottom: 8px; background: var(--c-paper);
  border: 1px solid var(--c-line); border-radius: var(--r-md); box-shadow: 0 1px 0 var(--c-line); position: relative; cursor: pointer;
  animation: rise .34s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 34ms); transition: transform .16s var(--ease-spring), border-color .16s;
}
.ecard:active { transform: scale(.985); border-color: var(--c-line-strong); }
.ecard.done { background: color-mix(in srgb, var(--c-paper) 78%, var(--c-green-soft)); }
.thumb, .hero { position: relative; display: block; overflow: hidden; background: var(--c-green); color: #fff; text-decoration: none; }
.thumb { flex: none; width: 128px; aspect-ratio: 16 / 9; border-radius: 10px; }
.thumb img, .hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.epn { position: absolute; left: 6px; top: 6px; background: var(--c-green); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 13px; line-height: 20px; padding: 0 7px; border-radius: 6px; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .85); font-variant-numeric: tabular-nums; }
.dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .74); color: #fff; font-size: 11px; font-weight: var(--w-semi); line-height: 17px; padding: 0 5px; border-radius: 4px; }
.pl { position: absolute; inset: 0; margin: auto; width: 38px; height: 38px; border-radius: 50%; background: rgba(0, 0, 0, .58); display: grid; place-items: center; }
.pl .i { width: 18px; height: 18px; margin-left: 2px; }
.none .nov { position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--t-xs); font-weight: var(--w-semi); padding-top: 14px; }
.cbody { display: grid; gap: 2px; min-width: 0; flex: 1; padding-right: 20px; }
.ctitle { font-weight: var(--w-bold); font-size: var(--t-md); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.csnip { font-size: var(--t-sm); color: var(--c-ink-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cmeta { font-size: 13px; color: var(--c-ink-2); }
.flags { position: absolute; top: 8px; right: 8px; display: grid; gap: 4px; }
.flags i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--c-green); color: #fff; }
.flags i.s { background: var(--c-yellow); color: var(--c-asphalt); }
.flags .i { width: 13px; height: 13px; }
.more { width: 100%; min-height: 48px; border-radius: var(--r-sm); border: var(--bw) dashed var(--c-line-strong); background: none; font-weight: var(--w-semi); margin-bottom: 8px; }
.foot { margin: 14px 4px 0; font-size: var(--t-xs); color: var(--c-ink-3); line-height: 1.5; }
.love { display: block; margin-bottom: 4px; font-family: var(--font-display); font-weight: 700; font-size: var(--t-md); color: var(--c-ink); }
.linkbtn { border: 0; background: none; padding: 0 4px; min-height: var(--tap); font-weight: var(--w-semi); text-decoration: underline; color: var(--c-ink-2); }

.skeleton { display: grid; gap: 8px; }
.skeleton i { display: block; height: 92px; border-radius: var(--r-md); background: linear-gradient(100deg, var(--c-sand-2) 30%, var(--c-paper) 50%, var(--c-sand-2) 70%); background-size: 220% 100%; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.shell-search { height: 52px; margin: 2px 16px 24px; border-radius: var(--r-md); background: var(--c-paper); border: var(--bw) solid var(--c-line-strong); flex: none; }
.empty { text-align: center; padding: 20px 24px; display: grid; justify-items: center; gap: 8px; }
.empty img { width: 100px; height: auto; animation: bob 2.6s ease-in-out infinite; }
.empty p { margin: 0; color: var(--c-ink-2); max-width: 30ch; }
.nojs { padding: 16px; }

/* ---------- buttons (yellow = the thing to tap; its text is always dark) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: var(--r-sm); background: var(--c-yellow); color: var(--c-asphalt);
  border: var(--bw) solid var(--c-yellow-deep); font-weight: var(--w-bold); text-decoration: none; position: relative; transition: transform .16s var(--ease-spring), background-color .16s;
}
.btn:active { transform: scale(.96); }
.btn.ghost { background: var(--c-paper); border-color: var(--c-line-strong); color: var(--c-ink); }
.btn.on { background: var(--c-green); border-color: var(--c-green-deep); color: #fff; }
.spark { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--c); pointer-events: none; animation: spark .55s var(--ease-out) forwards; }
@keyframes spark { from { transform: translate(-50%, -50%) scale(1); opacity: 1; } to { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(0); opacity: 0; } }

/* ---------- episode sheet ---------- */
.scrim { position: fixed; inset: 0; background: var(--c-scrim); z-index: var(--z-scrim); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sheet); background: var(--c-paper); color: var(--c-ink); border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92%; overflow-y: auto;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0px)); box-shadow: var(--sh-sheet); max-width: 560px; margin: 0 auto; overscroll-behavior: contain;
}
.grab { width: 44px; height: 5px; border-radius: 3px; background: var(--c-line-strong); margin: 0 auto 10px; }
.sheet .x { position: absolute; top: 22px; right: 26px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(20, 18, 16, .7); color: #fff; display: grid; place-items: center; }
.hero { aspect-ratio: 16 / 9; border-radius: var(--r-md); margin: 0 0 12px; }
.hero .pl { width: 62px; height: 62px; }
.hero .pl .i { width: 28px; height: 28px; margin-left: 3px; }
.hero .epn { display: none; }
.hero .dur { right: 10px; bottom: 10px; font-size: 13px; line-height: 21px; padding: 0 7px; }
.sheet-top { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; }
.epline { display: inline-block; background: var(--c-green); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: var(--t-sm); line-height: 22px; padding: 0 9px; border-radius: 6px; }
.sheet h2 { font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1.18; margin: 6px 0 8px; letter-spacing: -.005em; }
.sheet .stk { width: 76px; height: auto; flex: none; animation: bob 2.4s ease-in-out infinite; }
.sheet .syn { margin: 10px 0 10px; line-height: 1.55; }
.sheet h3 { font-size: var(--t-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--c-ink-3); margin: 14px 0 6px; font-weight: var(--w-semi); }
.sheet ul.moments { margin: 0 0 8px; padding-left: 1.1em; display: grid; gap: 2px; font-size: var(--t-sm); color: var(--c-ink-2); }
.who { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.who button, .who span { font-size: var(--t-sm); background: var(--c-sand); border: 1px solid var(--c-line-strong); border-radius: var(--r-pill); padding: 0 12px; min-height: 34px; display: inline-flex; align-items: center; color: var(--c-ink); }
.who span.maybe { opacity: .7; border-style: dashed; }
.sheet .hint { margin: -4px 0 10px; font-size: var(--t-xs); color: var(--c-ink-3); line-height: 1.4; }
.sheet .watch { width: 100%; margin-top: 2px; }
.watchmeta { margin: 6px 2px 0; font-size: var(--t-sm); color: var(--c-ink-2); }
.others { display: grid; gap: 6px; margin: 4px 0 0; }
.others a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--tap); padding: 0 12px; border: 1px solid var(--c-line-strong); border-radius: var(--r-sm); text-decoration: none; font-size: var(--t-sm); background: var(--c-sand); }
.others a span:last-child { color: var(--c-ink-3); }
.caution { margin: 10px 0 0; padding: 10px 12px; background: var(--c-warning-soft); border-radius: var(--r-sm); color: var(--c-warning); font-size: var(--t-sm); line-height: 1.4; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.row2 .btn { padding: 0 8px; white-space: nowrap; }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.pn button { min-height: var(--tap); border-radius: var(--r-sm); border: 1px solid var(--c-line-strong); background: var(--c-sand); font-weight: var(--w-semi); display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.pn button:disabled { opacity: .4; }

/* ---------- surprise overlay and toast ---------- */
.surprise { position: fixed; inset: 0; z-index: var(--z-surprise); display: grid; place-content: center; justify-items: center; gap: 8px; background: var(--c-scrim); color: #fff; text-align: center; animation: pop .2s var(--ease-out); }
.surprise img { width: 140px; height: auto; animation: bob 1.2s ease-in-out infinite; }
.surprise b { font-family: var(--font-display); font-weight: 800; font-size: 84px; line-height: 1.1; font-variant-numeric: tabular-nums; background: var(--c-green); padding: 0 24px; border-radius: 16px; outline: 4px solid #fff; outline-offset: -8px; }
.surprise p { margin: 0; font-weight: var(--w-semi); }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: var(--z-toast); background: var(--c-asphalt); color: #fff; padding: 10px 16px; border-radius: var(--r-pill); font-size: var(--t-sm); box-shadow: var(--sh-soft); max-width: calc(100vw - 32px); animation: pop .22s var(--ease-spring); }

/* ---------- the bottom bar (phones): Characters, Episodes, My list ---------- */
.tabs { display: none; }

/* ---------- phones ---------- */
@media (max-width: 899px) {
  html, body { height: auto; overflow: visible; }
  .app { --bar: calc(58px + env(safe-area-inset-bottom, 0px)); height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; padding-bottom: var(--bar); }
  .sky, .stars { position: fixed; }
  .buddy, .tags { display: none !important; }
  .appbar { min-height: 54px; padding-top: 8px; }
  .search { position: sticky; top: 0; z-index: 8; margin: 0; padding: 6px 16px 8px; background: var(--sky-a); }
  .search > .i { left: 30px; top: 21px; }
  .search .clear { right: 16px; top: 8px; }
  .search input { height: 48px; }
  .sheet { max-height: 94%; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

  .tabs {
    display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-dock); height: var(--bar, 58px); max-width: 520px; margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--c-paper); border-top: 1px solid var(--c-line); box-shadow: 0 -6px 18px rgba(0, 0, 0, .08);
  }
  .tabs button { position: relative; border: 0; background: none; display: grid; justify-items: center; align-content: center; gap: 1px; min-height: 58px; font-size: var(--t-xs); font-weight: var(--w-semi); color: var(--c-ink-3); }
  .tabs button .i { width: 24px; height: 24px; padding: 2px 0; border-radius: var(--r-pill); box-sizing: content-box; transition: background-color .2s, width .2s; }
  .tabs button[aria-current="page"] { color: var(--c-ink); }
  .tabs button[aria-current="page"] .i { background: var(--c-sand-2); width: 24px; padding: 2px 18px; }
  .tabs b { position: absolute; top: 5px; left: calc(50% + 12px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--c-green); color: #fff; font-size: 11px; line-height: 18px; }

  /* home: the building fills the screen, the button takes you to the episodes */
  .app[data-view="home"] { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .app[data-view="home"] .panel { display: none; }
  .app[data-view="home"] .search { position: relative; }
  .app[data-view="home"] .scene { flex: 1; min-height: 0; display: flex; }
  .app[data-view="home"] .scene-in { flex: 1; min-height: 0; display: flex; }
  .app[data-view="home"] .building { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .app[data-view="home"] .grid3 { flex: 1; min-height: 0; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 8px 8px; }
  .app[data-view="home"] .flat { min-height: 0; }
  .app[data-view="home"] .win { aspect-ratio: auto; height: 100%; min-height: 0; }
  .app[data-view="home"] .cta { display: flex; }

  /* list and My list: no title bar, so the episodes start high on the screen */
  .app:not([data-view="home"]) .appbar, .app:not([data-view="home"]) .scene { display: none; }
  .app[data-view="list"] .tags { display: flex !important; }
  .app[data-view="list"] .tags[hidden] { display: none !important; }
  .app[data-view="mine"] .search { display: none; }
  .app[data-view="mine"] .ptitle { display: block; }
  .app[data-view="mine"] .seg button[data-f="all"], .app[data-view="mine"] .seg button[data-f="unwatched"] { display: none; }
  .app[data-view="mine"] .seg button[data-f="saved"] { order: 1; }
  .app[data-view="mine"] .seg button[data-f="watched"] { order: 2; }
  .app[data-view="mine"] .panel { border-radius: 0; box-shadow: none; }
  .panel { flex: 1 0 auto; min-height: 70vh; overflow: visible; }
  .plist { position: relative; flex: none; overflow: hidden; overflow: clip; }
  .results { position: static; overflow: visible; }
}

/* ---------- wide screens: building and search on the left, episodes on the right ---------- */
@media (min-width: 900px) {
  .app { max-width: none; display: grid; grid-template-columns: 440px minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; column-gap: 24px; padding-inline: 24px; }
  .appbar { grid-column: 1; grid-row: 1; padding-inline: 0; }
  .search { grid-column: 1; grid-row: 2; margin-inline: 0; }
  .tags, .cta, .tabs, .dice2, .ptitle { display: none !important; }
  .win { aspect-ratio: 3 / 3.6; }
  .buddy { display: block; position: absolute; left: 90px; bottom: 0; width: auto; height: clamp(0px, calc(100% - 640px), 260px); z-index: -1; pointer-events: none; animation: bob 3.2s ease-in-out infinite; }
  .scene { grid-column: 1; grid-row: 3; }
  .scene-in { padding-inline: 0; }
  .panel { grid-column: 2; grid-row: 1 / -1; margin: 16px 0 0; box-shadow: 0 0 0 1px rgba(34, 32, 30, .12), var(--sh-soft); }
  .sheet { left: auto; right: 0; top: 0; bottom: 0; width: var(--sheet-w); max-height: none; border-radius: var(--r-lg) 0 0 var(--r-lg); margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
}
