/* ====== クロゼッタ デザイントークン ======
   正本: docs/WORLD_GUIDE.md §2。新しい色をその場で書かず、必ずここのトークンを使う。
   地は「夜のクロゼッタ」、差し色はパステル。パステル面の上の文字は --c-ink(濃い紫)。 */
:root {
  /* 地(夜) */
  --c-night-deep: #150c28;
  --c-night:      #1d1238;
  --c-night-hi:   #2a1a4e;
  --c-surface:    #241640;
  --c-surface-hi: #33224f;
  --c-line:       rgba(255,231,247,.22);
  /* 文字 */
  --c-text:      #fdf6ff;
  --c-text-mute: rgba(253,246,255,.74);
  --c-text-dim:  rgba(253,246,255,.52);
  --c-ink:       #3a2359;
  /* 差し色 */
  --c-rose:      #ff8ecb;
  --c-rose-deep: #e2559f;
  --c-lavender:  #c6a8ff;
  --c-honey:     #ffd782;
  --c-mint:      #86e9ce;
  --c-sky:       #8fd9ff;
  /* 紙(カード・図鑑セル) */
  --c-paper:      #fff7fb;
  --c-paper-2:    #ffe8f3;
  --c-paper-line: rgba(58,35,89,.18);
  /* レア度 */
  --rar-n:  #e7dff2;
  --rar-r:  #8fd9ff;
  --rar-sr: #ffd782;
  /* 属性(cards.jsのATTRSと一致。--attrColorが無い時のフォールバック用) */
  --attr-cute: #ff7fb8; --attr-cool: #6fc7ff; --attr-wa: #ff9b7a;
  --attr-street: #a9e86a; --attr-elegant: #b98cff;
  /* 形・間 */
  --r-s: 10px; --r-m: 16px; --r-l: 22px; --r-pill: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --tap-min: 44px;
  /* 動き */
  --dur-fast: 120ms; --dur-base: 220ms; --dur-slow: 420ms;
  --ease-out: cubic-bezier(.2,.7,.3,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--c-night-deep); overflow: hidden;
  touch-action: manipulation;
  overscroll-behavior: none; -webkit-touch-callout: none;
  font-family: "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif; color: var(--c-text); }
/* キーボード操作時のフォーカスを明示する */
:focus-visible { outline: 3px solid var(--c-sky); outline-offset: 2px; border-radius: var(--r-s); }
#app { position: relative; height: 100%; height: 100dvh; max-width: 480px; margin: 0 auto;
  background: var(--c-night-deep); }

/* ===== ステージ(動画)エリア: 全画面 ===== */
#stage { position: absolute; inset: 0; overflow: hidden; }
#stage video, #stage img.poster {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: filter .3s, opacity .3s; }
.dimmed { filter: brightness(.45) saturate(.6); }
#stage.shake { animation: stageShake .5s ease-out; }
@keyframes stageShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-9px) rotate(-.6deg); }
  40% { transform: translateX(8px) rotate(.5deg); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
/* SAKUYAのレベル成長エフェクト。明るい動画背景にも埋もれないよう、
   外周・中心光・星粒・リング・放射光を独立レイヤーで重ねる。 */
#aura { position: absolute; inset: 0; pointer-events: none; z-index: 2; opacity: 0;
  overflow: hidden; transition: opacity .18s; isolation: isolate; }
#aura::before, #aura::after, #aura .fxLayer { position: absolute; pointer-events: none;
  will-change: transform, opacity, filter; }
#aura::before, #aura::after { content: ''; inset: -18%; opacity: 0; }
#aura .fxLayer { display: block; opacity: 0; mix-blend-mode: screen; }
#aura .fxCore { inset: 11% 4% 17%; border-radius: 50%; }
#aura .fxStars { inset: -12%; }
#aura .fxRing { inset: 49% 4% 10%; border-radius: 50%; }
#aura .fxRays { inset: -25%; }
#aura .fxBurst { inset: 8% -12% 10%; border-radius: 50%; }
#stage.level-fx-active #aura { opacity: 1; }

/* Lv2: 一目で分かる桜色の外周＋光のスイープ */
#stage.level-fx-active[data-sakuya-level="2"] #aura {
  background: radial-gradient(ellipse at 50% 55%, transparent 32%, rgba(255,40,156,.1) 57%, rgba(255,36,146,.42) 100%);
  box-shadow: inset 0 0 28px 7px rgba(255,107,193,.96), inset 0 0 108px 28px rgba(255,32,144,.5); }
#stage.level-fx-active[data-sakuya-level="2"] #aura::before {
  opacity: .7; background: linear-gradient(112deg, transparent 35%, rgba(255,255,255,.08) 43%,
    rgba(255,112,205,.68) 49%, rgba(255,255,255,.12) 55%, transparent 65%);
  animation: fxSweep 2.8s ease-in-out infinite; }
#stage.level-fx-active[data-sakuya-level="2"] #aura .fxCore {
  opacity: .62; background: radial-gradient(ellipse, rgba(255,218,239,.55),
    rgba(255,51,163,.25) 38%, transparent 70%); }

/* Lv3: 外周に中心の鼓動光を追加 */
#stage.level-fx-active[data-sakuya-level="3"] #aura {
  background: radial-gradient(ellipse at 50% 54%, rgba(255,91,188,.18) 0, transparent 36%, rgba(255,38,148,.5) 100%);
  box-shadow: inset 0 0 34px 9px rgba(255,142,216,.98), inset 0 0 120px 32px rgba(255,28,143,.56);
  animation: fxAuraPulse 1.35s ease-in-out infinite alternate; }
#stage.level-fx-active[data-sakuya-level="3"] #aura .fxCore {
  opacity: .8; background: radial-gradient(ellipse, rgba(255,255,255,.55) 0,
    rgba(255,55,166,.36) 28%, rgba(255,40,151,.1) 53%, transparent 72%);
  animation: fxCorePulse 1.35s ease-in-out infinite; }

