:root {
  color-scheme: dark;
  --hull: #101c29;
  --deck: #172a3d;
  --deck-2: #1f3a56;
  --line: #34536f;
  --text: #e8eff6;
  --muted: #9fb4c7;
  --ice: #8fdcff;
  --amber: #ffb53d;
  --alarm: #ff7b7b;
  --ok: #62e3a8;
  --font-display: "Chakra Petch", "Zen Kaku Gothic New", sans-serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--hull);
  background-image:
    linear-gradient(rgba(143, 220, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 220, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  line-height: 1.6;
}

[hidden] { display: none !important; }

.screen { min-height: 100dvh; padding: 24px; }
.center { display: grid; place-items: center; }
.loading-text { color: var(--muted); }

/* ---- 認証画面 ---- */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 56px;
  align-items: center;
  max-width: 1020px;
  margin: 0 auto;
}

.auth-hero { text-align: center; }

.airlock { width: min(100%, 300px); height: auto; }
.al-hull { fill: var(--deck); stroke: var(--line); stroke-width: 2; }
.al-ring { fill: none; stroke: var(--ice); stroke-width: 10; stroke-dasharray: 60 12.25; transform-origin: 120px 120px; transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1); }
.al-inner { fill: var(--hull); stroke: var(--deck-2); stroke-width: 12; }
.hatch { fill: var(--deck-2); stroke: var(--line); stroke-width: 2; transition: transform 0.7s cubic-bezier(0.3, 0.7, 0.2, 1); }
.airlock.open .al-ring { transform: rotate(45deg); }
.airlock.open .hatch-l { transform: translateX(-34px); }
.airlock.open .hatch-r { transform: translateX(34px); }

.wordmark {
  margin: 16px 0 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: 0.04em;
}
.tagline { margin: 0; color: var(--muted); }

.auth-panel {
  background: var(--deck);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ice);
  border-radius: 6px;
  padding: 24px;
}

.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: 500 1rem var(--font-body);
  cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--ice); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 6px; font-weight: 500; }
.field small { display: block; margin-top: 4px; color: var(--muted); font-size: 0.82rem; }
.field input {
  width: 100%;
  padding: 11px 12px;
  background: var(--hull);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font: 1rem var(--font-body);
}
.field input:focus-visible { outline: 2px solid var(--ice); outline-offset: 1px; border-color: var(--ice); }
.field input:disabled { opacity: 0.6; }

