/* Dedicated gacha experience; ordinary drawers keep their own width and motion. */
.gacha-experience.sheet{

  --gacha-stage-shift:clamp(-220px,-29dvh,-135px);
  /* Room the focus line takes in the Draw track, and how far the stage rises for it
     (less on short screens, where the name track gives back part of the room). */
  --gacha-focus-room:36px;--gacha-focus-lift:36px;
  position:fixed;inset:0;margin:auto;width:100%;max-width:520px;
  height:100dvh;max-height:100dvh;border:0;border-radius:0;padding:0;
  background:linear-gradient(to bottom,var(--gacha-paper) 0%,var(--gacha-light) 42%,var(--gacha-light) 50%,var(--gacha-paper) 100%);color-scheme:var(--theme-color-scheme,dark);
  color:var(--gacha-ink);box-shadow:0 0 70px var(--ui-shadow);overflow:hidden;
}
.gacha-experience[open]{display:flex;flex-direction:column}
.gacha-experience::backdrop{background:var(--gacha-backdrop);backdrop-filter:blur(3px)}
.gacha-experience .gacha-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.gacha-scene{position:relative;flex:1;min-height:120px;margin-top:env(safe-area-inset-top);overflow:hidden}
/* The scene is lifted on the result screen, which brings the canvas's bottom edge into view above
   the controls: rays that reach it (Legendary, Mythic) fade out there instead of ending in a line. */
#gacha-canvas{display:block;width:100%;height:100%;position:absolute;inset:0;pointer-events:none;-webkit-mask-image:linear-gradient(to bottom,black calc(100% - 140px),transparent);mask-image:linear-gradient(to bottom,black calc(100% - 140px),transparent)}
.gacha-result{flex-shrink:0;text-align:center;min-height:66px;padding:0 20px 12px}
#gacha #result-name{font-size:clamp(23px,6vw,31px);font-weight:800;letter-spacing:-1px;line-height:1.14;margin:0 0 6px}
#gacha #result-theme{font-size:14px;line-height:1.4;color:var(--gacha-muted);margin:0}
.gacha-dock{position:relative;flex-shrink:0;display:flex;flex-direction:column;justify-content:flex-end;min-height:208px;padding:12px 24px calc(20px + env(safe-area-inset-bottom))}
.gacha-balance{position:absolute;z-index:3;top:calc(12px + env(safe-area-inset-top));left:16px;display:flex;align-items:center;gap:8px;min-height:44px;max-width:calc(100% - 88px);padding:0 12px;border-radius:22px;background:var(--gacha-quiet);color:var(--gacha-ink)}
.gacha-balance b{font-size:19px;font-weight:700;font-variant-numeric:tabular-nums;line-height:1}
/* The balance and, beside it, the chip that offers tickets for an ad (src/game/ad-ui.js).
   The chip is quiet when no ad can be watched now, and hidden while a draw runs. */
.gacha-top{position:absolute;z-index:3;top:calc(12px + env(safe-area-inset-top));left:16px;display:flex;align-items:center;gap:8px;max-width:calc(100% - 88px)}
.gacha-top .gacha-balance{position:static;max-width:none;min-width:0}
.gacha-ad{display:flex;align-items:center;flex:none;gap:6px;min-height:44px;padding:0 14px 0 12px;border:1px solid var(--gacha-action-border);border-radius:22px;background:var(--gacha-action);color:var(--gacha-action-ink);font-size:16px;font-weight:750;line-height:1;transition:background 120ms ease,transform 85ms ease}
.gacha-ad b{font-weight:750;font-variant-numeric:tabular-nums}
.gacha-ad svg{width:20px;height:20px}
.gacha-ad:hover{background:var(--gacha-action-hover)}
.gacha-ad:active{transform:translateY(1px);background:var(--gacha-action-pressed)}
.gacha-ad[data-ready=false]{border-color:transparent;background:var(--gacha-quiet);color:var(--gacha-muted)}
.gacha-ad[data-ready=false]:hover{background:var(--gacha-quiet-hover);color:var(--gacha-ink)}
.gacha-experience:is([data-phase=rolling],[data-phase=lock],[data-phase=opening],[data-phase=holding]) .gacha-ad{visibility:hidden}
/* Short screens: the result keycap reaches up to the top row, so the chip is lower and sits at
   the row's top edge, with its touch area kept at 44px. */