/* Lv4: 左右からピンクとシアンの双光 */
#stage.level-fx-active[data-sakuya-level="4"] #aura {
  background: linear-gradient(90deg, rgba(255,24,145,.5), transparent 32% 68%, rgba(0,224,255,.5));
  box-shadow: inset 0 0 38px 10px rgba(189,96,255,.98), inset 0 0 126px 34px rgba(105,65,255,.5); }
#stage.level-fx-active[data-sakuya-level="4"] #aura::before {
  opacity: .88; background: linear-gradient(102deg, transparent 20%, rgba(255,48,161,.55) 34%,
    transparent 46% 54%, rgba(0,229,255,.55) 66%, transparent 80%);
  animation: fxDualLight 1.8s ease-in-out infinite alternate; }
#stage.level-fx-active[data-sakuya-level="4"] #aura .fxCore {
  opacity: .72; background: radial-gradient(ellipse, rgba(255,255,255,.48), rgba(185,72,255,.25) 35%, transparent 68%); }

/* Lv5: 大粒の星を画面全体に追加 */
#stage.level-fx-active[data-sakuya-level="5"] #aura {
  background: radial-gradient(ellipse at 50% 52%, rgba(255,224,102,.15), transparent 42%, rgba(255,37,148,.44) 100%);
  box-shadow: inset 0 0 42px 11px rgba(255,221,105,.96), inset 0 0 132px 36px rgba(255,43,157,.56); }
#stage.level-fx-active[data-sakuya-level="5"] #aura .fxCore {
  opacity: .76; background: radial-gradient(ellipse, rgba(255,244,181,.5), rgba(255,57,167,.22) 40%, transparent 70%); }
#stage.level-fx-active[data-sakuya-level="5"] #aura .fxStars,
#stage.level-fx-active[data-sakuya-level="8"] #aura .fxStars,
#stage.level-fx-active[data-sakuya-level="9"] #aura .fxStars {
  opacity: 1;
  background-image: radial-gradient(circle, #fff 0 4px, transparent 5px),
    radial-gradient(circle, #ffe066 0 3px, transparent 4.5px),
    radial-gradient(circle, #ff63b9 0 4px, transparent 5.5px),
    radial-gradient(circle, #6feaff 0 2.5px, transparent 4px);
  background-size: 92px 118px, 71px 96px, 127px 109px, 58px 83px;
  background-position: 10px 8px, 38px 61px, 74px 20px, 21px 44px;
  filter: drop-shadow(0 0 7px #fff);
  animation: fxStarsRise 3.2s linear infinite; }

/* Lv6: 太い光柱が上昇 */
#stage.level-fx-active[data-sakuya-level="6"] #aura {
  background: linear-gradient(90deg, rgba(255,33,151,.38), transparent 38% 62%, rgba(0,218,255,.38));
  box-shadow: inset 0 0 48px 12px rgba(135,122,255,.98), inset 0 0 140px 38px rgba(75,58,255,.58); }
#stage.level-fx-active[data-sakuya-level="6"] #aura::before {
  opacity: .86;
  background: repeating-linear-gradient(90deg, transparent 0 31px, rgba(255,255,255,.12) 34px,
    rgba(76,221,255,.72) 40px, rgba(255,74,177,.48) 47px, transparent 57px);
  filter: blur(1px) drop-shadow(0 0 9px rgba(83,220,255,.9));
  animation: fxEnergyRise 1.7s ease-in-out infinite; }
#stage.level-fx-active[data-sakuya-level="6"] #aura .fxCore {
  opacity: .82; background: radial-gradient(ellipse, rgba(207,250,255,.58), rgba(105,68,255,.28) 42%, transparent 72%); }

/* Lv7: キャラクターを囲む太い二重リング */
#stage.level-fx-active[data-sakuya-level="7"] #aura {
  background: radial-gradient(ellipse at 50% 52%, rgba(161,95,255,.2), transparent 39%, rgba(59,47,255,.48) 100%);
  box-shadow: inset 0 0 54px 14px rgba(77,228,255,.98), inset 0 0 148px 42px rgba(151,46,255,.65); }
#stage.level-fx-active[data-sakuya-level="7"] #aura .fxCore {
  opacity: .88; background: radial-gradient(ellipse, rgba(255,255,255,.62), rgba(164,60,255,.3) 38%, transparent 70%); }
#stage.level-fx-active[data-sakuya-level="7"] #aura .fxRing,
#stage.level-fx-active[data-sakuya-level="8"] #aura .fxRing,
#stage.level-fx-active[data-sakuya-level="9"] #aura .fxRing {
  opacity: .96; border: 7px solid rgba(255,81,183,.9);
  box-shadow: 0 0 12px 3px rgba(255,255,255,.9), 0 0 28px 8px rgba(0,224,255,.82),
    inset 0 0 18px 5px rgba(255,55,173,.72);
  animation: fxRingPulse 1.35s ease-in-out infinite; }
#stage.level-fx-active[data-sakuya-level="7"] #aura::after {
  opacity: .74; background: radial-gradient(ellipse at 50% 73%, transparent 0 21%, rgba(0,231,255,.8) 22%,
    rgba(255,80,183,.86) 24%, transparent 27%);
  animation: fxOuterRing 1.35s ease-out infinite; }

/* Lv8: 星・リング・プリズムの高速合成 */
#stage.level-fx-active[data-sakuya-level="8"] #aura {
  background: linear-gradient(135deg, rgba(255,24,148,.48), transparent 40%, rgba(0,224,255,.5));
  box-shadow: inset 0 0 58px 15px rgba(225,118,255,.99), inset 0 0 155px 44px rgba(113,47,255,.7);
  animation: fxAuraPulse .72s ease-in-out infinite alternate; }
