/* AI WORLD TV — Material Design 3, dark scheme.
   Seed colours: gold (primary), dark red (secondary), warm grey (tertiary/neutral).
   Roles follow the M3 token names so components read like the spec. */
:root {
  --md-sys-color-primary: #E8C46A;
  --md-sys-color-on-primary: #3D2E00;
  --md-sys-color-primary-container: #5A4300;
  --md-sys-color-on-primary-container: #FFDF9A;
  --md-sys-color-secondary: #FFB4A9;
  --md-sys-color-on-secondary: #5F1410;
  --md-sys-color-secondary-container: #7A1A17;
  --md-sys-color-on-secondary-container: #FFDAD5;
  --md-sys-color-tertiary: #CFC6C2;
  --md-sys-color-surface: #131112;
  --md-sys-color-surface-container-lowest: #0D0B0C;
  --md-sys-color-surface-container-low: #1B1819;
  --md-sys-color-surface-container: #201C1D;
  --md-sys-color-surface-container-high: #2A2627;
  --md-sys-color-surface-container-highest: #353132;
  --md-sys-color-on-surface: #EDE0DE;
  --md-sys-color-on-surface-variant: #D6C4C1;
  --md-sys-color-outline: #9F8D8A;
  --md-sys-color-outline-variant: #4F4341;

  --brand-red: #A3201B;
  --brand-red-deep: #5C0E0B;
  --brand-gold: #D4AF37;
  --gold-gradient: linear-gradient(135deg, #F7E7AE 0%, #D4AF37 45%, #A7801E 100%);

  --md-sys-shape-xs: 4px; --md-sys-shape-sm: 8px; --md-sys-shape-md: 12px;
  --md-sys-shape-lg: 16px; --md-sys-shape-xl: 28px; --md-sys-shape-full: 999px;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-decel: cubic-bezier(.05, .7, .1, 1);

  --font: "Roboto", "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  --font-brand: "Cinzel", "Times New Roman", serif;

  --appbar-h: 64px;
  --drawer-w: 248px;
  --rail-w: 80px;
  --navbar-h: 80px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--appbar-h) + 56px); }
body {
  margin: 0;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: 400 14px/20px var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: currentColor; flex: none; }
:focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip { position: fixed; left: 8px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--md-sys-shape-full);
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); font-weight: 500; transition: top .2s; }
.skip:focus { top: 8px; }

/* ---------- state layer (M3 interaction states) ---------- */
.state { position: relative; overflow: hidden; isolation: isolate; }
.state::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0;
  transition: opacity .15s linear; pointer-events: none; z-index: -1; }
.state:hover::after { opacity: .08; }
.state:focus-visible::after, .state:active::after { opacity: .12; }

/* ---------- top app bar ---------- */
.appbar {
  position: fixed; inset: 0 0 auto 0; height: var(--appbar-h); z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 0 16px 0 8px;
  background: color-mix(in srgb, var(--md-sys-color-surface) 92%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 50%, transparent);
}
.icon-btn {
  width: 48px; height: 48px; display: inline-grid; place-items: center; flex: none;
  border: 0; border-radius: var(--md-sys-shape-full); background: transparent; cursor: pointer;
  color: var(--md-sys-color-on-surface-variant); position: relative; overflow: hidden; isolation: isolate;
}
.icon-btn::after { content: ""; position: absolute; inset: 4px; border-radius: inherit; background: currentColor; opacity: 0; transition: opacity .15s; z-index: -1; }
.icon-btn:hover::after { opacity: .08; } .icon-btn:active::after { opacity: .12; }

/* logo: gold emblem + engraved wordmark with a light sweep */
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: var(--md-sys-shape-full); flex: none; }
.brand-mark { width: 36px; height: 36px; filter: drop-shadow(0 2px 6px rgba(163,32,27,.55)); transition: transform .5s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.brand-word { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.bw-main {
  font: 800 19px/1 var(--font-brand); letter-spacing: .14em;
  background: linear-gradient(100deg, #A7801E 0%, #E9C761 22%, #FFF4CF 32%, #E9C761 42%, #C79A2B 70%, #F3DA8C 100%);
  background-size: 250% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: goldSweep 2.4s .4s var(--ease) both;
}
.brand:hover .bw-main { animation: goldSweep 1.4s var(--ease) both; }
.bw-tv {
  font: 800 12px/1 var(--font-brand); letter-spacing: .12em; padding: 4px 6px 4px 8px; border-radius: 4px;
  color: #FBE7A6; background: linear-gradient(180deg, #B5241D, #6E0F0B);
  box-shadow: inset 0 0 0 1px rgba(233,199,97,.75), 0 2px 8px rgba(163,32,27,.45);
}
@keyframes goldSweep { from { background-position: 100% 0; } to { background-position: 0 0; } }

.search {
  flex: 1 1 auto; max-width: 640px; margin: 0 auto; height: 48px; display: flex; align-items: center;
  border-radius: var(--md-sys-shape-full); background: var(--md-sys-color-surface-container-high);
  padding: 0 4px 0 16px; gap: 12px; transition: background .2s, box-shadow .2s;
}
.search:focus-within { background: var(--md-sys-color-surface-container-highest); box-shadow: 0 0 0 2px var(--md-sys-color-primary); }
.search-lead { color: var(--md-sys-color-on-surface-variant); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  color: var(--md-sys-color-on-surface); font: 400 16px/24px var(--font);
}
.search input::placeholder { color: var(--md-sys-color-on-surface-variant); }
.search input::-webkit-search-cancel-button { display: none; }
.only-compact { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 24px;
  border-radius: var(--md-sys-shape-full); border: 0; cursor: pointer; white-space: nowrap;
  font: 500 14px/20px var(--font); letter-spacing: .1px; position: relative; overflow: hidden; isolation: isolate;
}
.btn svg { width: 18px; height: 18px; margin-left: -8px; }
.btn::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; z-index: -1; }
.btn:hover::after { opacity: .08; } .btn:active::after { opacity: .12; }
.btn-filled { background: var(--gold-gradient); color: var(--md-sys-color-on-primary); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.btn-tonal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.btn-outlined { background: transparent; color: var(--md-sys-color-primary); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); }
.btn-text { background: transparent; color: var(--md-sys-color-primary); padding: 0 12px; }

/* ---------- navigation drawer / rail ---------- */
.drawer {
  position: fixed; top: var(--appbar-h); bottom: 0; left: 0; width: var(--drawer-w); z-index: 20;
  padding: 12px 12px 24px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--md-sys-color-surface);
  /* scrollbar stays invisible until the pointer is over the menu (as on YouTube) */
  scrollbar-width: thin; scrollbar-color: transparent transparent; scrollbar-gutter: stable;
  transition: scrollbar-color .3s, width .3s var(--ease);
}
.drawer:hover, .drawer:focus-within { scrollbar-color: var(--md-sys-color-outline-variant) transparent; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 16px; margin: 2px 0;
  border-radius: var(--md-sys-shape-full); color: var(--md-sys-color-on-surface-variant);
  font: 500 14px/20px var(--font); position: relative; overflow: hidden; isolation: isolate;
}
.nav-item::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; z-index: -1; }
.nav-item:hover::after { opacity: .08; }
.nav-item[aria-current="page"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.nav-item[aria-current="page"] svg { color: var(--md-sys-color-primary); }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-dot { width: 10px; height: 10px; border-radius: 50%; margin: 0 7px; flex: none; }
.nav-heading { margin: 8px 16px; font: 500 12px/16px var(--font); letter-spacing: .5px; text-transform: uppercase; color: var(--md-sys-color-primary); }
.divider { border: 0; border-top: 1px solid var(--md-sys-color-outline-variant); margin: 12px 16px; }
.drawer-foot { margin: 16px; font-size: 12px; line-height: 16px; color: var(--md-sys-color-on-surface-variant); }
.drawer-head { height: var(--appbar-h); display: flex; align-items: center; padding: 0 8px; margin: -12px -12px 8px; }
.only-modal { display: none; }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); }

/* ---------- main column ---------- */
.main { padding: calc(var(--appbar-h) + 0px) 24px 48px calc(var(--drawer-w) + 24px); min-height: 100vh; outline: 0; }
.loading { padding: 80px 0; text-align: center; color: var(--md-sys-color-on-surface-variant); }
.noscript { padding: 120px 24px; text-align: center; }

/* collapsed (desktop menu toggle) -> rail */
body.collapsed .main { padding-left: calc(var(--rail-w) + 24px); }

/* ---------- filter chips ---------- */
.chips {
  position: sticky; top: var(--appbar-h); z-index: 10; display: flex; gap: 8px; padding: 12px 0;
  overflow-x: auto; scrollbar-width: none; background: var(--md-sys-color-surface); margin: 0 -4px; padding-inline: 4px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 16px;
  border-radius: var(--md-sys-shape-sm); font: 500 14px/20px var(--font);
  color: var(--md-sys-color-on-surface-variant); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
  position: relative; overflow: hidden; isolation: isolate; white-space: nowrap;
}
.chip::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; z-index: -1; }
.chip:hover::after { opacity: .08; }
.chip[aria-current="page"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); box-shadow: none; padding-left: 8px; }
.chip[aria-current="page"]::before { content: ""; width: 18px; height: 18px; flex: none;
  background: currentColor; -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>') center/contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>') center/contain no-repeat; }

/* ---------- hero (featured) ---------- */
.hero {
  position: relative; margin: 8px 0 32px; border-radius: var(--md-sys-shape-xl); overflow: hidden;
  min-height: clamp(280px, 38vw, 460px); display: flex; align-items: flex-end;
  background: var(--md-sys-color-surface-container-lowest);
  box-shadow: 0 0 0 1px rgba(212,175,55,.35), 0 24px 60px -24px rgba(163,32,27,.55);
}
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 75% 30%; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(90deg, rgba(13,11,12,.96) 0%, rgba(13,11,12,.82) 34%, rgba(13,11,12,.15) 70%, rgba(13,11,12,0) 100%),
    linear-gradient(0deg, rgba(92,14,11,.55) 0%, rgba(92,14,11,0) 45%); }
.hero-body { position: relative; z-index: 2; padding: clamp(24px, 4vw, 48px); max-width: 720px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 500 12px/16px var(--font); letter-spacing: 1.2px; text-transform: uppercase; color: var(--md-sys-color-primary); }
.eyebrow::before { content: ""; width: 24px; height: 2px; background: var(--gold-gradient); }
.hero h2 { margin: 12px 0; font: 700 clamp(22px, 2.4vw, 34px)/1.3 var(--font); letter-spacing: 0; text-wrap: balance; }
.hero p { margin: 0 0 24px; color: var(--md-sys-color-on-surface-variant); font-size: 16px; line-height: 24px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- sections & grid ---------- */
.section { margin: 8px 0 40px; }
.section-head { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.section-head h2 { margin: 0; font: 400 22px/28px var(--font); }
.section-head .count { color: var(--md-sys-color-on-surface-variant); }
.section-head .spacer { flex: 1; }
.page-title { margin: 16px 0 4px; font: 400 32px/40px var(--font); }
.page-sub { margin: 0 0 8px; color: var(--md-sys-color-on-surface-variant); font-size: 16px; line-height: 24px; max-width: 720px; }

.grid { display: grid; gap: 40px 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { display: flex; flex-direction: column; gap: 12px; border-radius: var(--md-sys-shape-md); }
.thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--md-sys-shape-md); overflow: hidden;
  background: var(--md-sys-color-surface-container-high);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.card:hover .thumb img { transform: scale(1.03); }
.card:hover .thumb { box-shadow: 0 0 0 1px rgba(212,175,55,.45); }
.thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px;
  background: radial-gradient(120% 120% at 0% 0%, var(--brand-red-deep), var(--md-sys-color-surface-container-lowest) 60%);
  color: var(--md-sys-color-primary); font: 700 16px/1.3 var(--font-brand); letter-spacing: .06em; }
.badge {
  position: absolute; padding: 2px 6px; border-radius: var(--md-sys-shape-xs);
  font: 500 12px/16px var(--font); background: rgba(0,0,0,.82); color: #fff;
}
.badge-dur { right: 8px; bottom: 8px; }
.badge-plat { right: 8px; top: 8px; background: rgba(13,11,12,.86); color: var(--md-sys-color-primary); letter-spacing: .3px; }
.badge-ai { left: 8px; bottom: 8px; background: rgba(122,26,23,.92); color: #FFE7E3; }
.meta { display: flex; gap: 12px; padding: 0 4px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; display: grid; place-items: center;
  background: var(--gold-gradient); color: var(--md-sys-color-on-primary); font: 700 13px/1 var(--font-brand); }
.meta-text { min-width: 0; }
.card-title { margin: 0 0 4px; font: 500 16px/22px var(--font); color: var(--md-sys-color-on-surface);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: 14px; line-height: 20px; }

/* shorts shelf (vertical) */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 210px); gap: 16px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.shelf .thumb { aspect-ratio: 9 / 16; }

/* empty state */
.empty {
  display: grid; justify-items: center; text-align: center; gap: 12px; padding: 56px 24px; margin: 8px 0 40px;
  border-radius: var(--md-sys-shape-xl); background: var(--md-sys-color-surface-container-low);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
}
.empty svg { width: 48px; height: 48px; color: var(--md-sys-color-primary); }
.empty h2 { margin: 0; font: 400 22px/28px var(--font); }
.empty p { margin: 0; max-width: 460px; color: var(--md-sys-color-on-surface-variant); font-size: 16px; line-height: 24px; }

/* ---------- watch page ---------- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; padding-top: 24px; }
.player {
  position: relative; aspect-ratio: 16 / 9; width: 100%; border-radius: var(--md-sys-shape-lg); overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px rgba(212,175,55,.3), 0 20px 50px -20px rgba(163,32,27,.5);
}
.player.portrait { aspect-ratio: 9 / 16; width: auto; height: min(80vh, 760px); margin: 0 auto; }
.player video, .player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-link { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; gap: 16px; padding: 24px; }
.watch h1 { margin: 16px 0 12px; font: 500 20px/28px var(--font); }
.channel-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.channel-row .grow { flex: 1; min-width: 160px; }
.channel-name { font: 500 16px/24px var(--font); }
.channel-sub { color: var(--md-sys-color-on-surface-variant); font-size: 12px; line-height: 16px; }
.desc {
  margin-top: 16px; padding: 16px; border-radius: var(--md-sys-shape-md);
  background: var(--md-sys-color-surface-container); white-space: pre-line; line-height: 22px;
}
.desc-meta { font-weight: 500; margin-bottom: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag { color: var(--md-sys-color-primary); }
.ai-note { display: flex; gap: 12px; align-items: flex-start; margin-top: 12px; padding: 12px 16px; border-radius: var(--md-sys-shape-md);
  background: color-mix(in srgb, var(--md-sys-color-secondary-container) 55%, transparent); color: var(--md-sys-color-on-secondary-container); font-size: 14px; }
.ai-note svg { color: var(--md-sys-color-secondary); }
.upnext h2 { margin: 0 0 12px; font: 500 16px/24px var(--font); }
.mini { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 8px; margin-bottom: 8px; border-radius: var(--md-sys-shape-md); padding: 4px; }
.mini .card-title { font-size: 14px; line-height: 20px; }
.mini .card-sub { font-size: 12px; line-height: 18px; }

/* ---------- about / investors ---------- */
.about-hero { padding: 48px 0 24px; max-width: 880px; }
.about-hero h1 { margin: 12px 0 16px; font: 400 clamp(32px, 4.4vw, 52px)/1.15 var(--font-brand); letter-spacing: .02em;
  background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.about-hero p { font-size: 18px; line-height: 28px; color: var(--md-sys-color-on-surface-variant); margin: 0 0 24px; }
.pillars { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 16px 0 48px; }
.pillar { padding: 24px; border-radius: var(--md-sys-shape-lg); background: var(--md-sys-color-surface-container-low);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
.pillar svg { width: 32px; height: 32px; color: var(--md-sys-color-primary); }
.pillar h3 { margin: 12px 0 8px; font: 500 18px/24px var(--font); }
.pillar p { margin: 0; color: var(--md-sys-color-on-surface-variant); line-height: 22px; }
.steps { counter-reset: s; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 16px 0 48px; padding: 0; list-style: none; }
.steps li { counter-increment: s; padding: 20px; border-radius: var(--md-sys-shape-lg); background: var(--md-sys-color-surface-container); }
.steps li::before { content: counter(s, decimal-leading-zero); display: block; font: 700 28px/1 var(--font-brand); color: var(--brand-gold); margin-bottom: 12px; }
.steps b { display: block; margin-bottom: 4px; font-weight: 500; font-size: 16px; }
.steps span { color: var(--md-sys-color-on-surface-variant); }
.cta {
  display: grid; gap: 16px; justify-items: start; padding: clamp(24px, 4vw, 40px); margin: 0 0 48px; border-radius: var(--md-sys-shape-xl);
  background: radial-gradient(120% 160% at 100% 0%, rgba(212,175,55,.18), transparent 50%), linear-gradient(135deg, var(--brand-red-deep), var(--md-sys-color-surface-container-low));
  box-shadow: inset 0 0 0 1px rgba(212,175,55,.35);
}
.cta h2 { margin: 0; font: 400 28px/36px var(--font); }
.cta p { margin: 0; max-width: 640px; color: var(--md-sys-color-on-surface-variant); font-size: 16px; line-height: 24px; }

/* ---------- snackbar ---------- */
.snackbar { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 24px); opacity: 0; z-index: 60;
  padding: 14px 16px; border-radius: var(--md-sys-shape-xs); background: #EDE0DE; color: #322F2F; box-shadow: 0 4px 12px rgba(0,0,0,.5);
  transition: transform .25s var(--ease-decel), opacity .25s; pointer-events: none; }
.snackbar.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- mobile navigation bar ---------- */
.navbar { display: none; }

/* ===== breakpoints (M3 window size classes) ===== */
/* medium–expanded: rail */
@media (max-width: 1199px) {
  .drawer { width: var(--rail-w); padding: 8px 0; }
  .drawer .nav-heading, .drawer .divider, .drawer .drawer-foot, .drawer #navPlatforms { display: none; }
  .drawer .nav-item { flex-direction: column; justify-content: center; gap: 4px; height: 64px; padding: 0 4px; margin: 4px 8px; border-radius: var(--md-sys-shape-lg);
    font: 500 11px/14px var(--font); text-align: center; }
  .drawer .nav-item span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .main { padding-left: calc(var(--rail-w) + 16px); padding-right: 16px; }
  .watch { grid-template-columns: 1fr; }
}
/* desktop collapsed by menu button */
@media (min-width: 1200px) {
  body.collapsed .drawer { width: var(--rail-w); padding: 8px 0; }
  body.collapsed .drawer .nav-heading, body.collapsed .drawer .divider, body.collapsed .drawer .drawer-foot, body.collapsed .drawer #navPlatforms { display: none; }
  body.collapsed .drawer .nav-item { flex-direction: column; justify-content: center; gap: 4px; height: 64px; padding: 0 4px; margin: 4px 8px; border-radius: var(--md-sys-shape-lg); font: 500 11px/14px var(--font); text-align: center; }
  body.collapsed .drawer .nav-item span { white-space: normal; }
}
/* modal drawer (menu on medium & compact) */
body.modal-open .drawer {
  width: 300px !important; padding: 12px 12px 24px !important; top: 0; z-index: 50;
  background: var(--md-sys-color-surface-container-low); border-radius: 0 var(--md-sys-shape-lg) var(--md-sys-shape-lg) 0;
  box-shadow: 0 8px 32px rgba(0,0,0,.6); animation: slideIn .3s var(--ease-decel);
}
body.modal-open .drawer .only-modal { display: flex; }
body.modal-open .drawer .nav-heading, body.modal-open .drawer .divider, body.modal-open .drawer .drawer-foot { display: block !important; }
body.modal-open .drawer #navPlatforms { display: block !important; }
body.modal-open .drawer .nav-item { flex-direction: row !important; justify-content: flex-start !important; gap: 12px !important; height: 48px !important;
  padding: 0 16px !important; margin: 2px 0 !important; border-radius: var(--md-sys-shape-full) !important; font: 500 14px/20px var(--font) !important; text-align: left !important; }
@keyframes slideIn { from { transform: translateX(-100%); } }

/* compact: bottom navigation bar, no rail */
@media (max-width: 719px) {
  :root { --appbar-h: 56px; }
  .appbar { padding: 0 4px; gap: 0; }
  .brand-word { font-size: 16px; }
  .search { display: none; }
  body.search-mode .search { display: flex; position: absolute; inset: 4px 8px; max-width: none; z-index: 2; }
  .only-compact { display: inline-grid; margin-left: auto; }
  .hide-compact { display: none; }
  .drawer { display: none; }
  body.modal-open .drawer { display: block; }
  .main { padding: var(--appbar-h) 16px calc(var(--navbar-h) + 24px + env(safe-area-inset-bottom)); }
  .grid { grid-template-columns: 1fr; gap: 28px; }
  .hero { margin-left: -16px; margin-right: -16px; border-radius: 0; min-height: 420px; }
  .hero::before { background: linear-gradient(0deg, rgba(13,11,12,.98) 0%, rgba(13,11,12,.85) 45%, rgba(13,11,12,.1) 80%), linear-gradient(0deg, rgba(92,14,11,.5), transparent 50%); }
  .watch { padding-top: 0; margin: 0 -16px; }
  .upnext { padding: 0 16px; }
  .player { border-radius: 0; }
  .player.portrait { height: 72vh; }
  .watch .watch-info { padding: 0 16px; }
  .mini { grid-template-columns: 140px minmax(0,1fr); }
  .navbar {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(var(--navbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--md-sys-color-surface-container);
  }
  .navbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font: 500 12px/16px var(--font); color: var(--md-sys-color-on-surface-variant); }
  .navbar .ind { width: 64px; height: 32px; display: grid; place-items: center; border-radius: var(--md-sys-shape-full); transition: background .2s; }
  .navbar a[aria-current="page"] { color: var(--md-sys-color-on-surface); }
  .navbar a[aria-current="page"] .ind { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
  .snackbar { bottom: calc(var(--navbar-h) + 16px); }
}

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

/* =====================================================================
   v2 — YouTube-style chips & player, motion, typography, footer
   ===================================================================== */

/* ---------- typography ---------- */
.display { font-family: var(--font-display); font-weight: 700; letter-spacing: .01em; }
:lang(ja) { line-break: strict; }
h1, h2, h3, .card-title, .hero p { word-break: auto-phrase; text-wrap: pretty; }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ja).card-title, h1:lang(ja), h2:lang(ja), .card-title:lang(ja) { font-feature-settings: "palt"; letter-spacing: .02em; }
.page-title.display { font-size: clamp(28px, 3vw, 36px); line-height: 1.3; margin: 20px 0 6px; }
.about-hero h1.display { font-family: var(--font-display); }

/* ---------- language button + medium breakpoint ---------- */
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 10px; flex: none;
  border: 0; border-radius: var(--md-sys-shape-full); cursor: pointer; font: 500 13px/1 var(--font);
  color: var(--md-sys-color-primary); background: transparent; box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
  transition: background .2s, box-shadow .2s;
}
.lang-btn svg { width: 18px; height: 18px; }
.lang-btn:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent); box-shadow: inset 0 0 0 1px var(--md-sys-color-primary); }
@media (max-width: 1199px) { .hide-medium { display: none; } }
@media (max-width: 719px) { .lang-btn { padding: 0 10px; } .lang-btn span { display: none; } .lang-btn svg { width: 22px; height: 22px; } }