.btn {
  display: inline-block;
  padding: 11px 18px;
  background: var(--deck-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font: 700 1rem var(--font-body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--ice); }
.btn:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { width: 100%; background: var(--ice); border-color: var(--ice); color: #06202e; }
.btn.primary:hover:not(:disabled) { background: #b4e9ff; }
.btn.ghost { background: transparent; }

.msg {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: rgba(255, 181, 61, 0.08);
  font-size: 0.92rem;
}
.msg.error { border-left-color: var(--alarm); background: rgba(255, 123, 123, 0.1); color: #ffd0d0; }
.msg.ok { border-left-color: var(--ok); background: rgba(98, 227, 168, 0.1); color: #c9f6e0; }

/* ---- メインメニュー ---- */
.menu { max-width: 960px; margin: 0 auto; }
.menu-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  padding: 16px 20px;
  background: var(--deck);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.menu-name { margin: 0; font: 700 1.25rem var(--font-display); }
.menu-id { margin: 0; color: var(--muted); font-size: 0.85rem; }
.menu-wallet { margin-left: auto; text-align: right; }
.wallet-label { display: block; color: var(--muted); font-size: 0.8rem; }
.wallet-value { font: 700 1.5rem var(--font-display); color: var(--amber); }
.menu-actions { display: flex; gap: 8px; }
.menu-body { padding: 56px 0; text-align: center; }
.menu-body h2 { margin: 0 0 8px; font: 700 1.8rem var(--font-display); }
.menu-note { color: var(--muted); }
.menu-buttons { display: grid; gap: 12px; max-width: 320px; margin: 28px auto 0; }

/* ---- レスポンシブ・動きの配慮 ---- */
@media (max-width: 820px) {
  .auth { grid-template-columns: minmax(0, 1fr); gap: 24px; align-content: start; }
  .airlock { width: 150px; }
  .menu-wallet { margin-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .al-ring, .hatch { transition: none; }
}

/* ---- 参加・ロビー ---- */
.join { display: grid; place-items: center; }
.join-panel { width: min(100%, 420px); }
.join-panel h2 { margin: 0 0 16px; font: 700 1.4rem var(--font-display); }
.code-input { font: 700 2rem var(--font-display) !important; letter-spacing: 0.35em; text-align: center; }
.back { width: 100%; margin-top: 8px; }

.lobby { max-width: 1020px; margin: 0 auto; }
.lobby-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 16px 20px; background: var(--deck); border: 1px solid var(--line);
  border-top: 3px solid var(--ice); border-radius: 6px;
}
.lobby-head > div { margin-right: auto; }
.lobby-label { margin: 0; color: var(--muted); font-size: 0.8rem; }
.lobby-code { margin: 0; font: 700 2.4rem/1.1 var(--font-display); letter-spacing: 0.25em; color: var(--ice); }

.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.panel { background: var(--deck); border: 1px solid var(--line); border-radius: 6px; padding: 20px; }
.panel h2 { margin: 0 0 14px; font: 700 1.15rem var(--font-display); }
.count { margin-left: 8px; color: var(--muted); font-weight: 500; }

.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.player { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--hull); border: 1px solid var(--line); border-radius: 4px; }
.player.offline { opacity: 0.55; }
.player-art { width: 30px; height: 36px; flex: none; }
.player-art svg { width: 100%; height: 100%; display: block; }
.player-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tag { padding: 2px 8px; border-radius: 3px; font-size: 0.78rem; border: 1px solid var(--line); color: var(--muted); }
.tag-host { color: var(--amber); border-color: var(--amber); }
.tag-me { color: var(--ice); border-color: var(--ice); }

.name-form { display: flex; gap: 8px; align-items: flex-end; }
.name-form .field { flex: 1; margin-bottom: 0; }
.palette-label { margin: 20px 0 8px; color: var(--muted); font-size: 0.9rem; }
.palette { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.swatch {
  aspect-ratio: 1; border: 2px solid var(--line); border-radius: 50%;
  background: var(--swatch); cursor: pointer;
}
.swatch:hover:not(:disabled) { border-color: var(--text); }
.swatch:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
.swatch[aria-pressed="true"] { border-color: var(--ice); box-shadow: 0 0 0 3px var(--ice); }
.swatch:disabled { opacity: 0.25; cursor: not-allowed; }

.lobby-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 16px; }
.lobby-foot .menu-note { margin: 0; margin-right: auto; }
.lobby-foot .btn.primary { width: auto; }

.menu-body .msg { max-width: 420px; margin-left: auto; margin-right: auto; text-align: left; }

@media (max-width: 820px) {
  .lobby-grid { grid-template-columns: minmax(0, 1fr); }
  .lobby-code { font-size: 2rem; }
}

/* ---- ゲーム画面 ---- */
body.in-game { overflow: hidden; }
.game { position: fixed; inset: 0; padding: 0; min-height: 0; overflow: hidden; background: #0a121b; }
#game-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.hud { position: absolute; }
.hud-tl { top: 12px; left: 12px; padding: 8px 14px; background: rgba(16, 28, 41, 0.8); border: 1px solid var(--line); border-radius: 4px; }
.hud-line { margin: 0; font-size: 0.9rem; }
.hud-line strong { font: 700 1rem var(--font-display); letter-spacing: 0.15em; color: var(--ice); }
.minimap { position: absolute; top: 12px; right: 12px; width: 200px; height: 132px; border: 1px solid var(--line); border-radius: 4px; }
.hud-actions { right: 12px; bottom: 12px; display: flex; gap: 8px; }
.hud-actions .btn { background: rgba(16, 28, 41, 0.85); padding: 9px 14px; }
.stick {
  display: none; position: absolute; left: 24px; bottom: 28px; width: 132px; height: 132px;
  border-radius: 50%; background: rgba(23, 42, 61, 0.55); border: 2px solid rgba(143, 220, 255, 0.5);
  touch-action: none; user-select: none;
}
.stick-knob {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%; background: rgba(143, 220, 255, 0.75); pointer-events: none;
}
@media (pointer: coarse) { .stick { display: block; } }
@media (max-width: 560px) { .minimap { width: 140px; height: 92px; } }

/* ---- 前回の部屋に戻る確認 ---- */
.resume { max-width: 420px; margin: 20px auto 0; padding: 14px 16px; border: 1px solid var(--amber); border-radius: 6px; background: rgba(255, 181, 61, 0.08); text-align: left; }
.resume p { margin: 0; }
.resume strong { font: 700 1.1rem var(--font-display); letter-spacing: 0.15em; color: var(--amber); }
.resume-actions { display: flex; gap: 8px; margin-top: 10px; }
.resume-actions .btn { flex: 1; width: auto; }

/* ---- 役職・ボタン・通知 ---- */
.hud-role { font-weight: 700; color: var(--ice); }
.hud-role.is-impostor { color: var(--alarm); }

.action-pad { position: absolute; right: 12px; bottom: 70px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.act-btn {
  min-width: 112px; padding: 16px 18px; border-radius: 10px; border: 2px solid var(--line);
  background: rgba(16, 28, 41, 0.9); color: var(--text); font: 700 1.05rem var(--font-body); cursor: pointer;
}
.act-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.act-btn:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
.act-kill { border-color: var(--alarm); color: #ffd0d0; background: rgba(120, 30, 30, 0.85); }
.act-report { border-color: var(--amber); color: #ffe6b3; }
.act-use { border-color: var(--ice); }

.game-toast {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%); margin: 0; padding: 10px 18px;
  background: rgba(16, 28, 41, 0.92); border: 1px solid var(--amber); border-radius: 6px; font-weight: 700;
}

.role-reveal {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px;
  background: rgba(8, 14, 22, 0.88);
}
.role-reveal p { margin: 0; }
.reveal-label { color: var(--muted); }
.reveal-role { font: 700 clamp(2.4rem, 9vw, 4.5rem) var(--font-display); color: var(--ice); }
.role-reveal.is-impostor .reveal-role { color: var(--alarm); }
.reveal-mates { color: var(--text); font-size: 1.1rem; }

/* ---- 会議 ---- */
.meeting, .gameover { position: absolute; inset: 0; background: #0d1824; z-index: 5; overflow-y: auto; padding: 20px; }
.meeting { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 14px; }
.meeting-head h2 { margin: 0; font: 700 1.7rem var(--font-display); color: var(--amber); }
.meeting-sub { margin: 2px 0 0; color: var(--muted); }
.meeting-timer { margin: 6px 0 0; font: 700 1.1rem var(--font-display); color: var(--ice); }
.meeting-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; min-height: 0; }
.mplayers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; align-content: start; overflow-y: auto; }
.mplayer {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px; text-align: left;
  background: var(--deck); border: 2px solid var(--line); border-radius: 6px; color: var(--text); font: 500 1rem var(--font-body); cursor: pointer;
}
.mplayer:disabled { cursor: default; }
.mplayer.selected { border-color: var(--ice); box-shadow: 0 0 0 2px var(--ice); }
.mplayer.dead { opacity: 0.4; }
.mplayer:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
.mchat { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 8px; min-height: 0; background: var(--deck); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 6px; align-content: start; max-height: 46vh; }
.chat-msg strong { margin-right: 8px; color: var(--ice); }
.chat-msg.ghost { opacity: 0.7; font-style: italic; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; min-width: 0; padding: 10px; background: var(--hull); border: 1px solid var(--line); border-radius: 4px; color: var(--text); font: 1rem var(--font-body); }
.chat-form input:focus-visible { outline: 2px solid var(--ice); }
.meeting-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.meeting-hint { margin: 0; margin-right: auto; color: var(--muted); }
.meeting-foot .btn.primary { width: auto; }

.meeting-result {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center;
  background: rgba(8, 14, 22, 0.94); padding: 24px;
}
.result-text { margin: 0; font: 700 clamp(1.4rem, 4vw, 2.2rem) var(--font-display); }
.result-votes { list-style: none; margin: 0; padding: 0; color: var(--muted); display: grid; gap: 4px; }

/* ---- 勝敗 ---- */
.gameover { display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; }
.gameover h2 { margin: 0; font: 700 clamp(2rem, 7vw, 3.4rem) var(--font-display); }
.gameover.win-crew h2 { color: var(--ice); }
.gameover.win-impostor h2 { color: var(--alarm); }
.over-reason { margin: 0; color: var(--muted); }
.over-players { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; width: min(100%, 420px); }
.over-row { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: var(--deck); border: 1px solid var(--line); border-radius: 4px; text-align: left; }
.over-row.is-impostor { border-color: var(--alarm); }
.over-role { color: var(--muted); }
.over-row.is-impostor .over-role { color: var(--alarm); }
.over-wait { margin: 0; color: var(--muted); }
.gameover .btn.primary { width: auto; }

@media (max-width: 820px) {
  .meeting-body { grid-template-columns: minmax(0, 1fr); }
  .chat-list { max-height: 28vh; }
  .act-btn { min-width: 96px; padding: 14px 14px; }
}

/* ---- タスク：進捗バー・一覧・ボタン ---- */
.game-toast { top: 64px; }
.task-bar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: min(38vw, 340px); display: grid; gap: 4px; }
.task-bar-track { height: 14px; background: rgba(16, 28, 41, 0.9); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.task-bar-fill { height: 100%; width: 0; background: var(--ok); transition: width 0.4s; }
.task-bar-label { text-align: center; font-size: 0.85rem; color: var(--muted); }
.task-bar-label strong { color: var(--text); }

.task-panel { top: 116px; left: 12px; max-width: min(46vw, 260px); padding: 8px 12px; background: rgba(16, 28, 41, 0.8); border: 1px solid var(--line); border-radius: 4px; }
.task-panel:has(.task-list:empty) { display: none; }
.task-list-title { margin: 0 0 4px; font-weight: 700; font-size: 0.85rem; color: var(--muted); }
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 0.88rem; }
.task-list li.done { color: var(--ok); text-decoration: line-through; opacity: 0.8; }
.act-task { border-color: #ffd640; color: #fff1b8; }

/* ---- ミニゲームの窓 ---- */
.task-modal { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgba(8, 14, 22, 0.78); padding: 16px; }
.task-card { width: min(100%, 460px); background: var(--deck); border: 1px solid var(--line); border-top: 3px solid #ffd640; border-radius: 6px; padding: 18px; }
.task-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.task-card-head h2 { margin: 0; font: 700 1.2rem var(--font-display); }
.task-body { display: grid; gap: 14px; justify-items: center; min-height: 240px; align-content: center; touch-action: none; user-select: none; }
.task-body.mg-done > :not(.mg-success) { opacity: 0.25; pointer-events: none; }
.mg-success { margin: 0; font: 700 1.8rem var(--font-display); color: var(--ok); }
.mg-hint { margin: 0; color: var(--muted); text-align: center; font-size: 0.95rem; }
.mg-btn { width: auto !important; min-width: 160px; }
.mg-row { display: flex; gap: 10px; }

.mg-bar { width: 100%; height: 16px; background: var(--hull); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mg-bar-fill { height: 100%; width: 0; background: var(--ice); }
.mg-bar.mg-vertical { width: 18px; height: 220px; display: flex; align-items: flex-end; }
.mg-bar.mg-vertical .mg-bar-fill { width: 100%; height: 0; }

.mg-wiring { width: 100%; max-width: 340px; height: auto; touch-action: none; }

.mg-card-track { position: relative; width: 100%; height: 76px; background: #0f2233; border: 2px solid var(--line); border-radius: 8px; touch-action: none; }
.mg-card { position: absolute; left: 0; top: 8px; width: 96px; height: 56px; display: grid; place-items: center; background: #cfe3f5; color: #1a3550; font: 700 0.85rem var(--font-display); border-radius: 6px; cursor: grab; touch-action: none; }

.mg-xfer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; }
.mg-pc { padding: 14px 10px; background: var(--hull); border: 2px solid var(--line); border-radius: 6px; font-weight: 700; font-size: 0.85rem; text-align: center; }

.mg-lever-wrap { display: flex; gap: 24px; align-items: stretch; }
.mg-lever-track { position: relative; width: 56px; height: 220px; background: var(--hull); border: 2px solid var(--line); border-radius: 28px; touch-action: none; }
.mg-lever-handle { position: absolute; left: 4px; top: 0; width: 44px; height: 44px; border-radius: 50%; background: #ff7b7b; border: 3px solid #ffd0d0; cursor: grab; touch-action: none; }

.mg-align { position: relative; width: 100%; padding: 10px 0; }
.mg-band { position: absolute; top: 50%; height: 26px; transform: translateY(-50%); background: rgba(98, 227, 168, 0.3); border: 2px solid var(--ok); border-radius: 4px; pointer-events: none; }
.mg-align input[type="range"] { position: relative; width: 100%; margin: 0; }

.mg-lamp { width: 28px; height: 28px; border-radius: 50%; background: #2a3b4c; border: 2px solid var(--line); }
.mg-lamp.on { background: #ffd640; border-color: #fff1b8; box-shadow: 0 0 12px #ffd640; }
.mg-switch { width: 56px; height: 64px; border-radius: 8px; border: 2px solid var(--line); background: #2a3b4c; color: var(--text); font: 700 0.9rem var(--font-body); cursor: pointer; }
.mg-switch[aria-pressed="true"] { background: #ffd640; color: #3a2b00; border-color: #fff1b8; }

.mg-pads { display: grid; grid-template-columns: repeat(2, 108px); gap: 12px; }
.mg-pad { width: 108px; height: 108px; border-radius: 14px; border: 3px solid rgba(0, 0, 0, 0.4); background: var(--pad); opacity: 0.45; cursor: pointer; }
.mg-pad.lit { opacity: 1; box-shadow: 0 0 22px var(--pad); }
.mg-pad:disabled { cursor: default; }

.mg-hold { width: 150px; height: 150px; border-radius: 50%; border: 4px solid var(--ice); background: rgba(143, 220, 255, 0.12); color: var(--text); font: 700 1.2rem var(--font-body); cursor: pointer; touch-action: none; }
.mg-hold.on { background: rgba(143, 220, 255, 0.45); }

.mg-meter { position: relative; width: 100%; height: 34px; background: var(--hull); border: 2px solid var(--line); border-radius: 6px; overflow: hidden; }
.mg-zone { position: absolute; top: 0; bottom: 0; background: rgba(98, 227, 168, 0.4); }
.mg-needle { position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: #fff; }
.mg-count { margin: 0; color: var(--muted); }

/* ---- 能力ボタン ---- */
.act-ability { border-color: #8fdcff; color: #d7f2ff; }
.act-beam { border-color: #7df9ff; color: #e6ffff; background: rgba(20, 70, 90, 0.85); }
#seer-list li { color: #ffe6a8; }

/* ---- ゲーム設定（ロビー） ---- */
.settings-panel { margin-top: 16px; }
.settings-warnings { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.settings-warnings:empty { display: none; }
.settings-warnings li { padding: 8px 12px; border-left: 3px solid var(--amber); background: rgba(255, 181, 61, 0.08); font-size: 0.92rem; }
.settings-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.stab { padding: 7px 12px; background: transparent; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font: 500 0.92rem var(--font-body); cursor: pointer; }
.stab[aria-selected="true"] { color: var(--text); border-color: var(--ice); background: rgba(143, 220, 255, 0.1); }
.stab:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
.settings-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 18px; }
.sfield { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--hull); border: 1px solid var(--line); border-radius: 4px; }
.slabel { font-size: 0.92rem; }
.sctl { display: inline-flex; align-items: center; gap: 6px; }
.sunit { color: var(--muted); font-style: normal; font-size: 0.82rem; }
.sctl input[type="number"] { width: 84px; padding: 6px 8px; background: var(--deck); border: 1px solid var(--line); border-radius: 4px; color: var(--text); font: 1rem var(--font-body); }
.sctl select { max-width: 190px; padding: 6px 8px; background: var(--deck); border: 1px solid var(--line); border-radius: 4px; color: var(--text); font: 0.92rem var(--font-body); }
.sctl input[type="color"] { width: 44px; height: 32px; padding: 0; background: none; border: 1px solid var(--line); border-radius: 4px; }
.sctl input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--ice); }
.sctl input:focus-visible, .sctl select:focus-visible { outline: 2px solid var(--ice); }
.sctl input:disabled, .sctl select:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---- サボタージュ・通気口・修理 ---- */
.game-toast { top: 112px; }
.act-sabo { border-color: #ff9a3d; color: #ffe0c2; background: rgba(110, 55, 10, 0.85); }
.act-fix { border-color: #ff9a3d; color: #ffe0c2; }
.act-vent { border-color: #b69bff; color: #eadfff; }
.vent-panel { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.vent-panel[hidden] { display: none; }

.sabo-banner {
  position: absolute; top: 46px; left: 50%; transform: translateX(-50%); max-width: min(92vw, 560px); margin: 0;
  padding: 8px 16px; text-align: center; font-weight: 700; line-height: 1.5; white-space: pre-line;
  background: rgba(90, 20, 20, 0.92); border: 1px solid #ff6b6b; border-radius: 6px; color: #ffe0e0; z-index: 3;
}
.sabo-banner.is-critical { animation: sabo-pulse 0.8s ease-in-out infinite; }
@keyframes sabo-pulse { 50% { background: rgba(150, 30, 30, 0.96); } }
.crit-flash { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 90px 24px rgba(255, 40, 40, 0.55); animation: crit-glow 0.9s ease-in-out infinite; z-index: 2; }
.crit-flash[hidden] { display: none; }
@keyframes crit-glow { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .sabo-banner.is-critical, .crit-flash { animation: none; } }

.sabo-body { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.sabo-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 14px; text-align: left;
  background: var(--hull); border: 1px solid var(--line); border-radius: 6px; color: var(--text); font: 500 1rem var(--font-body); cursor: pointer;
}
.sabo-choice:hover:not(:disabled) { border-color: #ff9a3d; }
.sabo-choice:disabled { opacity: 0.5; cursor: not-allowed; }
.sabo-choice:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
.sabo-note { color: var(--muted); font-size: 0.85rem; }
.sabo-back { justify-self: start; }

/* ---- 酸素パネルのコード入力 ---- */
.mg-code { margin: 0; padding: 8px 20px; background: #0f2233; border: 2px solid var(--ice); border-radius: 6px; font: 700 2rem var(--font-display); letter-spacing: 0.3em; color: var(--ice); }
.mg-entry { margin: 0; font: 700 1.8rem var(--font-display); letter-spacing: 0.3em; min-height: 2.4rem; }
.mg-entry.bad { color: var(--alarm); }
.mg-keypad { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; }
.mg-key { height: 52px; background: var(--deck-2); border: 2px solid var(--line); border-radius: 8px; color: var(--text); font: 700 1.2rem var(--font-body); cursor: pointer; }
.mg-key:active { background: var(--ice); color: #06202e; }

/* ---- カメラ・演出の仕上げ ---- */
.act-cam { border-color: #c58fe0; color: #f1e0ff; }
.cam-card { width: min(100%, 760px); border-top-color: #c58fe0; }
.cam-canvas { display: block; width: 100%; height: auto; background: #05090e; border-radius: 4px; }
.mute-btn { padding: 8px 12px; }

.reveal-count { margin: 14px 0 0; color: var(--muted); font-size: 0.95rem; }

.death-flash { position: absolute; inset: 0; pointer-events: none; z-index: 6; background: radial-gradient(circle, rgba(255, 30, 30, 0) 35%, rgba(255, 30, 30, 0.7) 100%); animation: death-pulse 1s ease-out forwards; }
.death-flash[hidden] { display: none; }
@keyframes death-pulse { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

.meeting-intro { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(8, 14, 22, 0.96); animation: intro-fade 1.5s ease-out forwards; }
.meeting-intro[hidden] { display: none; }
.meeting-intro p { margin: 0; font: 700 clamp(2rem, 8vw, 4.2rem) var(--font-display); color: var(--alarm); letter-spacing: 0.08em; animation: intro-zoom 1.5s ease-out; }
@keyframes intro-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes intro-zoom { from { transform: scale(0.6); } to { transform: scale(1.05); } }

.eject-art { position: absolute; left: 0; top: 18%; width: 100%; height: 160px; overflow: hidden; pointer-events: none; }
.eject-art[hidden] { display: none; }
.eject-art .eject-sprite { position: absolute; left: 0; top: 30px; width: 84px; height: 100px; animation: eject-fly 3.2s ease-in forwards; }
.eject-art .eject-sprite svg { width: 100%; height: 100%; }
@keyframes eject-fly {
  from { transform: translate(-12vw, 40px) rotate(0deg) scale(1); }
  to { transform: translate(112vw, -30px) rotate(900deg) scale(0.7); }
}

.over-you { margin: 0; font: 700 clamp(1.2rem, 4vw, 1.8rem) var(--font-display); }
.over-you.won { color: var(--ok); }
.over-you.lost { color: var(--alarm); }
.gameover h2 { animation: over-pop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes over-pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .death-flash, .meeting-intro, .meeting-intro p, .eject-art .eject-sprite, .gameover h2 { animation: none; }
  .eject-art .eject-sprite { left: 46%; }
}

/* ---- ストア ---- */
.store { padding: 16px; max-width: 980px; margin: 0 auto; }
.store-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.store-head h2 { margin: 0; }
.store-modes, .store-tabs { flex-wrap: wrap; }
.store-grid, .store-history { list-style: none; margin: 0; padding: 0; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.store-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--deck); border: 1px solid var(--line); border-radius: 10px; }
.store-card.is-equipped { border-color: var(--ok); }
.store-art { height: 96px; display: grid; place-items: center; background: var(--hull); border-radius: 8px; overflow: hidden; }
.store-art-svg { width: 76px; height: 76px; display: block; }
.store-art-svg svg { width: 100%; height: 100%; display: block; }
.store-name { margin: 0; font-size: 1rem; word-break: break-word; }
.store-desc { margin: 0; color: var(--muted); font-size: 0.85rem; flex: 1; }
.store-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: auto; }
.store-price { color: var(--amber); font-weight: 700; margin-right: auto; }
.store-why { flex-basis: 100%; color: var(--alarm); font-size: 0.78rem; }
.store-empty { color: var(--muted); padding: 24px 0; }
.store-hist { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.store-hist strong { color: var(--text); }
#store-confirm-art .store-art { margin-bottom: 8px; }

/* 称号：グラデーションが流れ、光る */
.title-badge {
  display: inline-block; font-weight: 700; font-size: 0.82rem; line-height: 1.3; padding: 0 2px;
  background: linear-gradient(90deg, var(--t-start, #ffd76a), var(--t-mid, #ff7ab8), var(--t-end, #7df9ff), var(--t-mid, #ff7ab8), var(--t-start, #ffd76a));
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 var(--t-blur, 4px) var(--t-glow, #fff));
  animation: title-flow var(--t-dur, 4s) linear infinite;
}
.title-badge.solid { background: none; -webkit-text-fill-color: var(--t-start, #fff); color: var(--t-start, #fff); animation: none; }
.title-badge.rainbow {
  background-image: linear-gradient(90deg, #ff3b3b, #ffb53d, #f2ff3c, #3cff6f, #3cd0ff, #8a4fff, #ff3bd0, #ff3b3b);
  animation: title-flow var(--t-dur, 4s) linear infinite, title-hue calc(var(--t-dur, 4s) * 1.6) linear infinite;
}
.title-badge.still { animation: none; }
@keyframes title-hue { from { filter: drop-shadow(0 0 var(--t-blur, 4px) var(--t-glow, #fff)) hue-rotate(0deg); } to { filter: drop-shadow(0 0 var(--t-blur, 4px) var(--t-glow, #fff)) hue-rotate(360deg); } }
@keyframes title-flow { from { background-position: 0% 0; } to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) { .title-badge { animation: none; } }
.player-title { display: block; width: fit-content; line-height: 1.2; }

/* ---- 管理者ページ ---- */
.admin-body { overflow: auto; }
.admin-main { max-width: 980px; margin: 0 auto; padding: 16px; }
.admin-card { background: var(--deck); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.admin-card h3 { margin: 0 0 8px; }
.admin-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin: 8px 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.admin-next { color: var(--amber); font-weight: 700; margin: 4px 0 12px; }
.field-inline { display: grid; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.field-inline input, .field-inline select, .admin-main input[type="text"], .admin-main input[type="number"], .admin-main input[type="search"], .admin-main select {
  background: var(--hull); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: inherit; min-width: 0;
}
.admin-main input[type="color"] { width: 56px; height: 36px; padding: 2px; background: var(--hull); border: 1px solid var(--line); border-radius: 6px; }
.admin-main input[type="range"] { width: 200px; }
.counter { justify-self: end; font-size: 0.8rem; color: var(--muted); }
.counter.is-over { color: var(--alarm); font-weight: 700; }
.btn.is-armed { border-color: var(--amber); color: var(--amber); }
.title-preview { display: flex; flex-wrap: wrap; gap: 10px; }
.title-sample { flex: 1 1 150px; padding: 14px 10px; border-radius: 8px; text-align: center; border: 1px solid var(--line); }
.title-sample .title-badge { display: block; width: fit-content; margin: 0 auto 2px; font-size: 1rem; }
.title-sample-name { font-size: 0.9rem; color: #e8eff6; text-shadow: 0 0 3px #000; }
.admin-item { display: grid; grid-template-columns: 96px 1fr auto; gap: 8px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.admin-item-art .store-art { height: 64px; }
.admin-item-art .store-art-svg { width: 52px; height: 52px; }
.admin-item-main { display: grid; gap: 2px; min-width: 0; word-break: break-all; }
.price-input { width: 110px; }
.admin-mini { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); margin-top: 10px; }
.admin-mini .store-art { height: 64px; }
.admin-mini .store-art-svg { width: 52px; height: 52px; }
.admin-mini .store-name { font-size: 0.78rem; }
@media (max-width: 640px) { .admin-item { grid-template-columns: 72px 1fr; } .admin-item .admin-actions { grid-column: 1 / -1; } }
.admin-actions .btn.primary, .admin-row .btn.primary { width: auto; }

/* ---- ランクのエンブレム ---- */
.emblem { display: inline-block; position: relative; vertical-align: middle; flex: none; line-height: 0; }
.emblem svg { width: 100%; height: 100%; display: block; overflow: visible; }
.emblem.fx-glow svg { animation: emb-glow 2.2s ease-in-out infinite; }
.emblem.fx-flame svg { animation: emb-flame 0.9s ease-in-out infinite; }
.emblem.fx-rainbow svg { animation: emb-rainbow 3.2s linear infinite, emb-glow 2.2s ease-in-out infinite; }
.emblem.fx-sparkle svg { animation: emb-glow 2.4s ease-in-out infinite; }
@keyframes emb-glow { 0%, 100% { filter: drop-shadow(0 0 2px var(--emb-c)); } 50% { filter: drop-shadow(0 0 7px var(--emb-c)) drop-shadow(0 0 12px var(--emb-c2)); } }
@keyframes emb-flame { 0%, 100% { filter: drop-shadow(0 0 3px #ff8a1f) drop-shadow(0 -2px 4px #ff3b3b); } 50% { filter: drop-shadow(0 0 8px #ffd23f) drop-shadow(0 -4px 8px #ff6a1f); } }
@keyframes emb-rainbow { to { filter: hue-rotate(360deg) drop-shadow(0 0 6px #fff); } }
.emb-spark { position: absolute; width: 6px; height: 6px; background: #fff; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: 0; animation: emb-twinkle 1.8s ease-in-out infinite; pointer-events: none; }
.emb-spark.s0 { left: -2px; top: 2px; } .emb-spark.s1 { right: -3px; top: 8px; animation-delay: .6s; } .emb-spark.s2 { left: 45%; bottom: -3px; animation-delay: 1.2s; }
@keyframes emb-twinkle { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 50% { opacity: 1; transform: scale(1.2) rotate(90deg); } }
.rank-line { display: inline-flex; align-items: center; gap: 6px; }
.rank-name { font-weight: 700; }
.rank-progress { height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; margin-top: 4px; min-width: 120px; }
.rank-progress > i { display: block; height: 100%; background: linear-gradient(90deg, #5ee7ff, #ffd23f); }
@media (prefers-reduced-motion: reduce) { .emblem svg, .emb-spark { animation: none !important; } }
.menu-rank { margin-top: 6px; font-size: .85rem; }
.menu-rank .rank-meta { opacity: .8; font-size: .78rem; margin-top: 2px; }
.player-rank { margin-right: 2px; }
.over-reward { text-align: center; margin: 8px 0; }
.over-reward .reward-coins { font-size: 1.4rem; font-weight: 800; color: #ffd23f; margin: 2px 0; }
.over-reward .reward-rank { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; margin: 6px 0; animation: reward-pop .6s ease-out; }
.over-reward .reward-none { opacity: .7; font-size: .85rem; }
@keyframes reward-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.rank-rows { display: grid; gap: 8px; margin: 10px 0; }
.rank-row { align-items: center; flex-wrap: wrap; }
.rank-fields { display: flex; flex-wrap: wrap; gap: 8px 14px; flex: 1; min-width: 240px; }
.rank-f { display: inline-flex; flex-direction: column; gap: 2px; font-size: .78rem; }
.rank-f input[type=color] { width: 44px; height: 30px; padding: 0; }
.rank-prev { display: inline-flex; width: 44px; justify-content: center; }
.menu-level { margin-top: 8px; font-size: .85rem; }
.menu-level .lv-line { display: flex; align-items: baseline; gap: 8px; }
.menu-level .lv-num { font-weight: 800; font-size: 1.05rem; color: #9fe8ff; }
.menu-level .lv-meta { opacity: .8; font-size: .78rem; }
.menu-level .rank-progress > i { background: linear-gradient(90deg, #7bff9f, #5ee7ff); }
.ticket-btn { margin-left: 4px; }
.over-reward .reward-xp { font-weight: 700; color: #9fe8ff; margin: 2px 0; }
.over-reward .reward-lv { font-weight: 800; color: #7bff9f; margin: 2px 0; animation: reward-pop .6s ease-out; }
.rank-override { display: grid; gap: 8px; }
.act-libra { border-color: #ffd640; color: #fff2c0; }
.libra-list { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.libra-pick { width: 100%; padding: 10px; border-radius: 10px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); color: inherit; font: inherit; cursor: pointer; }
.libra-pick[aria-pressed="true"] { border-color: #ffd640; background: rgba(255,214,64,.22); }

/* ---- 定期メンテナンス表示 ---- */
html.maint-on, html.maint-on body { overflow: hidden; }
.maint { position: fixed; inset: 0; z-index: 99999; display: grid; place-items: center; background: #050b24; color: #eaf3ff; text-align: center; animation: maint-in .8s ease-out; }
.maint-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.maint-box { position: relative; padding: 24px 20px; max-width: min(720px, 92vw); animation: maint-float 6s ease-in-out infinite; }
.maint-mark { width: clamp(56px, 10vw, 88px); margin: 0 auto 18px; color: #bfe0ff; filter: drop-shadow(0 0 14px rgba(120,180,255,.8)); animation: maint-spin 9s linear infinite; }
.maint-mark svg { width: 100%; display: block; }
.maint-title { margin: 0; font-size: clamp(1.7rem, 6.2vw, 3.6rem); font-weight: 300; letter-spacing: .12em; white-space: nowrap; text-shadow: 0 0 24px rgba(120,180,255,.75), 0 0 60px rgba(80,140,255,.5); animation: maint-glow 3.2s ease-in-out infinite; }
.maint-msg { margin: 20px 0 0; font-size: clamp(.95rem, 2.8vw, 1.25rem); opacity: .85; line-height: 1.8; white-space: pre-wrap; }
.maint-until { margin: 10px 0 0; font-size: clamp(.9rem, 2.6vw, 1.1rem); color: #9fd0ff; letter-spacing: .08em; }
.maint-dots { display: flex; gap: 10px; justify-content: center; margin-top: 28px; }
.maint-dots i { width: 9px; height: 9px; border-radius: 50%; background: #cfe6ff; opacity: .25; animation: maint-dot 1.5s ease-in-out infinite; }
.maint-dots i:nth-child(2) { animation-delay: .25s; } .maint-dots i:nth-child(3) { animation-delay: .5s; }
@keyframes maint-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes maint-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes maint-spin { to { transform: rotate(360deg); } }
@keyframes maint-glow { 0%, 100% { opacity: .82; } 50% { opacity: 1; } }
@keyframes maint-dot { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) { .maint-box, .maint-mark, .maint-title, .maint-dots i { animation: none; } }
.maint-staff { position: absolute; right: 14px; bottom: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.maint-staff-btn { background: transparent; border: 1px solid rgba(190,225,255,.25); color: rgba(190,225,255,.55); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .75rem; letter-spacing: .1em; cursor: pointer; }
.maint-staff-btn:hover, .maint-staff-btn:focus-visible { color: #fff; border-color: rgba(190,225,255,.7); }
.maint-staff-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.maint-staff-form[hidden] { display: none; }
.maint-staff-form input { width: 9em; padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(190,225,255,.4); background: rgba(5,11,36,.7); color: #fff; font: inherit; }
.maint-staff-form button { padding: 6px 12px; border-radius: 8px; border: 1px solid rgba(190,225,255,.5); background: rgba(70,130,255,.35); color: #fff; font: inherit; cursor: pointer; }
.maint-staff-err { color: #ffb4b4; font-size: .8rem; }

/* ---- 新しいタスク ---- */
.mg-sweep { position: relative; width: 100%; max-width: 320px; margin: 8px auto; aspect-ratio: 320 / 200; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #2a6aa8, #1d3f66); }
.mg-sweep-under { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; color: rgba(255,255,255,.35); }
.mg-sweep-cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.mg-shells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px auto; max-width: 320px; }
.mg-shell { aspect-ratio: 1; border-radius: 50% 50% 46% 46%; border: 2px solid #ffd9a8; background: radial-gradient(circle at 35% 30%, #fff1dc, #e8a86a); color: #5a2f10; font: 800 1.3rem inherit; cursor: pointer; }
.mg-shell.ok { opacity: .35; }
.shake { animation: mg-shake .3s; }
@keyframes mg-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.mg-sort-item { width: 90px; height: 90px; margin: 10px auto; border-radius: 14px; display: grid; place-items: center; font-size: 2.4rem; }
.mg-sort-bins { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.mg-sort-bin { flex: 1; max-width: 100px; padding: 16px 0; border-radius: 10px; border: 3px solid; background: rgba(255,255,255,.05); font: 800 1.1rem inherit; cursor: pointer; }
.mg-lake { position: relative; height: 90px; margin: 10px auto; max-width: 320px; border-radius: 10px; background: linear-gradient(#3b8fc4, #1f5d8c); overflow: hidden; }
.mg-lake.hit { outline: 3px solid #62e3a8; } .mg-lake.miss { outline: 3px solid #ff6b6b; }
.mg-buoy { position: absolute; left: 50%; top: 0; bottom: 0; transform: translateX(-50%); background: rgba(255,255,255,.18); border-left: 2px dashed #fff; border-right: 2px dashed #fff; }
.mg-fish { position: absolute; top: 50%; font-size: 2rem; transform: translate(-50%, -50%); }
.mg-pull { display: block; margin: 8px auto; min-width: 140px; }
.mg-pump-bar { margin: 10px auto; }

/* リス地の選択 */
.spawn-pick { margin: 14px auto 0; text-align: center; }
.spawn-pick-label { margin: 0 0 6px; font-size: 13px; color: #9fb4c8; }
.spawn-pick-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.spawn-btn.on { background: #2d6f9e; border-color: #8fdcff; color: #fff; box-shadow: 0 0 10px rgba(143, 220, 255, .5); }
.reveal .spawn-pick, #reveal .spawn-pick { position: relative; z-index: 2; pointer-events: auto; }
.minimap { width: 300px; height: 66px; }
@media (max-width: 700px) { .minimap { width: 210px; height: 46px; } }

/* プレイヤー管理 */
.player-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) auto auto auto auto; gap: 8px 12px; align-items: center; }
.player-row.is-banned { opacity: .75; border-color: #ff6b6b; }
.tag-ban { color: #ff8a8a; font-size: .8em; margin-left: 6px; }
.btn.danger { background: #7a2a2a; border-color: #ff6b6b; color: #fff; }
@media (max-width: 800px) { .player-row { grid-template-columns: 1fr; } }

/* 島民一覧 */
.isl-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(8, 14, 22, 0.8); padding: 16px; }
.isl-card { width: min(420px, 100%); max-height: 80vh; overflow-y: auto; background: #101c29; border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: grid; gap: 10px; }
.isl-card h2 { margin: 0; font-size: 1.2rem; }
.isl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.isl-list li { padding: 7px 10px; background: rgba(255, 255, 255, 0.05); border-radius: 6px; }

/* ---- ミニゲーム：幅がつぶれる・はみ出す不具合の修正と、横向きスマホ用の詰めた配置 ---- */
.task-modal { overflow: hidden; }
.task-card { max-width: 100%; max-height: 100%; overflow-y: auto; box-sizing: border-box; }
.task-body { min-width: 0; -webkit-user-select: none; -webkit-touch-callout: none; }
.task-body > * { max-width: 100%; }
.task-body button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.mg-row { flex-wrap: wrap; justify-content: center; }
.mg-hold, .mg-lever-handle, .mg-card, .mg-pad, .mg-switch, .mg-key, .mg-shell, .mg-sort-bin { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.mg-hold { touch-action: none; }
.mg-lever-track { cursor: grab; }
.mg-lever-handle { pointer-events: none; }
/* 新しいタスク：親が中央寄せのグリッドなので、幅を明示する（これが無いと幅0になる） */
.mg-shells { width: 100%; max-width: 300px; }
.mg-shell { min-width: 0; padding: 0; }
.mg-sort-bins { width: 100%; max-width: 320px; }
.mg-sort-bin { min-width: 0; }
.mg-lake { width: 100%; max-width: 320px; }
.mg-fish { left: 0; pointer-events: none; line-height: 1; }
.mg-pull { margin: 0 auto; }
.mg-pump { display: flex; align-items: center; justify-content: center; gap: 22px; }
.mg-pump .mg-bar.mg-vertical { height: 150px; margin: 0; }
.mg-temp { position: absolute; top: 2px; bottom: 2px; width: 4px; margin-left: -2px; background: #fff; border-radius: 2px; box-shadow: 0 0 6px rgba(255,255,255,.8); pointer-events: none; }
.mg-count { margin: 0; }

@media (max-width: 420px) {
  .mg-switch { width: 44px; height: 56px; font-size: .8rem; }
  .mg-row { gap: 6px; }
  .task-card { padding: 14px; }
}
/* 横向きのスマホ（高さが小さい画面）：全部が画面に収まるように詰める */
@media (max-height: 480px) {
  .task-modal { padding: 6px; }
  .task-card { width: min(100%, 560px); padding: 8px 14px 10px; }
  .task-card-head { margin-bottom: 4px; }
  .task-card-head h2 { font-size: 1rem; }
  .task-card-head .btn { padding: 4px 12px; font-size: .85rem; }
  .task-body { gap: 6px; min-height: 0; }
  .mg-hint { font-size: .78rem; line-height: 1.3; }
  .mg-success { font-size: 1.3rem; }
  .mg-wiring { width: auto; max-width: 100%; height: min(52vh, 200px); }
  .mg-card-track { height: 64px; }
  .mg-card { height: 44px; }
  .mg-lever-track, .mg-bar.mg-vertical { height: min(46vh, 160px); }
  .mg-hold { width: min(34vh, 116px); height: min(34vh, 116px); font-size: 1rem; }
  .mg-pump .mg-bar.mg-vertical { height: min(40vh, 130px); }
  .mg-pads { grid-template-columns: repeat(4, min(20vh, 76px)); gap: 8px; }
  .mg-pad { width: min(20vh, 76px); height: min(20vh, 76px); }
  .mg-code { font-size: 1.2rem; padding: 2px 12px; margin: 0; }
  .mg-entry { margin: 0; font-size: 1.1rem; min-height: 0; }
  .mg-keypad { grid-template-columns: repeat(6, 44px); gap: 6px; }
  .mg-key { width: 44px; height: 36px; }
  .mg-sweep { max-width: min(100%, calc(48vh * 1.6)); margin: 0 auto; }
  .mg-shells { grid-template-columns: repeat(8, 1fr); max-width: 440px; margin: 0 auto; }
  .mg-sort-item { width: 56px; height: 56px; font-size: 1.6rem; margin: 0 auto; }
  .mg-sort-bins { margin-bottom: 0; }
  .mg-sort-bin { padding: 10px 0; }
  .mg-lake { height: 60px; margin: 0 auto; }
  .mg-switch { height: 52px; }
  .mg-meter { height: 28px; }
  .mg-align { padding: 6px 0; }
}

.mg-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mg-breaker { gap: 8px; flex-wrap: nowrap; }
.mg-sort-bin { font-size: 1.1rem; font-weight: 800; }
.mg-pump .mg-hold { white-space: nowrap; font-size: 1rem; }
@media (max-height: 480px) { .mg-pump .mg-hold { font-size: .82rem; } .mg-col { gap: 5px; } .mg-lamp { width: 22px; height: 22px; } }
@media (max-width: 340px) { .mg-switch { width: 36px; font-size: .7rem; } .mg-breaker { gap: 5px; } }

/* ---- マップを選ぶ ---- */
.lobby-map { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.lobby-map-info { flex: 1; min-width: 220px; }
.lobby-map-info h3 { margin: 0 0 6px; font-size: 1.15rem; }
.lobby-map-info p { margin: 4px 0 0; }
.map-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.map-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: rgba(255,255,255,.1); border: 1px solid var(--line); }
.map-tag.size-S { background: #1f5a3a; border-color: #5fd89a; color: #d8ffe8; }
.map-tag.size-M { background: #1f4a7a; border-color: #7fc0ff; color: #dcefff; }
.map-tag.size-L { background: #6a3a8a; border-color: #d09aff; color: #f4e6ff; }
.map-modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(8, 14, 22, 0.86); padding: 12px; }
.map-card { width: min(980px, 100%); max-height: 100%; display: flex; flex-direction: column; background: #101c29; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.map-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.map-head h2 { margin: 0; font-size: 1.2rem; }
.map-head .menu-note { flex: 1; margin: 0; }
.map-list { overflow-y: auto; padding: 14px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.map-item { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 12px; background: rgba(255,255,255,.04); border: 2px solid transparent; border-radius: 10px; align-items: start; }
.map-item.is-current { border-color: #8fdcff; background: rgba(95,180,230,.1); }
.map-thumb { width: 100%; max-height: 150px; background: #0a121b; border-radius: 6px; overflow: hidden; display: grid; place-items: center; }
.map-thumb canvas { width: 100%; height: 100%; display: block; object-fit: contain; }
.map-thumb-note { font-size: .7rem; color: #9fb4c8; padding: 6px; text-align: center; }
.map-body h3 { margin: 0 0 6px; font-size: 1.05rem; }
.map-blurb { margin: 0 0 4px; font-size: .9rem; }
.map-detail { margin: 0 0 4px; font-size: .8rem; color: #b8c8d8; line-height: 1.5; }
.map-stats { margin: 0 0 8px; font-size: .78rem; color: #9fb4c8; }
.map-pick { padding: 6px 14px; font-size: .9rem; }
@media (max-width: 520px) { .map-list { grid-template-columns: 1fr; } .map-item { grid-template-columns: 1fr; } .map-thumb { max-height: 130px; } }

/* ---- 会議：20人でも見やすく ---- */
/* 13人以上のときは、1人ぶんを小さくして列を増やす */
.mplayers:has(> :nth-child(13)) { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.mplayers:has(> :nth-child(13)) .mplayer { padding: 6px 8px; min-height: 0; font-size: .9rem; }
/* 横向きのスマホ（高さが小さい）：見出しを1行にまとめ、左に参加者・右にチャット */
@media (max-height: 480px) {
  .meeting, .gameover { padding: 8px 10px; }
  .meeting { gap: 6px; }
  .meeting-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
  .meeting-head h2 { font-size: 1.1rem; }
  .meeting-sub, .meeting-timer { margin: 0; font-size: .85rem; }
  .meeting-body { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 8px; }
  .mplayers, .mplayers:has(> :nth-child(13)) { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 5px; }
  .mplayer, .mplayers:has(> :nth-child(13)) .mplayer { padding: 4px 6px; font-size: .8rem; min-height: 0; }
  .meeting-foot { gap: 6px 8px; }
  .meeting-hint { font-size: .8rem; }
  .meeting-foot .btn { padding: 6px 14px; }
  .chat-form .btn { padding: 6px 10px; }
}
.mplayer .tag, .mplayer .tag-me, .mplayer .tag-host { white-space: nowrap; flex-shrink: 0; }
.mchat { min-width: 0; }
.chat-form .btn { flex-shrink: 0; white-space: nowrap; }
@media (max-height: 480px) {
  .mplayer { gap: 5px; }
  .mplayer .tag, .mplayer .tag-me, .mplayer .tag-host { font-size: .62rem; padding: 0 4px; }
  .mchat { padding: 6px; gap: 5px; }
  .chat-form { gap: 5px; }
  .chat-form input { padding: 6px 8px; font-size: .9rem; }
  .chat-form .btn { padding: 6px 10px; font-size: .85rem; }
}

/* ---- 転売：管理者の売却価格 ---- */
.sell-bulk { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.sell-bulk h4 { margin: 0 0 4px; }
.sel-box { display: block; margin-bottom: 4px; }
.sell-input { width: 120px; }

/* ---- 転売：売却モーダル・島民ショップ ---- */
.sell-choice { margin: 10px 0; padding: 10px; background: var(--deck); border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 6px; }
.sell-choice h4 { margin: 0; }
.sell-choice p { margin: 0; }
.sell-choice input { width: 100%; max-width: 200px; }
.market-bar { grid-column: 1 / -1; list-style: none; }
.market-card { border-color: #6aa0ff55; }
.sell-btn.is-armed, #store-sell-quick.is-armed { background: var(--danger, #c0392b); color: #fff; }
#store-sell .task-card { max-height: 92vh; overflow-y: auto; }

/* =====================================================================
   ロビー風UI（上部ナビ・プレイ・ショップ・ロッカー・バトルパス・クエスト）
   ===================================================================== */
:root {
  --hub-blue: #1f6bff;
  --hub-deep: #0b2a8a;
  --hub-purple: #6b3cff;
  --hub-yellow: #ffe23d;
  --hub-card: rgba(10, 30, 90, 0.55);
  --font-hub: "Dela Gothic One", "Zen Kaku Gothic New", sans-serif;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.in-hub {
  background-color: #0b1f73;
  background-image: radial-gradient(120% 90% at 70% 10%, #4fa3ff 0%, #2166f0 35%, #1236b8 70%, #0b1f73 100%);
  background-attachment: fixed;
  background-size: cover; /* 元の方眼(48px)の大きさを引き継がない */
  background-position: center;
  background-repeat: no-repeat;
}
/* 管理者が入れた背景画像（--hub-dim で暗さを調整） */
body.in-hub.has-bg {
  background-image: linear-gradient(rgba(0, 0, 0, var(--hub-dim, .25)), rgba(0, 0, 0, var(--hub-dim, .25))), var(--hub-bg-img);
}
body.in-hub .screen { padding-top: 16px; }
.hub-screen { max-width: 1280px; margin: 0 auto; }

/* ---- 上部ナビ ---- */
.hub-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px; padding: 8px 16px;
  background: linear-gradient(180deg, rgba(6, 18, 70, .85), rgba(6, 18, 70, .55));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.hub-logo { font: 400 1.15rem var(--font-hub); letter-spacing: .02em; color: #fff; white-space: nowrap; }
.hub-tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.hub-tabs::-webkit-scrollbar { display: none; }
.hub-tab {
  flex: none; padding: 6px 14px; border: 0; border-radius: 4px; background: transparent;
  color: rgba(255, 255, 255, .78); font: 700 .95rem var(--font-body); cursor: pointer; white-space: nowrap;
}
.hub-tab:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.hub-tab.on { background: #fff; color: #0b1f73; }
.hub-tab:focus-visible { outline: 2px solid var(--hub-yellow); outline-offset: 2px; }
.hub-right { display: flex; align-items: center; gap: 8px; }
.hub-coins {
  display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 999px;
  background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .2); font-weight: 800; color: #fff; white-space: nowrap;
}
.coin-ico {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6b0, #ffc928 55%, #c98a00); color: #6a4300; font: 900 .75rem var(--font-display);
}
.hub-acct { display: flex; flex-direction: column; line-height: 1.1; text-align: right; }
.hub-acct-name { font-weight: 700; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-acct-lv { font-size: .75rem; color: #9fe8ff; }
.btn.small { padding: 4px 10px; font-size: .8rem; }
.hub-kicker { margin: 0; color: #7df9ff; font: 700 .85rem var(--font-body); letter-spacing: .08em; }
.hub-title { margin: 0 0 8px; font: 400 clamp(1.6rem, 3.2vw, 2.4rem)/1.1 var(--font-hub); color: #fff; font-style: italic; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); }

/* ---- プレイ ---- */
.play-grid { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) minmax(240px, 330px); gap: 20px; align-items: stretch; min-height: calc(100dvh - 110px); }
.play-left { display: flex; flex-direction: column; gap: 8px; }
.play-left .menu-name { font: 700 1.2rem var(--font-body); }
.play-side-btn { align-self: flex-start; }
.play-left .menu-level, .play-left .menu-rank { background: rgba(0, 0, 0, .25); border-radius: 6px; padding: 8px 10px; }
.play-center { position: relative; display: flex; align-items: flex-end; justify-content: center; min-height: 360px; }
.play-right { display: flex; flex-direction: column; gap: 14px; justify-content: space-between; }
.play-cta { display: grid; gap: 10px; }
.btn.play-big {
  padding: 18px 10px; border: 0; border-radius: 4px; background: var(--hub-yellow); color: #111;
  font: 400 2rem/1 var(--font-hub); font-style: italic; box-shadow: 0 4px 0 #b89c00; display: grid; gap: 6px;
}
.btn.play-big small { font: 700 .85rem var(--font-body); font-style: normal; }
.btn.play-big:hover:not(:disabled) { background: #fff06b; }
.btn.play-sub { background: rgba(0, 0, 0, .35); border-color: rgba(255, 255, 255, .35); }

/* 広告 */
.ad-card { border: 3px solid #2a6cff; border-radius: 4px; background: #0b1f73; overflow: hidden; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
.ad-frame { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; }
.ad-img { width: 100%; height: 100%; object-fit: cover; display: block; animation: ad-in .5s ease; }
@keyframes ad-in { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }
.ad-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); font-weight: 800; }
.ad-empty { display: grid; gap: 4px; text-align: center; padding: 16px; }
.ad-empty strong { font: 400 1.2rem var(--font-hub); }
.ad-dots { display: flex; justify-content: center; gap: 6px; padding: 6px; background: rgba(0, 0, 0, .3); min-height: 20px; }
.ad-dot { width: 22px; height: 6px; border: 0; border-radius: 3px; background: rgba(255, 255, 255, .35); cursor: pointer; padding: 0; }
.ad-dot.on { background: #fff; }

/* ---- キャラクターの並び（ステージ） ---- */
.stage { position: relative; width: 100%; overflow: hidden; isolation: isolate; } /* 並びの z-index を外（モーダル等）に漏らさない */
.stage-solo { height: min(62vh, 520px); max-width: 360px; }
.lobby-stage {
  height: clamp(320px, 56vh, 520px); margin: 12px 0; border-radius: 8px;
  background:
    radial-gradient(60% 40% at 50% 100%, rgba(125, 249, 255, .35), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .25) 60%, rgba(0, 0, 0, .45));
  border: 1px solid rgba(255, 255, 255, .15);
}
.stage-fig {
  --s: 1; --h: calc(min(62vh, 520px) * .62);
  position: absolute; transform: translateX(-50%); width: calc(var(--fh, 210px) * var(--s)); display: flex; flex-direction: column; align-items: center;
}
.lobby-stage { --fh: clamp(190px, 40vh, 340px); }
.stage-solo { --fh: min(48vh, 380px); }
.stage-art { width: 100%; aspect-ratio: 1; animation: stage-bob 2.4s ease-in-out infinite; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .35)); }
.stage-art svg { width: 100%; height: 100%; display: block; }
@keyframes stage-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3%); } }
.stage-pad { width: 70%; height: calc(14px * var(--s)); margin-top: -10%; border-radius: 50%; background: radial-gradient(closest-side, rgba(160, 240, 255, .75), rgba(160, 240, 255, 0)); }
.stage-fig.is-me .stage-pad { background: radial-gradient(closest-side, rgba(170, 255, 255, 1), rgba(80, 170, 255, .35) 60%, transparent); height: calc(22px * var(--s)); }
.stage-fig.is-off { opacity: .5; }
.stage-tag {
  display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 2px;
  font-size: max(10px, calc(15px * var(--s))); line-height: 1.15; text-align: center; max-width: max(58px, calc(150px * var(--s)));
}
.stage-name {
  display: inline-flex; align-items: center; gap: 3px; max-width: 100%; padding: 1px 7px; border-radius: 4px;
  background: rgba(0, 0, 0, .55); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000;
}
.stage-crown { font-size: .9em; }
.stage-you { font-size: .75em; color: #0b1f73; background: var(--hub-yellow); border-radius: 3px; padding: 0 5px; font-weight: 800; }
.stage-tag .title-badge { font-size: .85em; }

/* ---- ショップ／ロッカー ---- */
.store.hub-screen { max-width: 1280px; padding: 16px; }
.store-head .store-coins-box { display: none; } /* 残高は上部ナビに表示 */
.store-head h2 { margin: 0 auto 0 0; }
.store-modes .tab, .store-tabs .tab { color: rgba(255, 255, 255, .8); }
.store-modes .tab[aria-selected="true"], .store-tabs .tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--hub-yellow); }
.store-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 340px); gap: 18px; align-items: start; }
.store-sec { margin: 14px 0 8px; font: 400 1.3rem var(--font-hub); font-style: italic; color: #fff; }
.store-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.store-card {
  border: 0; border-radius: 6px; padding: 10px; position: relative; cursor: pointer;
  background: linear-gradient(160deg, var(--cat-a, #1f9bd6), var(--cat-b, #0d4f8c));
  box-shadow: 0 4px 10px rgba(0, 0, 0, .25); transition: transform .12s, box-shadow .12s;
}
.store-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 3px #fff, 0 8px 18px rgba(0, 0, 0, .35); }
.store-card .store-art { background: rgba(255, 255, 255, .12); height: 120px; }
.store-card .store-art-svg { width: 100px; height: 100px; }
.store-card .store-desc { color: rgba(255, 255, 255, .78); }
.store-card .store-price { color: #fff; }
.store-card.is-equipped { box-shadow: 0 0 0 3px var(--hub-yellow); }
.cat-skin { --cat-a: #9b3cff; --cat-b: #4b1a9e; }
.cat-decoration { --cat-a: #1fa6ff; --cat-b: #0b4fa8; }
.cat-effect { --cat-a: #ff4fa8; --cat-b: #9e1a5c; }
.cat-color { --cat-a: #2fcf8a; --cat-b: #0b7a50; }
.cat-title { --cat-a: #ffb72b; --cat-b: #b5600b; }
.store-limited { margin-bottom: 4px; }
.limited-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.limited-card { min-height: 280px; }
.limited-card .store-art { height: 170px; }
.limited-card .store-art-svg { width: 150px; height: 150px; }
.limited-ribbon { position: absolute; top: 8px; left: 8px; z-index: 2; background: var(--hub-yellow); color: #111; font-weight: 900; font-size: .75rem; padding: 2px 8px; border-radius: 3px; }
.limited-card.is-empty {
  display: grid; place-items: center; align-content: center; gap: 6px; cursor: default;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .06) 0 12px, rgba(255, 255, 255, .02) 12px 24px), linear-gradient(160deg, #24357a, #0f1b4d);
  border: 2px dashed rgba(255, 255, 255, .35); border-radius: 6px;
}
.limited-card.is-empty:hover { transform: none; box-shadow: none; }
.limited-q { font: 400 5rem/1 var(--font-hub); color: rgba(255, 255, 255, .85); }
.limited-soon { font-weight: 800; letter-spacing: .1em; }
.store-preview {
  position: sticky; top: 70px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 16px; border-radius: 8px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(255, 255, 255, .15); min-height: 360px;
}
.pv-kicker { margin: 0; font-weight: 800; color: #7df9ff; }
.pv-fig { width: min(100%, 280px); aspect-ratio: 1; animation: stage-bob 2.4s ease-in-out infinite; }
.pv-fig svg { width: 100%; height: 100%; }
.store-preview .pv-art { width: 100%; height: 260px; background: transparent; }
.store-preview .pv-art .store-art-svg { width: 240px; height: 240px; }
.store-preview .pv-art .title-badge { font-size: 1.6rem; }
.pv-name { margin: 0; font: 400 1.5rem var(--font-hub); font-style: italic; }
.pv-desc { margin: 0; color: rgba(255, 255, 255, .8); }
.pv-price { margin: 0; font-weight: 900; font-size: 1.1rem; }
.pv-list { list-style: none; padding: 0; margin: 0; font-size: .85rem; color: rgba(255, 255, 255, .85); }
.pv-empty { color: rgba(255, 255, 255, .7); margin: auto 0; }

/* ---- バトルパス ---- */
.pass-body { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(260px, 1fr); gap: 24px; padding: 8px 0 24px; }
.pass.hub-screen { background: none; }
.pass-pagehead { display: flex; align-items: baseline; justify-content: space-between; }
.pass-pagehead h3 { margin: 0; font: 400 1.2rem var(--font-hub); }
.pass-claimed { color: rgba(255, 255, 255, .7); font-size: .85rem; }
.pass-grid { list-style: none; margin: 10px 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: minmax(90px, auto); gap: 8px; }
.pass-tile {
  position: relative; display: grid; place-items: center; border-radius: 4px;
  background: linear-gradient(160deg, #3a4bff, #1b228f); border: 2px solid rgba(255, 255, 255, .15);
}
.pass-tile.big { grid-row: span 2; background: linear-gradient(160deg, #6b3cff, #2a1290); }
.pass-q { font: 400 2.6rem/1 var(--font-hub); color: rgba(255, 255, 255, .85); }
.pass-tile.big .pass-q { font-size: 4.5rem; }
.pass-cost { position: absolute; left: 6px; bottom: 4px; font-size: .8rem; font-weight: 800; color: #ffe23d; }
.pass-nav { display: flex; gap: 6px; justify-content: center; }
.pass-page { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); background: transparent; color: #fff; font-weight: 800; cursor: pointer; }
.pass-page.on { background: #fff; color: #0b1f73; }
.pass-right { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.pass-silhouette {
  width: min(100%, 300px); aspect-ratio: 3 / 4; display: grid; place-items: center; border-radius: 8px;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .25), transparent), linear-gradient(180deg, #2a1290, #0b1f73);
}
.pass-silhouette span { font: 400 9rem/1 var(--font-hub); color: rgba(255, 255, 255, .6); }
.pass-label { margin: 0; font-weight: 800; }
.pass-buy {
  display: grid; gap: 2px; min-width: 260px; padding: 12px 20px; border: 0; border-radius: 999px;
  background: linear-gradient(90deg, #ffc928, #ffe23d); color: #2a1a00; cursor: not-allowed;
}
.pass-buy-l { font: 400 1rem var(--font-hub); }
.pass-buy-p { font-weight: 900; font-size: 1.2rem; }
.pass-note { margin: 0; color: rgba(255, 255, 255, .7); font-size: .85rem; }

/* ---- クエスト ---- */
.quest-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; padding: 8px 0 24px; }
.quest-side { display: flex; flex-direction: column; gap: 6px; }
.quest-cat { text-align: left; padding: 12px 14px; border-radius: 6px; border: 2px solid transparent; background: rgba(0, 0, 0, .25); color: #fff; font-weight: 800; cursor: pointer; }
.quest-cat.on { border-color: var(--hub-yellow); background: rgba(255, 255, 255, .15); }
.quest-main { display: grid; gap: 14px; align-content: start; }
.quest-card { padding: 16px; border-radius: 8px; background: rgba(10, 30, 110, .55); border: 2px solid rgba(255, 226, 61, .6); }
.quest-card h3 { margin: 0 0 4px; font: 400 1.2rem var(--font-hub); }
.quest-sub, .quest-meta { margin: 0 0 8px; color: rgba(255, 255, 255, .8); font-size: .9rem; }
.quest-track { list-style: none; padding: 0; margin: 12px 0; display: flex; gap: 0; align-items: center; }
.quest-node { flex: 1; display: grid; justify-items: center; gap: 4px; position: relative; }
.quest-node::before { content: ""; position: absolute; top: 28px; left: -50%; right: 50%; height: 4px; background: rgba(255, 255, 255, .25); z-index: 0; }
.quest-node:first-child::before { display: none; }
.quest-reward { position: relative; z-index: 1; width: 56px; height: 56px; display: grid; place-items: center; font-size: 1.6rem; border-radius: 6px; background: linear-gradient(160deg, #3a4bff, #1b228f); border: 2px solid rgba(255, 255, 255, .3); }
.quest-node.done .quest-reward { border-color: var(--hub-yellow); box-shadow: 0 0 10px rgba(255, 226, 61, .6); }
.quest-lv { font-weight: 800; font-size: .85rem; }
.quest-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.quest-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #ffe23d, #ff9f1c); }
.quest-ranks { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.quest-rank { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; background: rgba(0, 0, 0, .2); opacity: .7; }
.quest-rank.done { opacity: 1; }
.quest-rank.now { outline: 2px solid var(--hub-yellow); }
.quest-rank-t { display: grid; }
.quest-rank-t span { font-size: .8rem; color: rgba(255, 255, 255, .75); }
.quest-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.quest-stat { display: grid; justify-items: center; padding: 10px; border-radius: 6px; background: rgba(0, 0, 0, .25); }
.quest-stat strong { font: 400 1.6rem var(--font-hub); }
.quest-goal { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin-top: 8px; font-size: .9rem; }
.quest-goal .quest-bar { grid-column: 1 / -1; }
.quest-goal.done span:first-child::after { content: " ✓"; color: var(--hub-yellow); }

/* ---- 部屋のロビー ---- */
.lobby.hub-screen .panel { background: rgba(6, 18, 70, .55); border-color: rgba(255, 255, 255, .15); }

/* ---- スマホ ---- */
@media (max-width: 900px) {
  .play-grid { grid-template-columns: 1fr; min-height: 0; }
  .play-center { order: -1; min-height: 0; }
  .stage-solo { height: 300px; }
  .stage-solo { --fh: 230px; }
  .lobby-stage { --fh: 150px; height: 340px; }
  .store-layout { grid-template-columns: 1fr; }
  .store-preview { position: static; min-height: 0; order: -1; }
  .store-preview .pv-art { height: 160px; }
  .store-preview .pv-art .store-art-svg, .pv-fig { width: 150px; height: 150px; }
  .limited-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .limited-card { min-height: 0; }
  .limited-card .store-art { height: 90px; }
  .limited-card .store-art-svg { width: 80px; height: 80px; }
  .limited-q { font-size: 3rem; }
  .pass-body, .quest-body { grid-template-columns: 1fr; }
  .pass-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quest-side { flex-direction: row; overflow-x: auto; }
  .quest-cat { flex: none; }
  .quest-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-acct, .hub-logo { display: none; }
  .hub-nav { gap: 8px; padding: 6px 8px; }
}
@media (max-width: 560px) {
  .limited-row { grid-template-columns: 1fr; }
  .limited-card .store-art { height: 130px; }
  .store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-right .btn.small { padding: 3px 6px; font-size: .72rem; }
}

/* ---- 管理者：期間限定・広告 ---- */
.lim-slots, .ad-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 10px 0; }
.lim-slot, .ad-slot { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--deck); }
.lim-slot.is-empty { border-style: dashed; align-items: center; justify-content: center; }
.lim-slot-no { margin: 0; font-weight: 800; color: var(--ice); }
.lim-q { font: 400 3rem/1 var(--font-hub); opacity: .7; }
.lim-editor { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 16px; padding: 14px; margin: 10px 0; border: 2px solid var(--amber); border-radius: 8px; background: var(--deck); }
.lim-preview .store-art { height: 260px; }
.lim-preview .store-art-svg { width: 220px; height: 220px; }
.lim-preview .title-badge { font-size: 1.6rem; }
.lim-form { display: grid; gap: 8px; align-content: start; }
.lim-catalog .store-card.is-picked { box-shadow: 0 0 0 3px var(--amber); }
.ad-thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: var(--hull); display: grid; place-items: center; color: var(--muted); }
@media (max-width: 700px) { .lim-editor { grid-template-columns: 1fr; } }
.bg-thumb { position: relative; width: min(100%, 480px); aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: radial-gradient(120% 90% at 70% 10%, #4fa3ff, #1236b8 70%, #0b1f73); display: grid; place-items: center; color: #fff; margin: 8px 0; }
.bg-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bg-dim { position: absolute; inset: 0; }
.bg-sample { position: relative; font: 400 1.6rem var(--font-hub); font-style: italic; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.bundle-card { --cat-a: #ff8a1f; --cat-b: #b3261e; }
.lim-parts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; font-size: .8rem; }
.lim-parts .store-art { height: 70px !important; }
.lim-parts .store-art-svg { width: 60px !important; height: 60px !important; }

/* ---- バトルパス：商品の入ったマス ---- */
.pass-tile { overflow: hidden; }
.pass-pick { all: unset; cursor: pointer; display: grid; justify-items: center; align-content: center; gap: 2px; width: 100%; height: 100%; padding: 4px 4px 22px; box-sizing: border-box; }
.pass-pick:focus-visible { outline: 2px solid var(--hub-yellow); outline-offset: -2px; }
.pass-art { width: 46px; height: 46px; display: grid; place-items: center; }
.pass-tile.big .pass-art { width: 96px; height: 96px; }
.pass-art svg { width: 100%; height: 100%; }
.pass-art .title-badge { font-size: .7rem; white-space: nowrap; }
.pass-tile.big .pass-art .title-badge { font-size: .95rem; }
.pass-name { font-size: .7rem; font-weight: 700; text-align: center; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pass-badge { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; font-size: .7rem; font-weight: 900; background: rgba(0, 0, 0, .45); }
.pass-badge.done { background: #2fcf8a; color: #06301f; }
.pass-badge.go { background: var(--hub-yellow); color: #111; animation: pass-pop 1s ease-in-out infinite; }
@keyframes pass-pop { 50% { transform: scale(1.2); } }
.pass-tile.is-claimable { border-color: var(--hub-yellow); }
.pass-tile.is-claimed, .pass-tile.is-have { opacity: .8; }
.pass-tile.is-focus { box-shadow: 0 0 0 3px #fff; }
.pass-silhouette.has-item .pass-art { width: 70%; height: auto; aspect-ratio: 1; }
.pass-silhouette.has-item .pass-art .title-badge { font-size: 1.8rem; }
.pass-kind { margin: 0; color: #7df9ff; font-weight: 800; font-size: .9rem; }
.pass-item-name { margin: 0; font: 400 1.5rem var(--font-hub); font-style: italic; }
.pass-claim { min-width: 220px; padding: 10px 18px; border: 0; border-radius: 999px; background: #2fcf8a; color: #06301f; font-weight: 900; font-size: 1rem; cursor: pointer; }
.pass-claim:disabled { background: rgba(255, 255, 255, .18); color: rgba(255, 255, 255, .75); cursor: not-allowed; }
.pass-buy:not(:disabled) { cursor: pointer; }
.pass-buy:disabled { filter: saturate(.6); }
.pass-buy.is-owned { background: linear-gradient(90deg, #2fcf8a, #7df2c8); }
/* 管理者：バトルパスのマス */
.bp-tiles { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; margin: 8px 0; }
.bp-tile { all: unset; cursor: pointer; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--deck); font-size: .7rem; text-align: center; min-height: 86px; box-sizing: border-box; }
.bp-tile.is-sel { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.bp-tile .store-art { width: 44px; height: 44px !important; background: transparent; }
.bp-tile .store-art-svg { width: 40px !important; height: 40px !important; }
.bp-tile .title-badge { font-size: .55rem; }
.bp-tile-no { color: var(--muted); }
@media (max-width: 800px) { .bp-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.pass-level { margin: 6px 0 10px; padding: 8px 10px; border-radius: 6px; background: rgba(0, 0, 0, .28); display: grid; gap: 6px; }
.pass-level-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pass-level-num { font: 400 1.2rem var(--font-hub); color: var(--hub-yellow); }
.pass-level-meta { font-size: .8rem; color: rgba(255, 255, 255, .85); }
.pass-level-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pass-lvbuy { background: var(--hub-yellow); color: #111; border: 0; font-weight: 900; }
.pass-unlock { min-width: 220px; padding: 9px 18px; border: 2px solid var(--hub-yellow); border-radius: 999px; background: rgba(0, 0, 0, .35); color: var(--hub-yellow); font-weight: 900; cursor: pointer; }
.pass-unlock:disabled { opacity: .5; cursor: not-allowed; }
.bp-prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 8px 0; }

/* =====================================================================
   ガチャの演出
   ===================================================================== */
body.gfx-open { overflow: hidden; }
.gfx { position: fixed; inset: 0; z-index: 200; overflow: hidden; color: #fff; animation: gfx-in .35s ease both;
  background: radial-gradient(80% 60% at 50% 45%, #18306e 0%, #08122e 55%, #02040c 100%); }
.gfx-super { background: radial-gradient(70% 55% at 50% 50%, #1c0d33 0%, #07030f 60%, #000 100%); }
@keyframes gfx-in { from { opacity: 0; } to { opacity: 1; } }
.gfx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.gfx-stage { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; }
.gfx-flash { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; }
.gfx-flash.on { animation: gfx-flash 500ms ease-out both; }
@keyframes gfx-flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.gfx-title { position: absolute; top: 14px; left: 16px; z-index: 5; font: 400 1rem var(--font-hub); letter-spacing: .08em; opacity: .85; text-shadow: 0 0 10px rgba(255, 255, 255, .4); }
.gfx-skip, .gfx-ok { position: absolute; z-index: 6; border: 0; cursor: pointer; font-weight: 900; }
.gfx-skip { top: 12px; right: 14px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .3); }
.gfx-ok { left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); min-width: 200px; padding: 12px 24px; border-radius: 6px; background: var(--hub-yellow, #ffe23d); color: #111; font: 400 1.4rem var(--font-hub, sans-serif); font-style: italic; box-shadow: 0 4px 0 #b89c00; animation: gfx-up .4s ease both; }
@keyframes gfx-up { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
.gfx-stage.shake { animation: gfx-shake .5s linear infinite; }
.gfx-stage.bigshake { animation: gfx-bigshake .5s ease-out 1; }
@keyframes gfx-shake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-2px, 1px); } 50% { transform: translate(2px, -1px); } 75% { transform: translate(-1px, -2px); } }
@keyframes gfx-bigshake { 0% { transform: translate(0, 0) scale(1.02); } 20% { transform: translate(-12px, 6px); } 40% { transform: translate(10px, -8px); } 60% { transform: translate(-6px, 4px); } 80% { transform: translate(3px, -2px); } 100% { transform: none; } }

/* ---- カプセル ---- */
.gfx-floor { position: absolute; left: 50%; top: 58%; width: min(70vw, 520px); height: 120px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(120, 180, 255, .35), rgba(60, 110, 255, .08) 60%, transparent); }
.gfx-shadow { position: absolute; left: 50%; top: calc(58% + 44px); width: 150px; height: 26px; transform: translateX(-50%) scale(.2); border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .6), transparent); opacity: 0; }
.gfx-shadow.drop { animation: gfx-shadow 1.35s ease-in both; }
@keyframes gfx-shadow { 0% { transform: translateX(-50%) scale(.2); opacity: 0; } 41% { transform: translateX(-50%) scale(1); opacity: 1; } 55% { transform: translateX(-50%) scale(.7); opacity: .7; } 66% { transform: translateX(-50%) scale(1); opacity: 1; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
.gfx-capsule { --glow: #7fc4ff; position: absolute; left: 50%; top: 58%; width: 150px; height: 150px; margin: -150px 0 0 -75px; transform: translateY(-120vh); }
.has-win .gfx-capsule { --glow: #ffd24d; }
.gfx-cap-top, .gfx-cap-bottom { position: absolute; left: 0; width: 150px; height: 75px; overflow: hidden; }
/* 上半分＝透けるガラスのドーム（中に光の粒）、下半分＝金属の台座。継ぎ目は細い光の線 */
.gfx-cap-top { top: 0; border-radius: 75px 75px 0 0; background:
  radial-gradient(30% 22% at 30% 28%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 70%),
  radial-gradient(60% 50% at 55% 85%, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 70%),
  radial-gradient(120% 120% at 40% 20%, rgba(170, 240, 255, .75), rgba(40, 170, 230, .55) 55%, rgba(10, 60, 140, .85) 100%);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, .45), inset 0 -8px 14px rgba(0, 40, 90, .35); }
.gfx-super .gfx-cap-top { background:
  radial-gradient(30% 22% at 30% 28%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 70%),
  radial-gradient(120% 120% at 40% 20%, rgba(225, 190, 255, .8), rgba(130, 60, 255, .6) 55%, rgba(40, 8, 100, .9) 100%); }
.gfx-cap-bottom { top: 75px; border-radius: 0 0 75px 75px; background:
  repeating-linear-gradient(90deg, rgba(255, 255, 255, .08) 0 3px, rgba(0, 0, 0, .06) 3px 9px),
  radial-gradient(120% 130% at 40% 0%, #fff6d0 0%, #ffd24d 30%, #c98a00 70%, #6b4300 100%);
  box-shadow: inset 0 6px 10px rgba(0, 0, 0, .2); }
.gfx-super .gfx-cap-bottom { background: repeating-linear-gradient(90deg, rgba(255, 215, 120, .14) 0 3px, rgba(0, 0, 0, .1) 3px 9px), radial-gradient(120% 130% at 40% 0%, #6b5a3a 0%, #2a2318 45%, #0b0906 100%); }
.gfx-cap-seam { position: absolute; left: 2px; right: 2px; top: 73px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, rgba(255, 255, 255, .2), #ffffff, rgba(255, 255, 255, .2)); box-shadow: 0 0 6px 1px var(--glow); }
.gfx-cap-glare { position: absolute; left: 26px; top: 16px; width: 46px; height: 26px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0)); transform: rotate(-25deg); }
.gfx-capsule.drop { animation: gfx-drop 1.35s cubic-bezier(.3, 0, .7, 1) both; }
@keyframes gfx-drop { 0% { transform: translateY(-120vh); } 41% { transform: translateY(0) scale(1.06, .9); } 50% { transform: translateY(-90px) scale(.97, 1.04); } 59% { transform: translateY(0) scale(1.04, .94); } 66% { transform: translateY(-24px); } 72% { transform: translateY(0) scale(1.02, .98); } 100% { transform: translateY(0); } }
.gfx-capsule.wobble { animation: gfx-wobble .5s ease-in-out both; }
@keyframes gfx-wobble { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 45% { transform: rotate(11deg); } 70% { transform: rotate(-6deg); } 85% { transform: rotate(3deg); } }
.gfx-capsule.wobble .gfx-cap-seam, .gfx-capsule.charge .gfx-cap-seam { background: #fff; box-shadow: 0 0 14px 4px var(--glow), 0 0 40px 10px var(--glow); }
.gfx-capsule.charge { animation: gfx-charge .9s ease-in both; filter: drop-shadow(0 0 22px var(--glow)); }
@keyframes gfx-charge { 0% { transform: scale(1); } 60% { transform: scale(1.08) rotate(2deg); } 80% { transform: scale(1.12) rotate(-2deg); } 100% { transform: scale(1.18); filter: brightness(1.8) drop-shadow(0 0 40px var(--glow)); } }
.gfx-capsule.open .gfx-cap-top { animation: gfx-top .9s cubic-bezier(.2, .6, .3, 1) both; }
.gfx-capsule.open .gfx-cap-bottom { animation: gfx-bottom .9s cubic-bezier(.2, .6, .3, 1) both; }
.gfx-capsule.open .gfx-cap-seam, .gfx-capsule.open .gfx-cap-glare { opacity: 0; transition: opacity .1s; }
@keyframes gfx-top { to { transform: translate(-160px, -260px) rotate(-70deg); opacity: 0; } }
@keyframes gfx-bottom { to { transform: translate(170px, 240px) rotate(55deg); opacity: 0; } }

/* ---- 超レア：魔法陣・光の柱・門 ---- */
.gfx-circle { position: absolute; left: 50%; top: 62%; width: min(84vw, 560px); aspect-ratio: 1; transform: translate(-50%, -50%) perspective(700px) rotateX(64deg) scale(.4); opacity: 0; transition: opacity .8s, transform 1.2s cubic-bezier(.2, .8, .2, 1); filter: drop-shadow(0 0 8px var(--mc, #b98bff)) drop-shadow(0 0 22px var(--mc, #b98bff)); --mc: #b98bff; }
.has-win .gfx-circle { --mc: #ffd24d; animation: gfx-hue 3s linear infinite; }
@keyframes gfx-hue { to { filter: drop-shadow(0 0 8px var(--mc)) drop-shadow(0 0 22px var(--mc)) hue-rotate(360deg); } }
.gfx-circle.on { opacity: 1; transform: translate(-50%, -50%) perspective(700px) rotateX(64deg) scale(1); }
.gfx-circle.burst { transform: translate(-50%, -50%) perspective(700px) rotateX(64deg) scale(1.6); opacity: 0; transition: opacity .9s, transform .9s; }
.gfx-circle svg { width: 100%; height: 100%; overflow: visible; fill: none; stroke: var(--mc); stroke-width: 1.4; }
.gfx-circle .mc-r1 { animation: gfx-spin 14s linear infinite; }
.gfx-circle .mc-r2 { animation: gfx-spin 9s linear infinite reverse; }
.gfx-circle .mc-r3 { animation: gfx-spin 20s linear infinite; }
.gfx-circle .mc-r4 { animation: gfx-spin 5s linear infinite reverse; }
.gfx-circle circle, .gfx-circle polygon, .gfx-circle path { stroke-dasharray: 700; stroke-dashoffset: 700; }
.gfx-circle.on circle, .gfx-circle.on polygon, .gfx-circle.on path { animation: gfx-draw 1.6s ease forwards; }
@keyframes gfx-draw { to { stroke-dashoffset: 0; } }
@keyframes gfx-spin { to { transform: rotate(360deg); } }
.gfx-pillar { position: absolute; left: 50%; bottom: 38%; width: 180px; height: 0; transform: translateX(-50%); opacity: 0;
  background: linear-gradient(to top, rgba(255, 255, 255, .95), var(--best, #b98bff) 30%, rgba(255, 255, 255, 0)); filter: blur(6px); transition: height 1s ease-out, opacity .5s; mix-blend-mode: screen; }
.gfx-super:not(.has-win) .gfx-pillar { background: linear-gradient(to top, rgba(255, 255, 255, .9), #9b7bff 30%, rgba(255, 255, 255, 0)); }
.gfx-pillar.on { height: 70vh; opacity: .9; }
.gfx-door { position: absolute; top: 0; bottom: 0; width: 51%; z-index: 2; transition: transform .6s cubic-bezier(.7, 0, .3, 1);
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .03) 0 2px, transparent 2px 14px), linear-gradient(180deg, #2a2440, #0d0a18 50%, #2a2440);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .8); }
.gfx-door::after { content: ""; position: absolute; top: 12%; bottom: 12%; width: 2px; background: linear-gradient(transparent, var(--best, #b98bff), transparent); box-shadow: 0 0 12px var(--best, #b98bff); }
.gfx-door.left { left: 0; transform: translateX(-101%); border-right: 2px solid rgba(255, 215, 120, .5); }
.gfx-door.left::after { right: 18px; }
.gfx-door.right { right: 0; transform: translateX(101%); border-left: 2px solid rgba(255, 215, 120, .5); }
.gfx-door.right::after { left: 18px; }
.gfx-door.close { transform: translateX(0); }
.gfx-door.open.left { transform: translateX(-101%); transition-duration: .7s; }
.gfx-door.open.right { transform: translateX(101%); transition-duration: .7s; }
.gfx-crack { position: absolute; left: 50%; top: 0; bottom: 0; width: 0; z-index: 3; transform: translateX(-50%); background: #fff; box-shadow: 0 0 30px 10px #fff, 0 0 80px 30px var(--best, #b98bff); opacity: 0; transition: width .5s, opacity .2s; }
.gfx-crack.on { width: 6px; opacity: 1; }

/* ---- 結果カード ---- */
.gfx-card { --win: #ffd24d; width: 150px; aspect-ratio: 3 / 4.2; perspective: 900px; animation: gfx-deal .45s cubic-bezier(.2, .8, .3, 1.2) both; animation-delay: calc(var(--i, 0) * 60ms); }
.gfx-card.big { width: min(300px, 70vw); }
@keyframes gfx-deal { from { opacity: 0; transform: translateY(60px) scale(.6) rotate(-6deg); } to { opacity: 1; transform: none; } }
.gfx-card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, .7, .3, 1.15); }
.gfx-card.flip .gfx-card-inner { transform: rotateY(180deg); }
.gfx-back, .gfx-front { position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.gfx-back { display: grid; place-items: center; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .06) 0 8px, transparent 8px 16px), linear-gradient(160deg, #2f5bff, #0b1f73); border: 3px solid rgba(255, 255, 255, .5); }
.gfx-card.is-super .gfx-back { background: repeating-linear-gradient(45deg, rgba(255, 215, 120, .07) 0 8px, transparent 8px 16px), linear-gradient(160deg, #3a1470, #0b0418); border-color: rgba(255, 215, 120, .6); }
.gfx-back-mark { font: 400 3rem var(--font-hub, sans-serif); opacity: .7; }
.gfx-front { transform: rotateY(180deg); display: grid; grid-template-rows: auto 1fr auto auto auto; justify-items: center; gap: 2px; padding: 8px 6px; text-align: center;
  background: linear-gradient(170deg, #2b3a66, #131c3a); border: 3px solid #6c7fa8; }
.gfx-card.is-win .gfx-front { background: radial-gradient(90% 60% at 50% 35%, color-mix(in srgb, var(--win) 55%, #fff 0%), color-mix(in srgb, var(--win) 25%, #120a00) 70%); border-color: var(--win); box-shadow: 0 0 24px var(--win), inset 0 0 20px rgba(255, 255, 255, .25); }
.gfx-card.is-win.is-super .gfx-front { border-image: linear-gradient(135deg, #ff6bd6, #ffd24d, #7df9ff, #9bff6b, #ff6bd6) 1; border-width: 3px; border-style: solid; }
.gfx-card.is-win.flip { animation: gfx-pulse 1.6s ease-in-out .6s infinite; }
@keyframes gfx-pulse { 50% { filter: drop-shadow(0 0 16px var(--win)); } }
.gfx-label { font: 400 .95rem var(--font-hub, sans-serif); letter-spacing: .06em; }
.gfx-card.is-win .gfx-label { color: #fff; text-shadow: 0 0 8px var(--win), 0 2px 0 rgba(0, 0, 0, .4); }
.gfx-card.is-lose .gfx-label { color: #aebbd6; }
.gfx-art { width: 100%; display: grid; place-items: center; min-height: 0; }
.gfx-art svg { width: 100%; height: 100%; max-height: 100%; }
.gfx-art .store-art { width: 100%; height: 100%; background: transparent; }
.gfx-art .store-art-svg { width: 90%; height: auto; aspect-ratio: 1; }
.gfx-name { font-size: .8rem; line-height: 1.2; }
.gfx-card.big .gfx-name { font: 400 1.25rem var(--font-hub, sans-serif); }
.gfx-sub { font-size: .65rem; opacity: .8; }
.gfx-card.big .gfx-sub { font-size: .85rem; }
.gfx-tag { font-size: .62rem; font-weight: 900; padding: 1px 6px; border-radius: 999px; }
.gfx-tag.new { background: #ff3b6b; color: #fff; }
.gfx-tag.dup { background: rgba(0, 0, 0, .35); color: rgba(255, 255, 255, .8); }
.gfx-shine { position: absolute; inset: -40%; background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .55) 50%, transparent 60%); transform: translateX(-60%); animation: gfx-shine 2.2s ease-in-out .7s infinite; pointer-events: none; }
@keyframes gfx-shine { 0% { transform: translateX(-60%); } 50%, 100% { transform: translateX(60%); } }
.gfx-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 150px)); gap: 12px; padding: 50px 16px 90px; max-width: 100vw; }
.gfx-legend { position: absolute; top: 9%; left: 50%; transform: translateX(-50%); z-index: 3; white-space: nowrap; font: 400 clamp(2.2rem, 8vw, 5rem) var(--font-hub, sans-serif); font-style: italic; letter-spacing: .06em;
  background: linear-gradient(90deg, #ff6bd6, #ffd24d, #fff, #7df9ff, #9bff6b, #ff6bd6); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 12px rgba(255, 220, 120, .8)); animation: gfx-slam .7s cubic-bezier(.2, .8, .2, 1.2) both, gfx-flow 3s linear infinite; }
@keyframes gfx-slam { from { opacity: 0; transform: translateX(-50%) scale(3); filter: blur(12px); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes gfx-flow { to { background-position: 200% 0; } }
@media (max-width: 760px) {
  .gfx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 56px 10px 90px; width: 100%; box-sizing: border-box; align-self: stretch; max-height: 100dvh; overflow-y: auto; }
  .gfx-grid .gfx-card { width: 100%; }
  .gfx-name { font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) { .gfx *, .gfx { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- ショップのガチャ欄 ---- */
.gacha-box { margin: 8px 0 18px; padding: 14px; border-radius: 10px; background: linear-gradient(160deg, rgba(255, 210, 77, .18), rgba(10, 30, 110, .55)); border: 2px solid rgba(255, 226, 61, .55); }
.gacha-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; }
.gacha-head h3 { margin: 0; font: 400 1.35rem var(--font-hub); font-style: italic; }
.gacha-rates { margin: 2px 0 8px; font-size: .82rem; color: rgba(255, 255, 255, .85); }
.gacha-slots { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.gacha-slot { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px; border-radius: 8px; text-align: center; font-size: .75rem; font-weight: 700;
  background: linear-gradient(160deg, var(--cat-a, #ff8a1f), var(--cat-b, #b3261e)); cursor: pointer; border: 0; color: #fff; }
.gacha-slot.is-empty { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .06) 0 10px, rgba(255, 255, 255, .02) 10px 20px), linear-gradient(160deg, #24357a, #0f1b4d); cursor: default; border: 2px dashed rgba(255, 255, 255, .3); }
.gacha-slot .gs-art { width: 100%; aspect-ratio: 1; }
.gacha-slot .gs-art svg { width: 100%; height: 100%; }
.gacha-slot .gs-q { font: 400 3rem/1 var(--font-hub); opacity: .8; padding: 18px 0; }
.gacha-slot .gs-own { position: absolute; top: 4px; right: 4px; background: #2fcf8a; color: #06301f; border-radius: 999px; padding: 0 6px; font-size: .65rem; }
.gacha-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gacha-btn { display: grid; gap: 1px; min-width: 170px; padding: 9px 16px; border: 0; border-radius: 6px; cursor: pointer; text-align: center;
  background: var(--hub-yellow); color: #111; box-shadow: 0 4px 0 #b89c00; }
.gacha-btn b { font: 400 1.15rem var(--font-hub); font-style: italic; }
.gacha-btn span { font-size: .8rem; font-weight: 800; }
.gacha-btn.ten { background: linear-gradient(90deg, #ffb72b, #ff6a3d); color: #fff; box-shadow: 0 4px 0 #8f3214; }
.gacha-btn:disabled { filter: grayscale(.7) brightness(.8); cursor: not-allowed; box-shadow: none; }
.gacha-note { margin: 6px 0 0; font-size: .78rem; color: rgba(255, 255, 255, .78); }
/* 超レア */
.gacha-super { position: relative; overflow: hidden; border: 2px solid transparent; background:
  linear-gradient(160deg, #1c0d33, #07030f) padding-box,
  linear-gradient(120deg, #ff6bd6, #ffd24d, #7df9ff, #9bff6b, #ff6bd6) border-box; }
.gacha-super::before { content: ""; position: absolute; inset: -50%; background: conic-gradient(from 0deg, transparent, rgba(255, 210, 120, .12), transparent 30%); animation: gfx-spin 8s linear infinite; pointer-events: none; }
.gacha-super > * { position: relative; }
.gacha-super h3 { background: linear-gradient(90deg, #ffe9a8, #ff9ad8, #9ff6ff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 8px rgba(255, 210, 120, .5)); letter-spacing: .04em; }
.gacha-super .gacha-slots { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gacha-super .gacha-slot { background: radial-gradient(90% 70% at 50% 30%, color-mix(in srgb, var(--sc, #b98bff) 55%, transparent), #0b0818 75%); border: 1px solid color-mix(in srgb, var(--sc, #b98bff) 70%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--sc, #b98bff) 35%, transparent); }
.gacha-super .gacha-btn { background: linear-gradient(90deg, #ffe9a8, #ffd24d); }
.gacha-super .gacha-btn.ten { background: linear-gradient(90deg, #ff6bd6, #9b5cff); }
.gacha-left { font-weight: 900; color: #ffe9a8; }
@media (max-width: 700px) { .gacha-slots, .gacha-super .gacha-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); } .gacha-btn { min-width: 0; flex: 1; } }
.gfx-bundle { width: 100%; aspect-ratio: 1; }
.gfx-bundle svg { width: 100%; height: 100%; }
.super-picks .store-card { --cat-b: #0b0818; }
.super-lose { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; margin: 6px 0 10px; }

/* 管理者: アカウント操作（ふだんは閉じている） */
.player-row .admin-acct { grid-column: 1 / -1; border-top: 1px dashed rgba(255,255,255,.15); padding-top: 6px; }
.admin-acct summary { cursor: pointer; font-size: .85rem; opacity: .8; }
.admin-acct .admin-actions { margin-top: 6px; flex-wrap: wrap; }