#stage.level-fx-active[data-sakuya-level="8"] #aura .fxCore {
  opacity: .94; background: conic-gradient(from 0deg, rgba(255,69,176,.42), rgba(85,228,255,.5),
    rgba(255,226,105,.38), rgba(195,82,255,.48), rgba(255,69,176,.42));
  filter: blur(10px); animation: fxPrismTurn 4s linear infinite; }
#stage.level-fx-active[data-sakuya-level="8"] #aura .fxRing { animation-duration: .92s; }

/* Lv9: 金色の覚醒放射光を最大強度で合成 */
#stage.level-fx-active[data-sakuya-level="9"] #aura {
  background: radial-gradient(ellipse at 50% 50%, rgba(255,255,221,.25) 0, rgba(255,206,55,.14) 35%,
    rgba(255,45,157,.46) 70%, rgba(255,194,43,.64) 100%);
  box-shadow: inset 0 0 62px 17px rgba(255,235,123,1), inset 0 0 168px 48px rgba(255,86,41,.74);
  animation: fxAuraPulse .58s ease-in-out infinite alternate; }
#stage.level-fx-active[data-sakuya-level="9"] #aura .fxCore {
  opacity: 1; background: radial-gradient(ellipse, rgba(255,255,255,.78), rgba(255,220,74,.42) 34%,
    rgba(255,48,156,.19) 54%, transparent 72%);
  animation: fxCorePulse .8s ease-in-out infinite; }
#stage.level-fx-active[data-sakuya-level="9"] #aura .fxRays {
  opacity: .52; background: repeating-conic-gradient(from 0deg at 50% 52%, rgba(255,239,128,.9) 0 3deg,
    transparent 4deg 13deg, rgba(255,47,158,.76) 14deg 17deg, transparent 18deg 29deg);
  filter: drop-shadow(0 0 8px rgba(255,220,76,.85));
  animation: fxPrismTurn 8s linear infinite; }
#stage.level-fx-active[data-sakuya-level="9"] #aura .fxRing {
  border-color: rgba(255,225,81,.98); animation-duration: .7s;
  box-shadow: 0 0 14px 4px #fff, 0 0 34px 12px rgba(255,211,61,.95),
    inset 0 0 22px 7px rgba(255,51,158,.85); }

/* プレイヤーターン開始時の解放バースト。各レベルの常設演出に重ねる。 */
#stage.level-fx-enter #aura .fxBurst {
  animation: fxEnterBurst .95s cubic-bezier(.1,.65,.25,1) both;
  background: radial-gradient(ellipse, transparent 0 27%, rgba(255,255,255,.96) 29%,
    rgba(255,75,180,.9) 31%, rgba(71,226,255,.72) 34%, transparent 41%); }

@keyframes fxSweep { 0%,15% { transform: translateX(-65%); } 70%,100% { transform: translateX(65%); } }
@keyframes fxAuraPulse { from { opacity: .72; filter: brightness(.92); } to { opacity: 1; filter: brightness(1.28); } }
@keyframes fxCorePulse { 0%,100% { transform: scale(.88); opacity: .58; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes fxDualLight { from { transform: translateX(-5%) skewX(-5deg); } to { transform: translateX(5%) skewX(5deg); } }
@keyframes fxStarsRise { from { transform: translate3d(0,12%,0); } to { transform: translate3d(0,-12%,0); } }
@keyframes fxEnergyRise { 0% { transform: translateY(24%); opacity: .42; } 55% { opacity: 1; } 100% { transform: translateY(-24%); opacity: .42; } }
@keyframes fxRingPulse { 0%,100% { transform: scale(.92); opacity: .65; } 50% { transform: scale(1.04); opacity: 1; } }
@keyframes fxOuterRing { 0% { transform: scale(.76); opacity: .22; } 45% { opacity: .92; } 100% { transform: scale(1.2); opacity: .18; } }
@keyframes fxPrismTurn { to { transform: rotate(360deg); } }
@keyframes fxEnterBurst { 0% { transform: scale(.5); opacity: 0; filter: brightness(2); }
  28% { opacity: 1; } 100% { transform: scale(1.45); opacity: 0; filter: brightness(1); } }

#turnBanner { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  padding: 6px 18px; border-radius: 999px; font-weight: 800; font-size: 15px;
  background: rgba(255,45,150,.85); box-shadow: 0 0 14px rgba(255,45,150,.8);
  letter-spacing: .1em; white-space: nowrap; pointer-events: none; }
#turnBanner.cpu { background: rgba(0,170,255,.85); box-shadow: 0 0 14px rgba(0,170,255,.8); }
#scores { position: absolute; top: calc(44px + env(safe-area-inset-top, 0px)); left: 0; right: 0;
  display: flex; justify-content: space-between; padding: 0 12px; font-size: 13px;
  pointer-events: none; }
.scoreBox { background: rgba(0,0,0,.5); border-radius: 10px; padding: 5px 10px; min-width: 108px; }
.scoreBox .name { font-size: 10px; opacity: .8; }
.scoreBox .val { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.scoreBox .levelTag { font-size: 10px; letter-spacing: .08em; min-height: 13px; color: #ffe066; }
#p1Box { border: 1px solid #ff2d96; } #cpuBox { border: 1px solid #00aaff; text-align: right; }
#judge { position: absolute; bottom: 21%; left: 50%; transform: translateX(-50%);
  font-size: 30px; font-weight: 900; letter-spacing: .06em; opacity: 0;
  text-shadow: 0 0 12px currentColor; pointer-events: none; }
#judge.pop { animation: judgePop .45s ease-out; }
@keyframes judgePop { 0% {opacity:0; transform:translateX(-50%) scale(.6);}
  25% {opacity:1; transform:translateX(-50%) scale(1.15);} 70% {opacity:1;}
  100% {opacity:0; transform:translateX(-50%) scale(1);} }
#combo { position: absolute; bottom: 27%; left: 50%; transform: translateX(-50%);
  font-size: 16px; font-weight: 800; color: #ffe066; text-shadow: 0 0 10px rgba(255,224,102,.8);
  pointer-events: none; }

