/* GlassCast — styled for the Meta Ray-Ban Display (600×600, additive light).
   Black = unlit/transparent. Brighter = more light over the world. */

:root {
  --bg: #000;
  --surface: rgba(255, 255, 255, 0.07);
  --surface-2: rgba(255, 255, 255, 0.13);
  --text: #F4F7FA;
  --text-2: #A7B1BC;
  --played: #5A6068;
  --accent: #5CF0DC;
  --accent-2: #A48BFF;
  --grad: linear-gradient(120deg, var(--accent), var(--accent-2));
  --edge: 24px;          /* safe edge padding */
  --radius: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  font-size: 20px;
}

* { box-sizing: border-box; }

html, body, #app { inline-size: 100%; block-size: 100%; }

body {
  margin: 0;
  min-inline-size: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input { font: inherit; color: inherit; }
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: start;
}
img { display: block; }

/* ---------- Shell ---------- */
.app-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  inline-size: 100%;
  block-size: 100%;
  overflow: hidden;
  padding: var(--edge) var(--edge) 0;
}

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-block-size: 56px;
  padding-block-end: 12px;
}

.content {
  min-inline-size: 0;
  min-block-size: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding: 6px 6px var(--edge);
  margin: 0 -6px;
  scroll-padding-block: 16px;
}
.content::-webkit-scrollbar { display: none; }

/* ---------- Focus: more than colour alone (ring + lift + scale) ---------- */
:focus { outline: none; }
button:focus-visible,
.js-nav button:focus,
input:focus {
  outline: 3px solid var(--text);
  outline-offset: 2px;
  background: var(--surface-2);
}
.row:focus-visible, .ep:focus-visible, .js-nav .row:focus, .js-nav .ep:focus { transform: scale(1.015); }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-inline-size: 0; }
.brand svg { inline-size: 40px; block-size: 40px; flex: none; }
.wordmark { font-size: 1.3rem; font-weight: 400; letter-spacing: .01em; }
.wordmark b {
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo .bar { transform-box: fill-box; transform-origin: center; }
.logo.live .bar { animation: eq 1.1s var(--ease) infinite alternate; }
.logo.live .bar:nth-child(2) { animation-delay: -.35s; }
.logo.live .bar:nth-child(3) { animation-delay: -.7s; }
.logo.live .bar:nth-child(4) { animation-delay: -.2s; }
.logo.live .bar:nth-child(5) { animation-delay: -.55s; }
.logo .ripple { opacity: .9; }
.logo.live .ripple { animation: ripple 2.2s ease-out infinite; }
.logo.live .ripple.r2 { animation-delay: .5s; }
@keyframes eq { 0% { transform: scaleY(.35); } 100% { transform: scaleY(1); } }
@keyframes ripple { 0% { opacity: .15; } 40% { opacity: 1; } 100% { opacity: .15; } }

/* ---------- Buttons ---------- */
.icon-btn {
  display: grid;
  place-items: center;
  inline-size: 52px;
  block-size: 52px;
  border-radius: 50%;
  background: var(--surface);
  flex: none;
}
.icon-btn svg { inline-size: 26px; block-size: 26px; }

.back {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px 0 10px;
  block-size: 48px;
  border-radius: 24px;
  background: var(--surface);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-2);
  flex: none;
}
.back svg { inline-size: 22px; block-size: 22px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  block-size: 46px;
  padding: 0 18px;
  border-radius: 23px;
  background: var(--surface);
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
}
.pill svg { inline-size: 20px; block-size: 20px; }
.pill.primary { background: rgba(92, 240, 220, .16); color: var(--accent); }

/* ---------- Section headings ---------- */
.sect {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 14px 4px 10px;
}
.sect:first-child { margin-top: 2px; }

