/* ==========================================================================
   CHAOS RUSH — 見た目

   ■■ ここだけ読めば直せます ■■
   ● 色は下の :root{ } だけ。
   ● ★ ゲームの絵そのもの（キャラ・地形）は canvas に描いています。
     そちらの色は render.js の COLORS です。ここではありません。
   ● 画面は <section class="screen"> の出し入れで切り替わります。
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #141922;
  --panel: rgba(12, 16, 22, .82);
  --line: rgba(255, 255, 255, .14);
  --ink: #eef1f7;
  --dim: #9aa6bd;
  --gold: #f2c14e;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
               "Yu Gothic UI", Meiryo, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); overflow: hidden;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }

/* ---------- ボタン（ピンズゲーム共通の形にそろえています） ---------- */
.btn {
  font: inherit; font-weight: 700; font-size: 14px; line-height: 1.2;
  min-height: 36px; padding: 8px 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--ink); background: rgba(0, 0, 0, .3);
  border: 1.5px solid rgba(255, 255, 255, .35); border-radius: 999px;
  cursor: pointer; transition: background .15s, transform .08s;
}
.btn:hover { background: rgba(255, 255, 255, .12); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { color: #2a1d00; background: linear-gradient(#f8d67a, #e3a92b); border-color: #f8d67a; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.small { font-size: 12px; min-height: 30px; padding: 6px 12px; }
.btn.big { font-size: 16px; min-height: 46px; padding: 12px 30px; }

/* ---------- 画面 ---------- */
/* ★ 画面の下に、うっすら工場の影を敷きます（見た目の決まりは render.js の COLORS と
   そろえてあります）。絵のファイルは使わず、SVG を文字列のまま埋め込んでいるので、
   読み込みも増えませんし、拡大しても粗くなりません。 */
.screen {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  background:
    url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201200%20220%22%20preserveAspectRatio%3D%22xMidYMax%20slice%22%3E%3Cg%20fill%3D%22%231b2029%22%3E%3Crect%20x%3D%220%22%20y%3D%22120%22%20width%3D%2296%22%20height%3D%22100%22%2F%3E%3Crect%20x%3D%2234%22%20y%3D%2292%22%20width%3D%2214%22%20height%3D%2230%22%2F%3E%3Crect%20x%3D%22118%22%20y%3D%2286%22%20width%3D%22120%22%20height%3D%22134%22%2F%3E%3Crect%20x%3D%22262%22%20y%3D%22134%22%20width%3D%2278%22%20height%3D%2286%22%2F%3E%3Crect%20x%3D%22366%22%20y%3D%2270%22%20width%3D%22104%22%20height%3D%22150%22%2F%3E%3Crect%20x%3D%22398%22%20y%3D%2242%22%20width%3D%2216%22%20height%3D%2230%22%2F%3E%3Crect%20x%3D%22498%22%20y%3D%22118%22%20width%3D%22142%22%20height%3D%22102%22%2F%3E%3Crect%20x%3D%22668%22%20y%3D%2292%22%20width%3D%2286%22%20height%3D%22128%22%2F%3E%3Crect%20x%3D%22782%22%20y%3D%22140%22%20width%3D%22118%22%20height%3D%2280%22%2F%3E%3Crect%20x%3D%22928%22%20y%3D%2278%22%20width%3D%2298%22%20height%3D%22142%22%2F%3E%3Crect%20x%3D%22960%22%20y%3D%2250%22%20width%3D%2215%22%20height%3D%2230%22%2F%3E%3Crect%20x%3D%221054%22%20y%3D%22126%22%20width%3D%22146%22%20height%3D%2294%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22%23232936%22%3E%3Ccircle%20cx%3D%22300%22%20cy%3D%22104%22%20r%3D%2234%22%2F%3E%3Ccircle%20cx%3D%22300%22%20cy%3D%22104%22%20r%3D%2212%22%20fill%3D%22%231b2029%22%2F%3E%3Ccircle%20cx%3D%22726%22%20cy%3D%2266%22%20r%3D%2226%22%2F%3E%3Ccircle%20cx%3D%22726%22%20cy%3D%2266%22%20r%3D%229%22%20fill%3D%22%231b2029%22%2F%3E%3Ccircle%20cx%3D%221012%22%20cy%3D%22112%22%20r%3D%2220%22%2F%3E%3Ccircle%20cx%3D%221012%22%20cy%3D%22112%22%20r%3D%227%22%20fill%3D%22%231b2029%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") bottom center / 100% auto no-repeat,
    radial-gradient(ellipse 80% 60% at 50% 0%, #26304a, transparent 70%),
    linear-gradient(#141922, #0b0e14);
  overflow: auto;
}
.inner { width: 100%; max-width: 560px; text-align: center; }
.inner.narrow { max-width: 620px; text-align: left; }

.kicker { margin: 0 0 6px; font-size: 11px; letter-spacing: .26em; color: var(--dim); }
.logo {
  margin: 0; font-size: clamp(34px, 11vw, 62px); letter-spacing: .1em; font-weight: 900;
  background: linear-gradient(#fff3d0, #e3a92b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 10px 0 0; font-size: 14px; color: var(--dim); letter-spacing: .1em; }
/* テスト中の札。手直しが終わったら、index.html の <p class="beta"> と
   games.json の status（beta → public）を一緒に直してください。 */
.beta {
  margin: 12px auto 0; max-width: 24em; padding: 7px 14px;
  border-radius: 10px; font-size: 12.5px; font-weight: 700; line-height: 1.6;
  color: #4a3400; background: #f0c569;
}

.pickrow { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 30px 0 14px; }
.picklabel { font-size: 12px; color: var(--dim); }
.pick { display: flex; gap: 6px; }

.devices { margin: 0 auto 22px; font-size: 12px; line-height: 1.9; color: var(--dim); }

/* ---------- 誰が操作するかの選択 ---------- */
.slots { display: grid; gap: 8px; max-width: 420px; margin: 0 auto 16px; }
.slot-row {
  display: grid; grid-template-columns: 62px 1fr; gap: 10px; align-items: center;
  padding: 7px 12px; text-align: left;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: 10px;
}
.slot-row b { color: var(--c); font-size: 13px; }
.slot-row select {
  font: inherit; font-size: 12.5px; width: 100%;
  padding: 6px 8px; color: var(--ink);
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line); border-radius: 8px;
}
.slot-row select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.warn { color: #ffae6a; }

.menu { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 8px; }
.foot { margin-top: 26px; font-size: 12px; color: var(--dim); opacity: .75; }
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--gold); }

/* ---------- 通信対戦 ---------- */
.nettitle { margin: 0 0 20px; font-size: 26px; letter-spacing: .08em; }
.netlead { margin: 0 0 14px; font-size: 13px; line-height: 1.9; color: var(--dim); }
.netor { margin: 16px 0 10px; font-size: 11px; color: var(--dim); opacity: .7; }
.joinrow { display: flex; gap: 8px; justify-content: center; }
.code {
  font: inherit; font-size: 20px; font-weight: 700; letter-spacing: .3em; text-align: center;
  width: 170px; padding: 8px 10px; color: var(--ink);
  background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 10px;
}
.code:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.roomcode {
  margin: 6px 0 18px; font-size: clamp(38px, 12vw, 58px); font-weight: 900;
  letter-spacing: .22em; color: var(--gold);
}
.netmsg { margin: 14px 0 0; font-size: 12.5px; line-height: 1.9; color: #ffae6a; min-height: 1.2em; }

/* ---------- あそびかた ---------- */
.inner.narrow h2 { margin: 0 0 18px; font-size: 22px; letter-spacing: .06em; }
.inner.narrow h3 { margin: 22px 0 6px; font-size: 13px; letter-spacing: .1em; color: var(--gold); }
.inner.narrow p { margin: 0; font-size: 13.5px; line-height: 1.95; color: var(--dim); }
.inner.narrow p strong { color: var(--ink); }
.note { margin-top: 10px !important; font-size: 12.5px !important; }

.keys { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.keys th, .keys td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.keys th { font-size: 11px; color: var(--gold); letter-spacing: .08em; }
.keys td:first-child { color: var(--dim); white-space: nowrap; }

/* ---------- 結果 ---------- */
.result { list-style: none; margin: 0; padding: 0; }
.result li {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 12px; align-items: center;
  padding: 12px 14px; margin-bottom: 8px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 12px;
}
.result .place { font-size: 22px; font-weight: 900; color: var(--c); text-align: center; }
.result .who { font-weight: 700; }
.result .pts { font-weight: 700; color: var(--gold); }
.result .det { grid-column: 2 / -1; font-size: 11.5px; color: var(--dim); }

/* ---------- 遊ぶ画面 ---------- */
#play { position: fixed; inset: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#hud {
  position: absolute; left: 0; right: 0;
  top: max(8px, env(safe-area-inset-top));
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  padding: 0 10px; pointer-events: none;
}
.pcard {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c);
  font-size: 12px; backdrop-filter: blur(6px);
}
.pcard.dead { opacity: .45; }
.pcard .rk {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c); color: #10151d; font-weight: 900; font-size: 11px;
}
.pcard .nm { color: var(--c); font-weight: 700; }
.pcard .sc { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

#items {
  position: absolute; left: 0; right: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  padding: 0 10px; pointer-events: none;
}
.inv {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c);
  font-size: 12px; backdrop-filter: blur(6px);
}
.inv b { color: var(--c); margin-right: 2px; }
.wicon { font-size: 16px; }
.wname { font-size: 11.5px; color: var(--ink); }
/* ★ 待ち時間の帯。細いと見落とすので、太く・長くしてあります。
   いっぱいになったら使える、という意味です。 */
.wcool { width: 54px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.16);
         overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.wcool i { display: block; height: 100%; background: var(--c); transition: width .08s linear; }
/* 残り秒数。数字があると「あとどれくらいか」が一目で分かります。 */
.wsec { min-width: 26px; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
        color: var(--dim); text-align: right; }
.wsec.ready { color: var(--c); }
/* 待っている間は、その武器の欄ぜんたいを少し沈ませます */
.inv.waiting { opacity: .72; }
.inv.waiting .wicon { filter: grayscale(1); }

#center {
  position: absolute; inset: 0; display: grid; place-items: center;
  pointer-events: none; font-weight: 900; letter-spacing: .1em;
}
#centerText {
  font-size: clamp(56px, 16vw, 130px); color: var(--gold);
  text-shadow: 0 6px 30px rgba(0, 0, 0, .6);
}
#center.go #centerText { color: #7ce8a8; }

#quit {
  position: absolute; right: 10px;
  top: max(8px, env(safe-area-inset-top));
  background: var(--panel); backdrop-filter: blur(6px);
}

/* ---------- 動きを減らす設定の人には動かさない ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (max-width: 560px) {
  .pcard .sc { display: none; }
  .inv { font-size: 11px; }
}