/* ===== ノーツレーン(動画に重ねる全画面オーバーレイ、画面自体がタップパッド) ===== */
#laneWrap { position: absolute; inset: 0; z-index: 3; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
#missFlash { position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255,32,56,0) 35%, rgba(255,32,56,.5) 100%); }
#missFlash.on { animation: missFlash .5s ease-out; }
@keyframes missFlash { 0% { opacity: 1; } 100% { opacity: 0; } }
#judge.miss { font-size: 46px; }
#countdown { position: absolute; top: 38%; left: 50%; transform: translate(-50%,-50%);
  font-size: 96px; font-weight: 900; color: #fff; opacity: 0; pointer-events: none;
  text-shadow: 0 0 26px rgba(255,45,150,.95), 0 0 60px rgba(0,224,255,.6); }
#countdown.pop { animation: countPop .42s ease-out forwards; }
@keyframes countPop {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(1.7); }
  30% { opacity: 1; }
  100% { opacity: .92; transform: translate(-50%,-50%) scale(1); }
}

/* ===== オーバーレイ(メニュー各種) =====
   背景は「夜のクロゼッタ」: 夜空 → 月あかり → 星屑 → 町のシルエット2枚 → 窓明かり。
   スクロールコンテナの背景なので中身と一緒には流れない(background-attachment: scroll)。 */
.overlay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; gap: var(--sp-3); text-align: center;
  color: var(--c-text); backdrop-filter: blur(5px); overflow-y: auto;
  padding: calc(var(--sp-5) + env(safe-area-inset-top, 0px)) var(--sp-4)
           calc(var(--sp-5) + env(safe-area-inset-bottom, 0px));
  background:
    /* 窓明かり */
    radial-gradient(circle, rgba(255,215,130,.85) 0 1.6px, transparent 3.2px)
      7px calc(100% - 21px) / 37px 24px repeat-x,
    /* 町のシルエット(手前) */
    repeating-linear-gradient(90deg, transparent 0 15px, rgba(14,7,30,.97) 15px 43px)
      0 100% / 100% 54px repeat-x,
    /* 町のシルエット(奥) */
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(35,21,68,.94) 34px 71px)
      19px 100% / 100% 88px repeat-x,
    /* 星屑 */
    radial-gradient(circle, rgba(255,255,255,.70) 0 1.2px, transparent 2.4px)
      9px 11px / 78px 92px repeat,
    radial-gradient(circle, rgba(255,215,130,.55) 0 1.5px, transparent 2.9px)
      44px 30px / 123px 137px repeat,
    /* 月あかり */
    radial-gradient(ellipse 78% 34% at 50% -4%, rgba(198,168,255,.26), transparent 72%)
      0 0 / 100% 100% no-repeat,
    /* 夜空 */
    linear-gradient(180deg, rgba(42,26,78,.95) 0%, rgba(29,18,56,.96) 44%, rgba(21,12,40,.97) 100%)
      0 0 / 100% 100% no-repeat; }
/* 安全な中央寄せ: 収まる時は中央、あふれる時は上からスクロール
   (justify-content:centerだと上端がスクロール不能領域に切れるため使わない) */
.overlay > :first-child { margin-top: auto; }
.overlay > :last-child { margin-bottom: auto; }
.overlay h1 { font-size: 30px; line-height: 1.25; letter-spacing: .1em; font-weight: 900;
  flex-shrink: 0;
  background: linear-gradient(100deg, var(--c-rose), var(--c-honey) 48%, var(--c-lavender));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 10px rgba(255,142,203,.45)); }
.overlay h2 { font-size: 19px; letter-spacing: .12em; font-weight: 900; flex-shrink: 0; }
.overlay p { font-size: 12px; color: var(--c-text-mute); line-height: 1.8; }
.selLabel { font-size: 11px; letter-spacing: .2em; color: var(--c-text-dim); margin-top: 2px; }
.selRow { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; }
.selBtn { padding: 9px 14px; font-size: 13px; font-weight: 800; color: var(--c-text);
  background: var(--c-surface-hi); border: 2px solid var(--c-line);
  border-radius: var(--r-s); cursor: pointer; letter-spacing: .05em; min-height: var(--tap-min); }
.selBtn.sel { border-color: var(--c-honey); background: rgba(255,215,130,.2);
  color: var(--c-honey); box-shadow: 0 0 0 3px rgba(255,215,130,.16); }
.selBtn.lock { opacity: .35; pointer-events: none; }
/* 主ボタン: パステルの面に濃い文字(白文字は2.1:1でSC1.4.3に落ちるため使わない)。
   下辺の実体シャドウで「押せる」ことを形で伝える。 */
.btn { padding: 13px 36px; font-size: 17px; font-weight: 900; letter-spacing: .06em;
  color: var(--c-ink); min-height: var(--tap-min);
  background: linear-gradient(100deg, var(--c-rose), var(--c-lavender));
  border: none; border-radius: var(--r-pill); cursor: pointer; margin-top: var(--sp-1);
  box-shadow: 0 5px 0 0 var(--c-rose-deep), 0 12px 24px rgba(226,85,159,.32);
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out); }
.btn:active { transform: translateY(4px);
  box-shadow: 0 1px 0 0 var(--c-rose-deep), 0 4px 10px rgba(226,85,159,.28); }