/* ---------- Rows (shows) ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.rowwrap { display: flex; gap: 8px; align-items: stretch; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  inline-size: 100%;
  min-inline-size: 0;
  padding: 10px;
  border-radius: var(--radius);
  transition: transform .18s var(--ease), background .18s;
}
.rowwrap .row { flex: 1; }
.art {
  inline-size: 64px;
  block-size: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface);
  flex: none;
}
.row .txt { min-inline-size: 0; flex: 1; }
.row .t {
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .s {
  font-size: .75rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.badge {
  flex: none;
  font-size: .7rem;
  font-weight: 700;
  color: #000;
  background: var(--accent);
  border-radius: 12px;
  padding: 3px 10px;
}
.badge.quiet { background: none; color: var(--played); font-weight: 500; padding: 0; }

.add {
  flex: none;
  display: grid;
  place-items: center;
  inline-size: 60px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
}
.add svg { inline-size: 26px; block-size: 26px; }
.add.on { color: var(--text-2); }

/* ---------- Continue card ---------- */
.continue {
  display: flex;
  align-items: center;
  gap: 14px;
  inline-size: 100%;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
}
.continue .art { inline-size: 72px; block-size: 72px; }
.continue .txt { flex: 1; min-inline-size: 0; }
.continue .k { font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.continue .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 6px; }

.meter { block-size: 4px; border-radius: 2px; background: rgba(255,255,255,.14); overflow: hidden; }
.meter > i { display: block; block-size: 100%; background: var(--grad); border-radius: 2px; }

/* ---------- Search ---------- */
.searchbar { display: flex; gap: 10px; flex: 1; min-inline-size: 0; }
.searchbar input {
  flex: 1;
  min-inline-size: 0;
  block-size: 50px;
  border-radius: 25px;
  border: 0;
  background: var(--surface);
  padding: 0 20px;
  font-size: .95rem;
  outline-offset: 2px;
}
.searchbar input::placeholder { color: var(--text-2); }
.searchbar input::-webkit-search-cancel-button { display: none; }

.status {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 16px;
  padding: 40px 20px;
  color: var(--text-2);
  font-size: .9rem;
}
.status > svg { inline-size: 88px; block-size: 88px; }
.status .big { font-size: 1.1rem; color: var(--text); font-weight: 500; }

/* ---------- Show page ---------- */
.hero { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.hero .art { inline-size: 96px; block-size: 96px; border-radius: 16px; }
.hero h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero p { margin: 0; color: var(--text-2); font-size: .8rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }

/* ---------- Episodes ---------- */
.epwrap { display: flex; gap: 8px; align-items: stretch; }
.ep {
  flex: 1;
  min-inline-size: 0;
  display: grid;
  grid-template-columns: 14px 1fr;
  column-gap: 10px;
  align-items: start;
  padding: 12px 12px 12px 10px;
  border-radius: var(--radius);
  transition: transform .18s var(--ease), background .18s;
}
.ep .dot {
  inline-size: 10px;
  block-size: 10px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 8px;
  box-shadow: 0 0 10px rgba(92, 240, 220, .7);
}
.ep .et {
  font-size: .95rem;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ep .em { grid-column: 2; font-size: .72rem; color: var(--text-2); margin-top: 4px; }
.ep .meter { grid-column: 2; margin-top: 8px; max-inline-size: 220px; }
.ep.now .em { color: var(--accent); }

/* Heard episodes: dimmed (and labelled, so it isn't colour alone) */
.ep.played .dot { background: transparent; box-shadow: none; border: 2px solid var(--played); }
.ep.played .et { color: var(--played); font-weight: 400; }
.ep.played .em { color: var(--played); }
.ep.played:focus .et, .ep.played:focus-visible .et { color: var(--text-2); }

.mark {
  flex: none;
  display: grid;
  place-items: center;
  inline-size: 52px;
  border-radius: var(--radius);
  color: var(--played);
}
.mark svg { inline-size: 24px; block-size: 24px; }
.mark.on { color: var(--accent); }

/* ---------- Mini player ---------- */
.mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 calc(var(--edge) * -1);
  padding: 10px var(--edge) calc(var(--edge) - 4px);
  background: linear-gradient(to top, rgba(0,0,0,1) 60%, rgba(0,0,0,0));
}
.mini .open {
  flex: 1;
  min-inline-size: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  border-radius: 16px;
  background: var(--surface);
}
.mini .open svg { inline-size: 34px; block-size: 34px; flex: none; }
.mini .txt { min-inline-size: 0; }
.mini .t { font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .s { font-size: .68rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .icon-btn { inline-size: 56px; block-size: 56px; background: var(--surface); }

/* ---------- Player ---------- */
.player-top .pl-kicker {
  flex: 1;
  text-align: center;
  font-size: .65rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-2);
  font-weight: 700;
}
.speed { min-inline-size: 72px; justify-content: center; font-weight: 700; }

.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-block-size: 0;
  min-inline-size: 0;
  padding-bottom: var(--edge);
}
.cover-wrap { position: relative; margin-bottom: 18px; }
.cover {
  inline-size: 150px;
  block-size: 150px;
  border-radius: 22px;
  object-fit: cover;
  background: var(--surface);
}
.cover-wrap::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 28px;
  border: 2px solid transparent;
  background: var(--grad) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .4s;
}
.playing .cover-wrap::after { opacity: .9; animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { inset: -10px; opacity: .45; } }

