/* YouTube4Tesla - car screen styles.
   Built for the Tesla's 15" landscape touchscreen (big tap targets); a phone layout is
   at the bottom (@media max-width: 760px). */

:root {
  --bg: #0b0c0f;          /* page */
  --surface: #15171c;     /* cards, panels */
  --surface-2: #1d2027;   /* buttons, inputs */
  --surface-3: #262a33;   /* pressed */
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f6f8;
  --muted: #9aa3ae;
  --accent: #00a9f0;      /* the logo's cyan */
  --accent-press: #0092d0;
  --danger: #ff8f8f;
  --radius: 16px;
  --tap: 72px;            /* minimum height of anything you tap in the car */
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* "hidden" always wins over display rules below */

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

svg { width: 1em; height: 1em; flex: none; }

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 28px;
  font: inherit;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, transform 0.12s;
}
button:active { background: var(--surface-3); transform: scale(0.97); }
button.primary { background: var(--accent); border-color: transparent; color: #fff; }
button.primary:active { background: var(--accent-press); }
.icon-btn { padding: 0; font-size: 34px; background: transparent; border-color: transparent; }

/* ---------------------------------------------------------------------------------
   First screen: logo + "Start watching" (one tap unlocks sound in the car)
   --------------------------------------------------------------------------------- */
#start-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px;
  text-align: center;
  background: var(--bg);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#start-screen[hidden] { display: none; }
#start-screen.leaving { opacity: 0; transform: scale(1.02); pointer-events: none; }
.start-glow {
  position: absolute;
  inset: -10% -10% auto;
  height: 75%;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 15%, rgba(0, 169, 240, 0.22), transparent 62%);
}
.intro-logo { position: relative; display: flex; align-items: center; gap: min(26px, 2vw); max-width: 92vw; }
.intro-mark { position: relative; height: min(120px, 9vw); animation: mark-in 0.8s 0.1s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
.intro-mark img { height: 100%; display: block; }
/* A light sweep across the Y4T mark (masked to the logo's own shape) */
.intro-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.9) 50%, transparent 65%) -150% 0 / 250% 100% no-repeat;
  -webkit-mask: url("/img/y4t.png") center / contain no-repeat;
  mask: url("/img/y4t.png") center / contain no-repeat;
  animation: shine 1.1s 1s ease-in-out both;
}
.intro-word { height: min(70px, 5.2vw); animation: word-in 0.7s 0.55s ease-out both; }
.tagline { position: relative; margin: 6px 0 14px; font-size: 26px; color: var(--muted); animation: rise 0.6s 1.05s ease-out both; }
@keyframes mark-in {
  0% { opacity: 0; transform: scale(0.4); filter: blur(14px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
@keyframes word-in {
  from { opacity: 0; clip-path: inset(0 100% 0 0); transform: translateX(-16px); }
  to { opacity: 1; clip-path: inset(0 0 0 0); transform: none; }
}
@keyframes shine { from { background-position: -150% 0; } to { background-position: 250% 0; } }
.start-glow { animation: glow-in 1.6s ease-out both; }
@keyframes glow-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }

#start {
  position: relative;
  min-width: 380px;
  min-height: 112px;
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 12px 40px rgba(0, 169, 240, 0.35);
  animation: rise 0.6s 1.25s ease-out both;
}
/* Soft pulsing ring around the Start button */
#start::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 3px solid rgba(0, 169, 240, 0.6);
  animation: ring 2.2s 2s ease-out infinite;
  opacity: 0;
  pointer-events: none;
}
@keyframes ring { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.25); } }
#start svg { font-size: 34px; }
#start:active { background: var(--accent-press); }
.hint { position: relative; margin: 0; font-size: 19px; color: #6f7782; animation: rise 0.6s 1.45s ease-out both; }

/* Pressing Start: everything lifts away and a cyan burst fills the screen */
.launch-wipe {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 60%), #34c1ff, var(--accent) 40%, #006a99 100%);
  clip-path: circle(0 at var(--x, 50%) var(--y, 60%));
}
#start-screen.launching .launch-wipe { animation: burst 0.65s cubic-bezier(0.6, 0, 0.3, 1) forwards; }
#start-screen.launching .intro-logo { animation: lift 0.5s ease-in forwards; }
#start-screen.launching .tagline,
#start-screen.launching .hint,
#start-screen.launching #start { animation: drop 0.35s ease-in forwards; }
@keyframes burst { to { clip-path: circle(150% at var(--x, 50%) var(--y, 60%)); } }
@keyframes lift { to { opacity: 0; transform: scale(1.25); filter: blur(6px); } }
@keyframes drop { to { opacity: 0; transform: translateY(14px) scale(0.96); } }

/* Then Home's first videos cascade in */
body.just-started #page .section-title,
body.just-started #page .grid > .card { animation: card-in 0.5s ease-out both; }
body.just-started #page .grid > .card:nth-child(1) { animation-delay: 0.05s; }
body.just-started #page .grid > .card:nth-child(2) { animation-delay: 0.1s; }
body.just-started #page .grid > .card:nth-child(3) { animation-delay: 0.15s; }
body.just-started #page .grid > .card:nth-child(4) { animation-delay: 0.2s; }
body.just-started #page .grid > .card:nth-child(5) { animation-delay: 0.25s; }
body.just-started #page .grid > .card:nth-child(6) { animation-delay: 0.3s; }
body.just-started #page .grid > .card:nth-child(n+7) { animation-delay: 0.35s; }
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  #start-screen *, #start-screen *::after { animation-duration: 0.01s !important; animation-delay: 0s !important; }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------------------
   Browsing pages (browse.js)
   --------------------------------------------------------------------------------- */
body.watching #browse { display: none; }
body:not(.watching) #stage { visibility: hidden; }

#browse {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}

#topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(11, 12, 15, 0.92);
  border-bottom: 1px solid var(--line);
}
#topbar button { min-height: 64px; }
#nav-back { min-width: 56px; }
#topbar .logo { padding: 0 8px; background: transparent; border-color: transparent; }
#topbar .logo img { height: 44px; display: block; }

#search-form { position: relative; flex: 1; display: flex; align-items: center; min-width: 0; }
.search-icon { position: absolute; left: 22px; font-size: 26px; color: var(--muted); pointer-events: none; }
#search {
  flex: 1;
  min-width: 0;
  min-height: 64px;
  padding: 0 130px 0 60px;
  font: inherit;
  font-size: 23px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
#search::placeholder { color: #6f7782; }
#search:focus { border-color: var(--accent); background: var(--surface-2); }
#search::-webkit-search-cancel-button { display: none; }
.search-go {
  position: absolute;
  right: 6px;
  min-height: 52px !important;
  padding: 0 22px;
  font-size: 20px;
  border-radius: 999px;
  background: var(--surface-3);
  border-color: transparent;
}
#nav-account { gap: 10px; padding: 0 20px 0 14px; border-radius: 999px; font-size: 21px; }
#nav-account svg {
  width: 38px;
  height: 38px;
  padding: 7px;
  border-radius: 50%;
  color: var(--bg);
  background: var(--muted);
}
#nav-account.signed-in svg { background: var(--accent); color: #fff; }

#offline-banner {
  padding: 14px 20px;
  font-size: 21px;
  text-align: center;
  background: #4a1b1b;
  border-bottom: 1px solid rgba(255, 143, 143, 0.25);
}
#offline-banner[hidden] { display: none; }

#page { padding: 6px 28px 70px; }
.page-message { padding: 90px 20px; font-size: 24px; text-align: center; color: var(--muted); }
.page-message button { margin-top: 24px; }

.section-title { margin: 34px 4px 16px; font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 30px 22px;
}

.card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: var(--radius);
  transition: transform 0.12s;
}
.card:active { transform: scale(0.97); }

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card.channel .thumb { aspect-ratio: 1; width: 58%; margin: 0 auto; border-radius: 50%; }

.badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.82);
  border-radius: 6px;
}

.info { padding: 12px 4px 0; }
.info .title {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card.channel .info { text-align: center; }
.muted { color: var(--muted); font-size: 18px; margin-top: 4px; }
.info .channel {
  display: inline-block;
  max-width: 100%;
  margin-top: 6px;
  padding: 4px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis; /* long channel names end in "…" instead of sticking out */
  vertical-align: top;
  color: var(--muted);
  font-size: 18px;
}
.card { min-width: 0; }
.info .channel.link:active { color: var(--text); }

.more { grid-column: 1 / -1; justify-self: center; border-radius: 999px; }

.signin-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 22px 4px 0;
  padding: 18px 18px 18px 26px;
  font-size: 21px;
  background: linear-gradient(90deg, rgba(0, 169, 240, 0.14), rgba(0, 169, 240, 0.04));
  border: 1px solid rgba(0, 169, 240, 0.25);
  border-radius: 20px;
}
.signin-tip button { border-radius: 999px; }

.channel-head, .playlist-head {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 28px 4px 8px;
}
.channel-head h1, .playlist-head h1 { margin: 0; font-size: 36px; font-weight: 800; letter-spacing: -0.02em; }
.playlist-head { justify-content: space-between; }
.avatar { width: 120px; height: 120px; border-radius: 50%; }

.tabs { display: flex; gap: 12px; margin: 22px 0 18px; }
.tab { border-radius: 999px; min-height: 60px; }
.tab.on { background: var(--text); color: var(--bg); }