/* ---------- YouTube-style chip bar ---------- */
.chipbar { position: sticky; top: var(--appbar-h); z-index: 10; background: var(--md-sys-color-surface); margin: 0 -4px; }
.chips { position: static; padding: 12px 4px; margin: 0; scroll-behavior: smooth; }
.chip {
  height: 32px; padding: 0 12px; border-radius: var(--md-sys-shape-sm); box-shadow: none;
  background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface);
  transition: background .2s var(--ease), color .2s, transform .15s;
}
.chip:active { transform: scale(.97); }
.chip::before { display: none; }
.chip[aria-current="page"] { padding-left: 12px; background: var(--md-sys-color-on-surface); color: var(--md-sys-color-surface); }
.chip[aria-current="page"]::before { content: none; }
.chip svg { width: 16px; height: 16px; }
.chip-ai { color: var(--md-sys-color-primary); }
.chip-ai[aria-current="page"] { background: var(--gold-gradient); color: var(--md-sys-color-on-primary); }
.chip-arrow {
  position: absolute; top: 0; bottom: 0; z-index: 2; width: 64px; border: 0; padding: 0; cursor: pointer;
  display: flex; align-items: center; color: var(--md-sys-color-on-surface); opacity: 0; pointer-events: none; transition: opacity .2s;
}
.chip-arrow svg { width: 40px; height: 40px; padding: 8px; border-radius: 50%; transition: background .2s; }
.chip-arrow:hover svg { background: var(--md-sys-color-surface-container-highest); }
.chip-arrow.l { left: 0; justify-content: flex-start; background: linear-gradient(90deg, var(--md-sys-color-surface) 55%, transparent); }
.chip-arrow.r { right: 0; justify-content: flex-end; background: linear-gradient(270deg, var(--md-sys-color-surface) 55%, transparent); }
.chipbar.can-l .chip-arrow.l, .chipbar.can-r .chip-arrow.r { opacity: 1; pointer-events: auto; }
@media (hover: none) { .chip-arrow { display: none; } }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes kenburns { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.1) translate(-1.5%, -1%); } }
.main > * { animation: rise .5s var(--ease-decel) both; }
.main > *:nth-child(2) { animation-delay: .05s; } .main > *:nth-child(3) { animation-delay: .1s; } .main > *:nth-child(4) { animation-delay: .15s; }
.grid > .card, .shelf > .card, .pillars > *, .steps > li { animation: rise .55s var(--ease-decel) both; animation-delay: calc(min(var(--i, 0), 12) * 45ms + 80ms); }
.pillars > *:nth-child(2), .steps > li:nth-child(2) { --i: 1; } .pillars > *:nth-child(3), .steps > li:nth-child(3) { --i: 2; }
.pillars > *:nth-child(4), .steps > li:nth-child(4) { --i: 3; } .pillars > *:nth-child(n+5) { --i: 4; }
.hero-img { animation: kenburns 22s ease-in-out infinite alternate; transform-origin: 70% 40%; }
.hero-body > * { animation: rise .7s var(--ease-decel) both; }
.hero-body > :nth-child(2) { animation-delay: .08s; } .hero-body > :nth-child(3) { animation-delay: .16s; } .hero-body > :nth-child(4) { animation-delay: .24s; }

.card { transition: transform .35s var(--ease); }
.card .thumb { transition: box-shadow .35s var(--ease), border-radius .35s var(--ease), transform .35s var(--ease); }
.card:hover .thumb { transform: translateY(-3px); border-radius: 6px; box-shadow: 0 0 0 1px rgba(212,175,55,.5), 0 14px 32px -12px rgba(163,32,27,.65); }
.thumb img { opacity: 0; animation: fadeIn .4s ease forwards; }
.thumb { background: linear-gradient(100deg, var(--md-sys-color-surface-container-high) 30%, var(--md-sys-color-surface-container-highest) 50%, var(--md-sys-color-surface-container-high) 70%) 0 0 / 300% 100%; }
.thumb-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.35); z-index: 1; }
.thumb-prog span { display: block; height: 100%; background: #E53935; }
.thumb-prog ~ .badge-dur, .thumb-prog ~ .badge-ai { bottom: 12px; }
.pillar { transition: transform .3s var(--ease), box-shadow .3s; }
a.pillar:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px rgba(212,175,55,.5), 0 12px 28px -14px rgba(163,32,27,.6); }
.btn { transition: transform .15s var(--ease), box-shadow .2s; }
.btn:active { transform: scale(.97); }
.btn-filled:hover { box-shadow: 0 4px 16px rgba(212,175,55,.35); }
.nav-item { transition: background .2s var(--ease), color .2s; }
.scrim { animation: fadeIn .25s ease both; }
.ai-ic { color: var(--md-sys-color-primary); }

/* ---------- YouTube-style player ---------- */
.player-wrap { position: relative; isolation: isolate; }
.ambient { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: 0; pointer-events: none;
  transform: scale(1.12); filter: blur(60px) saturate(1.4); transition: opacity 1s ease; }