/* 副系統の主ボタン(対戦モード) */
.btn.alt { background: linear-gradient(100deg, var(--c-sky), var(--c-mint));
  box-shadow: 0 5px 0 0 #4a9bc4, 0 12px 24px rgba(74,155,196,.3); }
.btn.alt:active { box-shadow: 0 1px 0 0 #4a9bc4, 0 4px 10px rgba(74,155,196,.28); }
.btnSub { padding: 10px 20px; font-size: 13px; font-weight: 800; color: var(--c-text);
  background: var(--c-surface-hi); border: 1.5px solid var(--c-line);
  border-radius: var(--r-pill); cursor: pointer; min-height: var(--tap-min);
  box-shadow: 0 3px 0 0 rgba(0,0,0,.3);
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out); }
.btnSub:active { transform: translateY(2px); box-shadow: 0 1px 0 0 rgba(0,0,0,.3); }
.statusLine { font-size: 13px; font-weight: 800; color: var(--c-honey); line-height: 1.7; }
.creditLine { font-size: 10px !important; color: var(--c-text-dim); line-height: 1.9; }
.legalLink { color: var(--c-sky); font-weight: 700; text-decoration: underline;
  display: inline-block; padding: 6px 4px; }
#vsInfo { font-size: 13px; font-weight: 800; color: var(--c-honey); min-height: 18px; }

/* ===== 世界観パーツ(タイトルの扉・画面のサブラベル・タグライン) ===== */
/* クローゼットの扉。向こう側から町の明かりが漏れている */
.doorMark { position: relative; width: 62px; height: 84px; flex-shrink: 0;
  border-radius: 31px 31px var(--r-s) var(--r-s);
  background: linear-gradient(170deg, var(--c-surface-hi), var(--c-surface));
  border: 3px solid var(--c-lavender);
  box-shadow: 0 0 26px 6px rgba(255,215,130,.3), inset 0 0 18px rgba(255,215,130,.18); }
.doorMark::before { content: ''; position: absolute; inset: 9px 11px 12px;
  border-radius: 22px 22px 4px 4px; border: 2px solid rgba(255,215,130,.5); }
.doorMark::after { content: ''; position: absolute; right: 12px; top: 52%;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c-honey); box-shadow: 0 0 8px var(--c-honey); }
.tagline { font-size: 12px; font-weight: 800; letter-spacing: .16em;
  color: var(--c-lavender); }
/* 機能名(h2)の下に置く世界観の呼び名。機能名を消して置き換えないこと */
.screenSub { font-size: 11px; font-weight: 800; letter-spacing: .26em;
  color: var(--c-rose); margin-top: -6px; }

/* ステージカード */
.stageCard { display: flex; align-items: center; gap: var(--sp-3); width: 100%; max-width: 340px;
  background: linear-gradient(120deg, var(--c-surface-hi), var(--c-surface));
  border: 2px solid var(--c-line); border-radius: var(--r-m); padding: 9px var(--sp-3);
  cursor: pointer; text-align: left; color: var(--c-text); min-height: var(--tap-min);
  box-shadow: 0 3px 0 0 rgba(0,0,0,.3);
  transition: transform var(--dur-fast) var(--ease-out); }
.stageCard:active { transform: translateY(2px); }
.stageCard img { width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-s);
  border: 2px solid var(--c-line); }
.stageCard .sc-main { flex: 1; }
.stageCard .sc-title { font-size: 14px; font-weight: 900; letter-spacing: .04em; }
.stageCard .sc-sub { font-size: 11px; color: var(--c-text-mute); }
.stageCard .sc-state { font-size: 18px; }
.stageCard.cleared { border-color: var(--c-mint); }
.stageCard.cleared .sc-title { color: var(--c-mint); }
.stageCard.locked { opacity: .4; pointer-events: none; }

/* ===== 設定画面 ===== */
.settingBox { width: 100%; max-width: 340px; background: var(--c-surface);
  border: 1.5px solid var(--c-line); border-radius: var(--r-m); padding: var(--sp-3) 14px;
  display: flex; flex-direction: column; gap: var(--sp-2); }
.settingHead { font-size: 12px; font-weight: 800; letter-spacing: .15em;
  color: var(--c-text-mute); text-align: left; }
.settingRow { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; }
.settingRow label { font-weight: 700; white-space: nowrap; }
.settingRow input[type="range"] { flex: 1; min-width: 120px;
  accent-color: var(--c-rose); height: 28px; }
.settingRow input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--c-rose); }
.settingNote { font-size: 11px; color: var(--c-text-dim); line-height: 1.7; text-align: left; }
.btnSub.danger { border-color: rgba(255,138,158,.7); color: #ff9aa8; }

/* キャリブレーション */
#calibratePad { width: 200px; height: 200px; border-radius: 50%; cursor: pointer;
  border: 4px solid var(--c-rose); display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900; letter-spacing: .1em; color: var(--c-rose);
  background: rgba(255,142,203,.14); user-select: none; -webkit-user-select: none; }
#calibratePad.beat { animation: calibBeat .18s ease-out; }
@keyframes calibBeat { 0% { box-shadow: 0 0 0 0 rgba(255,45,150,.9); transform: scale(1.06); }
  100% { box-shadow: 0 0 0 26px rgba(255,45,150,0); transform: scale(1); } }

/* 一時停止ボタン(バトル中のみ表示。HUDはpointer-events:noneなので個別に有効化) */
#pauseBtn { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4);
  background: rgba(0,0,0,.5); color: #fff; font-size: 18px; cursor: pointer;
  pointer-events: auto; z-index: 6; }

/* ローディング */
#loadingList { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 220px;
  background: var(--c-surface); border: 1.5px solid var(--c-line);
  border-radius: var(--r-m); padding: var(--sp-3) var(--sp-4); }
.loadRow { font-size: 14px; font-weight: 700; text-align: left; }
.loadRow .loadIcon { display: inline-block; width: 22px; }