.account { max-width: 760px; margin: 60px auto; text-align: center; font-size: 23px; }
.account h1 { font-size: 38px; font-weight: 800; letter-spacing: -0.02em; }
.account p { line-height: 1.55; }
.big-url { font-size: 44px; font-weight: 800; color: var(--accent); }
.big-code {
  display: inline-block;
  margin: 12px 0 22px;
  padding: 14px 30px;
  font-size: 60px;
  font-weight: 800;
  letter-spacing: 8px;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
}

/* "Continue watching" progress line on thumbnails */
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255, 255, 255, 0.25); }
.progress span { display: block; height: 100%; background: var(--accent); }

/* Loading placeholders and page fade */
.skeleton { pointer-events: none; }
.skeleton .thumb, .skeleton .line, .skeleton-title {
  background: linear-gradient(90deg, #15171c 0%, #20232b 50%, #15171c 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 12px;
}
.skeleton .line { height: 20px; margin-top: 14px; width: 90%; }
.skeleton .line.short { width: 55%; height: 16px; }
.skeleton-title { height: 30px; width: 220px; margin-top: 34px; margin-bottom: 16px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
#page.fade-in { animation: fadein 0.25s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------------------
   Watching: the whole screen is the video, controls float on top
   --------------------------------------------------------------------------------- */
#stage {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: top 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), left 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
    width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), border-radius 0.32s;
  background: #000 center / contain no-repeat;
  overflow: hidden;
  touch-action: none; /* fingers go to app.js: double-tap skips, pinch zooms, swipe up shows videos */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
body.watching #stage { animation: fadein 0.2s ease-out; }
/* While a video starts: the thumbnail behind the spinner is greyed out, then fades
   back to colour as the video comes in. */
#stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(38, 42, 50, 0.35);
  -webkit-backdrop-filter: grayscale(0.9) brightness(0.75);
  backdrop-filter: grayscale(0.9) brightness(0.75);
  opacity: 0;
  transition: opacity 0.45s ease-out;
}
#stage.starting::before { opacity: 1; transition-duration: 0.25s; }
#stage canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
#stage canvas[hidden] { display: none; }

/* Messages over the video: loading, reconnecting, errors */
#notice {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: rgba(5, 6, 8, 0.66);
  pointer-events: none;
}
#notice[hidden] { display: none; }
#notice.light { background: transparent; }
#notice-title { font-size: 32px; font-weight: 700; }
#notice-title:empty, #notice-detail:empty { display: none; }
#notice-detail { max-width: 760px; font-size: 22px; line-height: 1.45; color: #c3c9d1; }
#notice-action {
  position: relative;
  z-index: 4;
  margin-top: 10px;
  pointer-events: auto;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
}
#notice-action[hidden] { display: none; }
#settings, #countdown { touch-action: pan-y; }

.spinner {
  width: 68px;
  height: 68px;
  border: 7px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}
.spinner[hidden] { display: none; }
#notice.light .spinner { filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.8)); }
@keyframes spin { to { transform: rotate(360deg); } }

#controls {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
#controls[hidden] { display: none; }
#stage.ui #controls { opacity: 1; }
#stage.ui #controls button,
#stage.ui #controls input { pointer-events: auto; }

.bar { display: flex; align-items: center; gap: 18px; padding: 16px 26px; }
.bar.top { padding-bottom: 60px; background: linear-gradient(rgba(0, 0, 0, 0.78), transparent); }
.bar.bottom { padding-top: 60px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.82)); }

#title {
  flex: 1;
  min-width: 0;
  font-size: 26px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
#watch-back { min-width: 64px; color: #fff; }

.pill {
  min-height: 60px;
  padding: 0 22px;
  font-size: 21px;
  border-radius: 999px;
  background: rgba(20, 22, 27, 0.7);
  border-color: rgba(255, 255, 255, 0.14);
}
.pill svg { font-size: 26px; }

.middle { display: flex; align-items: center; justify-content: center; }
#toggle {
  width: 132px;
  height: 132px;
  padding: 0;
  font-size: 96px;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: 50%;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.7));
}
#toggle:active { background: transparent; transform: scale(0.9); }
#toggle .i-play { display: none; }
#toggle.is-paused .i-play { display: block; margin-left: 8px; }
#toggle.is-paused .i-pause { display: none; }

#time {
  font-size: 22px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

#seek {
  flex: 1;
  min-width: 0;
  height: var(--tap);
  accent-color: var(--accent);
  cursor: pointer;
}
#seek::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; }
#seek::-webkit-slider-thumb { width: 36px; height: 36px; margin-top: -14px; }

/* Double-tap: a soft half-circle with running arrows and the seconds (YouTube-style) */
.skip-hint {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 38%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 26px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease-out;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  background: rgba(255, 255, 255, 0.1);
}
.skip-hint.left { left: 0; border-radius: 0 50% 50% 0 / 0 50% 50% 0; }
.skip-hint.right { right: 0; border-radius: 50% 0 0 50% / 50% 0 0 50%; }
.skip-hint.on { opacity: 1; transition-duration: 0.12s; }
.skip-hint b { font-weight: 700; }
.skip-hint .arrows { display: flex; font-size: 44px; }
.skip-hint.left .arrows { transform: scaleX(-1); }
.skip-hint .arrows svg { opacity: 0.25; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.8)); }
.skip-hint.on .arrows svg { animation: chev 0.75s ease-in-out infinite; }
.skip-hint.on .arrows svg:nth-child(2) { animation-delay: 0.12s; }
.skip-hint.on .arrows svg:nth-child(3) { animation-delay: 0.24s; }
@keyframes chev { 0%, 100% { opacity: 0.25; } 35% { opacity: 1; } }
/* the ripple where the finger tapped */
.tap-ripple {
  position: absolute;
  z-index: 1;
  width: 180px;
  height: 180px;
  margin: -90px 0 0 -90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
  animation: ripple 0.5s ease-out forwards;
}
@keyframes ripple { from { transform: scale(0.2); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

/* Swipe up on the video: a see-through row of more videos over the bottom */
#shelf {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 10px 0 22px;
  background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.75));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  transform: translate3d(0, 100%, 0);
  will-change: transform;
  touch-action: none; /* the handle is dragged by app.js; the row of videos below scrolls sideways itself */
}
#shelf.shelf-anim { transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes shelf-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes shelf-down { to { transform: translateY(100%); } }
.shelf-grip { width: 64px; height: 6px; margin: 0 auto 8px; padding: 0; border-radius: 3px; background: rgba(255, 255, 255, 0.45); }
.shelf-head { padding: 0 28px 12px; font-size: 22px; font-weight: 700; }
#shelf-list {
  display: flex;
  gap: 18px;
  padding: 0 28px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  touch-action: pan-x;
}
#shelf-list::-webkit-scrollbar { display: none; }
.shelf-item {
  flex: none;
  width: 300px;
  min-height: 0;
  padding: 0;
  display: block;
  text-align: left;
  font-weight: 400;
  background: transparent;
  border: 0;
  scroll-snap-align: start;
}
.shelf-item img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; }
.shelf-item .title { margin-top: 8px; font-size: 18px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); }
.shelf-item .muted { font-size: 15px; color: #c3c9d1; }

/* Up next rows (the watch page's right column) */
.upnext-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  min-height: 0;
  padding: 8px;
  text-align: left;
  font-weight: 400;
  background: transparent;
  border-color: transparent;
}
.upnext-item img { width: 168px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; flex: none; }
.upnext-item .title { font-size: 18px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.upnext-item .muted { font-size: 15px; margin-top: 4px; }

/* "Up next in 5" card */
#countdown {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  width: min(600px, 90%);
  padding: 26px;
  text-align: center;
  background: rgba(21, 23, 28, 0.97);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
#countdown[hidden] { display: none; }
.cd-label { font-size: 24px; color: var(--muted); margin-bottom: 14px; }
.cd-label b { color: var(--accent); }
#cd-thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; }
#cd-title { margin: 14px 0 20px; font-size: 22px; font-weight: 600; }
.cd-buttons { display: flex; gap: 14px; justify-content: center; }
.cd-buttons button { flex: 1; border-radius: 999px; }

/* ---------------------------------------------------------------------------------
   Phones and small screens: same site, sized down. (A popup explains it's built for
   the car; see device-note.js.)
   --------------------------------------------------------------------------------- */
@media (max-width: 760px) {
  :root { --tap: 48px; --radius: 12px; }
  button { font-size: 16px; padding: 0 18px; gap: 8px; }

  #start-screen { gap: 16px; }
  .intro-logo { gap: 12px; }
  .intro-mark { height: 54px; }
  .intro-word { height: 30px; }
  .tagline { font-size: 17px; margin-bottom: 8px; }
  #start { min-width: 0; width: min(320px, 86vw); min-height: 64px; font-size: 21px; }
  #start svg { font-size: 22px; }
  .hint { font-size: 14px; }

  #topbar { gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  #topbar button { min-height: 44px; }
  #nav-back { min-width: 36px; font-size: 26px; }
  #topbar .logo { padding: 0 2px; }
  #topbar .logo img { height: 28px; }
  .search-icon { left: 14px; font-size: 18px; }
  #search { min-height: 44px; padding: 0 12px 0 40px; font-size: 16px; } /* 16px stops iPhones zooming */
  .search-go { display: none; }
  #nav-account { padding: 0; min-width: 44px; background: transparent; border-color: transparent; }
  #nav-account .label { display: none; }
  #nav-account svg { width: 34px; height: 34px; padding: 6px; }

  #offline-banner { font-size: 14px; padding: 10px; }
  #page { padding: 0 12px 40px; }
  .page-message { font-size: 16px; padding: 50px 10px; }
  .section-title { font-size: 19px; margin: 22px 2px 10px; }
  .grid { grid-template-columns: 1fr; gap: 20px; }
  .info { padding-top: 10px; }
  .info .title { font-size: 16px; }
  .muted, .info .channel { font-size: 13px; }
  .badge { font-size: 12px; padding: 2px 6px; }
  .card.channel .thumb { width: 34%; }

  .signin-tip { flex-direction: column; align-items: stretch; text-align: center; font-size: 15px; padding: 16px; gap: 12px; }
  .channel-head, .playlist-head { gap: 14px; margin: 18px 2px 6px; }
  .channel-head h1, .playlist-head h1 { font-size: 22px; }
  .playlist-head { flex-direction: column; align-items: flex-start; }
  .avatar { width: 64px; height: 64px; }
  .tabs { margin: 14px 0 12px; }
  .tab { min-height: 40px; }
  .account { margin: 30px auto; font-size: 16px; padding: 0 6px; }
  .account h1 { font-size: 24px; }
  .big-url { font-size: 26px; }
  .big-code { font-size: 34px; letter-spacing: 4px; padding: 10px 18px; }
  .skeleton .line { height: 14px; }
  .skeleton-title { height: 22px; width: 150px; }

  .bar { gap: 10px; padding: 10px 12px; }
  .bar.top { padding-bottom: 36px; }
  .bar.bottom { padding-top: 36px; }
  #title { font-size: 15px; }
  #watch-back { min-width: 40px; font-size: 26px; }
  .pill { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .pill svg { font-size: 18px; }
  .middle { gap: 34px; }
  #toggle { width: 76px; height: 76px; font-size: 56px; }
  #time { font-size: 13px; }
  #seek { height: 36px; }
  #seek::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -8px; }
  #seek::-webkit-slider-runnable-track { height: 6px; }
  #notice-title { font-size: 20px; }
  #notice-detail { font-size: 15px; }
  .spinner { width: 44px; height: 44px; border-width: 5px; }
  .skip-hint { font-size: 18px; }
  .skip-hint .arrows { font-size: 18px; }
  .shelf-head { font-size: 16px; padding: 0 14px 8px; }
  #shelf-list { gap: 10px; padding: 0 14px; }
  .shelf-item { width: 180px; }
  .shelf-item .title { font-size: 13px; }
  .shelf-item .muted { font-size: 12px; }
  .upnext-item img { width: 130px; }
  .upnext-item .title { font-size: 14px; }
  .upnext-item .muted { font-size: 12px; }
  #load-back { min-width: 44px; font-size: 24px; top: 10px; left: 10px; }
  #countdown { padding: 16px; }
  .cd-label { font-size: 16px; }
  #cd-title { font-size: 15px; }
}

/* ---------------------------------------------------------------------------------
   Player settings panel and "Stats for nerds"
   --------------------------------------------------------------------------------- */
#settings-toggle { min-width: 64px; font-size: 32px; color: #fff; }
#settings {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  width: min(440px, 45%);
  overflow-y: auto;
  padding-bottom: 30px;
  background: rgba(11, 12, 15, 0.97);
  border-left: 1px solid var(--line);
  animation: slidein 0.22s ease-out;
}
.panel-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 14px 24px;
  font-size: 25px;
  font-weight: 700;
  background: inherit;
  border-bottom: 1px solid var(--line);
}
.panel-head .icon-btn { font-size: 28px; color: var(--muted); min-width: 56px; min-height: 56px; }
.settings-label { padding: 22px 24px 10px; font-size: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
#quality-options { display: flex; flex-direction: column; gap: 6px; padding: 0 12px; }
#quality-options button {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 70px;
  padding: 10px 18px;
  font-size: 22px;
  text-align: left;
  background: transparent;
  border-color: transparent;
}
#quality-options button small { font-size: 15px; font-weight: 500; color: var(--muted); }
#quality-options button.on { background: rgba(0, 169, 240, 0.14); border-color: rgba(0, 169, 240, 0.45); }
#quality-options button.on::after { content: "✓"; position: absolute; right: 22px; color: var(--accent); }
#quality-options button { position: relative; }
.switch-row {
  justify-content: space-between;
  width: calc(100% - 24px);
  margin: 18px 12px 0;
  font-size: 22px;
  background: var(--surface);
}
.switch {
  position: relative;
  width: 64px;
  height: 36px;
  border-radius: 999px;
  background: #3a3f4a;
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.switch-row.on .switch { background: var(--accent); }
.switch-row.on .switch::after { transform: translateX(28px); }

#stats {
  position: absolute;
  top: 96px;
  left: 20px;
  z-index: 2;
  padding: 12px 16px;
  font: 500 16px/1.55 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: #e7ebf0;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  pointer-events: none;
}
#stats b { display: inline-block; width: 92px; color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------------------------
   Account page, account badge photo, "Connected!" celebration
   --------------------------------------------------------------------------------- */
