.case-study { color: #242226; }
.case-heading { margin-bottom: 24px; padding-right: 12px; }
.case-heading .case-platform { color: #625f64; font-size: 16px; font-weight: 600; line-height: 1.5; margin: 0 0 6px; }
.case-heading h2 { font-size: clamp(36px, 5vw, 57px); font-weight: 670; letter-spacing: -.05em; line-height: 1.13; margin: 0; }
.case-heading > p:last-child { color: #565158; font-size: clamp(18px, 2.5vw, 22px); line-height: 1.5; margin: 12px 0 0; }
.case-study h3 { margin: 0; font-size: clamp(22px, 3vw, 28px); line-height: 1.25; letter-spacing: -.035em; }
.case-nowrap { white-space: nowrap; }
case-game-film, case-gate-demo, case-bead-board { display: block; }
case-game-film { border-radius: 20px; overflow: hidden; background: #19171b; color: #fff; }
case-game-film video { width: 100%; height: auto; display: block; background: #151318; aspect-ratio:16/9; }
.case-chapters { display: flex; padding: 4px 7px; border-top: 1px solid #443c43; }
.case-chapters button { appearance: none; border: 0; outline-offset: -3px; background: transparent; color: #cdc2c6; padding: 0 10px; height: 45px; flex: 1; font-size: 16px; font-weight: 550; position: relative; border-radius: 9px; }
.case-chapters button[aria-pressed=true] { color: #fff; background: #392d33; }
.case-chapters button[aria-pressed=true]::after { content: ''; display: block; position: absolute; bottom: 3px; left: 45%; right: 45%; height: 2px; background: #e8b6bc; border-radius: 2px; }
.case-section { margin-top: clamp(28px,5vw,44px); }
.case-section > p, .bead-export p { font-size: 17px; line-height: 1.55; color: #58555b; margin: 8px 0 16px; }
case-gate-demo { overflow: hidden; border-radius: 18px; border: 1px solid #dbd4d4; background: #f0eded; }
.gate-scene { display: grid; place-items: center; padding: clamp(22px,5vw,36px) 18px; background: radial-gradient(ellipse at 50% 100%,#50303a 0,#36262e 45%,#241c22 100%); }
.gate-track { width: 100%; max-width: 430px; aspect-ratio: 5 / 1; position: relative; border: 1px solid #896770; border-radius: 5px; background: repeating-linear-gradient(to right,transparent 0,transparent calc(20% - 1px),#70505c calc(20% - 1px),#70505c 20%),linear-gradient(#4d303c,#3c2530); }
.gate-bars { position: absolute; top: 13%; bottom:13%; left:42%; width:16%; border: 2px solid #b9a9ad; background: repeating-linear-gradient(90deg,#211b22 0,#211b22 15%,#ad9ba2 15%,#ad9ba2 22%,#211b22 22%,#211b22 25%); box-shadow:0 3px 0 #251820; }
.gate-piece { width:20%; height:100%; display:grid; place-items:center; position:absolute; top:0; left:0; }
.gate-hero { background: url("assets/case-hero-idle.webp") 50% 55% / contain no-repeat; z-index: 2; }
.gate-bomb { transform:translateX(100%); }
.gate-bomb i { width:45%; aspect-ratio:1; position:relative; border:2px solid #d7a4b0; background: #171719; border-radius:8%; box-shadow: 0 4px 4px #170c1480; }
.gate-bomb i::before { content:''; position:absolute; width:20%; height:23%; background:#f9ead7; bottom:100%; left:38%; box-shadow:3px -2px 0 #d45861; }
.gate-bomb i::after { content:''; position:absolute; width:12%; aspect-ratio:1; background:#f2737b; top:48%; left:14%; border-radius:50%; box-shadow: .36em 0 0 #f2737b,.72em 0 0 #f2737b; }
case-gate-demo[data-phase="rolled"] .gate-hero { background-image:url("assets/case-hero-kick.webp"); }
case-gate-demo[data-phase="rolled"] .gate-bomb,
case-gate-demo[data-phase="crossed"] .gate-hero { transform:translateX(400%); }
case-gate-demo[data-phase="crossed"] .gate-bomb { transform:translateX(0); }
@media(prefers-reduced-motion:no-preference) {
  case-gate-demo[data-phase="rolled"] .gate-bomb { transition:transform .45s cubic-bezier(.27,.71,.27,1); }
  case-gate-demo[data-phase="crossed"] .gate-hero, case-gate-demo[data-phase="crossed"] .gate-bomb { animation:gate-arrive .32s ease-out; }
  @keyframes gate-arrive { from { opacity:.25; filter:brightness(1.9); } to { opacity:1; filter:brightness(1); } }
}
.gate-footer,.bead-export,.bead-readout,.bead-material-title,.bead-tool-head { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.gate-footer { padding:12px 18px; min-height:70px; }
.gate-footer p,.bead-readout p { margin:0; font-size:16px; line-height:1.45; color:#423b42; }
.gate-action,.bead-export a { border:0; border-radius:100px; padding: 0 17px; display:inline-flex; justify-content:center; align-items:center; background:#363137; color:#fff; min-height:44px; font-weight:600; font-size:16px; white-space:nowrap; }
case-bead-board { border:1px solid #d6ded2; border-radius:20px; overflow:hidden; }
.bead-tool-head { padding:8px 15px; background:#eef3ec; }
.bead-tool-head > span { font-weight:600; font-size:17px; color:#344939; }
.bead-views { display:flex; padding:2px; border-radius:100px; background:#dde6d9; }
.bead-views button { background:none; color:#444f43; font-weight:600; min-height:40px; min-width:58px; border:none; border-radius:100px; padding:6px 12px; font-size:16px; }
.bead-views button[aria-pressed=true] { background:white; color:#29342b; box-shadow:0 1px 4px #22361f26; }
.bead-sheet { display:grid; place-items:center; background:#e9eee6; min-height:0; padding:clamp(13px,2.8vw,24px); }
.bead-sheet img,.bead-sheet canvas { width:auto; height:auto; max-width:100%; display:block; aspect-ratio:48/40; object-fit:contain; }
.bead-sheet .sheet-original,.bead-sheet .sheet-grid,.bead-sheet .sheet-grid-fallback { width:min(100%,365px); image-rendering:pixelated; }
.bead-sheet [hidden],.bead-readout [hidden] { display:none; }
.bead-workbench { padding:20px 24px 18px; }
.bead-material-title h3,.bead-export h3 { font-size:22px; }
.bead-material-title > span { color:#625f64; font-size:16px; white-space:nowrap; }
.bead-swatches { display:grid; grid-template-columns: repeat(8,minmax(0,1fr)); gap:5px; margin:1px 0 0; }
.bead-swatches button { min-height:44px; display:grid; place-items:center; padding:3px 0; border:0; border-radius:12px; background:transparent; }
.bead-swatches button::before { display:block; content:''; width:min(100%,38px); height:32px; border-radius:9px; background:var(--pigment); box-shadow:inset 0 0 0 1px #20322333; }
.bead-swatches button[aria-pressed=true]::before { outline:2px solid #283e31; outline-offset:2px; }
.bead-readout { min-height:44px; }
.bead-reset { border:0; background:none; color:#31553e; text-decoration:underline; text-underline-offset:3px; padding:0 3px; font-size:16px; min-height:44px; white-space:nowrap; }
.bead-export { padding:23px 0 0; flex-wrap:wrap; }
.bead-export p { margin:5px 0 0; }
.bead-export a { background:#e9eee6; color:#2c4436; }
.case-study button:focus-visible,.case-study a:focus-visible { outline:3px solid #785582; outline-offset:1px; }
@media(max-width:480px) {
  .case-heading { margin-bottom:18px; }
  .case-heading h2 { font-size:38px; }
  .case-heading > p:last-child { margin-top:8px; }
  .case-section > p,.bead-export p { font-size:16px; }
  case-game-film,case-bead-board { border-radius:15px; }
  .gate-footer { padding:10px 12px; }
  .gate-action { padding:0 13px; }
  .bead-tool-head { padding:7px 10px; }
  .bead-workbench { padding:14px; }
  .bead-swatches { grid-template-columns:repeat(4,minmax(0,1fr)); gap:1px 7px; }
  .bead-swatches button::before { width:100%; max-width:44px; height:29px; }
  .bead-export { padding-top:18px; gap:10px; }
}
@media(forced-colors:active) {
  .case-study button,.case-study a { border:1px solid ButtonText; }
  .case-study button[aria-pressed=true] { outline:2px solid Highlight; outline-offset:-3px; }
  .bead-swatches button::before,.gate-scene { forced-color-adjust:none; }
}