/* 通知トースト */
#toast { position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%);
  z-index: 30; background: var(--c-surface); border: 1.5px solid rgba(255,215,130,.6);
  color: var(--c-honey); font-size: 13px; font-weight: 700; border-radius: var(--r-pill);
  padding: 10px 20px; opacity: 0; pointer-events: none; transition: opacity var(--dur-slow);
  box-shadow: 0 8px 22px rgba(0,0,0,.45);
  max-width: 86%; text-align: center; }
#toast.on { opacity: 1; }

/* ===== リザルト(今夜のけっか) ===== */
#resultOverlay { display: none; }
.resultCard { width: 100%; max-width: 340px; display: flex; flex-direction: column;
  align-items: center; gap: var(--sp-3);
  background: linear-gradient(170deg, var(--c-surface-hi), var(--c-surface));
  border: 2px solid var(--c-line); border-radius: var(--r-l);
  padding: var(--sp-4) var(--sp-4) var(--sp-5);
  box-shadow: 0 14px 34px rgba(0,0,0,.5); }
#resultTitle { font-size: 40px; font-weight: 900; letter-spacing: .06em; line-height: 1.15;
  background: linear-gradient(100deg, var(--c-honey), var(--c-rose) 60%, var(--c-lavender));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 12px rgba(255,215,130,.4)); }
#resultOverlay.lose #resultTitle {
  background: linear-gradient(100deg, #9aa8c9, #c2b6d8);
  -webkit-background-clip: text; background-clip: text;
  filter: none; }
#resultDetail { font-size: 12px; color: var(--c-text-mute); line-height: 1.9;
  border-top: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line);
  padding: var(--sp-2) 0; width: 100%; }
.reward { color: var(--c-honey); font-weight: 900; font-size: 15px; line-height: 1.8; }
.resultMsg { font-size: 12px; color: var(--c-text-dim); }
.hidden { display: none !important; }

/* ===== クロゼッタ: タイトル・ラッキー属性 ===== */
.titleSub { font-size: 13px; letter-spacing: .3em; -webkit-text-fill-color: var(--c-text);
  color: var(--c-text); font-weight: 700; }
.luckyLine { font-size: 12px; font-weight: 800; color: var(--c-honey);
  background: rgba(255,215,130,.1);
  border: 1px dashed rgba(255,215,130,.6); border-radius: var(--r-pill); padding: 6px 16px; }
#songTheme { position: absolute; top: calc(76px + env(safe-area-inset-top, 0px));
  left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 800;
  color: #ffd9ec; background: rgba(0,0,0,.45); border-radius: 999px; padding: 3px 12px;
  pointer-events: none; white-space: nowrap; }

/* ===== カードUI(パステルの紙に印刷されたトレカ) =====
   docs/WORLD_GUIDE.md §2-4/§4。紙地は --c-paper、文字は --c-ink(紙の上で白文字は使わない)。
   属性色は各カードの --attrColor(cards.jsのATTRS)で与え、
   「上部の帯」と「イラスト面の淡いティント」と「属性チップ」の3か所にだけ使う。
   .cardEmoji の面が将来のカードイラスト(3:4)の入る枠。 */
.gameCard { position: relative; width: 158px; height: 220px; border-radius: var(--r-l);
  background: linear-gradient(170deg, var(--c-paper) 0%, var(--c-paper-2) 100%);
  border: 3px solid var(--rar-n); overflow: hidden; color: var(--c-ink);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 0 0 8px; flex-shrink: 0; user-select: none; -webkit-user-select: none;
  box-shadow: 0 6px 16px rgba(0,0,0,.42); }
.gameCard.rar-R  { border-color: var(--rar-r);
  box-shadow: 0 6px 16px rgba(0,0,0,.42), 0 0 14px rgba(143,217,255,.6); }
.gameCard.rar-SR { border-color: var(--rar-sr);
  box-shadow: 0 6px 16px rgba(0,0,0,.42), 0 0 18px rgba(255,215,130,.75); }