#nav-account .photo { display: none; width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
#nav-account.has-photo .photo { display: block; }
#nav-account.has-photo svg { display: none; }

.account-avatar, .celebrate-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
}
.account-avatar img, .celebrate-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-avatar { width: 120px; height: 120px; margin: 0 auto 6px; font-size: 54px; box-shadow: 0 0 0 6px rgba(0, 169, 240, 0.25); }
.account h1 { margin: 14px 0 6px; }
.account > button { margin-top: 14px; border-radius: 999px; }
.lock-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 46px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.lock-row .muted { margin: 0; }
button.plain { min-height: 56px; font-size: 20px; color: var(--muted); background: transparent; border-color: var(--line); border-radius: 999px; }

.celebrate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(0, 169, 240, 0.3), transparent 60%), var(--bg);
  animation: fadein 0.3s ease-out;
  transition: opacity 0.5s ease;
}
.celebrate.leaving { opacity: 0; }
.celebrate h1 { margin: 26px 0 0; font-size: 44px; font-weight: 800; letter-spacing: -0.02em; animation: rise 0.5s 0.45s both; }
.celebrate p { margin: 0; font-size: 22px; color: var(--muted); animation: rise 0.5s 0.6s both; }
.celebrate-ring {
  position: relative;
  width: 170px;
  height: 170px;
  padding: 8px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--sweep, 360deg), transparent 0);
  animation: pop 0.55s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.celebrate-avatar { width: 100%; height: 100%; font-size: 70px; border: 6px solid var(--bg); }
.celebrate-check {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 58px;
  height: 58px;
  padding: 10px;
  color: #fff;
  background: #22c55e;
  border: 5px solid var(--bg);
  border-radius: 50%;
  animation: pop 0.45s 0.35s cubic-bezier(0.2, 1.8, 0.4, 1) both;
}
.celebrate-check svg { width: 100%; height: 100%; }
.spark {
  position: absolute;
  top: 40%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  animation: spark 0.9s var(--d) ease-out both;
}
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes spark {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(1); }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(-190px) scale(0.4); }
}

@media (max-width: 760px) {
  #settings { width: 100%; }
  #settings-toggle { min-width: 40px; font-size: 22px; }
  #quality-options button { min-height: 54px; font-size: 16px; }
  #quality-options button small { font-size: 12px; }
  .switch-row { font-size: 16px; }
  #stats { top: 64px; left: 10px; font-size: 11px; padding: 8px 10px; }
  #stats b { width: 64px; }
  .account-avatar { width: 84px; height: 84px; font-size: 38px; }
  .lock-row { flex-direction: column; gap: 8px; margin-top: 30px; }
  button.plain { font-size: 15px; min-height: 44px; }
  .celebrate h1 { font-size: 28px; }
  .celebrate p { font-size: 15px; padding: 0 20px; }
  .celebrate-ring { width: 120px; height: 120px; }
  .celebrate-avatar { font-size: 48px; }
  .celebrate-check { width: 44px; height: 44px; padding: 7px; }
}

/* Pinch to zoom: the video grows to fill the screen (edges trimmed) or shrinks back.
   app.js sets --zoom while the fingers move. */
#stage canvas { transform: scale(var(--zoom, 1)); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
#stage.pinching canvas { transition: none; }

/* Bottom-right button: the watch page with details, and back to full screen */
#details-toggle { min-width: 64px; font-size: 32px; color: #fff; }
#details-toggle .i-full { display: none; }
body.details #details-toggle .i-full { display: block; }
body.details #details-toggle .i-details { display: none; }
@media (max-width: 760px) { #details-toggle { min-width: 40px; font-size: 22px; } }

/* While a video starts: a way back out, and a progress bar */
#load-back {
  position: absolute;
  top: 16px;
  left: 20px;
  z-index: 6;
  min-width: 64px;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 50%;
  display: none;
}
#stage.no-picture #load-back { display: inline-flex; }
#load-bar {
  position: absolute;
  left: 50%;
  bottom: 14%;
  z-index: 1;
  width: min(440px, 60%);
  height: 8px;
  margin-left: max(-220px, -30%);
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
#stage.starting #load-bar { opacity: 1; transition-duration: 0.2s; }
/* Stripes that run backwards (against the fill): research on progress bars found this
   makes the same wait feel shorter. */
#load-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 4px;
  background-color: var(--accent);
  background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.3) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.3) 75%, transparent 75%);
  background-size: 28px 28px;
  animation: stripes-back 0.6s linear infinite;
  transition: width 0.3s ease-out;
}
@keyframes stripes-back { from { background-position: 0 0; } to { background-position: -28px 0; } }

/* ---------------------------------------------------------------------------------
   Signal Tower loading game (game.js)
   --------------------------------------------------------------------------------- */
