/* ---------- the rip room, 3D: the scene fills the top, the sheet sits below it and never covers the card ---------- */
:root {
  --magenta: #ff2d9b; --magenta-deep: #8f0c4a; --rip-red: #5a0a2c;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1); --ease-spring: cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
body.rip-open { overflow: hidden; }
#rip { position: fixed; inset: 0; z-index: 100; color: var(--ink); background: #0b0b0f; display: grid; grid-template-rows: 1fr auto; overflow: hidden; }
#rip[hidden] { display: none; }
.rip-view { position: relative; min-height: 0; }
#rip-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.rip-top { position: absolute; inset: 14px 16px auto; z-index: 8; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rip-top .rip-chip { margin-left: auto; }
.rip-x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.18); background: rgba(20,20,24,0.8); color: #fff; font-size: 20px; cursor: pointer; }
.rip-x:focus-visible, .rq:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.rip-chip { padding: 8px 12px; border-radius: 999px; background: rgba(20,20,24,0.8); border: 1px solid rgba(255,255,255,0.18); color: var(--ink-2); }
.rip-loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; color: var(--muted); }
.rip-loading[hidden] { display: none; }

.rip-panel { position: relative; z-index: 7; background: linear-gradient(180deg, rgba(11,11,15,0), rgba(11,11,15,0.92) 30%, #0b0b0f); padding: 18px 20px calc(16px + env(safe-area-inset-bottom)); max-height: 46vh; overflow: auto; }
.rip-sheet { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; transition: opacity 220ms linear, transform 220ms linear; }
.rip-sheet[hidden] { display: none; }
#rip:not([data-phase="idle"]):not([data-phase="done"]) .rip-sheet { opacity: 0; transform: translateY(12px); pointer-events: none; }
/* while the pack is opening the whole screen is the scene: the panel leaves, and comes back a beat after the card lands */
#rip:not([data-phase="idle"]):not([data-phase="done"]) .rip-panel, #rip[data-phase="done"]:not(.panel-in) .rip-panel { display: none; }
#rip.panel-in .rip-panel { animation: panelin 420ms var(--ease-out); }
@keyframes panelin { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.rip-sheet h3 { margin: 0; font: 500 clamp(18px, 2.6vw, 24px)/1.15 var(--sans); letter-spacing: -0.01em; text-transform: uppercase; }
.rip-sub { margin: -4px 0 0; font-size: 12px; color: var(--muted); }
.rip-sub a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.rip-pills { display: flex; gap: 10px; }
.rip-pill { min-width: 120px; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,0.06); border: 1px solid var(--line-2); text-align: left; display: flex; flex-direction: column; gap: 2px; }
.rip-pill b { font-weight: 500; font-size: 16px; }
.rip-pill.gold b { color: var(--gold); }
.rip-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; text-transform: none; letter-spacing: 0; font-size: 11px; }
.rip-stats b { color: var(--ink); font-weight: 500; }

.slide { position: relative; width: min(100%, 420px); height: 64px; border-radius: 999px; background: #141518; border: 1px solid var(--line-2); overflow: hidden; touch-action: none; user-select: none; cursor: grab; }
.slide:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.slide-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, rgba(245,197,66,0.35), rgba(245,197,66,0.08)); }
.slide-knob { position: absolute; left: 6px; top: 6px; width: 52px; height: 52px; border-radius: 50%; background: var(--gold); color: #1a1200; display: grid; place-items: center; font-size: 24px; font-weight: 600; box-shadow: 0 6px 20px rgba(245,197,66,0.4); transform: translateX(var(--x, 0px)); }
.slide.snapping .slide-knob { transition: transform 260ms var(--ease-out); }
.slide-label { position: absolute; inset: 0 0 0 70px; display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 15px; pointer-events: none; }
.rip-queue { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.rq { width: 28px; height: 44px; border-radius: 5px; border: 1px solid rgba(255,255,255,0.25); background: #0c0d0f url("art/apack-logo.webp") center / contain no-repeat; cursor: pointer; padding: 0; opacity: 0.9; }
.rq:hover { border-color: var(--gold); }

.rip-result { margin: 0 auto; max-width: 560px; animation: sheetin 500ms var(--ease-spring); }
.rip-result[hidden] { display: none; }
@keyframes sheetin { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
.rtag { display: inline-block; padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.25); font: 500 11px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.rtag.hit { background: var(--gold); color: #1a1200; border-color: var(--gold); }
.rip-result h3 { margin: 10px 0 2px; font: 500 22px/1.15 var(--sans); letter-spacing: -0.01em; }
.rip-result .rsub { margin: 0; font-size: 12px; color: var(--muted); }
.rlines { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.rlines li { display: flex; align-items: baseline; gap: 10px; font-size: 13px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.08); }
.rlines li span { color: var(--muted); flex: 1; }
.rlines li b { font-weight: 500; }
.rlines li.gold b { color: var(--gold); }
.rlines li a, .rlines .simtx { font: 400 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.rlines .simtx { text-decoration: none; opacity: 0.5; }
.rlines li em { font-size: 11px; color: var(--muted); }
.rsay { margin: 10px 0 0; font-size: 12px; color: var(--ink-2); font-style: italic; }
.rip-actions { display: flex; gap: 10px; margin-top: 12px; }
.rip-actions .btn, .rip-actions .ghost { height: 44px; display: inline-flex; }

@media (max-width: 760px) {
  .rip-panel { max-height: 44vh; padding: 14px 14px calc(12px + env(safe-area-inset-bottom)); }
  .rip-pill { min-width: 0; flex: 1; }
  .rip-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .rip-result { animation: none; } }