.cardTop { display: flex; justify-content: space-between; align-items: center; width: 100%;
  font-size: 11px; font-weight: 900; padding: 4px 8px;
  background: var(--attrColor, #ccc); color: var(--c-ink);
  border-bottom: 2px solid rgba(255,255,255,.6); }
.cardRar { background: rgba(255,255,255,.88); border-radius: 6px; padding: 1px 7px;
  color: var(--c-ink); letter-spacing: .04em; }
.rar-R .cardRar { color: #145d84; } .rar-SR .cardRar { color: #8a5608; }
.cardStyle { background: rgba(255,255,255,.88); border-radius: 6px; padding: 1px 7px;
  color: var(--c-ink); font-variant-numeric: tabular-nums; }
/* イラスト枠。カードイラスト(3:4)を object-fit: cover で敷き、
   画像が無い/失敗したときは背後の絵文字プレースホルダーが出る(screens.jsが<img>を外す)。
   枠は 103x114 = 約9:10。3:4のイラストを cover で入れると上下が各8.5%だけ切れる。
   これは WORLD_GUIDE §4-2 の「上下各8%を安全余白として空ける」と一致させた値。
   枠を横幅いっぱい(142px)にすると切り取りが各15%になり、頭が切れる札が出るため広げない。
   高さは flex ではなく固定にし `flex: none` を付ける。カード名が2行になる札で
   枠が収縮し、切り取りが増えてしまうため(2026-08-16のE2Eで検出)。 */
.cardEmoji { position: relative; width: 103px; height: 114px; flex: none;
  margin: 8px auto 0; border-radius: 12px; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.84), rgba(255,255,255,.6)),
    var(--attrColor, #ccc);
  box-shadow: inset 0 0 0 1.5px var(--c-paper-line); }
.cardArtFallback { position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-size: 56px; line-height: 1;
  text-shadow: 0 3px 5px rgba(58,35,89,.28); }
.cardArt { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center; display: block; }
.cardName { font-size: 12.5px; font-weight: 900; line-height: 1.25;
  margin: 6px 8px 0; color: var(--c-ink); }
.cardAttrChip { margin: auto 8px 0; font-size: 10.5px; font-weight: 800;
  background: var(--attrColor, #ccc); color: var(--c-ink);
  border: 1.5px solid rgba(58,35,89,.28);
  border-radius: var(--r-pill); padding: 2px 10px; }
.cardCount { position: absolute; right: 13px; top: 39px; font-size: 11px; font-weight: 900;
  background: var(--c-ink); color: var(--c-paper); border-radius: 7px; padding: 1px 7px;
  z-index: 2; }
.cardShineTag { position: absolute; left: 13px; top: 39px; font-size: 10px; font-weight: 900;
  border-radius: 7px; padding: 1px 7px; background: rgba(58,35,89,.16); color: var(--c-ink);
  z-index: 2; }
.shine-2 .cardShineTag { background: linear-gradient(90deg,#ff9ad5,#ffe066,#7de8ff);
  color: var(--c-ink); }

/* 小型カード(コーデ/一覧用) */
.gameCard.mini { width: 96px; height: 134px; border-width: 2px; border-radius: var(--r-m);
  padding: 0 0 5px; box-shadow: 0 4px 10px rgba(0,0,0,.4); }
.gameCard.mini .cardTop { font-size: 8.5px; padding: 3px 5px; border-bottom-width: 1.5px; }
.gameCard.mini .cardRar, .gameCard.mini .cardStyle { padding: 0 5px; border-radius: 4px; }
/* 小型も同じ約9:10にして、切り取り率を大型カードとそろえる */
.gameCard.mini .cardEmoji { width: 52px; height: 58px; margin: 5px auto 0; border-radius: 8px; }
.gameCard.mini .cardArtFallback { font-size: 30px; }
.gameCard.mini .cardName { font-size: 9.5px; margin: 4px 5px 0; }
.gameCard.mini .cardAttrChip { font-size: 8px; padding: 1px 6px; margin: auto 5px 0;
  border-width: 1px; }
.gameCard.mini .cardCount { font-size: 9px; right: 9px; top: 29px; padding: 0 5px; }
.gameCard.mini .cardShineTag { font-size: 8px; left: 9px; top: 29px; padding: 0 5px; }
.gameCard.mini.equipped { outline: 3px solid var(--c-honey); outline-offset: 1px;
  box-shadow: 0 4px 10px rgba(0,0,0,.4), 0 0 16px rgba(255,215,130,.85); }
/* 上部の帯の中央(レア度チップとstyleチップのあいだ)に収まる短いラベルにする */
.gameCard.mini.equipped::after { content: '着用'; position: absolute; top: 3px; left: 50%;
  transform: translateX(-50%); font-size: 8px; font-weight: 900; color: var(--c-ink);
  background: var(--c-honey); border-radius: 4px; padding: 0 4px; z-index: 3;
  white-space: nowrap; line-height: 1.5;
  box-shadow: 0 0 0 1.5px rgba(58,35,89,.3); }

/* ===== 輝度進化(重ね): ノーマル→キラ→ホロ。CSSのリアルタイム加工で表現 =====
   紙地(明るい面)の上で見えるよう、白のスクリーン合成ではなく
   キラ=金の光沢/ホロ=虹のmultiplyで描く。 */
.cardFx { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.shine-1 .cardFx {   /* キラ: 金の光沢スイープ+きらめき */
  opacity: 1;
  background:
    radial-gradient(circle at 22% 30%, rgba(255,196,60,.95) 0 2px, transparent 4.4px),
    radial-gradient(circle at 74% 58%, rgba(255,168,40,.9) 0 1.7px, transparent 3.6px),
    radial-gradient(circle at 42% 78%, rgba(255,208,90,.9) 0 1.5px, transparent 3.2px),
    linear-gradient(115deg, transparent 34%, rgba(255,204,92,.55) 47%, transparent 60%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 240% 100%;
  animation: kiraSweep 2.4s ease-in-out infinite; }
.shine-2 .cardFx {   /* ホロ: 虹色が流れる(ホログラム風) */
  opacity: .6; mix-blend-mode: multiply;
  background:
    linear-gradient(115deg, transparent 28%, rgba(255,255,255,.85) 48%, transparent 66%),
    linear-gradient(65deg,
      #ff8ecb 0%, #ffd782 20%, #a9e86a 40%, #6fc7ff 60%, #c6a8ff 80%, #ff8ecb 100%);
  background-size: 260% 100%, 300% 100%;
  animation: holoFlow 3.2s linear infinite; }
@keyframes kiraSweep { 0%,100% { background-position: 0 0, 0 0, 0 0, -120% 0; }
  55% { background-position: 0 0, 0 0, 0 0, 120% 0; } }
@keyframes holoFlow { from { background-position: -130% 0, 0 0; }
  to { background-position: 130% 0, 300% 0; } }

/* ===== 獲得演出(1枚めくり) ===== */
.gainHint { font-size: 12px; color: var(--c-text-mute); }
#gainCardWrap { perspective: 900px; }
#gainFlipper { position: relative; width: 158px; height: 220px; cursor: pointer;
  transform-style: preserve-3d; transition: transform .65s cubic-bezier(.2,.7,.25,1); }
#gainFlipper.flipped { transform: rotateY(180deg); }
#gainFlipper .gameCard { position: absolute; inset: 0; backface-visibility: hidden;
  -webkit-backface-visibility: hidden; }
#gainFlipper .cardFront { transform: rotateY(180deg); }
/* 裏面: 町の扉のパターン */
.cardBack { border-color: var(--c-paper); color: var(--c-ink); padding: 0;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,255,255,.5), transparent 62%),
    repeating-linear-gradient(45deg, var(--c-lavender) 0 14px, var(--c-rose) 14px 28px);
  justify-content: center; align-items: center; gap: var(--sp-2);
  animation: backGlow 1.4s ease-in-out infinite alternate; }
.cardBackMark { font-size: 52px; filter: drop-shadow(0 3px 6px rgba(58,35,89,.4)); }
.cardBackText { font-size: 13px; font-weight: 900; letter-spacing: .28em; }
@keyframes backGlow { from { box-shadow: 0 6px 16px rgba(0,0,0,.42), 0 0 10px rgba(255,142,203,.5); }
  to { box-shadow: 0 6px 16px rgba(0,0,0,.42), 0 0 28px rgba(198,168,255,.95); } }
#cardGainInfo { font-size: 15px; font-weight: 800; line-height: 1.8; min-height: 48px; }
.gainNew { color: var(--c-honey); font-size: 19px; }
.gainShineUp { color: var(--c-sky); }

/* ===== コーデ画面(すがたみの間) ===== */
#opPanel { width: 100%; max-width: 360px; background: var(--c-surface);
  border: 1.5px solid var(--c-line); border-radius: var(--r-m); padding: 10px var(--sp-3);
  display: flex; flex-direction: column; gap: 5px; }
.opTotal { font-size: 16px; font-weight: 900; color: var(--c-honey); }
.opTotal b { font-size: 24px; font-variant-numeric: tabular-nums; }
.opNote { font-size: 10px; color: var(--c-text-dim); font-weight: 700; margin-left: 6px; }
.opBreak { font-size: 11px; color: var(--c-text-mute); }
.opThemes { font-size: 10px; color: var(--c-text); display: flex; flex-wrap: wrap; gap: 4px;
  justify-content: center; line-height: 1.9; }
.themeChip { border: 1.5px solid var(--attrColor, #888); border-radius: var(--r-pill);
  padding: 1px 8px; white-space: nowrap; }
#coordeList { width: 100%; max-width: 380px; display: flex; flex-direction: column;
  gap: var(--sp-1); }
.coordeSlotHead { font-size: 12px; font-weight: 800; text-align: left; color: var(--c-text);
  border-bottom: 1px solid var(--c-line); padding: 6px 2px 4px; }
.coordeSlotHead b { color: var(--c-honey); }
.noEquip { color: var(--c-text-dim); }
.coordeRow { display: flex; gap: var(--sp-2); overflow-x: auto; padding: 6px 2px;
  -webkit-overflow-scrolling: touch; }
.coordeEmpty { font-size: 11px; color: var(--c-text-dim); padding: var(--sp-3) var(--sp-1); }

/* ===== 図鑑(クローゼット帳・60マスグリッド) ===== */
#zukanGrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  width: 100%; max-width: 360px; }
.zukanCell { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-s);
  cursor: pointer; background: rgba(255,255,255,.05); border: 2px solid var(--c-line);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  color: var(--c-text); padding: 0; }