#tower-game {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: radial-gradient(ellipse at 50% 100%, rgba(0, 169, 240, 0.16), transparent 60%), rgba(6, 7, 10, 0.78);
  touch-action: none;
  cursor: pointer;
  animation: fadein 0.3s ease-out;
  transition: opacity 0.3s ease;
}
#tower-game.leaving { opacity: 0; pointer-events: none; }
#tower-game canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tg-top, .tg-bottom {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}
.tg-top { top: 8%; }
.tg-bottom { bottom: 4%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tg-kicker {
  display: inline-block; margin-bottom: 10px; padding: 5px 14px; border-radius: 999px;
  font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); background: rgba(0, 169, 240, 0.14);
}
#tg-title { font-size: 32px; font-weight: 700; }
#tg-speed { margin-top: 8px; font-size: 22px; color: var(--muted); font-variant-numeric: tabular-nums; }
#tg-speed b { color: var(--text); }
#tg-speed.ok b { color: #4ade80; }
#tg-speed.low b { color: #fbbf24; }
.tg-bar { width: min(420px, 60%); height: 8px; overflow: hidden; border-radius: 4px; background: rgba(255, 255, 255, 0.15); }
.tg-bar span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.2s; }
.tg-hint { font-size: 18px; color: #c3c9d1; }
#tg-score { min-height: 1.3em; font-size: 18px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  #tg-title { font-size: 20px; }
  #tg-speed { font-size: 14px; }
  .tg-hint, #tg-score { font-size: 13px; }
  .tg-kicker { font-size: 11px; margin-bottom: 6px; }
}

/* Thumbnail gliding from a card to the player when a video is tapped */
.zoom-thumb { position: fixed; z-index: 20; object-fit: cover; pointer-events: none; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }

/* ---------------------------------------------------------------------------------
   Watch page with details (bottom-right button on the video): the video in a box on
   the left with the title, channel, likes, description and comments under it, and
   more videos on the right. Each side scrolls on its own; the video stays put.
   --------------------------------------------------------------------------------- */
body.details {
  --v-w: min(calc(66vw - 40px), calc((100vh - 40px) * 0.6 * 16 / 9));
  --v-h: calc(var(--v-w) * 9 / 16);
}
body.details #stage {
  top: 20px;
  left: 24px;
  width: var(--v-w);
  height: var(--v-h);
  z-index: 2;
  border-radius: 16px;
}
#watch-info {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--bg);
  animation: fadein 0.25s ease-out;
}
body:not(.details) #watch-info { display: none; }
body.details .bar { padding: 10px 14px; gap: 10px; }
body.details .bar.top { padding-bottom: 30px; }
body.details .bar.bottom { padding-top: 30px; }
body.details #title, body.details #upnext-toggle { display: none; }
body.details #watch-back, body.details #settings-toggle, body.details #details-toggle { min-width: 52px; font-size: 26px; }
body.details #toggle { width: 96px; height: 96px; font-size: 68px; }
body.details #time { font-size: 17px; }
body.details .skip-hint { font-size: 18px; }

