:root {
    --ink: #fff7ec;
    --card: rgba(24, 18, 56, 0.78);
    --line: rgba(255, 255, 255, 0.16);
    --gold: #ffcf3f;
    --gold-ink: #3b2200;
    --red: #ff5a5f;
  }
  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: #1b1540 linear-gradient(180deg, #2a3478 0%, #4b3d8f 38%, #241c55 75%, #171236 100%);
    font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
  }
  main { max-width: 1100px; margin: 0 auto; padding: 22px 16px 48px; }
  .top { text-align: center; }
  h1 {
    margin: 6px 0 0;
    font-size: clamp(44px, 11vw, 96px);
    line-height: 0.95;
    letter-spacing: 0.02em;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 4px 0 #b4561f, 0 10px 24px rgba(0, 0, 0, 0.35);
  }
  .tag { margin: 12px auto 18px; font-size: clamp(17px, 3.6vw, 23px); max-width: 30em; }
  .tag b { color: var(--gold); }
  .stage {
    position: relative;
    border-radius: 26px;
    overflow: hidden;
    border: 4px solid #2c2160;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    background: #2a3478;
  }

  .hint {
    position: absolute; left: 12px; top: 10px;
    font-size: 13px; font-weight: 800; letter-spacing: 0.04em;
    background: rgba(0, 0, 0, 0.35); padding: 4px 10px; border-radius: 999px;
    pointer-events: none;
  }
  .controls { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 18px 0 8px; }
  .bark {
    font: inherit; font-weight: 900; font-size: 28px; letter-spacing: 0.06em;
    color: var(--gold-ink); background: var(--gold);
    border: 0; border-radius: 999px; padding: 14px 38px;
    box-shadow: 0 6px 0 #c47a12, 0 12px 24px rgba(0, 0, 0, 0.3);
    cursor: pointer; transition: transform 0.06s;
  }
  .bark:active { transform: translateY(4px); box-shadow: 0 2px 0 #c47a12; }
  .count { font-size: 18px; }
  .count b { font-size: 26px; color: var(--gold); }
  .ghost {
    font: inherit; font-size: 14px; color: var(--ink); background: transparent;
    border: 2px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer;
  }
  .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; }
  @media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
  .card { background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 20px; }
  .card h2 { margin: 0 0 8px; font-size: 22px; }
  .story p { margin: 0 0 10px; }
  .story .punch { font-weight: 900; color: var(--gold); font-size: 19px; }
  .clip {
    display: block; position: relative; overflow: hidden; min-height: 230px;
    text-decoration: none; color: var(--ink);
    background:
      repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.045) 0 2px, transparent 2px 4px),
      radial-gradient(circle at 50% 45%, #3c4b5e 0%, #161b24 75%);
  }
  .cam-top { display: flex; justify-content: space-between; font-family: ui-monospace, Menlo, monospace; font-size: 13px; letter-spacing: 0.08em; opacity: 0.9; }
  .rec::before {
    content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    background: var(--red); margin-right: 6px; animation: blink 1s steps(2) infinite;
  }
  @keyframes blink { 50% { opacity: 0; } }
  .play {
    width: 74px; height: 74px; border-radius: 50%; margin: 28px auto 12px;
    background: rgba(255, 255, 255, 0.92); display: grid; place-items: center;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4); transition: transform 0.15s;
  }
  .play::after {
    content: ""; margin-left: 6px;
    border-left: 24px solid #1b1540; border-top: 15px solid transparent; border-bottom: 15px solid transparent;
  }
  .clip:hover .play { transform: scale(1.08); }
  .clip-text { text-align: center; font-weight: 800; font-size: 19px; }
  .clip-sub { text-align: center; font-size: 13px; opacity: 0.75; }
  .coin { margin-top: 18px; display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
  .coin img { width: 120px; height: 120px; border-radius: 50%; border: 4px solid var(--gold); display: block; }
  .ticker { font-weight: 900; font-size: 26px; color: var(--gold); letter-spacing: 0.08em; }
  .ca { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
  .ca code {
    flex: 1 1 240px; font-family: ui-monospace, Menlo, monospace; font-size: 14px;
    background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 12px;
    padding: 10px 12px; word-break: break-all;
  }
  .btn {
    font: inherit; font-weight: 800; border-radius: 12px; padding: 10px 14px; border: 0;
    background: var(--gold); color: var(--gold-ink); cursor: pointer; text-decoration: none; display: inline-block;
  }
  .btn[disabled] { opacity: 0.45; cursor: default; }
  .btn.alt { background: transparent; color: var(--ink); border: 2px solid var(--line); }
  .links { display: flex; gap: 10px; flex-wrap: wrap; }
  @media (max-width: 560px) {
    .coin { grid-template-columns: 1fr; text-align: center; }
    .coin img { margin: 0 auto; }
    .links, .ca { justify-content: center; }
    .bark { font-size: 24px; padding: 12px 30px; }
  }
  .xpost { margin-top: 18px; }
  footer { text-align: center; margin-top: 28px; font-weight: 800; letter-spacing: 0.08em; opacity: 0.8; }

/* Stable geometry and keyboard controls. */
html { scroll-behavior: smooth; }
body { overflow-x: clip; }
main:focus { outline: none; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #fff7ec; outline-offset: 5px; }
.skip-link { position: fixed; left: 16px; top: -90px; z-index: 10; padding: 12px 20px; background: #fff7ec; color: #22163f; border-radius: 10px; font-weight: 800; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.stage { isolation: isolate; }
.hint { color: #fff; background: #22163fe6; }
.chapter { position: absolute; right: 14px; bottom: 12px; padding: 5px 12px; border-radius: 99px; background: #22163fe6; color: #fff7ec; font-size: 13px; font-weight: 800; pointer-events: none; }
.sound-controls { display: flex; justify-content: center; align-items: center; gap: 10px 20px; flex-wrap: wrap; min-height: 54px; padding: 8px 0; }
.ghost { background: #241b50; min-height: 44px; }
#sound { min-width: 162px; }
#pause { min-width: 112px; }
.volume { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.volume input { width: 104px; height: 44px; accent-color: #ffcf3f; cursor: pointer; }
.volume output { min-width: 4ch; font-variant-numeric: tabular-nums; }
.count { min-width: 200px; }
.count b { display: inline-block; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }
.card { box-shadow: inset 0 1px 0 #ffffff10; }
.clip:hover { border-color: #ffcf3f; }
.clip-sub { opacity: 1; color: #ddd8f0; }
.btn.alt:hover, .ghost:hover { background: #3c2c6d; border-color: #ffcf3f; }
.coin > div { min-width: 0; }
#copy { min-width: 88px; }
.chart { margin-top: 18px; height: 430px; padding: 8px; overflow: hidden; }
.chart iframe { width: 100%; height: 100%; border: 0; border-radius: 14px; }
.xpost { height: 640px; overflow: auto; contain: layout; }
.xpost a { color: #ffcf3f; }
.twitter-tweet { margin: 0 auto !important; }
.scene-paused *, .frozen * { animation-play-state: paused !important; }
.frozen #scene * { animation: none !important; }
@media (max-width: 679px) {

  .chapter { right: 8px; bottom: 8px; font-size: 11px; }
  .hint { left: 8px; top: 8px; font-size: 11px; }
  .controls { gap: 12px; }
  .count { min-width: 170px; font-size: 15px; }
  .sound-controls { gap: 6px 12px; }
  .volume { order: 3; justify-content: center; flex-basis: 100%; }
  .volume input { width: 155px; }
  .chart { height: 400px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Reserve the scene box, then reveal its first fully posed frame. */
.stage { visibility: hidden; }
.scene-ready .stage { visibility: visible; }

/* Native video stays inside its original uncropped 16:9 frame. */
.footage { padding: 10px; overflow: hidden; align-self: start; }
.video-shell { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #14121d; border-radius: 14px; overflow: hidden; }
.video-shell video { display: block; width: 100%; height: 100%; object-fit: contain; background: #14121d; }
.video-shell .clip { position: absolute; inset: 0; min-height: 0; padding: 16px; }
.video-shell .play { width: 58px; height: 58px; margin: 14px auto 6px; }
.video-shell .clip-text { font-size: 17px; }
.video-shell .clip-sub { font-size: 12px; }
.footage-caption { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px 14px; padding: 12px 8px 6px; }
.footage-caption strong { font-size: 14px; }
.footage-caption small { font-size: 12px; color: #ddd8f0; }
.footage-caption a { color: #ffcf3f; text-underline-offset: 3px; }
@media (max-width: 560px) {
  .video-shell .clip { padding: 10px; }
  .video-shell .cam-top { font-size: 10px; }
  .video-shell .play { width: 42px; height: 42px; margin: 7px auto 4px; }
  .video-shell .play::after { border-left-width: 16px; border-top-width: 10px; border-bottom-width: 10px; }
  .video-shell .clip-text { font-size: 14px; }
  .video-shell .clip-sub { font-size: 10px; }
}


/* V5 native-video stage: intrinsic geometry stays fixed through every state. */
.stage { visibility: visible; aspect-ratio: 16 / 9; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.stage:focus-visible { outline: 3px solid #fff7ec; outline-offset: 5px; }
.hero-poster, #hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
#hero-video { opacity: 0; }
.hero-playing #hero-video, .hero-loaded #hero-video { opacity: 1; }
.poster-only #hero-video { opacity: 0; }
.hint { transition: opacity .25s ease; }
.has-barked .hint { opacity: 0; }
.chapter { width: 250px; height: 30px; text-align: center; white-space: nowrap; }
#real-sound { min-width: 148px; }
#real-sound:disabled { opacity: .55; cursor: default; }
#bark-pop { position: absolute; left: 22%; top: 43%; transform: translate(-50%,-50%); opacity: 0; color: white; font-size: clamp(19px,3.5vw,44px); line-height: 1.1; font-weight: 900; letter-spacing: .02em; text-shadow: 0 3px 0 #18213c,2px 0 #18213c,-2px 0 #18213c; pointer-events: none; }
@media (max-width: 679px) { .chapter { width: 180px; height: 26px; font-size: 10px; padding: 5px 6px; right: 6px; bottom: 6px; } .hint { font-size: 9px; padding: 3px 7px; top: 6px; left: 6px; } }