.player-wrap.amb-on .ambient { opacity: .6; }
.yt { outline: none; user-select: none; -webkit-user-select: none; }
.yt video { cursor: pointer; background: #000; }
.yt.idle { cursor: none; }
.yt.idle video { cursor: none; }
.p-ctrl {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 0 12px 4px;
  background: linear-gradient(0deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.38) 60%, transparent 100%);
  transition: opacity .3s ease, transform .3s var(--ease);
}
.yt.idle .p-ctrl { opacity: 0; transform: translateY(6px); pointer-events: none; }
.yt:not(.started) .p-ctrl { opacity: 0; pointer-events: none; }
.p-prog { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.p-rail { position: relative; width: 100%; height: 3px; background: rgba(255,255,255,.22); transition: height .15s ease; }
.p-prog:hover .p-rail, .yt.scrub .p-rail { height: 5px; }
.p-buf, .p-hov, .p-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0; }
.p-buf { background: rgba(255,255,255,.4); }
.p-hov { background: rgba(255,255,255,.5); }
.p-played { background: linear-gradient(90deg, #C62828, #F44336); }
.p-knob { position: absolute; top: 50%; left: 0; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%;
  background: #F44336; box-shadow: 0 0 0 2px rgba(255,235,180,.5); transform: scale(0); transition: transform .15s ease; }
.p-prog:hover .p-knob, .yt.scrub .p-knob { transform: scale(1); }
.p-tip { position: absolute; bottom: 22px; transform: translateX(-50%); padding: 3px 8px; border-radius: 4px; background: rgba(28,24,25,.92);
  color: #fff; font: 500 12px/16px var(--font); opacity: 0; pointer-events: none; transition: opacity .15s; }
.p-prog:hover .p-tip, .yt.scrub .p-tip { opacity: 1; }
.p-bar { display: flex; align-items: center; gap: 2px; height: 44px; color: #fff; }
.p-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border: 0; padding: 0; background: none; color: #fff; cursor: pointer; border-radius: 50%; }
.p-btn svg { width: 26px; height: 26px; filter: drop-shadow(0 0 2px rgba(0,0,0,.5)); transition: transform .3s var(--ease); }
.p-btn:hover svg { transform: scale(1.08); }
.p-btn.spin svg { transform: rotate(45deg); }
.p-hd { position: absolute; top: 8px; right: 5px; padding: 0 2px; border-radius: 2px; background: #E53935; color: #fff; font: 700 8px/11px var(--font); }
.p-vol { display: flex; align-items: center; }
.p-volr { width: 0; opacity: 0; margin: 0; transition: width .25s var(--ease), opacity .2s, margin .25s; accent-color: #fff; cursor: pointer;
  -webkit-appearance: none; appearance: none; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, #fff var(--v, 100%), rgba(255,255,255,.3) var(--v, 100%)); }
.p-volr::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; }
.p-volr::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }
.p-vol:hover .p-volr, .p-vol:focus-within .p-volr { width: 64px; opacity: 1; margin: 0 8px 0 2px; }
.p-time { margin-left: 8px; font: 500 13px/1 var(--font); font-variant-numeric: tabular-nums; text-shadow: 0 0 2px rgba(0,0,0,.6); white-space: nowrap; }
.p-grow { flex: 1; }
.p-big {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 76px; height: 76px; margin: -38px 0 0 -38px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: var(--md-sys-color-on-primary); background: var(--gold-gradient);
  box-shadow: 0 0 0 6px rgba(13,11,12,.35), 0 12px 32px rgba(163,32,27,.6); transition: transform .25s var(--ease), opacity .25s;
}
.p-big svg { width: 40px; height: 40px; margin-left: 4px; }
.p-big:hover { transform: scale(1.06); }
.yt.started:not(.paused) .p-big, .yt.started .p-big { opacity: 0; pointer-events: none; transform: scale(.8); }
.yt.ended .p-big { opacity: 1; pointer-events: auto; transform: none; }
.p-bezel { position: absolute; left: 50%; top: 50%; z-index: 2; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; opacity: 0; pointer-events: none; }
.p-bezel svg { width: 34px; height: 34px; }
.p-bezel.go { animation: bezel .55s ease-out; }
@keyframes bezel { 0% { opacity: .95; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.4); } }
.p-spin { position: absolute; left: 50%; top: 50%; z-index: 2; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.18); border-top-color: var(--brand-gold); opacity: 0; pointer-events: none; }
.p-spin { transition: opacity .2s; }
/* only show after half a second of real buffering, like YouTube */
.yt.loading.started .p-spin { opacity: 1; transition-delay: .5s; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.p-menu {
  position: absolute; right: 12px; bottom: 60px; z-index: 4; min-width: 272px; max-height: calc(100% - 76px); overflow-y: auto; padding: 8px 0;
  border-radius: 12px; background: rgba(28,24,25,.92); backdrop-filter: blur(16px); color: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,.5); animation: menuIn .2s var(--ease-decel); scrollbar-width: thin;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.m-row, .m-head { width: 100%; display: flex; align-items: center; gap: 14px; min-height: 44px; padding: 0 14px 0 16px; border: 0; background: none;
  color: inherit; font: 500 14px/20px var(--font); text-align: left; cursor: pointer; }
.m-row:hover, .m-head:hover, .m-row:focus-visible { background: rgba(255,255,255,.1); outline: none; }
.m-row svg, .m-head svg { width: 22px; height: 22px; flex: none; }
.m-l { flex: 1; }
.m-v { color: rgba(255,255,255,.75); font-weight: 400; white-space: nowrap; }
.m-chev { width: 20px !important; height: 20px !important; opacity: .8; }
.m-head { border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: 6px; padding-bottom: 4px; }
.m-pick svg { color: var(--brand-gold); }
.m-hd { color: #E53935; font-size: 9px; font-weight: 700; margin-left: 2px; }
.m-sub { color: rgba(255,255,255,.6); font-weight: 400; margin-left: 6px; }
.switch { position: relative; display: inline-block; width: 36px; height: 14px; border-radius: 7px; background: rgba(255,255,255,.3); vertical-align: middle; transition: background .2s; }
.switch::after { content: ""; position: absolute; left: -2px; top: -3px; width: 20px; height: 20px; border-radius: 50%; background: #ddd; box-shadow: 0 1px 3px rgba(0,0,0,.5); transition: transform .2s var(--ease), background .2s; }
.switch.on { background: rgba(212,175,55,.55); }
.switch.on::after { transform: translateX(20px); background: var(--brand-gold); }
.yt.is-fs { border-radius: 0; box-shadow: none; }
.yt.is-fs .p-ctrl { padding: 0 24px 10px; }

/* theater mode */
body.theater .watch { grid-template-columns: 1fr; }
body.theater .player:not(.portrait) { aspect-ratio: auto; height: min(78vh, calc((100vw - var(--drawer-w) - 48px) * 9 / 16)); }
body.collapsed.theater .player:not(.portrait) { height: min(78vh, calc((100vw - var(--rail-w) - 48px) * 9 / 16)); }
body.theater .watch .upnext { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px 16px; }
body.theater .watch .upnext h2 { grid-column: 1 / -1; }
.player video { object-fit: contain; }

/* ---------- history ---------- */
.hist-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 28px; }

/* ---------- footer ---------- */
.site-foot {
  margin: 56px 0 0; padding: 32px 0 8px; border-top: 1px solid var(--md-sys-color-outline-variant);
  display: grid; gap: 24px; grid-template-columns: minmax(240px, 1fr) 2fr; color: var(--md-sys-color-on-surface-variant);
}
.sf-brand { display: flex; gap: 14px; align-items: flex-start; }
.sf-brand p { margin: 6px 0 0; line-height: 20px; max-width: 340px; }
.sf-name { display: flex; align-items: center; gap: 7px; font: 800 16px/1 var(--font-brand); letter-spacing: .14em; color: var(--brand-gold); }
.sf-links { display: flex; flex-wrap: wrap; gap: 6px 20px; align-content: flex-start; }
.sf-links a { padding: 4px 0; color: var(--md-sys-color-on-surface); transition: color .2s; }
.sf-links a:hover { color: var(--md-sys-color-primary); }
.sf-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 60%, transparent); font-size: 12px; line-height: 16px; }
@media (max-width: 719px) {
  .site-foot { grid-template-columns: 1fr; }
  .p-menu { right: 8px; left: 8px; min-width: 0; bottom: 56px; }
  .p-time { font-size: 12px; }
  .yt .p-btn { width: 40px; height: 40px; }
}

/* ---------- hover preview (YouTube inline playback) ---------- */
.thumb-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; opacity: 0; transition: opacity .35s ease; background: #000; }
.thumb.previewing .thumb-video { opacity: 1; }
.thumb.previewing img { transform: none; }
.thumb .badge { z-index: 2; }
.thumb-pbar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; z-index: 3; background: #E53935; transition: width .25s linear; }
.thumb.previewing .badge-ai, .thumb.previewing .thumb-prog { opacity: 0; transition: opacity .2s; }

/* ---------- voice search ---------- */
.mic-btn { background: var(--md-sys-color-surface-container-high); margin-left: 4px; }
.mic-btn::after { inset: 0; }
.voice { position: fixed; inset: 0; z-index: 70; display: grid; place-items: start center; padding-top: 12vh;
  background: rgba(0,0,0,.6); animation: fadeIn .2s ease both; }
.voice-box { position: relative; width: min(560px, calc(100vw - 32px)); min-height: 300px; padding: 40px 32px 28px; border-radius: var(--md-sys-shape-xl);
  background: var(--md-sys-color-surface-container-high); box-shadow: 0 24px 64px rgba(0,0,0,.6), inset 0 0 0 1px rgba(212,175,55,.25);
  display: grid; justify-items: center; align-content: space-between; gap: 24px; animation: menuIn .3s var(--ease-decel); }
.voice-x { position: absolute; right: 8px; top: 8px; }
.voice-text { margin: 0; justify-self: stretch; font: 400 26px/1.4 var(--font); color: var(--md-sys-color-on-surface); min-height: 2.8em; text-align: left; }
.voice-mic { width: 72px; height: 72px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface); transition: background .2s, box-shadow .2s; }
.voice-mic svg { width: 34px; height: 34px; }
.voice-mic.listening { background: linear-gradient(180deg, #D32F2F, #8E1712); color: #fff; animation: micPulse 1.4s ease-in-out infinite; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229,57,53,.5); } 50% { box-shadow: 0 0 0 18px rgba(229,57,53,0); } }
.voice-hint { margin: 0; color: var(--md-sys-color-on-surface-variant); }
@media (max-width: 719px) {
  .mic-btn { background: transparent; margin-left: 0; }
  .voice { padding-top: 0; place-items: stretch; }
  .voice-box { width: 100%; border-radius: 0; }
}

/* ---------- animated icons ----------
   Each icon gets a motion that matches its meaning. Plays on hover and once
   when an item becomes the current page; disabled by prefers-reduced-motion. */
.ic { transform-box: fill-box; transform-origin: center; }
@keyframes ic-hop { 0%,100% { transform: translateY(0); } 35% { transform: translateY(-4px) scale(1.06); } 60% { transform: translateY(0) scale(.96, 1.04); } 80% { transform: translateY(-1px); } }
@keyframes ic-zap { 0%,100% { transform: none; filter: none; } 20% { transform: rotate(-14deg) scale(1.15); filter: drop-shadow(0 0 4px #F7E7AE); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-6deg) scale(1.08); filter: drop-shadow(0 0 6px #D4AF37); } 80% { transform: rotate(3deg); } }
@keyframes ic-twinkle { 0%,100% { transform: none; filter: none; } 40% { transform: rotate(25deg) scale(1.22); filter: drop-shadow(0 0 6px #F7E7AE); } 70% { transform: rotate(-8deg) scale(.95); } }
@keyframes ic-rewind { from { transform: rotate(0); } to { transform: rotate(-360deg); } }
@keyframes ic-nudge { 0%,100% { transform: none; } 40% { transform: translateX(3px) scale(1.08); } 70% { transform: translateX(-1px); } }
@keyframes ic-pulse { 0%,100% { transform: none; } 30% { transform: scale(1.2); } 55% { transform: scale(.94); } 75% { transform: scale(1.06); } }
@keyframes ic-clap { 0%,100% { transform: none; } 25% { transform: rotate(-16deg); } 45% { transform: rotate(4deg) scale(1.05); } 65% { transform: rotate(-4deg); } }
@keyframes ic-roll { 0%,100% { transform: none; } 50% { transform: translateY(-3px) rotate(8deg); } }
@keyframes ic-bob { 0%,100% { transform: none; } 25% { transform: rotate(-14deg) translateY(-2px); } 50% { transform: rotate(10deg); } 75% { transform: rotate(-6deg) translateY(-1px); } }
@keyframes ic-eq { 0%,100% { transform: scaleY(1); } 20% { transform: scaleY(.55); } 45% { transform: scaleY(1.2); } 65% { transform: scaleY(.8); } 85% { transform: scaleY(1.1); } }
@keyframes ic-flip { 0%,100% { transform: none; } 50% { transform: perspective(60px) rotateY(180deg); } }
@keyframes ic-spinY { from { transform: perspective(60px) rotateY(0); } to { transform: perspective(60px) rotateY(360deg); } }
@keyframes ic-globe { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes dot-ring { 0% { box-shadow: 0 0 0 0 currentColor; } 100% { box-shadow: 0 0 0 7px transparent; } }

.ic-eq { transform-origin: bottom; }
.ic-movie { transform-origin: 15% 90%; }
.ic-music { transform-origin: 40% 90%; }

:is(.nav-item:hover, .nav-item[aria-current="page"], .navbar a:hover, .navbar a[aria-current="page"], .chip:hover, .pillar:hover, .btn:hover, .icon-btn:hover, .section-head:hover) .ic-home { animation: ic-hop .6s var(--ease); }
:is(.nav-item:hover, .nav-item[aria-current="page"], .navbar a:hover, .navbar a[aria-current="page"], .section-head:hover) .ic-shorts { animation: ic-zap .7s ease; }
:is(.nav-item:hover, .nav-item[aria-current="page"], .chip:hover, .chip[aria-current="page"], .pillar:hover, .section-head:hover) .ic-spark { animation: ic-twinkle .8s var(--ease); }
:is(.nav-item:hover, .nav-item[aria-current="page"], .section-head:hover) .ic-history { animation: ic-rewind .7s var(--ease); }
:is(.nav-item:hover, .nav-item[aria-current="page"], .pillar:hover) .ic-auto { animation: ic-nudge .6s var(--ease); }
:is(.nav-item:hover, .nav-item[aria-current="page"], .navbar a:hover, .navbar a[aria-current="page"], .pillar:hover, .icon-btn:hover) .ic-mic { animation: ic-pulse .7s ease; }
:is(.nav-item:hover, .nav-item[aria-current="page"], .navbar a:hover, .navbar a[aria-current="page"], .pillar:hover) .ic-movie { animation: ic-clap .6s var(--ease); }
:is(.nav-item:hover, .nav-item[aria-current="page"], .pillar:hover) .ic-cinema { animation: ic-roll .6s ease; }
:is(.nav-item:hover, .nav-item[aria-current="page"], .pillar:hover) .ic-music { animation: ic-bob .8s ease; }
:is(.nav-item:hover, .nav-item[aria-current="page"], .pillar:hover) .ic-eq { animation: ic-eq .7s ease; }
:is(.nav-item:hover, .nav-item[aria-current="page"], .navbar a:hover, .navbar a[aria-current="page"], .pillar:hover) .ic-news { animation: ic-flip .7s var(--ease); }
:is(.nav-item:hover, .nav-item[aria-current="page"], .pillar:hover) .ic-info { animation: ic-spinY .8s var(--ease); }
:is(.empty, .pillar:hover) .ic-globe { animation: ic-globe 6s linear infinite; }
.btn:hover .ic-play, .p-big:hover svg { animation: ic-nudge .5s var(--ease); }
.btn:hover .ic-share { animation: ic-pulse .5s ease; }
.btn:hover .ic-mail { animation: ic-bob .6s ease; }
.nav-item:hover .nav-dot, .nav-item[aria-current="page"] .nav-dot { color: inherit; animation: dot-ring .8s ease-out; }
.nav-dot { transition: transform .2s var(--ease); }
.nav-item:hover .nav-dot { transform: scale(1.35); }
/* the whole menu slides in on first load */
.drawer .nav-item { animation: rise .45s var(--ease-decel) both; }
.drawer li:nth-child(2) .nav-item { animation-delay: .03s; } .drawer li:nth-child(3) .nav-item { animation-delay: .06s; }
.drawer li:nth-child(4) .nav-item { animation-delay: .09s; } .drawer li:nth-child(5) .nav-item { animation-delay: .12s; }
.drawer li:nth-child(6) .nav-item { animation-delay: .15s; } .drawer li:nth-child(n+7) .nav-item { animation-delay: .18s; }

/* =====================================================================
   v3 — search cluster, AI agent + mascot, grand menu, greeting, aurora
   ===================================================================== */

/* ---------- search cluster: [search][mic][Ask AI] centred together ---------- */
.search-group { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; max-width: 820px; margin: 0 auto; min-width: 0; }
.search-group .search { margin: 0; max-width: none; position: relative; }
.mic-btn { margin-left: 0; flex: none; }
.ai-btn {
  position: relative; flex: none; height: 44px; padding: 2px; border: 0; border-radius: var(--md-sys-shape-full); cursor: pointer;
  background: conic-gradient(from var(--ang, 0deg), #A7801E, #FFF1BF, #D4AF37, #B5241D, #F7E7AE, #A7801E);
  animation: ringSpin 6s linear infinite; box-shadow: 0 0 18px -4px rgba(212,175,55,.55);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.ai-btn:hover { transform: translateY(-1px) scale(1.03); box-shadow: 0 0 26px -2px rgba(212,175,55,.75); }
.ai-btn:active { transform: scale(.97); }
.ai-btn-in { display: flex; align-items: center; gap: 6px; height: 100%; padding: 0 16px 0 6px; border-radius: inherit;
  background: linear-gradient(135deg, #2A1416, #1B1213); color: var(--md-sys-color-primary); font: 700 14px/1 var(--font); white-space: nowrap; }
.ai-btn .mascot { width: 34px; height: 34px; margin: -4px 0 -2px; }
@property --ang { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes ringSpin { to { --ang: 360deg; } }

/* autocomplete */
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; margin: 0; padding: 8px 0; list-style: none;
  border-radius: 16px; background: var(--md-sys-color-surface-container-high); box-shadow: 0 12px 36px rgba(0,0,0,.55);
  animation: menuIn .18s var(--ease-decel); }
.suggest li { display: flex; align-items: center; gap: 14px; padding: 8px 20px; cursor: pointer; font-size: 15px; }
.suggest li svg { width: 20px; height: 20px; color: var(--md-sys-color-on-surface-variant); }
.suggest li:hover, .suggest li[aria-selected="true"] { background: var(--md-sys-color-surface-container-highest); }

@media (max-width: 1199px) { .ai-btn-label { display: none; } .ai-btn-in { padding: 0 6px; } }
@media (max-width: 719px) {
  .search-group { flex: 0 1 auto; margin: 0 0 0 auto; gap: 0; max-width: none; }
  body.search-mode .search-group .search { display: flex; position: fixed; top: 4px; left: 8px; right: 8px; max-width: none; z-index: 35; }
  .ai-btn { height: 40px; margin: 0 2px; }
  .ai-btn .mascot { width: 30px; height: 30px; }
  .only-compact { margin-left: 0; }
}

/* ---------- mascot ---------- */
.mascot { width: 40px; height: 40px; overflow: visible; display: inline-block; vertical-align: middle; }
.mascot * { transform-box: fill-box; transform-origin: center; }
.mascot .m-float { animation: m-float 3.4s ease-in-out infinite; }
.mascot .m-body { transform-origin: 50% 100%; animation: m-squash 3.4s ease-in-out infinite; }
.mascot .m-shadow { animation: m-shadow 3.4s ease-in-out infinite; transform-origin: center; }
.mascot .m-eye { animation: m-blink 5.2s infinite; }
.mascot .m-eye:last-child { animation-delay: .04s; }
.mascot .m-eyes { animation: m-look 9s ease-in-out infinite; }
.mascot .m-spark { animation: m-twinkle 2.6s ease-in-out infinite; }
.mascot .m-mouth { transition: d .3s; }
@keyframes m-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes m-squash { 0%, 100% { transform: scale(1.03, .97); } 50% { transform: scale(.98, 1.02); } }
@keyframes m-shadow { 0%, 100% { transform: scale(1); opacity: .35; } 50% { transform: scale(.82); opacity: .22; } }
@keyframes m-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
@keyframes m-look { 0%, 18%, 100% { transform: translate(0, 0); } 24%, 40% { transform: translate(-2px, -.5px); } 48%, 64% { transform: translate(2px, .4px); } 72% { transform: translate(0, -1px); } }
@keyframes m-twinkle { 0%, 100% { transform: scale(.6) rotate(0); opacity: .4; } 50% { transform: scale(1.15) rotate(45deg); opacity: 1; } }
/* hover: it notices you */
:is(.ai-btn, .drawer-ai, .greet-bot):hover .mascot .m-eyes { animation: none; transform: scale(1.12) translateY(-.5px); }
:is(.ai-btn, .drawer-ai, .greet-bot):hover .mascot .m-float { animation: m-hop .5s var(--ease); }
@keyframes m-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-6px); } 70% { transform: translateY(1px); } }
/* states driven by the chat */
.mascot.thinking .m-eyes { animation: m-think 1.6s ease-in-out infinite; }
.mascot.thinking .m-spark { animation: m-spin 1s linear infinite; opacity: 1; }
@keyframes m-think { 0%, 100% { transform: translate(1.5px, -2px); } 50% { transform: translate(-1.5px, -2px); } }
@keyframes m-spin { to { transform: rotate(360deg) scale(1.1); } }
.mascot.talking .m-float { animation: m-talk .32s ease-in-out infinite; }
.mascot.talking .m-mouth { animation: m-mouth .32s ease-in-out infinite; }
@keyframes m-talk { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes m-mouth { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(2.4); } }
.mascot.happy .m-float { animation: m-jump .7s var(--ease); }
.mascot.happy .m-eye { animation: none; transform: scaleY(.45); }
@keyframes m-jump { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-7px) rotate(-6deg); } 60% { transform: translateY(0) rotate(4deg); } }
.mascot.wave .m-float { animation: m-wave 2.8s ease-in-out infinite; }
@keyframes m-wave { 0%, 60%, 100% { transform: rotate(0); } 66% { transform: rotate(-9deg); } 72% { transform: rotate(8deg); } 78% { transform: rotate(-6deg); } 84% { transform: rotate(4deg); } }

/* ---------- greeting (home) ---------- */
.greet { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; padding: 10px 16px 10px 10px; border-radius: 20px;
  background: linear-gradient(100deg, rgba(122,26,23,.35), rgba(212,175,55,.08) 60%, transparent);
  box-shadow: inset 0 0 0 1px rgba(212,175,55,.18); }
.greet > div { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.greet-bot { border: 0; background: none; padding: 0; cursor: pointer; }
.greet-bot .mascot { width: 52px; height: 52px; }
.greet-hi { font: 700 22px/1.3 var(--font-display);
  background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.greet-sub { color: var(--md-sys-color-on-surface-variant); }
.greet-ask { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 0; border-radius: 18px; cursor: pointer;
  background: rgba(212,175,55,.14); color: var(--md-sys-color-primary); font: 600 13px/1 var(--font); transition: background .2s; }
.greet-ask:hover { background: rgba(212,175,55,.24); }
.greet-ask svg { width: 18px; height: 18px; }
@media (max-width: 719px) { .greet-ask { display: none; } .greet-hi { font-size: 18px; } .greet-bot .mascot { width: 44px; height: 44px; } }

/* ---------- aurora: slow red/gold glow behind everything ---------- */
.aurora { position: fixed; inset: -20vh -10vw auto; height: 90vh; z-index: -1; pointer-events: none; opacity: .55;
  background:
    radial-gradient(40vw 30vh at 25% 30%, rgba(163,32,27,.28), transparent 70%),
    radial-gradient(35vw 28vh at 75% 20%, rgba(212,175,55,.16), transparent 70%),
    radial-gradient(30vw 25vh at 55% 60%, rgba(122,26,23,.18), transparent 70%);
  filter: blur(20px); animation: aurora 26s ease-in-out infinite alternate; will-change: transform; }
@keyframes aurora { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(4vw, 3vh, 0) scale(1.08); } 100% { transform: translate3d(-3vw, 1vh, 0) scale(1.03); } }
body { background: var(--md-sys-color-surface); }
.main, .chipbar { background: transparent; }
.chipbar { background: color-mix(in srgb, var(--md-sys-color-surface) 88%, transparent); backdrop-filter: blur(10px); }
.chip-arrow.l { background: linear-gradient(90deg, var(--md-sys-color-surface) 45%, transparent); }
.chip-arrow.r { background: linear-gradient(270deg, var(--md-sys-color-surface) 45%, transparent); }

/* ---------- grand menu ---------- */
.drawer { background: linear-gradient(180deg, var(--md-sys-color-surface) 0%, #160F10 70%, #1C1011 100%); border-right: 1px solid rgba(212,175,55,.08); }
.nav-item { height: 44px; margin: 1px 0; gap: 16px; padding: 0 14px; font-weight: 500; letter-spacing: .1px; }
.nav-item svg { width: 22px; height: 22px; color: var(--md-sys-color-on-surface-variant); transition: color .2s; }
.nav-item:hover svg { color: var(--md-sys-color-primary); }
.nav-item[aria-current="page"] {
  background: linear-gradient(90deg, #8E1712 0%, #6E1310 55%, rgba(110,19,16,.55) 100%); color: #FFF4E8;
  box-shadow: inset 3px 0 0 var(--brand-gold), 0 6px 18px -10px rgba(163,32,27,.9);
}
.nav-item[aria-current="page"] svg { color: #F3D98A; }
.nav-heading { display: flex; align-items: center; gap: 10px; margin: 14px 14px 6px; font: 700 11px/16px var(--font); letter-spacing: 1.4px;
  background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-heading::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(212,175,55,.45), transparent); }
.drawer .divider { margin: 8px 14px; border-top-color: rgba(212,175,55,.1); }
.drawer .divider + .nav-heading { margin-top: 6px; }
.nav-dot { width: 10px; height: 10px; box-shadow: 0 0 8px currentColor; color: inherit; }
.drawer-ai {
  display: flex; align-items: center; gap: 10px; width: calc(100% - 4px); margin: 14px 2px 4px; padding: 12px 14px 12px 10px; border: 0; cursor: pointer; text-align: left;
  border-radius: 18px; color: var(--md-sys-color-on-surface);
  background: radial-gradient(120% 140% at 0% 0%, rgba(212,175,55,.22), transparent 55%), linear-gradient(135deg, #3A1513, #1F1415);
  box-shadow: inset 0 0 0 1px rgba(212,175,55,.3); transition: transform .2s var(--ease), box-shadow .2s;
}
.drawer-ai:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(212,175,55,.6), 0 10px 24px -12px rgba(212,175,55,.5); }
.drawer-ai .mascot { width: 44px; height: 44px; flex: none; }
.drawer-ai-t { display: grid; gap: 2px; }
.drawer-ai b { color: var(--md-sys-color-primary); font-size: 14px; }
.drawer-ai small { color: var(--md-sys-color-on-surface-variant); font-size: 12px; line-height: 16px; }
@media (max-width: 1199px) { .drawer .drawer-ai { display: none; } body.modal-open .drawer .drawer-ai { display: flex; } }
@media (min-width: 1200px) { body.collapsed .drawer .drawer-ai { display: none; } }

/* ---------- agent panel ---------- */
.agent {
  position: fixed; z-index: 55; right: 16px; top: calc(var(--appbar-h) + 12px); bottom: 16px; width: min(440px, calc(100vw - 32px));
  display: flex; flex-direction: column; border-radius: 24px; overflow: hidden;
  background: linear-gradient(180deg, #221516 0%, #181213 40%, #151112 100%);
  box-shadow: 0 24px 64px rgba(0,0,0,.65), inset 0 0 0 1px rgba(212,175,55,.28);
  transform: translateX(calc(100% + 32px)); opacity: 0; visibility: hidden;
  transition: transform .45s var(--ease-decel), opacity .3s, visibility 0s .45s;
}
.agent.open { transform: none; opacity: 1; visibility: visible; transition: transform .45s var(--ease-decel), opacity .3s; }
.ag-head { display: flex; align-items: center; gap: 10px; padding: 12px 8px 12px 14px; border-bottom: 1px solid rgba(212,175,55,.14);
  background: radial-gradient(120% 200% at 0% 0%, rgba(163,32,27,.35), transparent 60%); }
.ag-avatar .mascot { width: 46px; height: 46px; }
.ag-title { flex: 1; display: grid; min-width: 0; }
.ag-title b { font: 700 16px/1.3 var(--font); background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ag-title span { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.ag-body { flex: 1; overflow-y: auto; padding: 16px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: rgba(212,175,55,.25) transparent; }
.ag-welcome { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 12px 4px; animation: rise .5s var(--ease-decel) both; }
.ag-hero .mascot { width: 112px; height: 112px; filter: drop-shadow(0 12px 28px rgba(212,175,55,.35)); }
.ag-welcome h2 { margin: 6px 0 0; font: 700 20px/1.4 var(--font-display); }
.ag-welcome p { margin: 0 0 8px; color: var(--md-sys-color-on-surface-variant); }
.ag-sugg { display: grid; gap: 8px; width: 100%; }
.ag-sugg button { padding: 12px 16px; border: 0; border-radius: 14px; cursor: pointer; text-align: left; font: 500 14px/1.4 var(--font);
  color: var(--md-sys-color-on-surface); background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px rgba(212,175,55,.18);
  transition: background .2s, transform .2s var(--ease); }
.ag-sugg button:hover { background: rgba(212,175,55,.12); transform: translateX(4px); }
.ag-sugg button:nth-child(1) { animation: rise .45s .1s var(--ease-decel) both; } .ag-sugg button:nth-child(2) { animation: rise .45s .16s var(--ease-decel) both; }
.ag-sugg button:nth-child(3) { animation: rise .45s .22s var(--ease-decel) both; } .ag-sugg button:nth-child(4) { animation: rise .45s .28s var(--ease-decel) both; }
.ag-msg { display: flex; gap: 8px; margin: 0 0 14px; animation: rise .35s var(--ease-decel) both; }
.ag-msg.me { justify-content: flex-end; }
.ag-msg.me .ag-bubble { max-width: 82%; border-radius: 18px 18px 4px 18px; background: linear-gradient(135deg, #9E1B16, #6E1310); color: #FFF4E8; }
.ag-msg.bot .mascot { width: 32px; height: 32px; flex: none; margin-top: 2px; }
.ag-col { flex: 1; min-width: 0; display: grid; gap: 8px; }
.ag-bubble { padding: 10px 14px; border-radius: 18px 18px 18px 4px; background: rgba(255,255,255,.06); line-height: 1.6; word-break: break-word; }
.ag-msg.bot .ag-bubble { box-shadow: inset 0 0 0 1px rgba(212,175,55,.14); }
.ag-cards { display: grid; gap: 6px; }
.ag-cards .mini { grid-template-columns: 128px minmax(0, 1fr); background: rgba(255,255,255,.03); border-radius: 12px; padding: 6px;
  transition: background .2s, transform .2s var(--ease); }
.ag-cards .mini:hover { background: rgba(212,175,55,.1); transform: translateX(3px); }
.ag-dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.ag-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-gold); animation: dot 1.2s ease-in-out infinite; }
.ag-dots i:nth-child(2) { animation-delay: .15s; } .ag-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
.ag-input { display: flex; align-items: flex-end; gap: 6px; margin: 0 12px; padding: 6px 6px 6px 16px; border-radius: 24px;
  background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px rgba(212,175,55,.22); transition: box-shadow .2s; }
.ag-input:focus-within { box-shadow: inset 0 0 0 2px var(--brand-gold); }
.ag-input textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--md-sys-color-on-surface);
  font: 400 15px/22px var(--font); padding: 8px 0; max-height: 140px; }
.ag-input textarea::placeholder { color: var(--md-sys-color-on-surface-variant); }
.ag-mic.rec { color: #fff; background: #C62828; animation: micPulse 1.4s ease-in-out infinite; }
.ag-send { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  background: var(--gold-gradient); color: var(--md-sys-color-on-primary); transition: transform .2s var(--ease); }
.ag-send:hover { transform: scale(1.08); }
.ag-send svg { width: 22px; height: 22px; margin-left: 2px; }
.ag-foot { margin: 6px 16px 10px; text-align: center; font-size: 11px; color: var(--md-sys-color-on-surface-variant); opacity: .8; }
@media (max-width: 719px) {
  .agent { inset: 0; width: auto; border-radius: 0; top: 0; bottom: 0; right: 0; transform: translateY(100%); }
  .agent.open { transform: none; }
  .ag-input { margin-bottom: env(safe-area-inset-bottom); }
}

.ag-welcome p, .ag-bubble, .greet-sub, .page-sub, .desc { word-break: auto-phrase; text-wrap: pretty; }


/* =====================================================================
   v4 — search-bar cluster, account, comments, live, menu groups, legal,
        studio, agent docking, themes (dark · light MUJI · plum & cream)
   ===================================================================== */

/* ---------- mic + Ask AI inside the search bar ---------- */
.search { padding-right: 5px; }
.search-sep { width: 1px; height: 24px; background: var(--md-sys-color-outline-variant); flex: none; }
.search .mic-btn { width: 40px; height: 40px; background: transparent; }
.search .ai-btn { height: 38px; padding: 1.5px; }
.search .ai-btn .mascot { width: 30px; height: 30px; }
.search .ai-btn-in { padding: 0 14px 0 4px; font-size: 13px; }
.search-group { max-width: 760px; }
#aiBtnM { display: none; }
@media (max-width: 719px) {
  .search-group .ai-btn.only-compact { display: inline-flex; }
  #aiBtnM { display: inline-flex; }
  body.search-mode .search .ai-btn, body.search-mode .search .search-sep { display: none; }
}

/* ---------- account ---------- */
.acct-btn { width: auto; min-width: 40px; height: 40px; padding: 0; flex: none; }
.acct-in { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 10px; border-radius: 18px;
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); color: var(--md-sys-color-primary); font: 600 13px/1 var(--font); }
.acct-in svg { width: 20px; height: 20px; }
.acct-av { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--gold-gradient); color: var(--md-sys-color-on-primary); font: 700 14px/1 var(--font); }
.acct-av.lg { width: 44px; height: 44px; font-size: 18px; }
.acct-menu, .theme-menu { position: fixed; top: calc(var(--appbar-h) - 6px); right: 12px; z-index: 60; min-width: 260px; padding: 8px 0;
  border-radius: 16px; background: var(--md-sys-color-surface-container-high); box-shadow: 0 16px 40px rgba(0,0,0,.4); animation: menuIn .18s var(--ease-decel); }
.am-head { display: flex; gap: 12px; align-items: center; padding: 8px 16px 12px; border-bottom: 1px solid var(--md-sys-color-outline-variant); margin-bottom: 6px; }
.am-head div { display: grid; min-width: 0; } .am-head small { color: var(--md-sys-color-on-surface-variant); overflow: hidden; text-overflow: ellipsis; }
.am-row, .theme-menu button { width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 16px; border: 0; background: none;
  color: var(--md-sys-color-on-surface); font: 500 14px/20px var(--font); cursor: pointer; text-align: left; }
.am-row:hover, .theme-menu button:hover { background: var(--md-sys-color-surface-container-highest); }
.am-row svg { width: 22px; height: 22px; color: var(--md-sys-color-on-surface-variant); }
.theme-menu p { margin: 4px 16px 8px; font: 600 12px/16px var(--font); color: var(--md-sys-color-on-surface-variant); letter-spacing: .5px; }
.theme-menu .sw { display: inline-flex; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
.theme-menu .sw i { width: 14px; height: 24px; }
.theme-menu button span:nth-child(2) { flex: 1; }
.theme-menu button svg { width: 20px; height: 20px; color: var(--md-sys-color-primary); }
.theme-btn { flex: none; }

/* auth dialog */
.auth { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.55); animation: fadeIn .2s both; }
.auth-box { position: relative; width: min(420px, 100%); display: grid; gap: 14px; justify-items: center; padding: 32px 28px 24px; border-radius: 28px;
  background: var(--md-sys-color-surface-container-high); box-shadow: 0 24px 64px rgba(0,0,0,.5); animation: menuIn .3s var(--ease-decel); }
.auth-x { position: absolute; right: 8px; top: 8px; }
.auth-box h2 { margin: 0; font-size: 24px; }
.auth-sub { margin: -6px 0 6px; text-align: center; color: var(--md-sys-color-on-surface-variant); font-size: 13px; }
.field { display: grid; gap: 6px; width: 100%; font: 500 13px/1.3 var(--font); color: var(--md-sys-color-on-surface-variant); }
.field input, .field textarea { width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; font: 400 16px/22px var(--font);
  color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-highest); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); outline: 0; }
.field input:focus, .field textarea:focus { box-shadow: inset 0 0 0 2px var(--md-sys-color-primary); }
.field small { font-weight: 400; }
.auth-err { margin: 0; width: 100%; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #C62828 18%, transparent); color: var(--md-sys-color-on-surface); font-size: 13px; }
.auth-go { width: 100%; height: 44px; }
.auth-go:disabled { opacity: .6; }
.auth-swap { margin: 0; font-size: 13px; color: var(--md-sys-color-on-surface-variant); }

/* ---------- watch page: subscribe, action pills, comments ---------- */
.sub-btn { background: var(--md-sys-color-on-surface); color: var(--md-sys-color-surface); }
.sub-btn.on { background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface); }
.act-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px 0 12px; border: 0; border-radius: 18px; cursor: pointer;
  background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); font: 500 14px/1 var(--font); transition: background .2s, transform .15s; }
.pill:hover { background: var(--md-sys-color-surface-container-highest); }
.pill:active { transform: scale(.96); }
.pill svg { width: 20px; height: 20px; }
.pill.on { color: var(--md-sys-color-primary); }
.pill.on svg { fill: currentColor; }
.pill.pop svg { animation: ic-pulse .5s ease; }
.comments { margin-top: 24px; }
.cm-title { margin: 0 0 16px; font: 500 18px/24px var(--font); }
.cm-form { display: flex; gap: 12px; margin-bottom: 24px; }
.cm-field { flex: 1; }
.cm-field textarea { width: 100%; resize: none; border: 0; border-bottom: 1px solid var(--md-sys-color-outline-variant); background: transparent;
  color: var(--md-sys-color-on-surface); font: 400 14px/20px var(--font); padding: 6px 0; outline: 0; }
.cm-field textarea:focus { border-bottom: 2px solid var(--md-sys-color-on-surface); }
.cm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.cm-signin { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 20px; padding: 10px 16px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface-variant); font: 500 14px/1.4 var(--font); }
.cm-list { list-style: none; margin: 0; padding: 0; }
.cm { display: flex; gap: 12px; margin-bottom: 18px; animation: rise .35s var(--ease-decel) both; }
.cm-meta { font-size: 13px; } .cm-meta span { color: var(--md-sys-color-on-surface-variant); margin-left: 4px; }
.cm p { margin: 4px 0; white-space: pre-wrap; word-break: break-word; line-height: 20px; }
.cm-tools .btn { height: 28px; padding: 0 8px; font-size: 12px; color: var(--md-sys-color-on-surface-variant); }

/* ---------- live ---------- */
.live-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 4px; background: #CC0000; color: #fff;
  font: 700 12px/18px var(--font); letter-spacing: .5px; }
.live-tag.sm { font-size: 10px; line-height: 14px; padding: 1px 6px; }
.nav-live { margin-left: auto; padding: 1px 6px; border-radius: 4px; background: #CC0000; color: #fff; font: 700 10px/14px var(--font); letter-spacing: .5px;
  animation: livePulse 2s ease-in-out infinite; }
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.live-pip { position: absolute; top: 2px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: #E53935; animation: livePulse 2s infinite; }
.navbar .ind { position: relative; }
.live-banner { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; align-items: center; gap: 16px; margin: 6px 0 16px; padding: 10px;
  border-radius: 20px; background: var(--md-sys-color-surface-container-low); box-shadow: inset 0 0 0 1px color-mix(in srgb, #CC0000 35%, transparent);
  transition: transform .25s var(--ease), box-shadow .25s; }
.live-banner:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px #CC0000, 0 12px 28px -14px rgba(204,0,0,.6); }
.lb-thumb { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #000; }
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb-thumb .live-tag { position: absolute; left: 8px; top: 8px; }
.lb-text { display: grid; gap: 4px; min-width: 0; }
.lb-k { font: 600 12px/16px var(--font); color: #E53935; letter-spacing: .4px; }
.lb-text b { font: 600 16px/1.4 var(--font); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 719px) { .live-banner { grid-template-columns: 120px minmax(0, 1fr); } .lb-go { display: none; } }
.live-page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; padding-top: 24px; }
.live-player { aspect-ratio: 16/9; }
.live-player video { cursor: default; }
.lp-top { position: absolute; left: 14px; top: 12px; z-index: 2; display: flex; align-items: center; gap: 10px; }
.lp-ch { font: 700 13px/1 var(--font-brand); letter-spacing: .14em; color: #F3D98A; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.lp-unmute { position: absolute; left: 14px; bottom: 60px; z-index: 2; display: none; align-items: center; gap: 8px; padding: 8px 14px; border: 0; border-radius: 20px;
  background: rgba(255,255,255,.92); color: #111; font: 600 13px/1 var(--font); cursor: pointer; }
.lp-unmute svg { width: 20px; height: 20px; }
.live-player.muted .lp-unmute { display: inline-flex; animation: rise .4s var(--ease-decel); }
.lp-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  background: linear-gradient(0deg, rgba(0,0,0,.75), transparent); color: #fff; }
.lp-now { font: 500 13px/1.3 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lp-golive { border: 0; background: none; color: #fff; font: 700 12px/1 var(--font); cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.lp-golive:hover { background: rgba(255,255,255,.12); }
.live-info h1 { margin: 16px 0 4px; font-size: 24px; }
.epg h2 { margin: 0 0 12px; font: 600 16px/24px var(--font); }
.epg ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.epg li { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; align-items: center; }
.epg time { font: 600 13px/1 var(--font); font-variant-numeric: tabular-nums; color: var(--md-sys-color-on-surface-variant); }
.epg li.now time { color: #E53935; }
.epg a { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px; border-radius: 12px; transition: background .2s; }
.epg li.now a { background: color-mix(in srgb, #CC0000 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, #CC0000 40%, transparent); }
.epg a:hover { background: var(--md-sys-color-surface-container-high); }
.epg img { width: 112px; height: 63px; border-radius: 8px; object-fit: cover; }
.epg b { display: block; font: 500 13px/18px var(--font); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.epg small { color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
@media (max-width: 1199px) { .live-page { grid-template-columns: 1fr; } }
@media (max-width: 719px) { .live-page { padding-top: 0; margin: 0 -16px; } .live-player { border-radius: 0; } .live-info, .epg { padding: 0 16px; } }
.subchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }

/* ---------- menu groups ---------- */
.nav-more { width: 100%; border: 0; background: none; cursor: pointer; text-align: left; }
.nav-chev { margin-left: auto; width: 20px !important; height: 20px !important; transition: transform .25s var(--ease); }
.nav-more[aria-expanded="true"] .nav-chev { transform: rotate(90deg); }
.nav-sub { list-style: none; margin: 0 0 4px; padding: 0 0 0 12px; animation: rise .3s var(--ease-decel); }
.nav-sub .nav-item { height: 40px; font-size: 13px; }
.drawer-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 16px 16px 0; }
.drawer-links a { font: 500 12px/18px var(--font); color: var(--md-sys-color-on-surface-variant); }
.drawer-links a:hover { color: var(--md-sys-color-primary); }
.drawer-foot { margin: 10px 16px 16px; }
@media (max-width: 1199px) { .drawer .drawer-links { display: none; } body.modal-open .drawer .drawer-links { display: flex; } .drawer .nav-live, .drawer .nav-chev { display: none; } body.modal-open .drawer .nav-live { display: inline; } }
@media (min-width: 1200px) { body.collapsed .drawer .drawer-links, body.collapsed .drawer .nav-live { display: none; } }

/* ---------- legal ---------- */
.legal { max-width: 760px; padding-bottom: 40px; }
.legal section { margin: 22px 0; }
.legal h2 { margin: 0 0 8px; font: 600 18px/26px var(--font); }
.legal p { margin: 0 0 10px; line-height: 1.8; color: var(--md-sys-color-on-surface-variant); }

/* ---------- studio ---------- */
.st-tabs { display: flex; gap: 8px; margin: 12px 0 20px; }
.st-tabs button { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border: 0; border-radius: 20px; cursor: pointer;
  background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); font: 600 14px/1 var(--font); }
.st-tabs button svg { width: 20px; height: 20px; }
.st-tabs button[aria-selected="true"] { background: var(--md-sys-color-on-surface); color: var(--md-sys-color-surface); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { display: grid; gap: 6px; padding: 16px; border-radius: 16px; background: var(--md-sys-color-surface-container); }
.kpi span { font-size: 12px; color: var(--md-sys-color-on-surface-variant); } .kpi b { font: 700 26px/1 var(--font); font-variant-numeric: tabular-nums; }
.st-card { padding: 16px 18px; margin-bottom: 16px; border-radius: 16px; background: var(--md-sys-color-surface-container-low); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
.st-card h2 { margin: 0 0 12px; font: 600 15px/22px var(--font); }
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 16px; }
.st-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.st-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; } .st-list li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-none { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: 13px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; }
.bar { flex: 1; height: var(--h); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--gold-gradient); position: relative; }
.bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; opacity: 0; transition: opacity .2s; }
.bar:hover span { opacity: 1; }
.bars-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--md-sys-color-on-surface-variant); margin-top: 6px; }
.st-form { display: grid; gap: 16px; margin-bottom: 20px; }
.st-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.drop { display: grid; justify-items: center; gap: 8px; padding: 32px; border-radius: 20px; cursor: pointer; text-align: center;
  border: 2px dashed var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface-variant); transition: border-color .2s, background .2s; }
.drop:hover { border-color: var(--md-sys-color-primary); background: color-mix(in srgb, var(--md-sys-color-primary) 6%, transparent); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop svg { width: 40px; height: 40px; color: var(--md-sys-color-primary); }
.st-cats { display: flex; flex-wrap: wrap; gap: 8px 18px; border: 0; padding: 0; margin: 0; }
.st-cats legend { font: 500 13px/1.3 var(--font); color: var(--md-sys-color-on-surface-variant); margin-bottom: 8px; }
.st-cats label, .st-check { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
.st-prog { display: grid; gap: 6px; }
.st-bar { height: 8px; border-radius: 4px; background: var(--md-sys-color-surface-container-highest); overflow: hidden; }
.st-bar span { display: block; height: 100%; width: 0; background: var(--gold-gradient); transition: width .3s; }
.job-done { color: #43A047; } .job-failed { color: #E53935; } .job-processing, .job-queued { color: var(--md-sys-color-primary); }

/* ---------- agent docks beside the page on wide screens (pushes content) ---------- */
@media (min-width: 1100px) {
  .main { transition: padding-right .45s var(--ease-decel); }
  body.agent-open .main { padding-right: calc(min(440px, 100vw - 32px) + 32px); }
  body.agent-open .agent { top: calc(var(--appbar-h) + 8px); bottom: 8px; right: 8px; }
}
.ag-hi { font-family: var(--font-display); font-size: 16px; }
.ag-greet { animation-delay: .1s; }
.ag-welcome { padding-bottom: 0; }
.ag-sugg { margin: 0 0 8px 40px; width: auto; }

/* platform badge stays gold on its dark chip in every theme */
.badge-plat { color: #F3D98A; }
/* text over video/images stays light in every theme */
.hero { color: #FFF8EE; }
.hero p { color: rgba(255,248,238,.85); }

/* =====================================================================
   THEME: light, MUJI style — unbleached paper, soft charcoal, one maroon accent
   ===================================================================== */
[data-theme="muji"] {
  --md-sys-color-primary: #7F0019; --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #F3DEDF; --md-sys-color-on-primary-container: #4A0010;
  --md-sys-color-secondary: #6E5B4F; --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: #ECE5DA; --md-sys-color-on-secondary-container: #3A2E26;
  --md-sys-color-tertiary: #8C8274;
  --md-sys-color-surface: #F7F4EE; --md-sys-color-surface-container-lowest: #FFFFFF; --md-sys-color-surface-container-low: #F2EEE6;
  --md-sys-color-surface-container: #EDE8DF; --md-sys-color-surface-container-high: #E7E1D6; --md-sys-color-surface-container-highest: #DFD8CC;
  --md-sys-color-on-surface: #2F2B26; --md-sys-color-on-surface-variant: #6B645B;
  --md-sys-color-outline: #9A9184; --md-sys-color-outline-variant: #DAD2C5;
  --brand-red: #7F0019; --brand-red-deep: #5A0012; --brand-gold: #A08C6E;
  --gold-gradient: linear-gradient(#7F0019, #7F0019);
  --font-display: "Noto Sans JP", "Roboto", system-ui, sans-serif;
}
[data-theme="muji"] .aurora { display: none; }
[data-theme="muji"] .drawer { background: var(--md-sys-color-surface); border-right: 1px solid var(--md-sys-color-outline-variant); }
[data-theme="muji"] .nav-item[aria-current="page"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-primary); box-shadow: inset 3px 0 0 var(--md-sys-color-primary); }
[data-theme="muji"] .nav-item[aria-current="page"] svg { color: var(--md-sys-color-primary); }
[data-theme="muji"] .nav-heading { background: none; color: var(--md-sys-color-on-surface-variant); -webkit-text-fill-color: currentColor; }
[data-theme="muji"] .nav-heading::after { background: var(--md-sys-color-outline-variant); }
[data-theme="muji"] .bw-main { background: none; color: #2F2B26; -webkit-text-fill-color: currentColor; animation: none; font-weight: 700; }
[data-theme="muji"] .bw-tv { background: #7F0019; color: #fff; box-shadow: none; }
[data-theme="muji"] .brand-mark { filter: none; }
[data-theme="muji"] .ai-btn { background: #7F0019; box-shadow: none; animation: none; }
[data-theme="muji"] .ai-btn-in { background: #FFFFFF; color: #7F0019; }
[data-theme="muji"] .hero { box-shadow: 0 0 0 1px var(--md-sys-color-outline-variant); }
[data-theme="muji"] .player { box-shadow: 0 0 0 1px var(--md-sys-color-outline-variant); }
[data-theme="muji"] .card:hover .thumb { box-shadow: 0 10px 24px -14px rgba(47,43,38,.45); }
[data-theme="muji"] .drawer-ai { background: var(--md-sys-color-surface-container-lowest); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
[data-theme="muji"] .drawer-ai b { color: var(--md-sys-color-primary); }
[data-theme="muji"] .about-hero h1, [data-theme="muji"] .greet-hi, [data-theme="muji"] .ag-title b { background: none; color: var(--md-sys-color-on-surface); -webkit-text-fill-color: currentColor; }
[data-theme="muji"] .cta { background: var(--md-sys-color-surface-container); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
[data-theme="muji"] .chipbar { background: color-mix(in srgb, var(--md-sys-color-surface) 92%, transparent); }

/* =====================================================================
   THEME: plum & cream — deep plum, warm cream panels, rose accent,
   soft mint→lavender backdrop
   ===================================================================== */
[data-theme="plum"] {
  --md-sys-color-primary: #4A1B2F; --md-sys-color-on-primary: #FFF6EF;
  --md-sys-color-primary-container: #F2DCE3; --md-sys-color-on-primary-container: #2E0E1C;
  --md-sys-color-secondary: #9C5470; --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: #EFD9E1; --md-sys-color-on-secondary-container: #4A1B2F;
  --md-sys-color-tertiary: #D98E9B;
  --md-sys-color-surface: #F3EDE5; --md-sys-color-surface-container-lowest: #FFFAF4; --md-sys-color-surface-container-low: #EFE7DE;
  --md-sys-color-surface-container: #EAE1D7; --md-sys-color-surface-container-high: #E4D9CD; --md-sys-color-surface-container-highest: #DBCEC1;
  --md-sys-color-on-surface: #2B1A22; --md-sys-color-on-surface-variant: #6A5560;
  --md-sys-color-outline: #957F88; --md-sys-color-outline-variant: #DCCDC3;
  --brand-red: #4A1B2F; --brand-red-deep: #3A1424; --brand-gold: #D98E9B;
  --gold-gradient: linear-gradient(135deg, #6A2A45, #4A1B2F);
}
[data-theme="plum"] body { background: linear-gradient(120deg, #D7EBE5 0%, #E6E3EE 100%) fixed; }
[data-theme="plum"] .aurora { display: none; }
[data-theme="plum"] .appbar { background: color-mix(in srgb, #F3EDE5 94%, transparent); }
[data-theme="plum"] .drawer { background: #F3EDE5; border-right: 1px solid var(--md-sys-color-outline-variant); }
[data-theme="plum"] .chipbar { background: transparent; backdrop-filter: none; }
[data-theme="plum"] .chip-arrow.l { background: linear-gradient(90deg, #DCEAE6 45%, transparent); }
[data-theme="plum"] .chip-arrow.r { background: linear-gradient(270deg, #E5E3EE 45%, transparent); }
[data-theme="plum"] .nav-item[aria-current="page"] { background: #4A1B2F; color: #FFF6EF; box-shadow: inset 3px 0 0 #D98E9B; }
[data-theme="plum"] .nav-item[aria-current="page"] svg { color: #F1C3CC; }
[data-theme="plum"] .nav-heading { background: none; color: #9C5470; -webkit-text-fill-color: currentColor; }
[data-theme="plum"] .nav-heading::after { background: linear-gradient(90deg, rgba(156,84,112,.45), transparent); }
[data-theme="plum"] .bw-main { background: none; color: #4A1B2F; -webkit-text-fill-color: currentColor; animation: none; }
[data-theme="plum"] .bw-tv { background: #4A1B2F; color: #F6D9DF; box-shadow: none; }
[data-theme="plum"] .ai-btn { background: conic-gradient(from var(--ang, 0deg), #4A1B2F, #D98E9B, #F3EDE5, #9C5470, #4A1B2F); box-shadow: 0 0 14px -4px rgba(156,84,112,.6); }
[data-theme="plum"] .ai-btn-in { background: #FFFAF4; color: #4A1B2F; }
[data-theme="plum"] .grid .card, [data-theme="plum"] .section-head { position: relative; }
[data-theme="plum"] .drawer-ai { background: linear-gradient(135deg, #4A1B2F, #6A2A45); color: #FFF6EF; box-shadow: none; }
[data-theme="plum"] .drawer-ai b { color: #F6D9DF; } [data-theme="plum"] .drawer-ai small { color: #E8CDD4; }
[data-theme="plum"] .about-hero h1, [data-theme="plum"] .greet-hi, [data-theme="plum"] .ag-title b { background: none; color: #4A1B2F; -webkit-text-fill-color: currentColor; }
[data-theme="plum"] .cta { background: #4A1B2F; color: #FFF6EF; box-shadow: none; }
[data-theme="plum"] .cta p { color: #E8CDD4; }
[data-theme="plum"] .live-banner, [data-theme="plum"] .empty, [data-theme="plum"] .pillar, [data-theme="plum"] .desc, [data-theme="plum"] .st-card { background: #FFFAF4; }

/* shared light-theme fixes for the agent panel */
:is([data-theme="muji"], [data-theme="plum"]) .agent { background: var(--md-sys-color-surface-container-lowest); box-shadow: 0 24px 64px rgba(43,26,34,.25), inset 0 0 0 1px var(--md-sys-color-outline-variant); }
:is([data-theme="muji"], [data-theme="plum"]) .ag-head { background: var(--md-sys-color-surface-container-low); border-bottom-color: var(--md-sys-color-outline-variant); }
:is([data-theme="muji"], [data-theme="plum"]) .ag-bubble { background: var(--md-sys-color-surface-container); }
:is([data-theme="muji"], [data-theme="plum"]) .ag-msg.bot .ag-bubble { box-shadow: none; }
:is([data-theme="muji"], [data-theme="plum"]) .ag-msg.me .ag-bubble { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
:is([data-theme="muji"], [data-theme="plum"]) .ag-sugg button { background: var(--md-sys-color-surface-container-low); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
:is([data-theme="muji"], [data-theme="plum"]) .ag-input { background: var(--md-sys-color-surface-container-low); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
:is([data-theme="muji"], [data-theme="plum"]) .ag-input:focus-within { box-shadow: inset 0 0 0 2px var(--md-sys-color-primary); }
:is([data-theme="muji"], [data-theme="plum"]) .ag-cards .mini { background: var(--md-sys-color-surface-container-low); }
:is([data-theme="muji"], [data-theme="plum"]) .ag-dots i { background: var(--md-sys-color-primary); }
:is([data-theme="muji"], [data-theme="plum"]) .acct-menu, :is([data-theme="muji"], [data-theme="plum"]) .theme-menu { box-shadow: 0 16px 40px rgba(43,26,34,.18), inset 0 0 0 1px var(--md-sys-color-outline-variant); }

/* fixes: text over the hero image stays light in every theme; live badge away from the video's own bug */
.hero .eyebrow { color: #F3D98A; }
.hero .btn-outlined { color: #FFF8EE; box-shadow: inset 0 0 0 1px rgba(255,248,238,.65); }
.lp-top { left: auto; right: 14px; }

/* =====================================================================
   v5 — extra DARK themes. Each sets M3 tokens + 4 accent slots:
     --acc1 (metal/highlight), --acc1-l (light tint), --acc2 (brand), --acc2-d (deep)
   The rules below repaint every element that the default theme hard-codes
   in red/gold, so a new dark theme is just a token block.
   ===================================================================== */
[data-theme^="d-"] {
  --gold-gradient: linear-gradient(135deg, var(--acc1-l) 0%, var(--acc1) 45%, color-mix(in srgb, var(--acc1) 70%, #000) 100%);
  --brand-red: var(--acc2); --brand-red-deep: var(--acc2-d); --brand-gold: var(--acc1);
}
[data-theme^="d-"] .aurora { background:
  radial-gradient(40vw 30vh at 25% 30%, color-mix(in srgb, var(--acc2) 30%, transparent), transparent 70%),
  radial-gradient(35vw 28vh at 75% 20%, color-mix(in srgb, var(--acc1) 16%, transparent), transparent 70%),
  radial-gradient(30vw 25vh at 55% 60%, color-mix(in srgb, var(--acc2-d) 22%, transparent), transparent 70%); }
[data-theme^="d-"] .drawer { background: linear-gradient(180deg, var(--md-sys-color-surface) 0%, var(--md-sys-color-surface-container-lowest) 100%);
  border-right: 1px solid color-mix(in srgb, var(--acc1) 10%, transparent); }
[data-theme^="d-"] .nav-item[aria-current="page"] { background: linear-gradient(90deg, var(--acc2) 0%, color-mix(in srgb, var(--acc2) 55%, transparent) 100%);
  color: #fff; box-shadow: inset 3px 0 0 var(--acc1), 0 6px 18px -10px var(--acc2); }
[data-theme^="d-"] .nav-item[aria-current="page"] svg { color: var(--acc1-l); }
[data-theme^="d-"] .nav-heading::after { background: linear-gradient(90deg, color-mix(in srgb, var(--acc1) 45%, transparent), transparent); }
[data-theme^="d-"] .drawer .divider { border-top-color: color-mix(in srgb, var(--acc1) 12%, transparent); }
[data-theme^="d-"] .bw-main { background: linear-gradient(100deg, color-mix(in srgb, var(--acc1) 70%, #000) 0%, var(--acc1) 22%, var(--acc1-l) 32%, var(--acc1) 42%, color-mix(in srgb, var(--acc1) 80%, #000) 70%, var(--acc1-l) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; }
[data-theme^="d-"] .bw-tv { background: linear-gradient(180deg, var(--acc2), var(--acc2-d)); color: var(--acc1-l);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc1) 75%, transparent), 0 2px 8px color-mix(in srgb, var(--acc2) 45%, transparent); }
[data-theme^="d-"] .brand-mark { filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--acc2) 55%, transparent)); }
[data-theme^="d-"] .ai-btn { background: conic-gradient(from var(--ang, 0deg), var(--acc2-d), var(--acc1-l), var(--acc1), var(--acc2), var(--acc1-l), var(--acc2-d));
  box-shadow: 0 0 18px -4px color-mix(in srgb, var(--acc1) 55%, transparent); }
[data-theme^="d-"] .ai-btn-in { background: var(--md-sys-color-surface-container-high); color: var(--acc1-l); }
[data-theme^="d-"] .hero { box-shadow: 0 0 0 1px color-mix(in srgb, var(--acc1) 35%, transparent), 0 24px 60px -24px color-mix(in srgb, var(--acc2) 55%, transparent); }
[data-theme^="d-"] .player { box-shadow: 0 0 0 1px color-mix(in srgb, var(--acc1) 30%, transparent), 0 20px 50px -20px color-mix(in srgb, var(--acc2) 50%, transparent); }
[data-theme^="d-"] .card:hover .thumb { box-shadow: 0 0 0 1px color-mix(in srgb, var(--acc1) 50%, transparent), 0 14px 32px -12px color-mix(in srgb, var(--acc2) 65%, transparent); }
[data-theme^="d-"] .hero .eyebrow { color: var(--acc1-l); }
[data-theme^="d-"] .drawer-ai { background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--acc1) 22%, transparent), transparent 55%),
  linear-gradient(135deg, var(--acc2-d), var(--md-sys-color-surface-container-low)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc1) 30%, transparent); }
[data-theme^="d-"] .agent { background: linear-gradient(180deg, var(--md-sys-color-surface-container) 0%, var(--md-sys-color-surface-container-low) 40%, var(--md-sys-color-surface) 100%);
  box-shadow: 0 24px 64px rgba(0,0,0,.65), inset 0 0 0 1px color-mix(in srgb, var(--acc1) 28%, transparent); }
[data-theme^="d-"] .ag-head { background: radial-gradient(120% 200% at 0% 0%, color-mix(in srgb, var(--acc2) 35%, transparent), transparent 60%);
  border-bottom-color: color-mix(in srgb, var(--acc1) 14%, transparent); }
[data-theme^="d-"] .ag-msg.me .ag-bubble { background: linear-gradient(135deg, var(--acc2), var(--acc2-d)); color: #fff; }
[data-theme^="d-"] .ag-msg.bot .ag-bubble, [data-theme^="d-"] .ag-sugg button, [data-theme^="d-"] .ag-input { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc1) 18%, transparent); }
[data-theme^="d-"] .ag-input:focus-within { box-shadow: inset 0 0 0 2px var(--acc1); }
[data-theme^="d-"] .ag-dots i { background: var(--acc1); }
[data-theme^="d-"] .cta { background: radial-gradient(120% 160% at 100% 0%, color-mix(in srgb, var(--acc1) 18%, transparent), transparent 50%),
  linear-gradient(135deg, var(--acc2-d), var(--md-sys-color-surface-container-low)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc1) 35%, transparent); }
[data-theme^="d-"] .p-played { background: linear-gradient(90deg, var(--acc2-d), var(--acc2)); }
[data-theme^="d-"] .p-knob { background: var(--acc2); }
[data-theme^="d-"] .switch.on { background: color-mix(in srgb, var(--acc1) 55%, transparent); }
[data-theme^="d-"] .switch.on::after { background: var(--acc1); }

/* Midnight & Silver */
[data-theme="d-midnight"] {
  --acc1: #C3D0E4; --acc1-l: #EEF3FB; --acc2: #2453B8; --acc2-d: #12285C;
  --md-sys-color-primary: #A9C7FF; --md-sys-color-on-primary: #0B1F44;
  --md-sys-color-secondary: #B6C6E6; --md-sys-color-secondary-container: #1E3566; --md-sys-color-on-secondary-container: #DCE6FF;
  --md-sys-color-surface: #0D111A; --md-sys-color-surface-container-lowest: #080B12; --md-sys-color-surface-container-low: #141A26;
  --md-sys-color-surface-container: #19202E; --md-sys-color-surface-container-high: #222A3A; --md-sys-color-surface-container-highest: #2C3546;
  --md-sys-color-on-surface: #E3E8F2; --md-sys-color-on-surface-variant: #B7C0D1; --md-sys-color-outline: #8892A5; --md-sys-color-outline-variant: #3A4458;
}
/* Emerald & Gold */
[data-theme="d-emerald"] {
  --acc1: #DDBB63; --acc1-l: #F6E6B2; --acc2: #0E6B4F; --acc2-d: #063528;
  --md-sys-color-primary: #E6C66E; --md-sys-color-on-primary: #2E2400;
  --md-sys-color-secondary: #9ED6BF; --md-sys-color-secondary-container: #0F4A38; --md-sys-color-on-secondary-container: #C8F0E0;
  --md-sys-color-surface: #0B1411; --md-sys-color-surface-container-lowest: #060C0A; --md-sys-color-surface-container-low: #111D19;
  --md-sys-color-surface-container: #16231E; --md-sys-color-surface-container-high: #1E2D27; --md-sys-color-surface-container-highest: #283830;
  --md-sys-color-on-surface: #E2ECE6; --md-sys-color-on-surface-variant: #B6C8BE; --md-sys-color-outline: #84998E; --md-sys-color-outline-variant: #34473E;
}
/* Royal Violet */
[data-theme="d-violet"] {
  --acc1: #D9B8FF; --acc1-l: #F3E6FF; --acc2: #6A2FB0; --acc2-d: #341460;
  --md-sys-color-primary: #DDBDFF; --md-sys-color-on-primary: #2E0D58;
  --md-sys-color-secondary: #CDBFE6; --md-sys-color-secondary-container: #432A6E; --md-sys-color-on-secondary-container: #EADCFF;
  --md-sys-color-surface: #120E19; --md-sys-color-surface-container-lowest: #0B0810; --md-sys-color-surface-container-low: #1A1523;
  --md-sys-color-surface-container: #201A2B; --md-sys-color-surface-container-high: #2A2337; --md-sys-color-surface-container-highest: #352D43;
  --md-sys-color-on-surface: #EAE2F2; --md-sys-color-on-surface-variant: #C6BBD4; --md-sys-color-outline: #958BA4; --md-sys-color-outline-variant: #463D55;
}
/* Sakura Night */
[data-theme="d-sakura"] {
  --acc1: #FFB7CC; --acc1-l: #FFE3EC; --acc2: #B33A6A; --acc2-d: #5E1634;
  --md-sys-color-primary: #FFB1C8; --md-sys-color-on-primary: #5E1132;
  --md-sys-color-secondary: #EBC0CF; --md-sys-color-secondary-container: #6E2945; --md-sys-color-on-secondary-container: #FFD9E5;
  --md-sys-color-surface: #161014; --md-sys-color-surface-container-lowest: #0E0A0D; --md-sys-color-surface-container-low: #1F171C;
  --md-sys-color-surface-container: #251C22; --md-sys-color-surface-container-high: #30252C; --md-sys-color-surface-container-highest: #3B2F37;
  --md-sys-color-on-surface: #F2E3EA; --md-sys-color-on-surface-variant: #D4BCC7; --md-sys-color-outline: #A08A95; --md-sys-color-outline-variant: #4E3E47;
}
/* Pure Black (OLED) */
[data-theme="d-black"] {
  --acc1: #FFFFFF; --acc1-l: #FFFFFF; --acc2: #E5161B; --acc2-d: #8A0B0E;
  --md-sys-color-primary: #FF5A55; --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-secondary: #E0E0E0; --md-sys-color-secondary-container: #272727; --md-sys-color-on-secondary-container: #FFFFFF;
  --md-sys-color-surface: #000000; --md-sys-color-surface-container-lowest: #000000; --md-sys-color-surface-container-low: #0F0F0F;
  --md-sys-color-surface-container: #181818; --md-sys-color-surface-container-high: #212121; --md-sys-color-surface-container-highest: #2C2C2C;
  --md-sys-color-on-surface: #F1F1F1; --md-sys-color-on-surface-variant: #AAAAAA; --md-sys-color-outline: #717171; --md-sys-color-outline-variant: #303030;
  --gold-gradient: linear-gradient(135deg, #FF4A44, #E5161B);
}
[data-theme="d-black"] .aurora { display: none; }
[data-theme="d-black"] .bw-main { background: none; color: #fff; -webkit-text-fill-color: currentColor; animation: none; }
[data-theme="d-black"] .bw-tv { background: #E5161B; color: #fff; box-shadow: none; }

/* theme menu: grouped grid of swatches */
.theme-menu { width: 300px; padding: 10px 0 12px; }
.theme-menu .tm-group { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 10px 6px; }
.theme-menu .tm-group button { flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px; border-radius: 12px; position: relative; font-size: 12px; }
.theme-menu .tm-group button[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--md-sys-color-primary); }
.theme-menu .tm-group button svg { position: absolute; right: 6px; top: 6px; width: 18px; height: 18px; }
.theme-menu .sw { width: 100%; }
.theme-menu .sw i { flex: 1; height: 22px; }

/* ---------- line icons: states that fill ---------- */
.pill.on, .p-big, .p-bezel, .chip-ai[aria-current="page"] { --ic-fill: currentColor; }
.pill.on svg { fill: none; }
.ag-send svg { width: 20px; height: 20px; margin: 0 2px 0 0; }
.nav-item[aria-current="page"] svg { --ic-w: 2.1; }

/* =====================================================================
   v6 — generated LIGHT themes (l-gen: Sakura, Matcha, Sky, your colour)
   ===================================================================== */
[data-theme^="l-"] {
  --gold-gradient: linear-gradient(135deg, var(--acc2), var(--acc2-d));
  --brand-red: var(--acc2); --brand-red-deep: var(--acc2-d); --brand-gold: var(--acc1);
}
[data-theme^="l-"] body { background: linear-gradient(160deg, var(--md-sys-color-surface) 0%, color-mix(in srgb, var(--acc1-l) 40%, var(--md-sys-color-surface)) 100%) fixed; }
[data-theme^="l-"] .aurora { display: none; }
[data-theme^="l-"] .chipbar { background: color-mix(in srgb, var(--md-sys-color-surface) 92%, transparent); }
[data-theme^="l-"] .drawer { background: var(--md-sys-color-surface); border-right: 1px solid var(--md-sys-color-outline-variant); }
[data-theme^="l-"] .nav-item[aria-current="page"] { background: var(--acc2); color: #fff; box-shadow: inset 3px 0 0 var(--acc1-l); }
[data-theme^="l-"] .nav-item[aria-current="page"] svg { color: #fff; }
[data-theme^="l-"] .nav-heading { background: none; color: var(--acc2); -webkit-text-fill-color: currentColor; }
[data-theme^="l-"] .nav-heading::after { background: linear-gradient(90deg, color-mix(in srgb, var(--acc2) 35%, transparent), transparent); }
[data-theme^="l-"] .bw-main { background: none; color: var(--acc2-d); -webkit-text-fill-color: currentColor; animation: none; }
[data-theme^="l-"] .bw-tv { background: var(--acc2); color: #fff; box-shadow: none; }
[data-theme^="l-"] .brand-mark { filter: none; }
[data-theme^="l-"] .ai-btn { background: conic-gradient(from var(--ang, 0deg), var(--acc2), var(--acc1-l), var(--acc1), var(--acc2-d), var(--acc2)); box-shadow: 0 0 14px -4px color-mix(in srgb, var(--acc2) 50%, transparent); }
[data-theme^="l-"] .ai-btn-in { background: var(--md-sys-color-surface-container-lowest); color: var(--acc2-d); }
[data-theme^="l-"] .hero { box-shadow: 0 18px 44px -24px color-mix(in srgb, var(--acc2) 60%, transparent); }
[data-theme^="l-"] .card:hover .thumb { box-shadow: 0 12px 28px -14px color-mix(in srgb, var(--acc2) 60%, transparent); }
[data-theme^="l-"] .drawer-ai { background: linear-gradient(135deg, var(--acc2), var(--acc2-d)); color: #fff; box-shadow: none; }
[data-theme^="l-"] .drawer-ai b { color: var(--acc1-l); } [data-theme^="l-"] .drawer-ai small { color: rgba(255,255,255,.82); }
[data-theme^="l-"] .about-hero h1, [data-theme^="l-"] .ag-title b { background: none; color: var(--acc2-d); -webkit-text-fill-color: currentColor; }
[data-theme^="l-"] .cta { background: var(--acc2-d); color: #fff; box-shadow: none; } [data-theme^="l-"] .cta p { color: rgba(255,255,255,.82); }
[data-theme^="l-"] .live-banner, [data-theme^="l-"] .empty, [data-theme^="l-"] .pillar, [data-theme^="l-"] .desc, [data-theme^="l-"] .st-card { background: var(--md-sys-color-surface-container-lowest); }
[data-theme^="l-"] .agent { background: var(--md-sys-color-surface-container-lowest); box-shadow: 0 24px 64px rgba(0,0,0,.18), inset 0 0 0 1px var(--md-sys-color-outline-variant); }
[data-theme^="l-"] .ag-head { background: var(--md-sys-color-surface-container-low); border-bottom-color: var(--md-sys-color-outline-variant); }
[data-theme^="l-"] .ag-bubble { background: var(--md-sys-color-surface-container); }
[data-theme^="l-"] .ag-msg.bot .ag-bubble { box-shadow: none; }
[data-theme^="l-"] .ag-msg.me .ag-bubble { background: var(--acc2); color: #fff; }
[data-theme^="l-"] .ag-sugg button, [data-theme^="l-"] .ag-input, [data-theme^="l-"] .ag-cards .mini { background: var(--md-sys-color-surface-container-low); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
[data-theme^="l-"] .ag-input:focus-within { box-shadow: inset 0 0 0 2px var(--acc2); }
[data-theme^="l-"] .ag-dots i { background: var(--acc2); }
[data-theme^="l-"] .acct-menu, [data-theme^="l-"] .theme-menu { box-shadow: 0 16px 40px rgba(0,0,0,.16), inset 0 0 0 1px var(--md-sys-color-outline-variant); }

/* ---------- theme menu: tiles + "your colour" ---------- */
.theme-menu { width: 360px; max-height: calc(100vh - var(--appbar-h) - 24px); overflow-y: auto; padding: 12px 0 14px; scrollbar-width: thin; }
.theme-menu p { margin: 8px 16px 8px; }
.theme-menu .tm-group { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 12px 4px; }
.theme-menu .tm-group button { flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px 6px; border-radius: 14px; font: 500 11px/14px var(--font); text-align: center; }
.theme-menu .tm-group button .sw { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  box-shadow: 0 2px 8px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.15); transition: transform .2s var(--ease); }
.theme-menu .tm-group button .sw i { width: auto; height: auto; }
.theme-menu .tm-group button .sw i:first-child { grid-row: 1 / 3; }
.theme-menu .tm-group button:hover .sw { transform: scale(1.08); }
.theme-menu .tm-group button[aria-checked="true"] { box-shadow: none; background: var(--md-sys-color-surface-container-highest); }
.theme-menu .tm-group button[aria-checked="true"] .sw { box-shadow: 0 0 0 2px var(--md-sys-color-surface-container-high), 0 0 0 4px var(--md-sys-color-primary); }
.theme-menu .tm-group button svg { right: 8px; top: 6px; width: 16px; height: 16px; }
.tm-n { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-custom { display: flex; align-items: center; gap: 12px; margin: 0 12px; padding: 10px 12px; border-radius: 14px; background: var(--md-sys-color-surface-container); }
.tm-custom.on { box-shadow: inset 0 0 0 2px var(--md-sys-color-primary); }
.tm-color { position: relative; width: 44px; height: 44px; flex: none; cursor: pointer; }
.tm-color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.tm-color span { display: block; width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,.3), inset 0 0 0 2px rgba(255,255,255,.4);
  background-image: conic-gradient(from 0deg, transparent 0 0) !important; }
.tm-color::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); box-shadow: 0 0 0 2px var(--md-sys-color-surface-container); }
.tm-seg { flex: 1; display: grid; grid-template-columns: 1fr 1fr; border-radius: 20px; padding: 3px; background: var(--md-sys-color-surface-container-highest); }
.tm-seg button { justify-content: center; padding: 8px 6px; border-radius: 16px; font: 600 12px/1 var(--font); }
.tm-seg button[aria-checked="true"] { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.tm-seg button[aria-checked="true"]:hover { background: var(--md-sys-color-primary); }
@media (max-width: 719px) { .theme-menu { left: 8px; right: 8px; width: auto; } }

/* the inset accent bar showed as a gold sliver on the rounded pill: use a soft glow only (all themes) */
html[data-theme] .nav-item[aria-current="page"] { box-shadow: 0 6px 16px -10px color-mix(in srgb, var(--brand-red, #A3201B) 80%, transparent); }

/* channel avatar = the round logo: no square backdrop behind it, just a clean circle */
img.avatar { background: none; border-radius: 50%; object-fit: contain; box-shadow: 0 0 0 1px color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent); }

/* =====================================================================
   v7 — player extras, phone header, OTP, prefs, changelog
   ===================================================================== */

/* theater: sized from width (works with drawer, rail or no menu); never on phones */
body.theater .player:not(.portrait), body.collapsed.theater .player:not(.portrait) { aspect-ratio: 16 / 9; height: auto; max-height: 80vh; }
@media (max-width: 719px) {
  body.theater .watch { grid-template-columns: 1fr; }
  body.theater .player:not(.portrait) { max-height: none; }
  .yt .p-btn[data-a="theater"] { display: none; }               /* phones: fullscreen button is enough */
}
.yt.is-fs { width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto; }

/* subtitles box (YouTube style), lifts above the control bar */
.p-cc { position: absolute; left: 50%; bottom: 64px; z-index: 2; transform: translateX(-50%); max-width: 86%; text-align: center; pointer-events: none;
  transition: bottom .3s var(--ease); }
.yt.idle .p-cc, .yt:not(.started) .p-cc { bottom: 18px; }
.p-cc span { display: inline; padding: 2px 8px; line-height: 1.75; font: 500 clamp(14px, 2.1vw, 22px)/1.7 var(--font); color: #fff;
  background: rgba(8,8,8,.78); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.p-ccbtn .cc-ic { display: grid; place-items: center; width: 26px; height: 19px; border: 2px solid currentColor; border-radius: 4px; font: 800 10px/1 var(--font); letter-spacing: .5px; }
.p-ccbtn.on { position: relative; }
.p-ccbtn.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 7px; height: 3px; border-radius: 2px; background: #E53935; }

/* autoplay switch on the control bar */
.p-auto { width: 52px; }
.ap-sw { position: relative; display: block; width: 36px; height: 14px; border-radius: 7px; background: rgba(255,255,255,.35); transition: background .2s; }
.ap-knob { position: absolute; top: 50%; left: -2px; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; display: grid; place-items: center;
  background: #ddd; color: #111; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .25s var(--ease), background .2s; --ic-fill: currentColor; }
.ap-knob svg { width: 12px !important; height: 12px !important; filter: none !important; }
.p-auto.on .ap-sw { background: rgba(255,255,255,.55); }
.p-auto.on .ap-knob { transform: translateX(18px); background: #fff; }
.p-auto:not(.on) .ap-knob svg { opacity: .35; }

/* "up next" countdown */
.p-next { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgba(0,0,0,.72); animation: fadeIn .3s ease both; }
.pn-in { display: grid; gap: 10px; justify-items: center; max-width: 80%; text-align: center; color: #fff; }
.pn-in small { font: 600 14px/1 var(--font); color: rgba(255,255,255,.8); }
.pn-c { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 6px; border-radius: 50%; border: 2px solid #fff; font-weight: 700; }
.pn-in b { font: 600 clamp(16px, 2.2vw, 22px)/1.4 var(--font); }
.pn-act { display: flex; gap: 10px; margin-top: 6px; }

/* ---------- phone header: [menu][logo] … [search][Ask AI][account] ---------- */
@media (max-width: 719px) {
  .appbar { gap: 2px; padding: 0 4px 0 2px; }
  .brand { gap: 6px; padding: 4px 4px 4px 2px; min-width: 0; flex: 0 1 auto; }
  .brand-mark { width: 30px; height: 30px; }
  .bw-main { font-size: 14px; letter-spacing: .08em; }
  .bw-tv { font-size: 9px; padding: 3px 4px 3px 5px; }
  .brand-word { gap: 5px; }
  .theme-btn, .lang-btn, .appbar > .btn-tonal { display: none !important; }
  .search-group { flex: none; margin-left: auto; }
  #aiBtnM { height: 36px; padding: 1.5px; }
  #aiBtnM .ai-btn-in { padding: 0 4px; }
  #aiBtnM .mascot { width: 28px; height: 28px; }
  .acct-btn { min-width: 40px; }
  .acct-in { padding: 0; box-shadow: none; width: 36px; justify-content: center; }
  .acct-in span { display: none; }
  .acct-in svg { width: 24px; height: 24px; }
}
@media (max-width: 359px) { .bw-main { display: none; } }

/* theme + language as menu buttons on phones */
.drawer-prefs { display: none; gap: 8px; margin: 12px 14px 0; }
.pref-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border: 0; border-radius: 20px; cursor: pointer;
  background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); font: 600 13px/1 var(--font); }
.pref-btn svg { width: 18px; height: 18px; }
@media (max-width: 719px) { body.modal-open .drawer .drawer-prefs { display: flex; } }

/* ---------- OTP sign-in ---------- */
.otp-in { text-align: center; font: 700 28px/1.2 ui-monospace, "SFMono-Regular", Menlo, monospace !important; letter-spacing: .5em; padding-left: .5em !important; }
.auth-fine { margin: -4px 0 0; font-size: 12px; color: var(--md-sys-color-on-surface-variant); text-align: center; }
.auth-off { padding: 24px 16px; margin: 0; width: 100%; }
.auth-off p { font-size: 14px; }
.auth-go svg { width: 18px; height: 18px; margin-left: -6px; }
.auth-resend:disabled { opacity: .55; cursor: default; }
.field small { font-weight: 400; opacity: .8; }

/* ---------- version + changelog ---------- */
.ver { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
.ver:hover { color: var(--md-sys-color-primary); }
.log { list-style: none; margin: 16px 0 0; padding: 0; position: relative; }
.log::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--md-sys-color-outline-variant); }
.log > li { position: relative; padding: 0 0 22px 32px; }
.log > li::before { content: ""; position: absolute; left: 0; top: 5px; width: 16px; height: 16px; border-radius: 50%; background: var(--md-sys-color-surface);
  box-shadow: inset 0 0 0 3px var(--md-sys-color-primary); }
.log > li:first-child::before { background: var(--md-sys-color-primary); }
.log-v { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.log-v b { font: 700 16px/1.3 var(--font); } .log-v time { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.log ul { margin: 0; padding-left: 18px; color: var(--md-sys-color-on-surface-variant); line-height: 1.8; }

/* pre-rendered SEO text: shown only until the app boots (or with JS off) */
.seo { max-width: 900px; padding: 32px 0; color: var(--md-sys-color-on-surface-variant); line-height: 1.8; }
.seo h1 { color: var(--md-sys-color-on-surface); font: 700 26px/1.4 var(--font-display); }
.seo a { color: var(--md-sys-color-primary); }

.m-row { min-height: 40px; }


/* phones: header + bottom navigation slide away while scrolling down (YouTube app behaviour) */
@media (max-width: 719px) {
  .appbar, .navbar { transition: transform .28s var(--ease); will-change: transform; }
  .chipbar { transition: top .28s var(--ease); }
  body.bars-hidden .appbar { transform: translateY(-100%); }
  body.bars-hidden .navbar { transform: translateY(100%); }
  body.bars-hidden .chipbar { top: 0; }
}

/* ---------- follow us (menu) ---------- */
.drawer-social { margin: 14px 2px 0; }
.drawer-social .nav-heading { margin: 0 12px 8px; }
.soc-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px; }
.soc { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container-high); transition: color .2s, background .2s, transform .2s var(--ease), box-shadow .2s; }
.soc svg { width: 20px; height: 20px; }
a.soc:hover { color: var(--soc); transform: translateY(-2px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--soc) 55%, transparent), 0 6px 16px -8px var(--soc); }
.soc.soon { opacity: .4; cursor: default; }
[data-theme="muji"] a.soc:hover, [data-theme="plum"] a.soc:hover, [data-theme^="l-"] a.soc:hover { color: var(--soc); }
[data-theme="muji"] .soc[style*="#FFFFFF"]:hover, [data-theme="plum"] .soc[style*="#FFFFFF"]:hover, [data-theme^="l-"] .soc[style*="#FFFFFF"]:hover { color: #000; }
@media (max-width: 1199px) { .drawer .drawer-social { display: none; } body.modal-open .drawer .drawer-social { display: block; } }
@media (min-width: 1200px) { body.collapsed .drawer .drawer-social { display: none; } }

/* six social icons on one row */
.soc-row { gap: 4px; flex-wrap: nowrap; }
.soc { width: 34px; height: 34px; flex: none; }
.soc svg { width: 18px; height: 18px; }

/* phones: the player settings menu becomes a bottom sheet (YouTube app style) —
   the player is too short to hold the whole menu */
@media (max-width: 719px) {
  .yt .p-menu {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 90; min-width: 0; max-height: 72vh;
    padding: 18px 0 calc(12px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0;
    background: #212121; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55);           /* dims the page behind the sheet */
    animation: sheetUp .3s var(--ease-decel);
  }
  .yt .p-menu::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: rgba(255,255,255,.3); }
  .yt .m-row, .yt .m-head { min-height: 50px; font-size: 15px; }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
/* tablets: touch targets a little larger */
@media (min-width: 720px) and (max-width: 1199px) { .yt .m-row, .yt .m-head { min-height: 44px; } }

/* tablets too: account as an icon, theme + language move into the menu (header was overcrowded at ~820px) */
@media (max-width: 1199px) {
  .theme-btn, .lang-btn { display: none !important; }
  .acct-in { padding: 0; width: 36px; justify-content: center; box-shadow: none; }
  .acct-in span { display: none; }
  .acct-in svg { width: 24px; height: 24px; }
  body.modal-open .drawer .drawer-prefs { display: flex; }
}

/* agent input: one standard 48px pill, everything vertically centred on one line */
.ag-input { align-items: center; min-height: 48px; padding: 4px 4px 4px 18px; gap: 4px; border-radius: 24px; }
.ag-input textarea { padding: 12px 0; font-size: 15px; line-height: 20px; min-height: 44px; max-height: 120px; align-self: center; }
.ag-input .ag-mic { width: 38px; height: 38px; flex: none; }
.ag-input .ag-mic svg { width: 20px; height: 20px; }
.ag-send { width: 38px; height: 38px; align-self: center; }
.ag-send svg { width: 18px; height: 18px; margin: 0 1px 0 0; }
.ag-foot { margin: 6px 16px 10px; }

/* entrance animations must not leave a transform behind: a lingering identity
   transform turns the page into the containing block for position:fixed
   children (the phone settings sheet ended up at the bottom of the page) */
.main > *, .grid > .card, .shelf > .card, .pillars > *, .steps > li, .hero-body > * { animation-fill-mode: backwards; }
/* while the phone settings sheet is open the bottom nav steps aside */
@media (max-width: 719px) { body.sheet-open .navbar { transform: translateY(100%); } }

/* the sheet lives inside the player's stacking context: lift the player above later page content while it is open */
@media (max-width: 719px) { body.sheet-open .player-wrap { position: relative; z-index: 95; } }


/* ---------- my connection ---------- */
.cx { padding-bottom: 32px; }
.cx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.cx-card { padding: 18px 20px; border-radius: 20px; background: var(--md-sys-color-surface-container-low); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
.cx-card h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font: 600 16px/24px var(--font); }
.cx-card h2 svg { width: 22px; height: 22px; color: var(--md-sys-color-primary); }
.cx-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 60%, transparent); font-size: 14px; }
.cx-row:last-child { border-bottom: 0; }
.cx-row span { color: var(--md-sys-color-on-surface-variant); flex: none; }
.cx-row b { font-weight: 500; text-align: right; word-break: break-word; }
.cx-ip { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.cx-ua { display: grid; gap: 8px; margin-top: 12px; }
.cx-ua span { font-size: 14px; color: var(--md-sys-color-on-surface-variant); }
.cx-ua code { display: block; padding: 10px 12px; border-radius: 10px; background: var(--md-sys-color-surface-container-highest); font: 12px/1.6 ui-monospace, Menlo, monospace; word-break: break-all; }
.cx-ua .btn { justify-self: start; height: 34px; }
.cx-speed { display: grid; justify-items: center; text-align: center; }
.cx-speed h2 { justify-self: stretch; }
.cx-gauge { position: relative; width: 260px; height: 150px; }
.cx-gauge svg { width: 100%; height: 100%; }
.g-bg, .g-fg { fill: none; stroke-width: 10; stroke-linecap: round; }
.g-bg { stroke: var(--md-sys-color-surface-container-highest); }
.g-fg { stroke: url(#mg-body); stroke: var(--md-sys-color-primary); stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .4s var(--ease); }
.cx-speed.running .g-fg { filter: drop-shadow(0 0 6px var(--md-sys-color-primary)); }
.cx-num { position: absolute; left: 0; right: 0; bottom: 4px; display: grid; justify-items: center; }
.cx-num b { font: 700 44px/1 var(--font); font-variant-numeric: tabular-nums; }
.cx-num span { font-size: 13px; color: var(--md-sys-color-on-surface-variant); }
.cx-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin: 14px 0 6px; }
.cx-stats div { display: grid; gap: 4px; padding: 10px 6px; border-radius: 12px; background: var(--md-sys-color-surface-container); }
.cx-stats span { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.cx-stats b { font: 700 18px/1.2 var(--font); }
.cx-rec { min-height: 20px; margin: 4px 0 12px; color: var(--md-sys-color-primary); font-size: 14px; }
.cx-geo { margin: 12px 0 0; font-size: 14px; line-height: 1.7; }
#cxGeo { margin-top: 12px; }
.cx-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; color: var(--md-sys-color-on-surface-variant); font-size: 13px; }
.cx-note svg { width: 18px; height: 18px; flex: none; color: var(--md-sys-color-primary); }
@media (max-width: 719px) { .cx-grid { grid-template-columns: 1fr; } .cx-row { flex-direction: column; gap: 2px; } .cx-row b { text-align: left; } }

/* ---------- studio: system + sources ---------- */
.kpi small { font-size: 11px; color: var(--md-sys-color-on-surface-variant); line-height: 1.4; }
.svc { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.svc li { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.svc li span:last-child { color: var(--md-sys-color-on-surface-variant); font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.good { background: #43A047; box-shadow: 0 0 8px #43A047; } .dot.warn { background: #FB8C00; box-shadow: 0 0 8px #FB8C00; }
.dot.bad { background: #E53935; box-shadow: 0 0 8px #E53935; animation: livePulse 1.4s infinite; } .dot.na { background: var(--md-sys-color-outline); }
.spark { width: 100%; height: 120px; display: block; }
.spark polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark .sp0, .lg .sp0 { stroke: var(--md-sys-color-primary); background: var(--md-sys-color-primary); }
.spark .sp1, .lg .sp1 { stroke: #64B5F6; background: #64B5F6; }
.lg { margin-left: 10px; font-size: 12px; font-weight: 400; color: var(--md-sys-color-on-surface-variant); }
.lg i { display: inline-block; width: 10px; height: 3px; margin: 0 4px 2px 8px; vertical-align: middle; border-radius: 2px; }
.st-card h2 small { font-weight: 400; font-size: 12px; color: var(--md-sys-color-on-surface-variant); margin-left: 6px; }
.st-list.ev li { font-size: 12px; } .st-list time { color: var(--md-sys-color-on-surface-variant); margin-right: 6px; }
.st-list .lv-warn, .lv-warn { color: #FFB74D; } .st-list .lv-error, .lv-error { color: #EF9A9A; }
.st-list b.ok { color: #66BB6A; } .st-list b.low { color: #FFB74D; }
.st-list.yt li { align-items: center; } .st-list.yt .btn { height: 28px; font-size: 12px; padding: 0 8px; }

/* ---------- languages: regional CJK typefaces + language menu ---------- */
html:lang(zh-Hans) { --font: "Roboto", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; --font-display: "Noto Serif SC", "Songti SC", serif; }
html:lang(zh-Hant) { --font: "Roboto", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif; --font-display: "Noto Serif TC", "Songti TC", serif; }
html:lang(ko) { --font: "Roboto", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; --font-display: "Noto Serif KR", serif; }
html:lang(ko) h1, html:lang(ko) h2, html:lang(ko) .card-title { word-break: keep-all; }
.lang-menu { width: 220px; }
.lang-menu .lm-n { flex: 1; font-size: 15px; }

/* ---------- phone fixes (2026-10-29) ---------- */
/* The ambient glow is scaled to 1.12, so it stuck out ~25px past the screen edge. Chrome then widened the page, and the fixed
   header and bottom bar ran off screen (account icon cut off on the right). Clip sideways only; overflow: clip makes no scroll
   box, so sticky bars keep working. */
.main { overflow-x: clip; }
/* Phones: dim the picture while the controls show (as YouTube does), so captions burned into the video don't run into the
   control bar. */
@media (max-width: 719px) {
  .yt::after { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .3s ease; pointer-events: none; }
  .yt.started:not(.idle)::after { opacity: 1; }
  .p-ctrl { background: linear-gradient(0deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.5) 55%, transparent 100%); }
}
/* Big play button + play/pause flash: see-through glass with a line icon (owner 2026-10-29: the solid gold disc was too heavy). */
.p-big { width: 68px; height: 68px; margin: -34px 0 0 -34px; color: #fff; background: rgba(0,0,0,.28); --ic-fill: none;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.p-big svg { width: 32px; height: 32px; margin-left: 3px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.45)); }
.p-big:hover { background: rgba(0,0,0,.4); }
.p-bezel { --ic-fill: none; background: rgba(0,0,0,.3); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.7); }
/* Phones/PCs with "reduce motion" on (Android "Remove animations"): animations are switched off, so thumbnails that start at
   opacity 0 and fade in stayed invisible. Show them straight away. */
@media (prefers-reduced-motion: reduce) { .thumb img { opacity: 1; } }
/* One-column watch page (phones, tablets, theater): "1fr" let a long unbroken word or link in a description widen the column
   past the screen; minmax(0, 1fr) keeps it to the screen and long links wrap. */
@media (max-width: 1199px) { .watch { grid-template-columns: minmax(0, 1fr); } }
body.theater .watch { grid-template-columns: minmax(0, 1fr); }
.desc { overflow-wrap: anywhere; }
/* "Show more" under long video grids (24 at a time; loads by itself near the end of the page). */
.grid-more-wrap { display: flex; justify-content: center; margin: 24px 0 8px; }
.grid-more { min-width: 180px; }
/* Shorts rows: every card the same width and height (owner 2026-10-29: "make it aligned", "same height").
   No channel picture, title on 2 lines, channel and views on one line each. */
.shelf { align-items: start; }
.shelf .meta { padding: 0 2px; }
.shelf .avatar { display: none; }
.shelf .card-title { font-size: 15px; line-height: 21px; height: 42px; margin: 8px 0 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shelf .card-sub { font-size: 13px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 719px) { .shelf { grid-auto-columns: calc((100% - 12px) / 2.15); gap: 12px; } }
/* Shorts whose portrait picture is missing fall back to the 4:3 one, which has black bands: zoom past them. */
.shelf .thumb img[src$="/hqdefault.jpg"] { transform: scale(1.34); }
/* Watch page: title on one line (tap it to read all of it), channel name on one line, Subscribe stays beside it. */
.watch-info h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.watch-info h1.open { white-space: normal; }
.channel-row { flex-wrap: nowrap; }
.channel-row .grow { min-width: 0; }
.channel-name, .channel-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-row .sub-btn { flex: none; }
@media (max-width: 719px) { .watch-info h1 { font-size: 18px; line-height: 26px; } }
/* Phones, sized like YouTube's app: compact Subscribe, one scrollable row of actions. */
@media (max-width: 719px) {
  .channel-row { gap: 10px; }
  .channel-name { font-size: 15px; line-height: 20px; }
  .channel-row .sub-btn { height: 36px; padding: 0 16px; font-size: 14px; }
  .act-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .act-row::-webkit-scrollbar { display: none; }
  .act-row .pill { flex: none; height: 36px; font-size: 14px; }
}
/* Share sheet (when the browser has no share sheet of its own, e.g. inside LINE or Facebook, or on a PC). */
.ss-wrap { position: fixed; inset: 0; z-index: 200; display: grid; align-items: end; justify-items: center; }
.ss-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.55); animation: fadeIn .2s ease both; }
.ss-sheet { position: relative; width: min(520px, 100%); margin: 0 auto; padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0; background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface);
  box-shadow: 0 -12px 40px rgba(0,0,0,.45); animation: sheetUp .25s var(--ease-decel) both; }
@media (min-width: 720px) { .ss-wrap { align-items: center; } .ss-sheet { border-radius: 20px; padding-bottom: 20px; } }
.ss-head { display: flex; align-items: center; justify-content: space-between; }
.ss-head h3 { margin: 0; font: 600 18px/24px var(--font); }
.ss-row { display: flex; gap: 8px; justify-content: space-between; padding: 12px 0 16px; overflow-x: auto; scrollbar-width: none; }
.ss-t { flex: 1 0 64px; display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.ss-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 20px/1 var(--font); }
.ss-t:hover .ss-ic { transform: translateY(-2px); transition: transform .15s; }
.ss-link { display: flex; gap: 8px; align-items: center; padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--md-sys-color-surface-container-highest); }
.ss-link input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--md-sys-color-on-surface); font: 400 14px/20px var(--font); }
/* ---------- Shorts feed (like YouTube Shorts): one Short per screen, swipe for the next ---------- */
.sx { height: calc(100vh - var(--appbar-h) - 24px); height: calc(100dvh - var(--appbar-h) - 24px); overflow-y: auto; scroll-snap-type: y mandatory;
  overscroll-behavior: contain; scrollbar-width: none; margin-top: 12px; }
.sx::-webkit-scrollbar { display: none; }
.sx-item { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: flex; justify-content: center; align-items: flex-end; gap: 16px; padding-bottom: 12px; }
.sx-media { position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: calc(100% - 80px); border-radius: 16px; overflow: hidden; background: #000; }
.sx-poster, .sx-media iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.sx-media iframe { pointer-events: none; }           /* our tap layer handles play/pause and lets swipes scroll the feed */
.sx-tap { position: absolute; z-index: 2; inset: 0; margin: 0 auto; height: 100%; aspect-ratio: 9 / 16; max-width: calc(100% - 80px);
  border: 0; background: transparent; cursor: pointer; transform: translateX(-48px); }
.sx-item.paused .sx-tap::after { content: ""; position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  background: rgba(0,0,0,.35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M8 5.5v13l10.5-6.5z'/%3E%3C/svg%3E") center / 30px no-repeat;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.8); }
.sx-info { position: absolute; z-index: 3; bottom: 28px; left: 50%; width: min(calc(100% - 112px), calc((100dvh - var(--appbar-h) - 48px) * 9 / 16 - 24px));
  transform: translateX(calc(-50% - 48px)); color: #fff; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.sx-item::after { content: ""; position: absolute; z-index: 1; bottom: 12px; left: 50%; height: 40%; aspect-ratio: auto; width: min(calc(100% - 80px), calc((100dvh - var(--appbar-h) - 24px) * 9 / 16));
  transform: translateX(calc(-50% - 48px)); border-radius: 0 0 16px 16px; background: linear-gradient(0deg, rgba(0,0,0,.65), transparent); pointer-events: none; }
.sx-ch { display: flex; align-items: center; gap: 8px; font: 600 15px/20px var(--font); }
.sx-ch .avatar { width: 32px; height: 32px; font-size: 13px; }
.sx-title { margin: 8px 0 2px; font: 500 15px/21px var(--font); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sx-meta { margin: 0; font-size: 12px; opacity: .85; }
.sx-rail { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
.sx-b { display: grid; justify-items: center; gap: 4px; border: 0; background: none; color: var(--md-sys-color-on-surface); font: 500 12px/16px var(--font); cursor: pointer; }
.sx-b svg { width: 48px; height: 48px; padding: 12px; border-radius: 50%; background: var(--md-sys-color-surface-container-high); }
.sx-b.on svg { color: var(--md-sys-color-primary); --ic-fill: currentColor; }
/* phones: full screen between the bars, buttons on the picture (as in the YouTube app) */
@media (max-width: 719px) {
  body.sx-on .main { padding-left: 0; padding-right: 0; }
  .sx { position: fixed; z-index: 5; top: var(--appbar-h); bottom: calc(var(--navbar-h) + env(safe-area-inset-bottom)); left: 0; right: 0; height: auto; margin: 0; background: #000; }
  .sx-item { display: block; padding: 0; }
  .sx-media { position: absolute; inset: 0; max-width: none; aspect-ratio: auto; border-radius: 0; }
  .sx-tap { inset: 0; height: auto; aspect-ratio: auto; max-width: none; transform: none; }
  .sx-item::after { left: 0; right: 0; width: auto; bottom: 0; transform: none; border-radius: 0; }
  .sx-info { left: 14px; right: 76px; width: auto; bottom: 16px; transform: none; }
  .sx-rail { position: absolute; z-index: 3; right: 8px; bottom: 16px; padding: 0; gap: 16px; }
  .sx-b { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
  .sx-b svg { width: 44px; height: 44px; padding: 10px; background: rgba(0,0,0,.25); filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
  body.sx-on .site-foot { display: none; }
}
/* Shorts on tablets/PCs: no separate shade box (it did not line up with the video); text shadow is enough. */
@media (min-width: 720px) { .sx-item::after { display: none; } .sx-info { text-shadow: 0 1px 4px rgba(0,0,0,.9), 0 0 12px rgba(0,0,0,.5); } }
/* First load: while the app starts, the plain search-engine text inside <main> stays readable to crawlers but is hidden,
   and grey placeholder cards show instead (owner 2026-10-29: the page flashed a text list on load). */
.main > .seo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.main:has(> .seo)::before {
  --sk: color-mix(in srgb, var(--md-sys-color-on-surface) 9%, transparent);
  content: ""; display: block; margin-top: 16px; height: min(900px, calc(100vh - var(--appbar-h) - 40px));
  background:
    linear-gradient(var(--sk) 0 0) 0 0 / 100% 46% no-repeat,
    linear-gradient(var(--sk) 0 0) 0 calc(46% + 18px) / 72% 16px no-repeat,
    linear-gradient(var(--sk) 0 0) 0 calc(46% + 44px) / 46% 13px no-repeat,
    linear-gradient(var(--sk) 0 0) 0 calc(46% + 84px) / 100% 30% no-repeat,
    linear-gradient(var(--sk) 0 0) 0 calc(76% + 102px) / 72% 16px no-repeat;
  border-radius: 14px; animation: skPulse 1.1s ease-in-out infinite alternate;
}
@keyframes skPulse { from { opacity: .5; } to { opacity: 1; } }
/* placeholder cards: fixed sizes (percent positions in background shorthands are relative, they smeared) */
.main:has(> .seo)::before {
  height: 580px; border-radius: 0;
  background:
    linear-gradient(var(--sk) 0 0) 0 0 / 100% 210px no-repeat,
    linear-gradient(var(--sk) 0 0) 0 226px / 72% 16px no-repeat,
    linear-gradient(var(--sk) 0 0) 0 252px / 46% 13px no-repeat,
    linear-gradient(var(--sk) 0 0) 0 300px / 100% 210px no-repeat,
    linear-gradient(var(--sk) 0 0) 0 526px / 72% 16px no-repeat,
    linear-gradient(var(--sk) 0 0) 0 552px / 46% 13px no-repeat;
}
@media (min-width: 720px) { .main:has(> .seo)::before { height: 420px; background:
    linear-gradient(var(--sk) 0 0) 0 0 / 100% 340px no-repeat,
    linear-gradient(var(--sk) 0 0) 0 360px / 40% 18px no-repeat,
    linear-gradient(var(--sk) 0 0) 0 390px / 25% 14px no-repeat; } }
/* Phones: Shorts use the whole screen above the bottom bar, no top header (as in the YouTube app); a small back button. */
.sx-back { display: none; }
@media (max-width: 719px) {
  body.sx-on .appbar { transform: translateY(-100%); visibility: hidden; }
  body.sx-on .sx { top: 0; }
  body.sx-on .sx-back { display: grid; place-items: center; position: fixed; z-index: 6; top: calc(8px + env(safe-area-inset-top)); left: 8px;
    width: 40px; height: 40px; border-radius: 50%; color: #fff; background: rgba(0,0,0,.35); }
  body.sx-on .sx-back svg { width: 24px; height: 24px; }
}
/* Phones: the video page shows no top header; the player is pinned at the top while the details scroll (YouTube app). */
@media (max-width: 719px) {
  body.watch-on .appbar { transform: translateY(-100%); visibility: hidden; }
  body.watch-on .main { padding-top: 0; }
  body.watch-on .watch > div > .player-wrap, body.watch-on .watch > div > .player { position: sticky; top: 0; z-index: 12; }
  body.watch-on .w-back { display: grid; place-items: center; position: fixed; z-index: 14; top: calc(6px + env(safe-area-inset-top)); left: 6px;
    width: 36px; height: 36px; border-radius: 50%; color: #fff; background: rgba(0,0,0,.4); }
  body.watch-on .w-back svg { width: 22px; height: 22px; }
}
/* Phones: theme and language menus open as a sheet at the bottom of the screen, above everything (they opened at the top,
   over the side menu). */
@media (max-width: 719px) {
  .theme-menu { top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); left: 8px; right: 8px; width: auto; max-height: 75vh; overflow-y: auto;
    z-index: 210; box-shadow: 0 -8px 40px rgba(0,0,0,.6); }
}
/* Phones: the back button on videos and Shorts is hidden until the video is touched, then fades after 3 s. */
@media (max-width: 719px) {
  body.watch-on .w-back, body.sx-on .sx-back { opacity: 0; pointer-events: none; transition: opacity .25s ease; }
  body.watch-on.back-show .w-back, body.sx-on.back-show .sx-back { opacity: 1; pointer-events: auto; }
}
/* Phones: the pinned player stays at the top through the whole page, Up next included (it let go before Up next). */
@media (max-width: 719px) {
  body.watch-on .watch { row-gap: 0; }
  body.watch-on .watch > div { display: contents; }
  body.watch-on .watch > .upnext { margin-top: 24px; }
}
/* ---------- our controls on YouTube videos (YouTube's own controls are off) ---------- */
.ytp iframe { pointer-events: none; }
.ytp-tap { position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.ytp .p-ctrl { z-index: 3; }
.ytp.started.paused .p-ctrl { opacity: 1; }
.ytp.started:not(.paused):not(.idle) .p-big, .ytp.started.paused .p-big { opacity: 1; pointer-events: auto; transform: none; }
.ytp.started:not(.paused):not(.idle) .p-big svg { visibility: hidden; }
.ytp.started:not(.paused):not(.idle) .p-big { opacity: 0; pointer-events: none; }
.ytp.idle { cursor: none; }
.ytp.loading .p-spin { opacity: 1; animation: spin .9s linear infinite; }
body.ytp-fs .ytp { position: fixed !important; inset: 0; z-index: 300; width: 100vw; height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0; }
.ytp:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border-radius: 0; }
/* settings sheet */
.ys-sheet .ys-h { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; font: 600 14px/20px var(--font); color: var(--md-sys-color-on-surface-variant); }
.ys-sheet .ys-h svg { width: 20px; height: 20px; }
.ys-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.ys-o { min-width: 64px; height: 40px; padding: 0 14px; border: 0; border-radius: 20px; cursor: pointer; font: 500 14px/20px var(--font);
  background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface); }
.ys-o.on { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
/* our own videos: on phones the settings menu opens as a sheet at the bottom of the screen too (it was cut off inside the
   small player) */
@media (max-width: 719px) {
  .p-menu { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); max-height: 70vh; overflow-y: auto; z-index: 220; }
}
/* Play icons sit in the middle of their circles: the triangle is drawn right of the box centre already, so no extra nudge. */
.p-big svg, .ytp .p-big svg { margin: 0 0 0 1px; }
.p-bezel svg { margin: 0; }
.p-big { display: grid; place-items: center; padding: 0; }
/* ---------- loading shimmer + smooth page changes (owner 2026-10-29) ---------- */
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }
:root { --shim: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--md-sys-color-on-surface) 9%, transparent) 50%, transparent 70%); }
/* thumbnails shimmer until the picture covers them (a few sweeps, then rest) */
.thumb { animation: shimmer 1.4s linear 6; }
/* first load: a light sweep over the placeholder cards */
.main:has(> .seo)::after {
  content: ""; display: block; height: 580px; margin-top: -580px; pointer-events: none;
  background: var(--shim) 0 0 / 300% 100%; animation: shimmer 1.3s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) 0 0 / 100% 210px no-repeat, linear-gradient(#000 0 0) 0 226px / 72% 16px no-repeat,
    linear-gradient(#000 0 0) 0 252px / 46% 13px no-repeat, linear-gradient(#000 0 0) 0 300px / 100% 210px no-repeat,
    linear-gradient(#000 0 0) 0 526px / 72% 16px no-repeat, linear-gradient(#000 0 0) 0 552px / 46% 13px no-repeat;
          mask: linear-gradient(#000 0 0) 0 0 / 100% 210px no-repeat, linear-gradient(#000 0 0) 0 226px / 72% 16px no-repeat,
    linear-gradient(#000 0 0) 0 252px / 46% 13px no-repeat, linear-gradient(#000 0 0) 0 300px / 100% 210px no-repeat,
    linear-gradient(#000 0 0) 0 526px / 72% 16px no-repeat, linear-gradient(#000 0 0) 0 552px / 46% 13px no-repeat;
}
.main:has(> .seo)::before { animation: none; }
@media (min-width: 720px) { .main:has(> .seo)::after { height: 420px; margin-top: -420px;
  -webkit-mask: linear-gradient(#000 0 0) 0 0 / 100% 340px no-repeat, linear-gradient(#000 0 0) 0 360px / 40% 18px no-repeat, linear-gradient(#000 0 0) 0 390px / 25% 14px no-repeat;
          mask: linear-gradient(#000 0 0) 0 0 / 100% 340px no-repeat, linear-gradient(#000 0 0) 0 360px / 40% 18px no-repeat, linear-gradient(#000 0 0) 0 390px / 25% 14px no-repeat; } }
/* YouTube player: its picture + a shimmer show until the video starts, then fade away */
.ytp-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; transition: opacity .5s ease; pointer-events: none; }
.ytp::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: var(--shim) 0 0 / 300% 100%;
  animation: shimmer 1.3s linear infinite; transition: opacity .4s ease; }
.ytp.started .ytp-poster, .ytp.started::before { opacity: 0; }
.ytp.started::before { animation: none; }
/* Shorts: shimmer behind the picture while it loads */
.sx-media { background: #111 var(--shim) 0 0 / 300% 100%; animation: shimmer 1.3s linear 8; }
/* the cross-fade between pages */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; animation-timing-function: cubic-bezier(.2, 0, 0, 1); }
/* channel pictures and letter badges */
img.avatar.ch-pic { object-fit: cover; background: var(--md-sys-color-surface-container-high); }
.avatar.av-l { background: hsl(var(--av-h, 40) 42% 36%); color: #fff; font-weight: 700; }
/* a YouTube video that cannot play here: message + next video (moves on by itself) */
.ytp-err { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 16px; text-align: center; background: rgba(0,0,0,.82); color: #fff; }
.ytp-err p { margin: 0; font: 500 15px/22px var(--font); }
/* Phones: the category chips hide with the header when scrolling down and come back on scroll up (owner 2026-10-29). */
@media (max-width: 719px) {
  .chipbar { transition: top .28s var(--ease), transform .28s var(--ease), opacity .2s ease; }
  body.bars-hidden .chipbar { top: 0; transform: translateY(-110%); opacity: 0; pointer-events: none; }
}
/* YouTube videos before they start: a loading ring (not a play button) while the video starts by itself; taps go straight
   to the YouTube player underneath, because some phone browsers only start a video on a tap inside the player itself.
   If it has not started after 4 s, the button turns into "tap to play". */
.ytp:not(.started) .ytp-tap { display: none; }
.ytp:not(.started) iframe { pointer-events: auto; }
.ytp-poster, .ytp:not(.started) .p-big, .ytp:not(.started) .p-spin { pointer-events: none; }
.ytp:not(.started) .p-big { opacity: 1; transform: none; }
.ytp:not(.started):not(.need-tap) .p-big svg { opacity: 0; }
.ytp:not(.started):not(.need-tap) .p-big::after { content: ""; position: absolute; inset: 14px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin .9s linear infinite; }
.ytp.need-tap .p-big { animation: tapPulse 1.6s ease-in-out infinite; }
@keyframes tapPulse { 0%, 100% { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85), 0 0 0 0 rgba(255,255,255,.35); } 50% { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85), 0 0 0 14px rgba(255,255,255,0); } }
/* Shorts: same — until a Short plays, a tap reaches the YouTube player itself */
.sx-item.playing:not([data-state="1"]):not([data-state="3"]) .sx-media iframe { pointer-events: auto; z-index: 2; }
.sx-item.playing:not([data-state="1"]):not([data-state="3"]) .sx-tap { display: none; }

/* ---------- 2026-10-30 (owner): related chips over Up next, full screen fit/fill, sideways phones, mini player ---------- */
/* chips over Up next (YouTube: All · From <channel> · topics) */
.upnext .upn-chips { margin: 0 0 12px; position: relative; }
.upnext .upn-chips .chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; scroll-snap-type: x proximity; }
.upnext .upn-chips .chips::-webkit-scrollbar { display: none; }
.upnext .upn-chips .chip { flex: 0 0 auto; border: 0; cursor: pointer; font: 500 14px/20px var(--font); white-space: nowrap; scroll-snap-align: start; }
.upnext .upn-chips .chip[aria-current] { background: var(--md-sys-color-on-surface); color: var(--md-sys-color-surface); }
@media (max-width: 719px) { .upnext .upn-chips { margin: 4px -12px 10px; padding: 0 12px; } }

/* full screen: "fill" zooms a wide picture over a long screen (edges above and below are cut) */
.player.fill-on iframe { transform: scale(var(--fill, 1)); transform-origin: 50% 50%; transition: transform .25s ease; }
.player.fill-on video { object-fit: cover; }
.player:fullscreen video { object-fit: contain; }
.player.fill-on:fullscreen video { object-fit: cover; }
.player:fullscreen, body.ytp-fs .ytp { background: #000; }

/* a phone turned sideways on a video page: the video covers the whole screen, as in the YouTube app */
body.land-full.watch-on .watch > div > .player-wrap,
body.land-full.watch-on .watch > div > .player,
body.land-full.watch-on .watch > div > .player-wrap > .player {
  position: fixed !important; inset: 0; z-index: 300; width: 100vw !important; height: 100dvh !important; max-height: none;
  aspect-ratio: auto !important; border-radius: 0; margin: 0;
}
body.land-full.watch-on .watch > div > .player-wrap .ambient { display: none; }
body.land-full.watch-on { overflow: hidden; }

/* mini player: the video keeps playing in a small frame after leaving its page; tap = back to the video */
.mini-dock { position: fixed; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 250; width: min(46vw, 360px);
  aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08);
  animation: md-in .25s ease; }
@media (min-width: 720px) { .mini-dock { bottom: 20px; right: 20px; } }
.mini-dock[hidden] { display: none; }
@keyframes md-in { from { transform: translateY(20px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.mini-dock .md-slot, .mini-dock .md-slot > .player { position: absolute; inset: 0; }
.mini-dock .player.docked { width: 100% !important; height: 100% !important; aspect-ratio: auto; border-radius: 0; box-shadow: none; margin: 0; }
.mini-dock .player.docked > :not(iframe):not(video) { display: none !important; }
.mini-dock .player.docked iframe, .mini-dock .player.docked video { pointer-events: none; transform: none; }
.mini-dock .md-open { position: absolute; inset: 0; z-index: 2; background: transparent; border: 0; cursor: pointer; }
.mini-dock .md-bar { position: absolute; top: 4px; right: 4px; z-index: 3; display: flex; gap: 4px; }
.mini-dock .md-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(6px); }
.mini-dock .md-btn svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; }
@media (prefers-reduced-motion: reduce) { .mini-dock { animation: none; } .player.fill-on iframe { transition: none; } }
.upnext .upn-chips .chip[aria-current]::before { display: none; }
.upnext .upn-chips .chip[aria-current] { padding-left: 12px; box-shadow: none; }
/* phones: the chips stay right under the pinned video while Up next scrolls (owner 2026-10-30 11:04), never hidden */
@media (max-width: 719px) {
  body.watch-on .upnext .upn-chips, body.watch-on.bars-hidden .upnext .upn-chips {
    position: sticky; top: var(--pin-h, calc(100vw * 9 / 16)); z-index: 11; transform: none; opacity: 1; pointer-events: auto;
    margin: 0 -12px 8px; padding: 0 12px; background: var(--md-sys-color-surface); backdrop-filter: none;
  }
  body.watch-on .upnext .upn-chips .chips { padding: 8px 0; }
}
/* Safari / iPhone: videos start muted (the only way Safari lets them start by themselves); one tap turns the sound on */
.ytp-unmute { position: absolute; left: 12px; top: 12px; z-index: 6; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px 0 10px;
  border: 0; border-radius: 17px; cursor: pointer; background: rgba(0,0,0,.66); color: #fff; font: 600 13px/1 var(--font); backdrop-filter: blur(6px);
  animation: um-in .3s ease; }
.ytp-unmute[hidden] { display: none; }
.ytp-unmute svg { width: 18px; height: 18px; }
@keyframes um-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
body.watch-on .ytp-unmute { top: calc(12px + env(safe-area-inset-top)); left: 52px; }
@media (prefers-reduced-motion: reduce) { .ytp-unmute { animation: none; } }
/* the video page: total views + age under the title (YouTube style) */
.watch-info .w-meta { margin: -6px 0 12px; color: var(--md-sys-color-on-surface-variant); font: 400 13px/18px var(--font); }
/* a play request was refused (apps' built-in browsers): the next tap goes to the YouTube player itself */
.ytp.pass .ytp-tap { display: none; }
.ytp.pass iframe { pointer-events: auto; }
.ytp.pass .p-big, .ytp.pass .ytp-poster { pointer-events: none; }
.ytp.pass .p-big { opacity: 1; }
/* "N new videos" pill (fresh list arrived while scrolling) */
.new-pill { position: fixed; z-index: 40; left: 50%; top: calc(var(--appbar-h) + 64px); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px 0 10px; border: 0; border-radius: 18px; cursor: pointer; background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); font: 600 14px/1 var(--font); box-shadow: 0 6px 20px rgba(0,0,0,.45); animation: menuIn .25s var(--ease-decel) both; }
.new-pill svg { width: 18px; height: 18px; transform: rotate(90deg); }
body.bars-hidden .new-pill { top: 12px; }
/* 続きから見る: one video, with a link to 履歴 beside the heading */
.section-head .sec-link { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font: 600 14px/20px var(--font); color: var(--md-sys-color-primary); }
.section-head .sec-link svg { width: 18px; height: 18px; }
@media (min-width: 720px) { .cont-one .grid { grid-template-columns: minmax(0, 420px); } }
/* Phones: the bottom bar is slightly see-through (frosted), so the page shows faintly behind it (owner 2026-10-31). */
@media (max-width: 719px) {
  .navbar { background: color-mix(in srgb, var(--md-sys-color-surface-container) 78%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
    border-top: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 35%, transparent); }
}
/* Phones: every page shows faintly through the bottom bar; on Shorts the video runs under the bar (as in the YouTube app), with
   the title and buttons kept above it. */
@media (max-width: 719px) {
  .navbar { background: color-mix(in srgb, var(--md-sys-color-surface-container) 62%, transparent); }
  .navbar a[aria-current="page"] .ind { background: color-mix(in srgb, var(--md-sys-color-secondary-container) 82%, transparent); }
  body.sx-on .sx { bottom: 0; }
  body.sx-on .navbar { background: rgba(0, 0, 0, .32); border-top-color: rgba(255, 255, 255, .08); }
  body.sx-on .sx-info, body.sx-on .sx-rail { bottom: calc(var(--navbar-h) + 14px + env(safe-area-inset-bottom)); }
  body.sx-on .sx-item::after { height: 50%; }
}
/* Phones: a Short fills the whole screen top to bottom (sides trimmed a little, as in the YouTube app) instead of black bands. */
@media (max-width: 719px) {
  body.sx-on .sx-media iframe { left: 50%; right: auto; width: max(100%, calc(100dvh * 9 / 16)); transform: translateX(-50%); }
}
/* Shorts on phones: lighter shade under the bottom bar so the video shows through it */
@media (max-width: 719px) {
  body.sx-on .sx-item::after { background: linear-gradient(0deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,.55) 16%, rgba(0,0,0,.35) 40%, transparent 100%); }
  body.sx-on .navbar { background: rgba(0, 0, 0, .22); }
}

/* 11-08 owner: player settings see-through (glass): the video stays visible behind the 設定 sheet and the player menu */
.ys-wrap .ss-scrim { background: rgba(0,0,0,.12); }
.ys-sheet { background: rgba(24,24,24,.58); color: #fff; box-shadow: 0 8px 32px rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(2px) saturate(130%); backdrop-filter: blur(2px) saturate(130%); }
.ys-sheet .ys-h { color: rgba(255,255,255,.8); }
.ys-sheet .ss-head .icon-btn { color: #fff; }
.ys-o { background: rgba(255,255,255,.14); color: #fff; }
.ys-o:hover { background: rgba(255,255,255,.22); }
.ys-o.on, .ys-o.on:hover { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.p-menu { background: rgba(24,24,24,.58); -webkit-backdrop-filter: blur(2px) saturate(130%); backdrop-filter: blur(2px) saturate(130%); }
@media (max-width: 719px) {
  .yt .p-menu { background: rgba(24,24,24,.62); box-shadow: 0 0 0 100vmax rgba(0,0,0,.12); }
}
/* 11-08 owner: the Up next chips sat over the first video on wide screens: .upn-chips is position: relative, so the
   sticky .chipbar top (the header height) pushed it 64px down. Keep it in place (phones set their own sticky top). */
.upnext .upn-chips { top: auto; }

/* Phones (owner 2026-12-03, "follow YouTube"): the controls are laid out like the YouTube phone player. Top right: autoplay, picture-in-picture,
   subtitles, settings. Centre: play / pause. Bottom left: time. Bottom right: full screen. The progress bar runs along the bottom edge.
   Nothing sits in the lower middle any more, so subtitles are never covered by buttons. Markup is unchanged: this is layout only. */
@media (max-width: 719px), (pointer: coarse) and (max-height: 520px) {
  .yt .p-ctrl { top: 0; padding: 0; background: none; pointer-events: none; }
  .yt.is-fs .p-ctrl { padding: 0; }
  .yt .p-ctrl .p-btn, .yt .p-ctrl .p-prog, .yt .p-ctrl .p-vol, .yt .p-ctrl .p-time { pointer-events: auto; }
  .yt.idle .p-ctrl *, .yt:not(.started) .p-ctrl * { pointer-events: none; }
  /* top row: what is not placed elsewhere below (mute, then autoplay / picture-in-picture / subtitles / settings on the right) */
  .yt .p-bar { height: 52px; padding: 4px 4px 0 4px; gap: 0; background: linear-gradient(180deg, rgba(0,0,0,.55), transparent); }
  .yt .p-volr { display: none; }
  .yt .p-vol, .yt .p-btn[data-y="mute"] { order: 1; }                                            /* the top-left corner belongs to the page's back button */
  .yt .p-btn[data-a="autoplay"] { order: 1; }
  .yt .p-btn[data-a="pip"] { order: 2; }
  .yt .p-btn[data-a="cc"], .yt .p-btn[data-y="cc"] { order: 3; }
  .yt .p-btn[data-a="settings"], .yt .p-btn[data-y="settings"] { order: 4; }
  /* centre: play / pause */
  .yt .p-btn[data-a="play"], .yt .p-btn[data-y="play"] { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -34px 0 0 -28px; background: rgba(0,0,0,.38); }
  .yt .p-btn[data-a="play"] svg, .yt .p-btn[data-y="play"] svg { width: 34px; height: 34px; }
  .ytp.paused .p-btn[data-y="play"], .ytp:not(.started) .p-btn[data-y="play"] { opacity: 0; pointer-events: none; }   /* YouTube videos: the big play button is already there when paused */
  /* bottom left: time, bottom right: full screen */
  .yt .p-time { position: absolute; left: 12px; bottom: 26px; margin: 0; padding: 5px 9px; border-radius: 14px; background: rgba(0,0,0,.42); font-size: 12.5px; }
  .yt .p-btn[data-a="fs"], .yt .p-btn[data-y="fs"] { position: absolute; right: 4px; bottom: 18px; }
  .yt .p-btn[data-a="theater"] { display: none; }
  /* progress bar along the bottom edge, with a taller touch area */
  .yt .p-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 20px; align-items: flex-end; }
  .yt .p-knob { top: auto; bottom: -5px; margin-top: 0; transform: scale(1); }
  .yt .p-tip { bottom: 30px; }
  /* subtitles: clear of the time and the full-screen button while the controls show, near the bottom edge when they hide */
  .yt .p-cc { left: 4%; right: 4%; max-width: none; transform: none; bottom: 46px; }
  .yt .p-cc span { font-size: 13px; line-height: 1.55; padding: 1px 6px; }
  .yt.idle .p-cc, .yt:not(.started) .p-cc { bottom: 12px; }
}
/* a phone held sideways (full screen): larger subtitle text */
@media (pointer: coarse) and (max-height: 520px) and (min-width: 720px) { .yt .p-cc span { font-size: 16px; } }