#wi-main {
  position: absolute;
  left: 24px;
  width: var(--v-w);
  top: calc(20px + var(--v-h) + 4px);
  bottom: 0;
  padding: 14px 4px 40px;
  overflow-y: auto;
  touch-action: pan-y;
}
#wi-title { margin: 0 0 6px; font-size: 26px; font-weight: 700; line-height: 1.25; }
#wi-meta { font-size: 17px; }
.wi-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0; }
#wi-channel { display: flex; align-items: center; gap: 14px; min-width: 0; cursor: pointer; }
#wi-channel img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
#wi-channel .name { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#wi-channel .muted { font-size: 15px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 22px;
  font-size: 19px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--surface-2);
  flex: none;
}
.chip svg { font-size: 24px; }
.chip:empty, #wi-likes.none { display: none; }
#wi-desc {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 16px 18px;
  text-align: left;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 0;
  border-radius: 14px;
}
#wi-desc .when { display: block; margin-bottom: 6px; font-weight: 700; }
#wi-desc .text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: #d5dae0; }
#wi-desc.open .text { display: block; }
#wi-desc .more { display: block; margin-top: 6px; font-weight: 700; color: var(--muted); }
.wi-comments-head { margin: 26px 0 8px; font-size: 22px; font-weight: 700; }
.comment { display: flex; gap: 14px; padding: 12px 0; }
.comment img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.comment .who { font-size: 15px; color: var(--muted); }
.comment .who b { color: var(--text); font-weight: 600; margin-right: 6px; }
.comment .said { margin-top: 4px; font-size: 17px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment .said.long { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.comment .said.long.open { display: block; }
.comment .likes { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.comment .likes svg { font-size: 16px; }
#wi-comments .more-comments { margin: 14px 0; width: 100%; }
#wi-comments .muted { padding: 10px 0; font-size: 17px; }

#wi-side {
  position: absolute;
  left: calc(24px + var(--v-w) + 20px);
  right: 12px;
  top: 20px;
  bottom: 0;
  padding-bottom: 40px;
  overflow-y: auto;
  touch-action: pan-y;
}
.wi-side-head { padding: 0 8px 10px; font-size: 20px; font-weight: 700; }
#wi-side .upnext-item img { width: 46%; max-width: 190px; }
#wi-side .upnext-item .title { font-size: 16px; }
#wi-side .upnext-item .muted { font-size: 14px; }

@media (max-width: 760px) {
  body.details { --v-w: 100vw; }
  body.details #stage { top: 0; left: 0; border-radius: 0; }
  #watch-info { overflow-y: auto; touch-action: pan-y; }
  #wi-main, #wi-side { position: static; width: auto; overflow: visible; }
  #wi-main { padding: calc(var(--v-h) + 12px) 14px 10px; }
  #wi-side { padding: 0 6px 30px; }
  #wi-title { font-size: 18px; }
  #wi-meta { font-size: 13px; }
  #wi-channel img { width: 40px; height: 40px; }
  #wi-channel .name { font-size: 15px; }
  #wi-channel .muted { font-size: 12px; }
  .chip { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .chip svg { font-size: 18px; }
  #wi-desc { font-size: 14px; padding: 12px 14px; }
  .wi-comments-head { font-size: 17px; }
  .comment .said { font-size: 14px; }
  .comment img { width: 34px; height: 34px; }
  .wi-side-head { font-size: 17px; }
  body.details #toggle { width: 64px; height: 64px; font-size: 46px; }
}

/* ---------------------------------------------------------------------------------
   Passenger acknowledgement (safety.js)
   --------------------------------------------------------------------------------- */
#safety {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(5, 6, 8, 0.78);
  animation: fadein 0.25s ease-out;
}
.safety-card {
  width: min(980px, 100%); max-height: 100%; overflow-y: auto;
  padding: 32px; border-radius: 26px;
  background: linear-gradient(180deg, #1b1e25, #121419);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.safety-head { display: flex; gap: 22px; align-items: center; margin-bottom: 24px; }
.safety-shield {
  flex: none; width: 84px; height: 84px; display: grid; place-items: center;
  border-radius: 22px; color: #fff; font-size: 44px;
  background: var(--accent); box-shadow: 0 10px 34px rgba(0, 169, 240, 0.45);
}
.safety-kicker { font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.safety-head h2 { margin: 4px 0; font-size: 32px; font-weight: 800; }
.safety-head p { margin: 0; font-size: 19px; color: var(--muted); }
.safety-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.safety-item { display: flex; gap: 16px; padding: 20px; border-radius: 18px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.safety-item b { display: block; margin-bottom: 6px; font-size: 20px; }
.safety-item span { font-size: 16px; line-height: 1.45; color: #c3c9d1; }
.safety-icon { flex: none; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px; font-size: 28px; }
.safety-icon.passenger { background: rgba(0, 169, 240, 0.16); color: #4cc6ff; }
.safety-icon.eye { background: rgba(255, 107, 107, 0.15); color: #ff8f8f; }
.safety-icon.copy { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.safety-icon.signal { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.safety-buttons { display: flex; justify-content: flex-end; gap: 14px; margin-top: 26px; }
.safety-buttons button { min-width: 180px; }
@media (max-width: 760px) {
  .safety-card { padding: 20px; }
  .safety-head { gap: 14px; }
  .safety-shield { width: 56px; height: 56px; font-size: 30px; border-radius: 16px; }
  .safety-head h2 { font-size: 21px; }
  .safety-head p { font-size: 14px; }
  .safety-grid { grid-template-columns: 1fr; gap: 10px; }
  .safety-item { padding: 14px; }
  .safety-item b { font-size: 16px; }
  .safety-item span { font-size: 13px; }
  .safety-icon { width: 40px; height: 40px; font-size: 22px; }
  .safety-buttons button { min-width: 0; flex: 1; }
}
/* Parked-only things while driving (Theater Mode etc.) */

/* ---------------------------------------------------------------------------------
   Section bar, Apps, Theater Mode, Maps (apps.js)
   --------------------------------------------------------------------------------- */
#topbar { flex-wrap: wrap; row-gap: 10px; }
#sections {
  flex-basis: 100%; display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -4px; padding: 0 4px 2px; touch-action: pan-x;
}
#sections::-webkit-scrollbar { display: none; }
.section-btn {
  flex: none; min-height: 52px; padding: 0 22px; font-size: 19px; font-weight: 600;
  border-radius: 999px; background: var(--surface-2); border-color: transparent; color: #d5dae0;
}
.section-btn.on { background: var(--text); color: var(--bg); }
body.watching #sections { display: none; }

#toast {
  position: fixed; left: 50%; bottom: 34px; z-index: 70; max-width: min(720px, 90vw);
  padding: 16px 26px; border-radius: 16px; font-size: 19px; text-align: center;
  background: rgba(30, 33, 40, 0.97); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.app-group { margin: 26px 4px 12px; font-size: 18px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.app-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px;
  min-height: 150px; padding: 20px 10px 16px; border-radius: 20px; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
}
.app-tile img, .app-letter, .app-glyph {
  width: 64px; height: 64px; border-radius: 16px; flex: none; object-fit: contain;
}
.app-tile img { background: #fff; padding: 8px; }
.app-letter { display: grid; place-items: center; font-size: 30px; font-weight: 800; background: var(--surface-3); }
.app-name { font-size: 17px; font-weight: 700; line-height: 1.2; }
.app-sub { font-size: 13px; color: var(--muted); line-height: 1.3; }
.app-glyph { background: var(--accent) center / 36px no-repeat; }
.g-tv { background-color: #e5484d; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='6' width='18' height='12' rx='2'/%3E%3Cpath d='M8 3l4 3 4-3'/%3E%3C/svg%3E"); }
.g-radio { background-color: #f59e0b; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Cpath d='M7.8 7.8a6 6 0 0 0 0 8.4M16.2 7.8a6 6 0 0 1 0 8.4M4.9 4.9a10 10 0 0 0 0 14.2M19.1 4.9a10 10 0 0 1 0 14.2'/%3E%3C/svg%3E"); }
.g-map { background-color: #22c55e; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11.5a7 7 0 0 1 14 0C19 14.8 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E"); }
.g-camp { background-color: #ea580c; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 3c1 3 5 5 5 10a5 5 0 0 1-10 0c0-3 2-4 2-6 1.5 1 2 2 2 3 1-2 1-4 1-7z'/%3E%3Cpath d='M4 21h16'/%3E%3C/svg%3E"); }
.g-games { background-color: #8b5cf6; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Crect x='2' y='7' width='20' height='11' rx='5'/%3E%3Cpath d='M7 11v3M5.5 12.5h3M16 11.5h.01M18 13.5h.01'/%3E%3C/svg%3E"); }
.g-weather { background-color: #0ea5e9; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='9' r='3.5'/%3E%3Cpath d='M9 2v1.5M2 9h1.5M4 4l1 1M14 4l-1 1M8 20h9a4 4 0 0 0 0-8 5 5 0 0 0-9.3 1.6A3.3 3.3 0 0 0 8 20z'/%3E%3C/svg%3E"); }
.g-star { background-color: #eab308; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 3l2.7 5.6 6.1.8-4.5 4.3 1.1 6.1L12 17l-5.4 2.8 1.1-6.1-4.5-4.3 6.1-.8z'/%3E%3C/svg%3E"); }
.g-library { background-color: #3b82f6; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='7' width='14' height='13' rx='2'/%3E%3Cpath d='M7 4h12a2 2 0 0 1 2 2v10M9 11l4 2.5L9 16z'/%3E%3C/svg%3E"); }
.g-help { background-color: #64748b; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6V14M12 17.5h.01'/%3E%3C/svg%3E"); }
.theater-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.theater-note { font-size: 17px; color: var(--muted); }
.theater-form { display: flex; gap: 12px; margin: 6px 0 4px; }
.theater-form input { flex: 1; min-width: 0; min-height: 60px; padding: 0 20px; font: inherit; font-size: 19px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; }

.maps { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 420px; margin-top: 16px; }
.maps-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.maps-bar input { flex: 1; min-width: 200px; min-height: 60px; padding: 0 20px; font: inherit; font-size: 19px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; }
.maps-tabs { display: flex; gap: 8px; }
.maps-frame { flex: 1; width: 100%; border: 0; border-radius: 18px; background: var(--surface); }
@media (max-width: 760px) {
  .section-btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
  .app-tile { min-height: 110px; padding: 14px 6px 10px; }
  .app-tile img, .app-letter, .app-glyph { width: 46px; height: 46px; border-radius: 12px; background-size: 26px; }
  .app-name { font-size: 13px; }
  .app-sub { display: none; }
  .maps { height: calc(100vh - 170px); }
  .maps-bar input { min-height: 44px; font-size: 15px; }
}

/* ---------------------------------------------------------------------------------
   Radio and Live TV (media.js)
   --------------------------------------------------------------------------------- */
.media-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.media-head .section-title { margin-right: auto; }
.media-search input, .media-select {
  min-height: 56px; min-width: 260px; padding: 0 18px; font: inherit; font-size: 18px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
}
.media-note { margin: 10px 4px 0; font-size: 15px; color: var(--muted); }
.chips { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 6px 0 4px; touch-action: pan-x; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; min-height: 50px; padding: 0 20px; font-size: 17px; border-radius: 999px; background: var(--surface-2); border-color: transparent; }
.chip-btn.on { background: var(--accent); color: #fff; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin-top: 16px; }
.media-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0;
  padding: 16px 10px 14px; border-radius: 18px; text-align: center; font-weight: 400;
  background: var(--surface); border: 1px solid var(--line);
}
.media-art {
  width: 100%; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden;
  border-radius: 12px; background: #fff1; font-size: 40px; font-weight: 800; color: var(--muted);
}
.media-art img { max-width: 80%; max-height: 80%; object-fit: contain; }
.media-name { font-size: 16px; font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.media-sub { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mylists { margin: 18px 0; }
.mylist-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 16px; color: #c3c9d1; border-bottom: 1px solid var(--line); }
body.is-source #details-toggle, body.is-source #upnext-toggle { display: none; }

#radio-card {
  position: absolute; inset: 0; z-index: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 50% 40%, #1c2a3a, #07090c 70%); pointer-events: none;
}
.radio-art { width: 220px; height: 220px; display: grid; place-items: center; overflow: hidden; border-radius: 32px; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.radio-art img { max-width: 86%; max-height: 86%; object-fit: contain; }
.radio-live { font-size: 15px; font-weight: 800; letter-spacing: 0.14em; color: var(--accent); }
.radio-title { max-width: 80%; font-size: 34px; font-weight: 800; text-align: center; }
.eq { display: flex; gap: 6px; align-items: flex-end; height: 40px; }
.eq span { width: 8px; height: 100%; border-radius: 4px; background: var(--accent); transform-origin: bottom; animation: eq 1s ease-in-out infinite; }
.eq span:nth-child(2) { animation-delay: -0.4s; } .eq span:nth-child(3) { animation-delay: -0.7s; }
.eq span:nth-child(4) { animation-delay: -0.2s; } .eq span:nth-child(5) { animation-delay: -0.55s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }
@media (max-width: 760px) {
  .media-search input, .media-select { min-height: 44px; min-width: 0; width: 100%; font-size: 15px; }
  .chip-btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .radio-art { width: 130px; height: 130px; border-radius: 22px; }
  .radio-title { font-size: 20px; }
}

/* ---------------------------------------------------------------------------------
   Favorites star, Home strip, Weather, Camp & Rest, Help (relax.js)
   --------------------------------------------------------------------------------- */
.star {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 52px; height: 52px; min-height: 0; padding: 0;
  display: grid; place-items: center; border-radius: 50%; border: 0;
  background: rgba(10, 11, 14, 0.6); color: #fff; font-size: 26px;
}
.star svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.star.on { color: #facc15; }
.star.on svg { fill: currentColor; }
.card { position: relative; }
.wi-row .star { position: static; flex: none; background: var(--surface-2); width: 56px; height: 56px; }
.app-tile, .media-tile { position: relative; }
.app-tile .star, .media-tile .star { top: 6px; right: 6px; width: 40px; height: 40px; font-size: 20px; }

.home-strip { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 18px 4px 0; }
.hs-clock { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.hs-date { margin-top: 6px; font-size: 18px; color: var(--muted); }
.hs-weather { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 0 22px; border-radius: 999px; background: var(--surface); font-weight: 400; }
.hs-icon { font-size: 30px; }
.hs-temp { font-size: 26px; font-weight: 800; }
.hs-weather .muted { font-size: 16px; }

.wx-now { display: flex; align-items: center; gap: 26px; padding: 26px; border-radius: 22px; background: var(--surface); }
.wx-icon { font-size: 90px; line-height: 1; }
.wx-temp { font-size: 72px; font-weight: 800; line-height: 1; }
.wx-desc { font-size: 26px; font-weight: 700; margin: 6px 0; }
.wx-hours { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
.wx-hour { flex: none; width: 96px; padding: 14px 8px; border-radius: 16px; text-align: center; background: var(--surface); font-size: 17px; }
.wx-hicon { font-size: 30px; margin: 6px 0; }
.wx-rain { font-size: 14px; color: #60a5fa; }
.wx-days { display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: var(--surface); }
.wx-day { display: grid; grid-template-columns: 1fr 60px 70px 140px; align-items: center; gap: 12px; padding: 14px 22px; font-size: 19px; border-bottom: 1px solid var(--line); }
.wx-day .wx-hicon { margin: 0; font-size: 26px; text-align: center; }
.wx-range { text-align: right; font-weight: 700; }

.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 18px; }
.scene-tile { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 6px; min-height: 170px; padding: 20px; border-radius: 22px; border: 0; text-align: left; }
.scene-name { font-size: 24px; font-weight: 800; }
.scene-sub { font-size: 16px; color: rgba(255, 255, 255, 0.75); font-weight: 400; }
.scene-fire { background: radial-gradient(circle at 50% 120%, #ff9a3c, #b33a12 45%, #2a0c05 80%); }
.scene-rain { background: linear-gradient(160deg, #1d3550, #0a1320); }
.scene-ocean { background: linear-gradient(180deg, #13406a, #0b6d8c 60%, #08324a); }
.scene-forest { background: linear-gradient(180deg, #0b1424, #0c2416 70%); }
.scene-brown { background: radial-gradient(circle, #343a52, #0b0c12 70%); }
#scene { position: fixed; inset: 0; z-index: 50; background: #000; }
#scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#scene.dim canvas { opacity: 0.25; }
.scene-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 22px 28px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); transition: opacity 0.4s; }
.scene-title { margin-right: auto; font-size: 24px; font-weight: 700; }
#scene.quiet .scene-bar { opacity: 0; pointer-events: none; }

.help-box { max-width: 900px; margin: 0 0 18px; padding: 20px 26px; border-radius: 18px; background: var(--surface); }
.help-box h3 { margin: 0 0 10px; font-size: 22px; }
.help-box ul { margin: 0; padding-left: 22px; }
.help-box li, .help-box p { font-size: 18px; line-height: 1.55; color: #d5dae0; margin: 6px 0; }
@media (max-width: 760px) {
  .star { width: 40px; height: 40px; font-size: 20px; }
  .hs-clock { font-size: 30px; }
  .hs-date { font-size: 13px; }
  .hs-weather { min-height: 44px; padding: 0 14px; gap: 8px; }
  .hs-weather .muted { display: none; }
  .wx-now { padding: 16px; gap: 14px; }
  .wx-icon { font-size: 56px; }
  .wx-temp { font-size: 46px; }
  .wx-day { grid-template-columns: 1fr 40px 50px 100px; font-size: 15px; padding: 12px 14px; }
  .scene-tile { min-height: 120px; }
  .help-box li, .help-box p { font-size: 15px; }
}

/* ---------------------------------------------------------------------------------
   Games (games.js)
   --------------------------------------------------------------------------------- */
.game-g2048 { background: linear-gradient(135deg, #f59e0b, #b45309); }
.game-snake { background: linear-gradient(135deg, #0891b2, #134e4a); }
.game-ttt { background: linear-gradient(135deg, #7c3aed, #312e81); }
.game-memory { background: linear-gradient(135deg, #e11d48, #701a75); }
.game-head { display: flex; align-items: center; gap: 18px; }
.game-head .section-title { margin-right: auto; }
.game-score { font-size: 20px; font-weight: 700; color: var(--accent); }
.game-board { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 10px; touch-action: none; user-select: none; -webkit-user-select: none; }
.g2048 { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: min(560px, 92vw, calc(100vh - 260px)); aspect-ratio: 1; padding: 12px; border-radius: 18px; background: #2a2f3a; }
.g2048 .t { display: grid; place-items: center; border-radius: 10px; background: #3a404d; font-size: clamp(22px, 5vh, 44px); font-weight: 800; color: #fff; }
.t2 { background: #475569 !important; } .t4 { background: #64748b !important; } .t8 { background: #f59e0b !important; }
.t16 { background: #f97316 !important; } .t32 { background: #ef4444 !important; } .t64 { background: #dc2626 !important; }
.t128 { background: #eab308 !important; } .t256 { background: #ca8a04 !important; } .t512 { background: #22c55e !important; }
.t1024 { background: #0ea5e9 !important; font-size: clamp(18px, 4vh, 34px) !important; } .t2048, .t4096 { background: #a855f7 !important; font-size: clamp(18px, 4vh, 34px) !important; }
.game-over { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 18px; background: rgba(0, 0, 0, 0.6); font-size: 30px; font-weight: 800; }
.snake { border-radius: 14px; }
.ttt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(460px, 90vw, calc(100vh - 280px)); aspect-ratio: 1; }
.ttt-cell { min-height: 0; padding: 0; font-size: clamp(40px, 9vh, 80px); font-weight: 800; border-radius: 16px; background: var(--surface-2); }
.ttt-cell.X { color: var(--accent); } .ttt-cell.O { color: #f43f5e; }
.memory { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: min(560px, 92vw, calc(100vh - 260px)); aspect-ratio: 1; }
.mem-card { min-height: 0; padding: 0; font-size: clamp(30px, 7vh, 56px); border-radius: 14px; background: linear-gradient(135deg, #1e3a5f, #0f172a); }
.mem-card.up { background: var(--surface-2); }
.mem-card.done { opacity: 0.45; }

/* ---------------------------------------------------------------------------------
   Player extras: speed, sound only, loading steps (app.js)
   --------------------------------------------------------------------------------- */
#speed-options { display: flex; gap: 8px; padding: 0 12px; flex-wrap: wrap; }
#speed-options button { flex: 1; min-width: 80px; min-height: 56px; padding: 0 10px; font-size: 17px; border-radius: 14px; }
#speed-options button.on { background: rgba(0, 169, 240, 0.14); border-color: rgba(0, 169, 240, 0.45); color: var(--accent); }
#speed-options button:disabled { opacity: 0.35; }
.switch-row small { display: block; margin-top: 2px; font-size: 14px; font-weight: 500; color: var(--muted); }
#load-step {
  position: absolute; left: 0; right: 0; bottom: calc(14% - 40px); z-index: 1; text-align: center;
  font-size: 18px; font-weight: 600; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  opacity: 0; transition: opacity 0.35s; pointer-events: none;
}
#stage.starting #load-step { opacity: 1; }
#audio-card {
  position: absolute; inset: 0; z-index: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 50% 40%, #1c2a3a, #07090c 70%); pointer-events: none;
}
.radio-art.wide { width: 360px; height: 202px; border-radius: 20px; background: #000; }
.radio-art.wide img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 760px) {
  #load-step { font-size: 13px; bottom: calc(14% - 28px); }
  .radio-art.wide { width: 220px; height: 124px; }
}

/* ---------------------------------------------------------------------------------
   Library, Shorts, channel extras (ytx.js)
   --------------------------------------------------------------------------------- */
.badge.live { background: #e5484d; color: #fff; font-weight: 800; letter-spacing: 0.06em; }
.shorts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; margin-top: 18px; }
.short-card { position: relative; display: block; min-height: 0; padding: 0; overflow: hidden; border: 0; border-radius: 18px; aspect-ratio: 9 / 16; background: var(--surface); text-align: left; }
.short-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.short-title {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 12px 30px; font-size: 16px; font-weight: 700; line-height: 1.25;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85)); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.short-views { position: absolute; left: 12px; bottom: 10px; font-size: 13px; color: #d5dae0; font-weight: 600; }
.channel-head { position: relative; flex-wrap: wrap; }
.channel-head .star { position: static; margin-left: auto; background: var(--surface-2); }
.sub-btn { min-width: 160px; }
.sub-btn.on { background: var(--surface-2); color: var(--text); }
.channel-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.channel-tools .chips { flex: none; }
.channel-tools .media-search { margin-left: auto; }
@media (max-width: 760px) {
  .shorts-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .short-title { font-size: 13px; }
  .channel-tools .media-search { margin-left: 0; width: 100%; }
}

/* ---------------------------------------------------------------------------------
   Profiles, PIN pad, kids mode (profiles.js)
   --------------------------------------------------------------------------------- */
#nav-profile { display: flex; align-items: center; gap: 10px; padding: 0 16px 0 8px; border-radius: 999px; background: var(--surface-2); border-color: transparent; }
.pf-dot { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; font-size: 20px; font-weight: 800; color: #fff; }
.pf-dot.flip { animation: pf-flip 0.6s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes pf-flip { 0% { transform: rotateY(0) scale(1); } 45% { transform: rotateY(90deg) scale(0.7); } 100% { transform: rotateY(0) scale(1); } }
.pf-name { font-size: 18px; font-weight: 700; }

/* The full-screen chooser: a soft colour glow behind the tiles, which pop in one by one. */
#who, #pin {
  position: fixed; inset: 0; z-index: 65; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 30%, rgba(0, 169, 240, 0.18), transparent 60%), rgba(5, 6, 8, 0.94);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: who-in 0.35s ease-out;
}
#pin { z-index: 70; }
@keyframes who-in { from { opacity: 0; } to { opacity: 1; } }
#who.leaving, #pin.leaving { animation: who-out 0.5s ease-in forwards; }
@keyframes who-out { to { opacity: 0; transform: scale(1.06); } }
.who-card { width: min(940px, 100%); max-height: 100%; overflow-y: auto; text-align: center; }
.who-title { margin: 0 0 34px; font-size: 42px; font-weight: 800; letter-spacing: -0.02em; animation: who-title 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes who-title { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: none; } }
.who-title.hi { animation: who-hi 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; color: var(--accent); }
@keyframes who-hi { from { opacity: 0.2; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
.who-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 26px; margin-bottom: 26px; }

.who-p {
  flex-direction: column; gap: 14px; min-height: 0; padding: 12px; border-color: transparent; background: transparent;
  animation: who-pop 0.6s cubic-bezier(0.2, 1.1, 0.3, 1.25) both; animation-delay: calc(var(--i, 0) * 80ms + 120ms);
  transition: transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1), opacity 0.35s, filter 0.35s;
}
@keyframes who-pop { from { opacity: 0; transform: translateY(40px) scale(0.6); } to { opacity: 1; transform: none; } }
.who-p:active { transform: scale(0.92); background: transparent; }
.who-p.fresh .who-dot { animation: who-fresh 0.9s cubic-bezier(0.2, 1.2, 0.3, 1.4); }
@keyframes who-fresh { 0% { transform: scale(0.3) rotate(-25deg); } 60% { transform: scale(1.18) rotate(6deg); } 100% { transform: none; } }
.who-dot {
  position: relative; width: 132px; height: 132px; display: grid; place-items: center; border-radius: 30px;
  font-size: 58px; font-weight: 800; color: #fff; background: var(--surface-3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), inset 0 -8px 20px rgba(0, 0, 0, 0.18);
  transition: transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1), box-shadow 0.3s;
}
.who-dot.big { width: 120px; height: 120px; font-size: 52px; margin: 0 auto 6px; }
.who-dot.bump { animation: who-bump 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes who-bump { 0% { transform: scale(0.86); } 100% { transform: scale(1); } }
.who-p:hover .who-dot { transform: translateY(-6px) scale(1.06); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5); }
.who-ring { position: absolute; inset: -6px; border-radius: 36px; border: 3px solid rgba(255, 255, 255, 0.9); opacity: 0; transform: scale(0.9); }
.who-lock { position: absolute; right: -8px; bottom: -8px; display: grid; place-items: center; width: 40px; height: 40px; font-size: 20px; border-radius: 50%; background: #1d2027; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
.who-p.add .who-dot, .who-p.join .who-dot { background: rgba(255, 255, 255, 0.07); border: 2px dashed rgba(255, 255, 255, 0.3); color: rgba(255, 255, 255, 0.75); box-shadow: none; }
.who-p.join .who-dot { font-size: 46px; }
.who-name { max-width: 150px; font-size: 21px; font-weight: 700; line-height: 1.2; }
/* Chosen: it springs forward with a ring that pulses out; the others shrink and fade. */
.who-card.chosen .who-p:not(.picked) { opacity: 0; transform: scale(0.6) translateY(20px); filter: blur(6px); pointer-events: none; }
.who-p { max-width: 240px; }
.who-card.chosen .who-p:not(.picked) { max-width: 0; padding-left: 0; padding-right: 0; margin: 0 -13px; overflow: hidden; transition: max-width 0.5s ease-in-out 0.1s, opacity 0.3s, transform 0.3s, filter 0.3s, padding 0.5s; }
.who-card.chosen .who-manage { opacity: 0; }
.who-p.picked { transform: scale(1.22); }
.who-p.picked .who-dot { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.15), 0 24px 60px rgba(0, 169, 240, 0.45); }
.who-p.picked .who-ring { animation: who-ring 0.7s ease-out infinite; }
@keyframes who-ring { 0% { opacity: 0.9; transform: scale(0.95); } 100% { opacity: 0; transform: scale(1.5); } }
/* Edit mode: the tiles gently wobble. */
.who-row.editing .who-p:not(.add):not(.join) .who-dot { animation: who-wobble 0.5s ease-in-out infinite alternate; outline: 3px dashed rgba(255, 255, 255, 0.55); outline-offset: 5px; }
@keyframes who-wobble { from { transform: rotate(-2.5deg); } to { transform: rotate(2.5deg); } }
.who-manage { min-height: 52px; transition: opacity 0.3s; }

/* Make / edit form: it slides up; colour swatches pop one by one. */
.who-edit { max-width: 540px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; text-align: left; animation: who-slide 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.1) both; }
@keyframes who-slide { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
.who-edit input { min-height: 62px; padding: 0 20px; font: inherit; font-size: 21px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; }
.who-edit input:focus { outline: 2px solid var(--accent); }
.who-edit input.shake { animation: who-shake 0.4s; }
@keyframes who-shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.who-edit .muted { margin: 0; font-size: 17px; line-height: 1.5; }
.swatches { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; padding: 6px 0; }
.swatch { width: 50px; height: 50px; min-height: 0; padding: 0; border-radius: 50%; border: 3px solid transparent; animation: who-pop 0.5s cubic-bezier(0.2, 1.1, 0.3, 1.4) both; animation-delay: calc(var(--i) * 40ms + 200ms); transition: transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1), border-color 0.2s; }
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: #fff; transform: scale(1.18); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15); }
.who-buttons { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.who-buttons button { min-width: 140px; }
.who-buttons .danger { color: #ff8f8f; }

/* PIN pad: dots pop as they fill, shake when wrong, turn green when right. */
.pin-card { width: auto; }
.pin-card h2 { margin: 0 0 22px; font-size: 30px; font-weight: 800; animation: who-title 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.pin-dots { display: flex; justify-content: center; gap: 22px; margin-bottom: 10px; }
.pin-dots span { width: 24px; height: 24px; border-radius: 50%; border: 3px solid #4b5360; transition: background 0.15s, border-color 0.15s; }
.pin-dots span.on { background: var(--accent); border-color: var(--accent); animation: pin-pop 0.3s cubic-bezier(0.3, 1.7, 0.5, 1); }
@keyframes pin-pop { 0% { transform: scale(0.5); } 100% { transform: scale(1); } }
.pin-dots.bad { animation: who-shake 0.45s; }
.pin-dots.bad span { background: #ef4444; border-color: #ef4444; }
.pin-dots.ok span { background: #22c55e; border-color: #22c55e; animation: pin-ok 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pin-ok { 0% { transform: scale(1); } 50% { transform: scale(1.5); } 100% { transform: scale(1); } }
.pin-msg { min-height: 1.5em; margin-bottom: 14px; font-size: 17px; color: #ff8f8f; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 96px); gap: 14px; justify-content: center; animation: who-slide 0.45s 0.1s cubic-bezier(0.2, 0.9, 0.3, 1.1) both; }
.pin-key { min-height: 80px; font-size: 30px; border-radius: 22px; transition: transform 0.12s cubic-bezier(0.3, 1.6, 0.5, 1), background 0.12s; }
.pin-key:active { transform: scale(0.9); background: var(--accent); }
.pin-key.small { font-size: 17px; color: var(--muted); background: transparent; border-color: transparent; }

body.kids-mode #search-form, body.kids-mode #nav-account, body.kids-mode #settings-toggle { display: none; }
.kids-channels { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; padding: 6px 0; touch-action: pan-x; }
.kids-ch { flex-direction: column; gap: 10px; min-width: 130px; padding: 12px; font-size: 16px; font-weight: 700; background: var(--surface); }
.kids-ch img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.kids-allow { min-height: 56px; }

@media (max-width: 760px) {
  .pf-name { display: none; }
  #nav-profile { padding: 0 4px; }
  .pf-dot { width: 36px; height: 36px; font-size: 16px; }
  .who-title { font-size: 26px; margin-bottom: 22px; }
  .who-row { gap: 12px; }
  .who-dot { width: 86px; height: 86px; font-size: 38px; border-radius: 22px; }
  .who-dot.big { width: 90px; height: 90px; font-size: 40px; }
  .who-name { font-size: 14px; max-width: 100px; }
  .who-lock { width: 30px; height: 30px; font-size: 14px; }
  .swatch { width: 40px; height: 40px; }
  .who-edit input { min-height: 50px; font-size: 17px; }
  .pin-card h2 { font-size: 22px; }
  .pin-pad { grid-template-columns: repeat(3, 74px); }
  .pin-key { min-height: 62px; font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  #who *, #pin *, .pf-dot { animation: none !important; transition: none !important; }
}


/* Captions picker (features.js) */
#cc-options { display: flex; gap: 8px; padding: 0 12px; flex-wrap: wrap; }
#cc-options button { min-height: 52px; padding: 0 16px; font-size: 16px; border-radius: 14px; }
#cc-options button.on { background: rgba(0, 169, 240, 0.14); border-color: rgba(0, 169, 240, 0.45); color: var(--accent); }
#cc-options small { align-self: center; color: var(--muted); font-size: 14px; }
.stream-open { display: flex; gap: 10px; }
.stream-open input { min-width: 200px; }
.media-tile .media-art img[src*="jtv"], .media-tile .media-art img[src*="kick"] { max-width: 100%; max-height: 100%; object-fit: cover; }

/* ---------------------------------------------------------------------------------
   "Make a profile" pop-up (maker.js): cyan, with plenty of motion
   --------------------------------------------------------------------------------- */
#maker {
  position: fixed; inset: 0; z-index: 66; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 35%, rgba(0, 169, 240, 0.28), transparent 62%), rgba(4, 6, 9, 0.88);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  animation: who-in 0.35s ease-out;
}
#maker.leaving { animation: who-out 0.4s ease-in forwards; }
.maker-card {
  position: relative; width: min(720px, 100%); max-height: 100%; overflow-y: auto; padding: 34px 38px 30px; text-align: center;
  border-radius: 30px; background: linear-gradient(180deg, #14202b, #0d1218 70%);
  border: 1px solid rgba(0, 169, 240, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 169, 240, 0.12), 0 30px 90px rgba(0, 0, 0, 0.65), 0 0 80px rgba(0, 169, 240, 0.22);
  animation: mk-card 0.7s cubic-bezier(0.2, 1.1, 0.3, 1.2) both;
}
@keyframes mk-card { from { opacity: 0; transform: translateY(50px) scale(0.86); } to { opacity: 1; transform: none; } }
/* A cyan light that slowly sweeps along the top edge. */
.maker-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, #00a9f0, #7dd3fc, #00a9f0, transparent); background-size: 200% 100%;
  animation: mk-sweep 2.6s linear infinite;
}
@keyframes mk-sweep { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.mk-title { margin: 6px 0 8px; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; animation: who-title 0.55s 0.15s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.mk-sub { margin: 0 auto 18px; max-width: 560px; font-size: 19px; line-height: 1.5; color: #b6c6d4; animation: who-title 0.55s 0.25s both; }
.mk-foot { margin: 16px 0 4px; font-size: 16px; color: #7fa4bd; animation: who-title 0.55s 1s both; }

/* Hero: a floating avatar with three dots orbiting it. */
.mk-hero { position: relative; width: 150px; height: 150px; margin: 0 auto 6px; animation: mk-float 3.4s ease-in-out infinite; }
@keyframes mk-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.orbit { position: absolute; inset: 0; animation: mk-spin linear infinite; }
.orbit i { position: absolute; left: 50%; top: -4px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #4cc6ff; box-shadow: 0 0 14px 3px rgba(0, 169, 240, 0.8); }
.orbit.o1 { animation-duration: 4s; }
.orbit.o2 { inset: 14px; animation-duration: 6s; animation-direction: reverse; }
.orbit.o2 i { width: 9px; height: 9px; background: #fff; box-shadow: 0 0 12px 3px rgba(255, 255, 255, 0.6); }
.orbit.o3 { inset: -10px; animation-duration: 9s; }
.orbit.o3 i { width: 7px; height: 7px; background: #22d3ee; }
@keyframes mk-spin { to { transform: rotate(360deg); } }
.mk-avatar {
  position: relative; display: grid; place-items: center; width: 132px; height: 132px; margin: 0 auto; border-radius: 34px;
  font-size: 60px; font-weight: 800; color: #fff; background: var(--c, #00a9f0);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5), inset 0 -10px 24px rgba(0, 0, 0, 0.2), 0 0 40px color-mix(in srgb, var(--c, #00a9f0) 50%, transparent);
}
.mk-avatar.small { position: absolute; inset: 22px; width: auto; height: auto; border-radius: 30px; font-size: 54px; }
.mk-avatar.huge { width: 150px; height: 150px; font-size: 68px; border-radius: 40px; }
/* Spinning light ring around the avatar while you design it. */
.mk-form .mk-avatar::before {
  content: ""; position: absolute; inset: -9px; border-radius: 42px; z-index: -1;
  background: conic-gradient(from 0deg, #00a9f0, transparent 30%, #7dd3fc 50%, transparent 80%, #00a9f0);
  animation: mk-spin 3s linear infinite; filter: blur(2px);
}
.mk-avatar.bump { animation: who-bump 0.4s cubic-bezier(0.3, 1.7, 0.5, 1); }

/* Benefit rows slide in one after another. */
.mk-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; }
.mk-row {
  display: flex; gap: 14px; padding: 16px; border-radius: 18px; background: rgba(0, 169, 240, 0.07); border: 1px solid rgba(0, 169, 240, 0.2);
  animation: mk-row 0.6s cubic-bezier(0.2, 1, 0.3, 1.15) both; animation-delay: calc(var(--i) * 110ms + 380ms);
  transition: transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1), background 0.25s;
}
.mk-row:hover { transform: translateY(-4px) scale(1.02); background: rgba(0, 169, 240, 0.13); }
@keyframes mk-row { from { opacity: 0; transform: translateX(46px) scale(0.92); } to { opacity: 1; transform: none; } }
.mk-ico { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; font-size: 28px; color: #fff; background: linear-gradient(135deg, #00a9f0, #0078b3); box-shadow: 0 6px 18px rgba(0, 169, 240, 0.4); }
.mk-row b { display: block; margin-bottom: 4px; font-size: 19px; }
.mk-row span { font-size: 15.5px; line-height: 1.45; color: #aebfcd; }

.mk-buttons { display: flex; justify-content: center; gap: 14px; margin-top: 20px; animation: who-title 0.55s 1.1s both; }
.mk-form .mk-buttons { animation: none; }
.mk-later { min-width: 130px; color: #9db3c4; background: transparent; border-color: rgba(255, 255, 255, 0.12); }
.mk-go { position: relative; overflow: hidden; min-width: 240px; font-weight: 800; background: linear-gradient(135deg, #00b6ff, #0090d8); border: 0; box-shadow: 0 10px 30px rgba(0, 169, 240, 0.5); animation: mk-pulse 2.2s ease-in-out infinite; }
.mk-go::after { content: ""; position: absolute; top: 0; bottom: 0; width: 60px; left: -80px; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent); animation: mk-shine 2.6s ease-in-out infinite; }
@keyframes mk-pulse { 0%, 100% { box-shadow: 0 10px 30px rgba(0, 169, 240, 0.45); } 50% { box-shadow: 0 10px 46px rgba(0, 169, 240, 0.85); } }
@keyframes mk-shine { 0% { left: -80px; } 55%, 100% { left: 120%; } }

/* The make-it form. */
.mk-form { display: flex; flex-direction: column; gap: 18px; align-items: center; max-width: 520px; margin: 14px auto 0; animation: who-slide 0.5s 0.1s cubic-bezier(0.2, 0.9, 0.3, 1.1) both; }
.mk-form input { width: 100%; min-height: 62px; padding: 0 20px; font: inherit; font-size: 22px; text-align: center; color: var(--text); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(0, 169, 240, 0.3); border-radius: 16px; }
.mk-form input:focus { outline: 2px solid #00a9f0; box-shadow: 0 0 24px rgba(0, 169, 240, 0.35); }
.mk-form input.shake { animation: who-shake 0.4s; }
.mk-form .switch-row { width: 100%; text-align: left; }

/* Building: a ring draws itself around the avatar, then everything pops. */
.mk-build { padding: 10px 0 6px; }
.mk-big { position: relative; width: 210px; height: 210px; margin: 0 auto 8px; display: grid; place-items: center; }
.mk-big svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); filter: drop-shadow(0 0 10px rgba(0, 169, 240, 0.7)); }
.mk-big .track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 7; }
.mk-big .ring { fill: none; stroke: #00b6ff; stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 0.12s linear; }
.mk-build:not(.done) .mk-avatar { animation: mk-breathe 1.4s ease-in-out infinite; }
@keyframes mk-breathe { 0%, 100% { transform: scale(0.96); } 50% { transform: scale(1.04); } }
.mk-build.done .mk-avatar { animation: mk-pop 0.7s cubic-bezier(0.2, 1.4, 0.3, 1.5); }
@keyframes mk-pop { 0% { transform: scale(0.8) rotate(-8deg); } 55% { transform: scale(1.22) rotate(4deg); } 100% { transform: none; } }
.mk-build.done .ring { stroke: #fff; animation: mk-flash 0.8s ease-out; }
@keyframes mk-flash { 0% { stroke-width: 7; } 40% { stroke-width: 18; opacity: 1; } 100% { stroke-width: 7; opacity: 0.7; } }
.mk-build.done .mk-title { color: #4cc6ff; animation: who-hi 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4) both; }
.dots i { font-style: normal; animation: mk-dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; } .dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes mk-dot { 0%, 70%, 100% { opacity: 0.2; } 35% { opacity: 1; } }

/* Confetti flies out of whatever it's launched from. */
.confetti { position: absolute; left: 50%; top: 50%; z-index: 5; border-radius: 2px; pointer-events: none; animation: confetti 1.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards; }
@keyframes confetti {
  0% { transform: translate(-50%, -50%) rotate(0) scale(1); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y) + 120px)) rotate(var(--r)) scale(0.6); opacity: 0; }
}
.guest-tip { margin: 26px auto 0; max-width: 560px; }
.guest-tip p { font-size: 17px; line-height: 1.5; }

@media (max-width: 760px) {
  .maker-card { padding: 22px 18px 20px; border-radius: 24px; }
  .mk-title { font-size: 24px; }
  .mk-sub { font-size: 15px; }
  .mk-hero { width: 110px; height: 110px; }
  .mk-avatar.small { inset: 16px; font-size: 38px; }
  .mk-avatar { width: 100px; height: 100px; font-size: 44px; }
  .mk-avatar.huge { width: 110px; height: 110px; font-size: 48px; }
  .mk-big { width: 160px; height: 160px; }
  .mk-rows { grid-template-columns: 1fr; gap: 10px; }
  .mk-row { padding: 12px; }
  .mk-ico { width: 42px; height: 42px; font-size: 22px; }
  .mk-row b { font-size: 16px; } .mk-row span { font-size: 13.5px; }
  .mk-go { min-width: 0; flex: 1; }
  .mk-form input { min-height: 50px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  #maker *, #maker { animation-duration: 0.01s !important; animation-iteration-count: 1 !important; transition: none !important; }
  .confetti { display: none; }
}
@media (max-height: 860px) and (min-width: 761px) {
  .maker-card { padding: 22px 30px 20px; }
  .mk-hero { width: 96px; height: 96px; margin-bottom: 0; }
  .mk-avatar.small { inset: 14px; font-size: 36px; border-radius: 22px; }
  .mk-title { font-size: 28px; margin: 2px 0 4px; }
  .mk-sub { font-size: 16px; margin-bottom: 12px; }
  .mk-rows { gap: 10px; }
  .mk-row { padding: 11px 13px; gap: 12px; }
  .mk-ico { width: 42px; height: 42px; font-size: 23px; }
  .mk-row b { font-size: 17px; margin-bottom: 2px; }
  .mk-row span { font-size: 14px; line-height: 1.35; }
  .mk-foot { margin: 10px 0 0; font-size: 14px; }
  .mk-buttons { margin-top: 12px; }
  .mk-avatar { width: 104px; height: 104px; font-size: 46px; }
  .mk-form { gap: 12px; }
  .mk-form input { min-height: 52px; }
}

#sleep-options { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 22px 18px; }
#sleep-options button { flex: 1 1 auto; min-height: 56px; padding: 0 14px; font-size: 18px; }
#sleep-options button.on { background: var(--accent); color: #fff; border-color: transparent; }