@media(max-height:650px){.gacha-ad{position:relative;align-self:flex-start;min-height:36px;padding:0 12px 0 10px;font-size:15px}.gacha-ad::after{content:"";position:absolute;inset:-4px 0}.gacha-ad svg{width:18px;height:18px}}
@media(prefers-reduced-motion:reduce){.gacha-ad{transition:none}}
@media(forced-colors:active){.gacha-ad{border:1px solid ButtonText;background:ButtonFace;color:ButtonText}}
.gacha-experience svg{fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;width:24px;height:24px}
.gacha-experience [hidden]{display:none!important}
.gacha-draws{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.gacha-key{
  display:flex;align-items:center;justify-content:center;gap:14px;
  min-width:0;min-height:56px;padding:12px 16px;
  border:1px solid var(--gacha-action-border);border-radius:16px;background:var(--gacha-action);color:var(--gacha-action-ink);
  box-shadow:inset 0 1px 0 var(--ui-highlight-soft);font-size:16px;font-weight:750;
  transition:background 120ms ease,transform 85ms ease;
}
.gacha-key small{display:flex;align-items:center;gap:5px;font-size:14px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums}
.gacha-key small svg{width:18px;height:18px}
.gacha-key small b{font:inherit}
.gacha-key:not(:disabled):hover{background:var(--gacha-action-hover)}
.gacha-key:not(:disabled):active{transform:translateY(1px);background:var(--gacha-action-pressed)}
.gacha-key:disabled{opacity:1;color:var(--gacha-disabled-ink);background:var(--gacha-disabled);border-color:var(--gacha-disabled-border);box-shadow:none}
.gacha-footer{margin-top:12px}
.gacha-close{
  position:absolute;z-index:3;top:calc(12px + env(safe-area-inset-top));right:16px;
  display:grid;place-items:center;width:44px;height:44px;min-height:44px;padding:10px;
  border:0;border-radius:50%;background:var(--gacha-quiet);color:var(--gacha-muted);box-shadow:none;
}
.gacha-close svg{width:20px;height:20px}
.gacha-close:not(:disabled):hover{background:var(--gacha-quiet-hover);color:var(--gacha-ink)}
.gacha-place,.gacha-skip{
  display:block;width:100%;min-height:52px;border-radius:16px;padding:12px 16px;
  font:inherit;font-size:14px;font-weight:650;box-shadow:none;
}
.gacha-experience .gacha-place{background:var(--gacha-place);color:var(--gacha-ink);border:1px solid var(--gacha-border)}
.gacha-place:not(:disabled):hover{background:var(--gacha-place-hover);border-color:var(--gacha-border)}
.gacha-place:not(:disabled):active{background:var(--gacha-place-pressed);transform:translateY(1px)}
.gacha-skip{min-height:56px;border:1px solid var(--gacha-border);background:var(--gacha-surface);color:var(--gacha-ink)}
/* One emphasis per state (2026-11-10, user: after a draw people could not find where to go).
   Before a draw the Draw keys carry the action colour; once a result is up, Place on board
   takes it and the Draw keys step back to an outline. Close is a solid, readable disc. */
.gacha-experience[data-phase=result] .gacha-place{background:var(--gacha-action);color:var(--gacha-action-ink);border-color:var(--gacha-action-border);font-size:16px;font-weight:750;box-shadow:inset 0 1px 0 var(--ui-highlight-soft)}
.gacha-experience[data-phase=result] .gacha-place:not(:disabled):hover{background:var(--gacha-action-hover);border-color:var(--gacha-action-border)}
.gacha-experience[data-phase=result] .gacha-place:not(:disabled):active{background:var(--gacha-action-pressed)}
.gacha-experience[data-phase=result] .gacha-key:not(:disabled){background:transparent;color:var(--gacha-action);border:1.5px solid var(--gacha-action);box-shadow:none}
.gacha-experience[data-phase=result] .gacha-key:not(:disabled):hover{background:var(--gacha-quiet-hover)}
.gacha-experience[data-phase=result] .gacha-key:not(:disabled):active{background:var(--gacha-quiet)}
.gacha-experience .gacha-close{background:var(--gacha-surface);color:var(--gacha-ink);border:1px solid var(--gacha-border)}
.gacha-experience button:focus-visible{outline:3px solid var(--gacha-focus);outline-offset:3px}
.gacha-experience .gacha-message{margin:0 0 6px;font-size:12px;color:var(--gacha-muted);text-align:center}
@media(max-height:650px){
 .gacha-result{min-height:48px;padding-bottom:5px}#gacha #result-name{font-size:23px}#gacha #result-theme{font-size:12px}
 .gacha-dock{min-height:180px;padding-top:5px;padding-bottom:calc(12px + env(safe-area-inset-bottom))}
 .gacha-key,.gacha-skip{min-height:52px;font-size:15px}
 .gacha-footer{margin-top:10px}.gacha-place{min-height:48px;padding:10px}
}
@media(max-height:450px) and (min-width:600px){
 .gacha-experience.sheet[open]{max-width:844px;display:grid;grid-template-columns:1.1fr 1fr;grid-template-rows:1fr auto auto}
 .gacha-scene{grid-column:1;grid-row:1 / 4;height:100%;min-height:0;margin:0}
 .gacha-result{grid-column:2;grid-row:1;align-self:end}
 .gacha-results{grid-column:2;grid-row:2;margin:0 20px}
 .gacha-dock{grid-column:2;grid-row:3;width:100%}
}

/* Keep the case and result on one stage; only the keycap moves during release. */
@media (min-height:451px), (max-width:599px){
 .gacha-experience .gacha-scene{position:absolute;inset:0;z-index:0;width:100%;height:100%;margin:0;transform:translateY(calc(var(--gacha-stage-shift) - var(--gacha-focus-lift)))}
 .gacha-experience .gacha-result,.gacha-experience .gacha-results,.gacha-experience .gacha-dock{position:relative;z-index:1}
 .gacha-experience[data-phase=holding] .gacha-result,.gacha-experience[data-phase=result] .gacha-result{animation:gacha-content-rise 420ms cubic-bezier(.22,1,.36,1) both}
 .gacha-experience[data-phase=result] .gacha-results,.gacha-experience[data-phase=result] .gacha-footer{animation:gacha-content-rise 460ms 70ms cubic-bezier(.22,1,.36,1) both}
}
@keyframes gacha-content-rise{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.gacha-experience[data-phase] :is(.gacha-result,.gacha-results,.gacha-footer){animation:none}}
@media(prefers-reduced-motion:reduce){.gacha-key{transition:none}}
@media(forced-colors:active){
 .gacha-key{border:2px solid ButtonText;background:ButtonFace;color:ButtonText}
 .gacha-close{border:1px solid ButtonText}.gacha-experience .gacha-place{background:ButtonFace;color:ButtonText;border:2px solid ButtonText}
}


/* Local preview only: replenishes test credit without changing tap progression. */
.gacha-test-tickets{position:absolute;z-index:3;left:24px;top:calc(54px + env(safe-area-inset-top));min-height:44px;border:0;background:none;padding:0 2px;font-size:11px;color:var(--gacha-muted);text-decoration:underline;text-underline-offset:3px}

/* Committed ticket changes: decorative layer never intercepts input. */
.currency-fx-layer{position:absolute;inset:0;z-index:6;pointer-events:none;overflow:hidden}
.currency-delta{position:absolute;font:750 15px/1 Manrope,sans-serif;font-variant-numeric:tabular-nums;white-space:nowrap}
.currency-delta.is-spend{color:var(--ui-spend)}.currency-delta.is-gain{color:var(--ui-gain)}
.gacha-experience .currency-delta.is-spend{color:var(--gacha-spend)}
.gacha-experience .currency-delta.is-gain{color:var(--gacha-gain)}
.gacha-balance b,#ticket-balance b{display:inline-block;transform-origin:center}

/* Result-group layout. Card appearance and carousel states live in shared components. */
.gacha-results {display:block;flex-shrink:0;margin:0 16px;min-width:0}
.gacha-scene {touch-action:pan-y}
.gacha-progress {margin:0 0 12px;color:var(--gacha-muted);text-align:center;font-size:12px;font-variant-numeric:tabular-nums}
.gacha-running-actions {display:flex;gap:10px}
.gacha-running-actions .gacha-skip {flex:1;min-width:0;padding:12px 8px;font-size:13px}
.gacha-skip:disabled {opacity:.55;cursor:default}
.gacha-dock {min-height:176px}
@media(max-height:650px){.gacha-dock {min-height:152px;padding-left:16px;padding-right:16px}.gacha-results .ui-reward-grid {max-width:255px;gap:6px}}
@media(max-height:450px) and (min-width:600px){.gacha-dock {min-height:142px}.gacha-results {margin:0 12px}}

/* Fixed scene tracks: revealing controls never change the canvas size or keycap anchor. */
.gacha-experience.sheet[open] {display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 100px 112px calc(176px + var(--gacha-focus-room) + env(safe-area-inset-bottom))}
.gacha-experience .gacha-scene {grid-column:1;grid-row:1;min-height:0}
/* The name starts at the top of its row, so the keycap above can stop a fixed gap over it
   (resultBottom in src/game/gacha-ui.js), whatever the name's length or the text size. */
.gacha-experience .gacha-result {grid-column:1;grid-row:2;display:flex;flex-direction:column;justify-content:flex-start;min-height:0;height:100%;padding:6px 20px 8px;overflow:hidden}
.gacha-experience #result-name {display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;flex-shrink:0}
.gacha-experience .gacha-results {grid-column:1;grid-row:3;align-self:center}
.gacha-experience .gacha-dock {grid-column:1;grid-row:4;min-height:0;height:100%;width:100%}
@media(max-height:650px){.gacha-experience.sheet[open] {--gacha-focus-room:28px;--gacha-focus-lift:12px;grid-template-rows:minmax(0,1fr) 72px 106px calc(152px + var(--gacha-focus-room) + env(safe-area-inset-bottom))}}
@media(max-height:450px) and (min-width:600px){
 .gacha-experience.sheet[open] {--gacha-focus-room:28px;grid-template-columns:1.1fr 1fr;grid-template-rows:minmax(0,1fr) 106px calc(152px + var(--gacha-focus-room) + env(safe-area-inset-bottom))}
 .gacha-experience .gacha-scene {grid-column:1;grid-row:1 / 4;height:100%;margin:0}
 .gacha-experience .gacha-result {grid-column:2;grid-row:1;padding:48px 20px 0}
 .gacha-experience .gacha-results {grid-column:2;grid-row:2}
 .gacha-experience .gacha-dock {grid-column:2;grid-row:3}
}

/* Reward signals on the stage: the sound mark rides the result keycap's top-right corner
   (the scene reports the keycap's centre and size each paint) and a mood toast drops in
   under the balance row. Both take the stage palette. */
.gacha-experience {--mark-surface:var(--gacha-surface);--mark-ink:var(--gacha-muted);--mark-ring:var(--gacha-border);--mark-shadow:var(--ui-shadow-strong);--mark-accent:var(--gacha-action);--mark-accent-ink:var(--gacha-action-ink);--mark-accent-ring:var(--gacha-ink);
 --ui-toast-surface:var(--gacha-surface);--ui-toast-border:var(--gacha-border);--ui-toast-ink:var(--gacha-ink);--ui-toast-muted:var(--gacha-muted);--ui-toast-shadow:var(--ui-shadow-strong);--ui-toast-accent:var(--gacha-action);--ui-toast-accent-ink:var(--gacha-action-ink)}
.gacha-sound-mark {position:absolute;z-index:2;left:var(--x,50%);top:var(--y,50%);margin:calc(var(--size) / -2) 0 0 calc(var(--size) / -2);pointer-events:none}
.gacha-toasts {position:absolute;z-index:4;left:16px;right:16px;top:calc(66px + env(safe-area-inset-top))}
/* When the keycap's top face reaches into that band (the stage sits higher on short
   screens; the UI decides from the keycap anchor) the toast rises from just above the
   dock instead, over the result thumbnails. */
.gacha-toasts[data-edge=bottom] {top:auto;bottom:calc(184px + var(--gacha-focus-room) + env(safe-area-inset-bottom))}
.gacha-toasts[data-edge=bottom] .ui-toast {animation-name:ui-toast-in-up}
.gacha-toasts[data-edge=bottom] .ui-toast[data-leaving] {animation-name:ui-toast-out-down}
@media(max-height:650px){.gacha-toasts[data-edge=bottom] {bottom:calc(160px + var(--gacha-focus-room) + env(safe-area-inset-bottom))}}
@media(max-height:450px) and (min-width:600px){.gacha-toasts {left:auto;right:16px;width:min(360px,45%)}}
/* Focus: the Typing group draws lean to (docs/TARGETED_DRAWS.md). One line above the Draw keys,
   kept as last chosen; the picker is a sheet inside the gacha dialog. */
.gacha-focus{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;width:100%;margin:0 0 8px;padding:7px 10px 11px;border:1px solid var(--gacha-border);border-radius:14px;background:var(--gacha-quiet);color:var(--gacha-ink);font:inherit;text-align:left;cursor:pointer;overflow:hidden}
.gacha-focus:not(:disabled):hover{background:var(--gacha-quiet-hover)}
.gacha-focus-cap{width:32px;height:32px;display:grid;place-items:center;flex:none}
.gacha-focus-cap canvas{width:32px;height:32px;display:block}
.gacha-focus-cap[data-any=true]{width:26px;height:26px;margin:3px;border:2px dashed var(--gacha-muted);border-radius:8px}
.gacha-focus-copy{display:grid;gap:1px;min-width:0;line-height:1.25}
.gacha-focus-copy strong{display:flex;align-items:baseline;gap:6px;min-width:0;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gacha-focus-copy b{font-size:9.5px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--gacha-muted)}
.gacha-focus-copy small{font-size:11.5px;color:var(--gacha-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}
.gacha-focus-copy em,.gacha-focus-row-copy em{font-style:normal;font-weight:600;font-size:12px;color:var(--gacha-muted);font-variant-numeric:tabular-nums}
.gacha-focus-change{padding:5px 11px;border:1px solid var(--gacha-border);border-radius:999px;background:var(--gacha-surface);font-size:12px;font-weight:700;white-space:nowrap}
.gacha-focus-bar{position:absolute;left:12px;right:12px;bottom:5px;height:3px;border-radius:3px;background:var(--gacha-border);overflow:hidden}
.gacha-focus-meter{display:block;height:3px;border-radius:3px;background:var(--gacha-border);overflow:hidden}
.gacha-focus-bar i,.gacha-focus-meter i{display:block;height:100%;background:var(--gacha-action);transform-origin:left;transition:transform 320ms cubic-bezier(.22,1,.36,1)}
.gacha-result-tags{display:inline-block;margin:0 0 0 8px;padding:1px 9px;vertical-align:1px;border-radius:999px;background:var(--gacha-quiet);color:var(--gacha-ink);font-size:12px;font-weight:700}
.gacha-focus-picker{position:absolute;inset:0;z-index:6}
.gacha-focus-scrim{position:absolute;inset:0;background:var(--gacha-backdrop)}
.gacha-focus-sheet{text-align:left;position:absolute;left:0;right:0;bottom:0;max-height:84%;display:flex;flex-direction:column;border-radius:22px 22px 0 0;background:var(--gacha-surface);color:var(--gacha-ink);box-shadow:0 -12px 40px var(--ui-shadow);padding-bottom:env(safe-area-inset-bottom)}
.gacha-focus-sheet header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 12px 4px 18px}
.gacha-focus-sheet h3{margin:0;font-size:17px}
.gacha-focus-close{width:44px;height:44px;display:grid;place-items:center;border:0;border-radius:50%;background:var(--gacha-quiet);color:var(--gacha-muted);box-shadow:none}
.gacha-focus-about{margin:0;padding:0 18px 8px;font-size:12px;line-height:1.45;color:var(--gacha-muted)}
.gacha-focus-warn{margin:0 14px 8px;padding:7px 10px;border-radius:10px;background:var(--gacha-quiet);font-size:12px;color:var(--gacha-ink)}
.gacha-focus-list{overflow-y:auto;overscroll-behavior:contain;padding:2px 8px 14px;display:grid;gap:2px}
.gacha-focus-row{display:flex;align-items:center;gap:10px;width:100%;min-height:56px;padding:7px 10px;border:0;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;box-shadow:none}
.gacha-focus-row:hover{background:var(--gacha-quiet)}
.gacha-focus-row[aria-pressed=true]{background:var(--gacha-quiet);box-shadow:inset 0 0 0 2px var(--gacha-action)}
.gacha-focus-row-copy{flex:1;min-width:0;display:grid;gap:4px}
.gacha-focus-row-copy strong{display:flex;justify-content:space-between;gap:8px;font-size:14px}
.gacha-focus-row-copy small{font-size:11.5px;color:var(--gacha-muted)}
@media(max-height:650px){.gacha-focus{margin-bottom:6px;padding:5px 10px 9px}.gacha-focus-cap,.gacha-focus-cap canvas{width:28px;height:28px}}
@media(prefers-reduced-motion:reduce){.gacha-focus-bar i,.gacha-focus-meter i{transition:none}}
@media(forced-colors:active){.gacha-focus{border:2px solid ButtonText}.gacha-focus-bar i,.gacha-focus-meter i{background:Highlight}}