.show-name {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  max-inline-size: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

/* Title: waits, then scrolls slowly once if too long */
.marquee {
  inline-size: 100%;
  max-inline-size: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 2px 0;
}
.marquee.overflow {
  text-align: start;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent);
  padding-inline: 16px;
}
.marquee span { display: inline-block; will-change: transform; transition: opacity .5s; }

.timeline { inline-size: 100%; margin: 18px 0 16px; }
.timeline .meter { block-size: 6px; border-radius: 3px; }
.times {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  color: var(--text-2);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.controls { display: flex; align-items: center; justify-content: center; gap: 14px; }
.ctl {
  display: grid;
  place-items: center;
  inline-size: 64px;
  block-size: 64px;
  border-radius: 50%;
  background: var(--surface);
  position: relative;
}
.ctl svg { inline-size: 30px; block-size: 30px; }
.ctl.small { inline-size: 54px; block-size: 54px; }
.ctl.small svg { inline-size: 24px; block-size: 24px; }
.ctl.main {
  inline-size: 88px;
  block-size: 88px;
  background: var(--grad);
  color: #000;
}
.ctl.main svg { inline-size: 38px; block-size: 38px; }
.ctl.main:focus-visible, .js-nav .ctl.main:focus { outline-color: var(--text); background: var(--grad); transform: scale(1.06); }
.ctl .num {
  position: absolute;
  font-size: .5rem;
  font-weight: 700;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -38%);
}
.ctl.main.buffering::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 20px);
  background: #1d2226;
  color: var(--text);
  padding: 12px 20px;
  border-radius: 24px;
  font-size: .8rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
  max-inline-size: calc(100% - 48px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Skeleton loading */
.skel { block-size: 76px; border-radius: var(--radius); background: var(--surface); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ---------- Now-playing pill (top of every screen while an episode is loaded) ---------- */
.nowslot:empty { display: none; }
.nowbar { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
.nowpill {
  flex: 1;
  min-inline-size: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  block-size: 52px;
  padding: 0 8px 0 10px;
  border-radius: 26px;
  background: linear-gradient(90deg, rgba(92,240,220,.16), rgba(164,139,255,.16));
}
.nowpill svg.logo { inline-size: 30px; block-size: 30px; flex: none; }
.nowpill .txt { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; }
.nowpill .t { font-size: .75rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowpill .s { font-size: .62rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowpill .go {
  flex: none;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(0,0,0,.35);
}
.nowbar .icon-btn { inline-size: 52px; block-size: 52px; }

/* ---------- Search button: labelled, and unmistakable when highlighted ---------- */
.gobtn { block-size: 50px; padding: 0 16px; background: rgba(92,240,220,.16); color: var(--accent); flex: none; }
.gobtn:focus-visible, .js-nav .gobtn:focus,
.key.go:focus-visible, .js-nav .key.go:focus {
  background: var(--grad);
  color: #000;
  outline-color: var(--text);
  box-shadow: 0 0 18px rgba(92,240,220,.55);
}
.kbtoggle.on { background: rgba(92,240,220,.2); color: var(--accent); }
.searchbar input:focus { box-shadow: 0 0 0 2px var(--accent) inset; }
.searching { font-size: .8rem; color: var(--accent); margin: 4px 4px 12px; }
.status .pill { margin-top: 4px; }

/* ---------- On-screen keyboard ---------- */
.kb { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.krow { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.krow.wide { grid-template-columns: repeat(8, 1fr); }
.krow.fn { grid-template-columns: 1fr 2fr 1fr 1.2fr 1.8fr; }
.key {
  block-size: 44px;
  border-radius: 10px;
  background: var(--surface);
  font-size: .9rem;
  font-weight: 500;
  text-align: center;
  display: grid;
  place-items: center;
  padding: 0;
  min-inline-size: 0;
}
.key.chunk { font-size: .62rem; font-weight: 700; color: var(--text-2); }
.key.fnk { font-size: .7rem; font-weight: 700; color: var(--text-2); }
.key.fnk svg { inline-size: 22px; block-size: 22px; }
.key.on { color: var(--accent); }
.key.go { display: flex; gap: 6px; justify-content: center; align-items: center; color: var(--accent); background: rgba(92,240,220,.16); }
.key.go svg { inline-size: 18px; block-size: 18px; }
.js-nav .key:focus, .key:focus-visible { background: var(--text); color: #000; outline: none; }
.js-nav .key.go:focus { background: var(--grad); }

/* ---------- Clear (×) inside the search box ---------- */
.searchbar { position: relative; }
.searchbar input { padding-right: 52px; }
.clearq {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  inline-size: 40px;
  block-size: 40px;
  border-radius: 50%;
  display: none;
  place-items: center;
  background: rgba(255,255,255,.12);
  color: var(--text);
}
.searchbar.has-text .clearq { display: grid; }
.clearq svg { inline-size: 20px; block-size: 20px; }

/* ---------- Removing shows (two-step: press once to arm, again to confirm) ---------- */
:root { --warn: #FF8A7A; }
.rm {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  inline-size: 52px;
  border-radius: var(--radius);
  color: var(--played);
  font-size: .75rem;
  font-weight: 700;
  transition: inline-size .2s var(--ease), background .2s, color .2s;
}
.rm svg { inline-size: 22px; block-size: 22px; flex: none; }
.rm span { display: none; }
.rm.confirm { inline-size: 132px; color: var(--warn); background: rgba(255,138,122,.14); }
.rm.confirm span { display: inline; }
.js-nav .rm:focus, .rm:focus-visible { color: var(--text); }
.js-nav .rm.confirm:focus, .rm.confirm:focus-visible { color: var(--warn); }
.add.confirm, .pill.confirm { color: var(--warn); background: rgba(255,138,122,.14); }
.add.wide { inline-size: 110px; font-size: .75rem; font-weight: 700; }
.libitem { transition: opacity .25s, transform .25s var(--ease); }
.libitem.leaving { opacity: 0; transform: translateX(-30px); }

/* ---------- Display sleep: dim, then fully dark (black = unlit on the glasses) ---------- */
#app, .toast { transition: opacity 1.2s ease; }
body.dim #app { opacity: .12; }
body.off #app, body.off .toast { opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility 0s .8s; }
body.dim *, body.dim *::before, body.dim *::after,
body.off *, body.off *::before, body.off *::after { animation-play-state: paused !important; }

/* ---------- Backup status line (Library screen) ---------- */
.backup-note { font-size: .62rem; color: var(--played); text-align: center; margin: 18px 0 4px; display: flex; gap: 8px; justify-content: center; align-items: center; }
.backup-note:empty { display: none; }
.backup-note .dot { inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--played); flex: none; }
.backup-note .dot.ok { background: var(--accent); }
.backup-note .dot.warn { background: #FFC86B; }
.backup-note .dot.bad { background: var(--warn, #FF8A7A); }

/* ---------- Add via phone ---------- */
.pillrow { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.phonepanel { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 8px 0 4px; }
.ph-icon svg { inline-size: 40px; block-size: 40px; color: var(--accent); }
.ph-step { font-size: .75rem; color: var(--text-2); }
.ph-url { font-size: .85rem; font-weight: 700; color: var(--text); word-break: break-all; margin-bottom: 4px; }
.ph-code {
  font-size: 2.1rem; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 2px 0 6px;
}
.ph-status { display: flex; gap: 8px; align-items: center; font-size: .7rem; color: var(--text-2); margin-bottom: 10px; }
.ph-status .dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: #FFC86B; }
.ph-status.on .dot { background: var(--accent); box-shadow: 0 0 8px rgba(92,240,220,.7); }