/* 入手済みは「紙の棚」。属性色を白でうすめたパステル面にする */
.zukanCell.got { color: var(--c-ink); border-color: var(--rar-n);
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,255,255,.62)),
    var(--attrColor, #ccc); }
/* マスはイラストが全面に載るので、レア度枠がイラスト背景と直に接する。
   属性背景と枠色が近い組み合わせ(クール×R など)でも枠が消えないよう、
   内側に濃い細線を1本入れて必ず分離する(WORLD_GUIDE §4-5 の検収6)。 */
.zukanCell.got { box-shadow: inset 0 0 0 1px rgba(58,35,89,.32); }
.zukanCell.got.rar-R  { border-color: var(--rar-r); }
.zukanCell.got.rar-SR { border-color: var(--rar-sr);
  box-shadow: inset 0 0 0 1px rgba(58,35,89,.32), 0 0 8px rgba(255,215,130,.75); }
.zEmoji { font-size: 24px; text-shadow: 0 2px 3px rgba(58,35,89,.3); }
/* マスは3/4なのでイラストが切れずに収まる。読み込み失敗時は<img>が外れて絵文字に戻る。
   属性色はイラストの背景そのものが担う(§5の属性別背景色)。 */
.zArt { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; }
.zCount { position: absolute; right: 2px; bottom: 2px; font-size: 9px; font-weight: 900;
  background: var(--c-ink); color: var(--c-paper); border-radius: 6px; padding: 0 4px; }
.zUnknown { font-size: 18px; font-weight: 900; color: var(--c-text-dim); }
#zukanDetail { width: 100%; max-width: 360px; min-height: 64px; font-size: 12px;
  line-height: 1.8; background: var(--c-surface); color: var(--c-text-mute);
  border: 1.5px solid var(--c-line); border-radius: var(--r-m); padding: var(--sp-2) var(--sp-3); }
#zukanDetail b { color: var(--c-text); }

/* ===== 横画面の案内(縦画面専用) ===== */
#rotateHint { display: none; position: fixed; inset: 0; z-index: 50;
  background: var(--c-night-deep); color: var(--c-text); font-size: 18px; font-weight: 800;
  align-items: center; justify-content: center; text-align: center; padding: 24px; }
@media (orientation: landscape) and (max-height: 520px) {
  #rotateHint { display: flex; }
}

/* ===== 視差・点滅を抑える設定の尊重 ===== */
@media (prefers-reduced-motion: reduce) {
  #stage.shake, #aura, #aura::before, #aura::after, #aura .fxLayer, #missFlash.on, #calibratePad.beat,
  .cardFx, .cardBack {
    animation: none !important; }
  /* キラ・ホロは動きを止めても「静止した光沢」として残す(輝度の差が消えないように) */
  #judge.pop, #countdown.pop { animation: none !important; opacity: 1; }
  #stage video, #stage img.poster { transition: none; }
  #gainFlipper { transition-duration: .01s; }
  .btn, .btnSub, .stageCard { transition: none; }
}
