/* 色・文字・段階色と、共通部品(ボタン・モーダル・トースト)の最低限の見た目。
   「夜の遊技場」: 濃い紺の地に、朱と金。データは琥珀色のLED。ぼかし・ツヤは使わない。 */

@font-face {
  font-family: "DotGothic16";
  src: url("../assets/fonts/DotGothic16-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  /* 地と面 */
  --bg: #0b0d16;
  --bg-2: #131728;
  --bg-3: #1b2138;
  --line: #2a3150;
  /* 文字 */
  --ink: #f3ead6;
  --ink-2: #a9b0c6;
  --ink-3: #6f7791;
  /* 朱と金 */
  --shu: #d83a2e;
  --shu-deep: #8f1d16;
  --kin: #e8b84a;
  --kin-deep: #a17418;
  /* LED */
  --led: #ffb300;
  --led-dim: #5c4100;
  --led-bg: #0a0704;
  /* 良い・注意・悪い */
  --ok: #37c871;
  --warn: #ffb300;
  --ng: #ff5a4d;

  /* 段階色: 灰 < 青 < 緑 < 赤 < 金 < 虹 */
  --tier-gray: #8a90a0;
  --tier-blue: #4f8cff;
  --tier-green: #33c26b;
  --tier-red: #ef4a3c;
  --tier-gold: #c8961e;   /* 金。だるまの「黄」(#ffe600)と見分けられる濃さ */
  --tier-yellow: #ffe600;
  --tier-rainbow: linear-gradient(90deg, #e5332a, #ff9a2e, #ffe600, #22b14c, #3f7df0, #8e5cf0);
  /* 虹の平たいしま(ぼかしなし) */
  --tier-rainbow-stripes: repeating-linear-gradient(135deg, #e5332a 0 22px, #ff9a2e 22px 44px, #ffe600 44px 66px, #22b14c 66px 88px, #3f7df0 88px 110px, #8e5cf0 110px 132px);

  /* 文字の種類 */
  --font-ui: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  --font-led: "DotGothic16", "Hiragino Sans", monospace;

  /* 角と余白 */
  --r-s: 6px;
  --r-m: 12px;
  --r-l: 18px;
  --pad: 14px;
  --top-h: 52px;
  --tab-h: 58px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* 設定の色(1灰 2青 3緑 4赤 5金 6虹)。data-setting="1".."6" を付けて使う */
/* 数字のあとの単位(G など)。ドットの書体だと G が 6 に見えるので、本文の書体で小さく */
.u { font-family: var(--font-ui); font-size: .62em; font-weight: 800; margin-left: 1px; letter-spacing: 0; }

[data-setting="1"] { --set-color: var(--tier-gray); }
[data-setting="2"] { --set-color: var(--tier-blue); }
[data-setting="3"] { --set-color: var(--tier-green); }
[data-setting="4"] { --set-color: var(--tier-red); }
[data-setting="5"] { --set-color: var(--tier-gold); }
[data-setting="6"] { --set-color: #ffe14d; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: #05060b;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
  /* 折り返し: 行頭の句読点を避け、最後の行に1〜2文字だけ残らないようにする。
     文節で折り返す(auto-phrase)のは Chrome だけ。iPhone(Safari)では pretty が効く */
  line-break: strict;
  word-break: auto-phrase;
  overflow-wrap: break-word;
  text-wrap: pretty;
}
button { font: inherit; color: inherit; }
a { color: var(--kin); }

#app {
  position: relative;
  display: flex; flex-direction: column;
  max-width: 480px; height: 100vh; height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}
#topbar { flex: none; padding-top: var(--safe-t); }
#tabbar { flex: none; padding-bottom: var(--safe-b); }
#screens { position: relative; flex: 1; min-height: 0; }
.screen { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen[hidden] { display: none !important; }
#fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 50; }
#modal-root { position: absolute; inset: 0; pointer-events: none; z-index: 80; }
#toast-root { position: absolute; left: 0; right: 0; top: calc(var(--safe-t) + var(--top-h) + 10px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 65; }

/* LEDの数字 */
.led { font-family: var(--font-led); color: var(--led); letter-spacing: .04em; font-variant-numeric: tabular-nums; }

/* ボタン */
.btn {
  appearance: none; border: 1px solid var(--line); border-radius: var(--r-m);
  min-height: 44px; padding: 10px 16px;
  background: var(--bg-3); color: var(--ink); font-weight: 700; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--shu); border-color: var(--shu-deep); color: #fff; }
.btn-gold { background: var(--kin); border-color: var(--kin-deep); color: #2a1c00; }
.btn-danger { background: transparent; border-color: var(--ng); color: var(--ng); }

/* モーダル */
.modal-wrap {
  position: absolute; inset: 0; pointer-events: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(4, 5, 10, .76);
  opacity: 0; transition: opacity .16s;
}
.modal-wrap.is-open { opacity: 1; }
.modal-box {
  width: 100%; max-width: 400px; max-height: 88%; overflow: auto;
  padding: 18px; border-radius: var(--r-l);
  background: var(--bg-2); border: 1px solid var(--line);
  -webkit-user-select: text; user-select: text;
}
.modal-title { margin: 0 0 10px; font-size: 18px; font-weight: 800; }
.modal-text { margin: 0; color: var(--ink-2); white-space: pre-wrap; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.modal-actions.is-stack { flex-direction: column; }

/* 上の知らせ帯(押さなくても消える) */
.notice-banner {
  position: absolute; left: 12px; right: 12px; top: calc(var(--safe-t) + var(--top-h) + 6px); z-index: 66;
  display: flex; flex-direction: column; gap: 1px;
  padding: 9px 14px; border-radius: var(--r-m);
  background: var(--bg-2); border: 2px solid var(--kin);
  opacity: 0; transform: translateY(-10px); transition: opacity .2s, transform .2s;
  cursor: pointer;
}
.notice-banner.is-on { opacity: 1; transform: none; }
.notice-banner .nb-title { color: var(--kin); font-size: 12px; font-weight: 900; letter-spacing: .04em; }
.notice-banner .nb-text { color: var(--ink); font-size: 14px; font-weight: 700; }

/* トースト */
.toast {
  padding: 9px 14px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--ink);
  font-size: 13px; font-weight: 700;
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: none; }
.toast-gold { border-color: var(--kin); color: var(--kin); }
.toast-ng { border-color: var(--ng); color: var(--ng); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* 読点・句点のかたまりごとに折り返す(S6.phrases が付ける)。かたまりが1行より長いときは、中で折り返す */
.ph { display: inline-block; max-width: 100%; }
