/*! Antihex (c) 2026 Not1ce - MIT License - https://github.com/Not1cemusic/antihex */
/* ============================================================
   見た目。色は config.js の theme / avoidColor / playerColor で変えられます。
   Appearance. Colors come from theme / avoidColor / playerColor in config.js.
   ============================================================ */

:root {
  /* config.js で上書きされる色 */
  --bg: #0b0b0d;           /* theme.background */
  --ink: #eceae4;          /* theme.text */
  --accent: #c9b58c;       /* theme.accent */
  --avoid: #ff3b30;        /* avoidColor */
  --alert: var(--avoid);   /* 接触やエラーを知らせる色(避ける色が背景に近いときは差し色) */
  --player: #ffffff;       /* playerColor */
  --player-size: 14px;     /* playerSize */

  /* main.js が画面サイズから計算する */
  --area: 320px;

  /* 上の色から作る、濃淡違いの色 */
  --muted: color-mix(in srgb, var(--ink) 55%, var(--bg));
  --faint: color-mix(in srgb, var(--ink) 34%, var(--bg));
  --line: color-mix(in srgb, var(--ink) 13%, transparent);
  --line-strong: color-mix(in srgb, var(--ink) 30%, transparent);
  --surface: color-mix(in srgb, var(--ink) 5%, var(--bg));
  --veil: color-mix(in srgb, var(--bg) 80%, transparent);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

/* 上からうっすら光が差す背景と、細かい粒子 */
body {
  background:
    radial-gradient(120% 70% at 50% -20%, color-mix(in srgb, var(--ink) 9%, var(--bg)) 0%, transparent 62%),
    var(--bg);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding:
    max(14px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

/* プレイ中は画面全体で操作できるようにして、スクロールやピンチ拡大を止める。
   エリアの上では自機がカーソルの代わりになるので、カーソルを隠す(エリアの外では普通に表示) */
.app[data-state="playing"] {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.app[data-state="playing"] .area { cursor: none; }
/* 始まる前も自機を動かせるとき(指で遊ぶときの秒読みの間、または、ほかのプログラムから動かされているとき) */
.app[data-free="1"] .area { cursor: none; }
.app[data-free="1"] .player { z-index: 7; }
.app[data-bare="1"] .overlay { display: none; }
/* タッチ操作では、プレイ中の押し間違いを防ぐため言語ボタンを隠す */
.app[data-state="playing"][data-input="touch"] .lang-btn { visibility: hidden; }
.app[data-state="playing"][data-input="touch"] .credits { pointer-events: none; }

.top, .scoreboard, .result-panel, .credits {
  width: var(--area);
  max-width: 100%;
}

/* 小さな見出し文字(SCORE / BEST など) */
.label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- ヘッダー ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
}
.title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.9em;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.34em;
  white-space: nowrap;
}
/* タイトルを押すと開始画面に戻る */
.title { cursor: pointer; }
/* 長いタイトルは、言語ボタンなどに重ならないよう「…」で切る */
.title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: -8px;
  padding: 6px 0 6px 8px;
}
.title::before {
  display: inline-block;
  margin-right: 0.9em;
  vertical-align: 0.05em;
}
.title::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--alert);
  box-shadow: 0 0 12px color-mix(in srgb, var(--alert) 70%, transparent);
}
.lang-btn {
  flex: none;
  appearance: none;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 6px 0 5px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.lang-btn:hover { color: var(--ink); border-color: var(--line-strong); }

.top-right { flex: none; display: flex; align-items: center; gap: 18px; }

/* 音量。マウスのある端末(PC)だけに出す */
.volume { display: none; align-items: center; gap: 8px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) {
  .volume { display: flex; }
}
.volume svg { flex: none; width: 14px; height: 14px; fill: currentColor; }
.volume input {
  width: 72px;
  height: 20px;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
/* つまみの位置(--fill)まで文字の色で塗る */
.volume input::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(to right, var(--ink) var(--fill, 100%), var(--line) var(--fill, 100%));
}
.volume input::-moz-range-track {
  height: 2px;
  background: linear-gradient(to right, var(--ink) var(--fill, 100%), var(--line) var(--fill, 100%));
}
.volume input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 9px;
  height: 9px;
  margin-top: -3.5px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
}
.volume input::-moz-range-thumb { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--ink); }
.volume:hover { color: var(--ink); }

/* ---------- スコア ---------- */
.scoreboard {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 6px;   /* 余白は padding で取る(main.js が高さを測るため) */
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.num .dec { font-size: 0.5em; letter-spacing: 0; }
small {
  margin-left: 0.35em;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.score-value {
  display: block;
  margin-top: 4px;
  font-size: clamp(46px, calc(var(--area) * 0.14), 68px);
  font-weight: 200;
  line-height: 0.95;
  letter-spacing: -0.03em;
  transition: color 0.12s;
}
/* ゴーストと対戦中は、2 つのスコアを同じ大きさで並べ、勝っているほうに差し色を付ける */
.app[data-ghost="1"] .score-value { font-size: clamp(32px, calc(var(--area) * 0.1), 52px); }
.score-ghost { margin-right: auto; padding-left: 4px; }
.app[data-lead="you"] .score-main .score-value,
.app[data-lead="ghost"] .score-ghost .score-value { color: var(--accent); }
.app[data-hit="1"]:not([data-state="result"]) .score-main .score-value { color: var(--alert); }
.app[data-hit="1"][data-state="result"] .replay-score-value { color: var(--alert); }
.score-side {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: right;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.score-side:hover .label { color: var(--ink); }
.best-value {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.badge {
  display: inline-block;
  margin-right: 0.9em;
  color: var(--accent);
  animation: rise 0.5s var(--ease) both;
}
.badge::after { content: " —"; color: var(--faint); }

/* ---------- エリア ---------- */
.wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}
.playfield { position: relative; width: var(--area); }

.area {
  position: relative;
  width: var(--area);
  height: var(--area);
  background: #000;
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--line),
    0 34px 70px -36px rgba(0, 0, 0, 0.9);
  transition: box-shadow 0.12s;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.app[data-hit="1"] .area {
  box-shadow:
    0 0 0 1px var(--alert),
    0 0 42px -8px color-mix(in srgb, var(--alert) 60%, transparent);
}

/* 四隅の L 字の飾り。接触中は避ける色に変わる */
.corner {
  position: absolute;
  width: 11px;
  height: 11px;
  border: 0 solid var(--line-strong);
  pointer-events: none;
  transition: border-color 0.12s;
}
.corner.tl { left: -7px; top: -7px; border-width: 1px 0 0 1px; }
.corner.tr { right: -7px; top: -7px; border-width: 1px 1px 0 0; }
.corner.bl { left: -7px; top: calc(var(--area) - 4px); border-width: 0 0 1px 1px; }
.corner.br { right: -7px; top: calc(var(--area) - 4px); border-width: 0 1px 1px 0; }
.app[data-hit="1"] .corner { border-color: var(--alert); }

.area video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;      /* 正方形でない動画は中央を正方形に切り抜く */
  pointer-events: none;
}
/* 動画の上に重ねる、絵を写した画面 */
.area .screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.player {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--player-size);
  height: var(--player-size);
  border-radius: 50%;
  background: var(--player);
  box-shadow:
    0 0 0 1.5px rgba(0, 0, 0, 0.6),
    0 0 14px color-mix(in srgb, var(--player) 55%, transparent);
  pointer-events: none;
  will-change: transform;
}
/* ゴースト(読み込んだリプレイの自機)。輪だけで表示する */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--player-size);
  height: var(--player-size);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--player), 0 0 0 3px rgba(0, 0, 0, 0.45);
  opacity: 0.6;
  pointer-events: none;
  will-change: transform;
}
/* ゴーストの名前(輪のすぐ上に小さく) */
.ghost[data-name]:not([data-name=""])::after {
  content: attr(data-name);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--player);
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.9), 0 0 1px rgba(0, 0, 0, 0.9);
}
.ghost[data-hit="1"] { box-shadow: 0 0 0 1.5px var(--alert), 0 0 0 3px rgba(0, 0, 0, 0.45); }

.app[data-hit="1"] .player {
  box-shadow:
    0 0 0 1.5px rgba(0, 0, 0, 0.85),
    0 0 0 4px var(--player);
}

/* 光の刺激に関する注意。押して進むまで、エリア全体を覆う */
.gate {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg);
  text-align: center;
}
.gate-body { max-width: 30em; max-height: 100%; overflow-y: auto; }
.gate-body .btn { margin-top: clamp(14px, calc(var(--area) * 0.06), 26px); }
.list-warning { color: var(--accent); }

/* 開始前・一時停止・エラーのときにエリアへかぶせる幕 */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    radial-gradient(80% 80% at 50% 50%, transparent 0%, color-mix(in srgb, var(--bg) 55%, transparent) 100%),
    var(--veil);
  -webkit-backdrop-filter: blur(5px) saturate(0.7);
  backdrop-filter: blur(5px) saturate(0.7);
  text-align: center;
  cursor: pointer;
}
.app[data-state="playing"] .overlay,
.app[data-state="result"] .overlay { display: none; }
/* 開始前は、後ろで流れる映像が見えるように幕を薄くする */
.app[data-state="ready"] .overlay {
  background: color-mix(in srgb, var(--bg) 58%, transparent);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.app[data-state="loading"] .overlay,
.app[data-state="ready"] .overlay,
.app[data-state="starting"] .overlay,
.app[data-state="error"] .overlay { cursor: default; }

/* 文字の大きさはエリアの大きさに合わせる(小さい画面でもはみ出さないように) */
/* 小さい画面で文字が収まらないときは、枠の中でスクロールできるようにする */
.overlay-body { max-width: 32em; max-height: 100%; overflow-y: auto; }
.overlay-body > * { animation: rise 0.6s var(--ease) both; }
.overlay-body > :nth-child(2) { animation-delay: 0.05s; }
.overlay-body > :nth-child(3) { animation-delay: 0.1s; }
.overlay-body > :nth-child(4) { animation-delay: 0.15s; }
.overlay-title {
  margin: 0;
  font-size: clamp(15px, calc(var(--area) * 0.062), 30px);
  font-weight: 300;
  letter-spacing: 0.34em;
  text-indent: 0.34em;      /* 字間の分だけ右にずれるのを戻す */
  line-height: 1.35;
}
.overlay-text {
  margin: 1.5em 0 0;
  font-size: clamp(11px, calc(var(--area) * 0.034), 13px);
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--ink) 78%, var(--bg));
  overflow-wrap: anywhere;
}
.overlay .btn {
  margin-top: clamp(14px, calc(var(--area) * 0.06), 28px);
  min-height: clamp(36px, calc(var(--area) * 0.12), 46px);
  min-width: min(15em, 80%);
}
/* 名前の入力欄(開始画面) */
.name-input {
  display: block;
  width: min(14em, 80%);
  margin: clamp(10px, calc(var(--area) * 0.04), 16px) auto 0;
  padding: 6px 8px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;   /* これより小さいと、iPhone で入力時に画面が拡大される */
  letter-spacing: 0.06em;
  text-align: center;
}
.name-input::placeholder { color: var(--faint); font-size: 12px; letter-spacing: 0.14em; }
.name-input:focus { outline: none; border-bottom-color: var(--ink); }
a.link-btn { text-decoration: none; }
.overlay-note {
  margin: clamp(10px, calc(var(--area) * 0.04), 18px) 0 0;
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.overlay-desc {
  margin: 0.9em 0 0;
  font-size: clamp(11px, calc(var(--area) * 0.034), 13px);
  line-height: 1.8;
  letter-spacing: 0.06em;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.overlay-text:empty, .overlay-note:empty, .overlay-title:empty, .overlay-desc:empty { display: none; }

.swatch {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin: 0 0.45em;
  vertical-align: -0.12em;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 35%, transparent);
}
.swatch.round { border-radius: 50%; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.9em;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { background: transparent; color: var(--ink); }
.btn:active { transform: translateY(1px); }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9em;
  height: 1.9em;
  border: 1px solid currentColor;
  border-radius: 2px;
  font: inherit;
  font-size: 9px;
  letter-spacing: 0;
  opacity: 0.55;
}
/* キーボードのない端末では R キーの案内を出さない */
@media (hover: none) { kbd { display: none; } }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

/* ---------- 時間経過バー / シークバー ---------- */
.bar {
  padding: 14px 0 8px;
  touch-action: none;
  outline: none;
}
.bar-track {
  position: relative;
  height: 2px;
  background: var(--line);
}
.bar-fill {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform-origin: left center;
  transform: scaleX(0);
}
/* 接触した区間は、目盛りのように上下にはみ出して見せる */
.bar-hits { position: absolute; inset: 0; }
.bar-hits i {
  position: absolute;
  top: -4px;
  bottom: -4px;
  min-width: 2px;
  background: var(--alert);
}
.bar-thumb {
  display: none;
  position: absolute;
  top: 50%;
  left: 0;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 3px var(--bg);
  transition: transform 0.15s var(--ease);
}
.app[data-state="result"] .bar { padding: 18px 0 12px; cursor: pointer; }
.app[data-state="result"] .bar-thumb { display: block; }
/* 結果画面ではエリアの上からでも縦にスクロールできるようにする */
.app[data-state="result"] .area { touch-action: pan-y; }
.app[data-state="result"] .bar:hover .bar-thumb { transform: scale(1.25); }
.app[data-state="result"] .bar:focus-visible .bar-thumb { box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--accent); }

/* ---------- リプレイ ---------- */
.replay-big {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--ink) 55%, transparent);
  border-radius: 50%;
  background: var(--veil);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.replay-big:hover { transform: scale(1.06); border-color: var(--ink); }
.replay-big svg { width: 30px; height: 30px; margin-left: 3px; fill: currentColor; vertical-align: middle; }

.replay-row .label, .btn { white-space: nowrap; }
.replay-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
}
.icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background-color 0.2s;
}
.icon-btn:hover { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn .icon-play { margin-left: 2px; }
.icon-btn .icon-pause { display: none; }
.icon-btn[data-playing="1"] .icon-play { display: none; }
.icon-btn[data-playing="1"] .icon-pause { display: block; }
.replay-time {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.replay-score { margin-left: auto; text-align: right; }
.replay-score-value {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  font-weight: 300;
  line-height: 1.1;
  transition: color 0.12s;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.result-panel { margin-top: -14px; }   /* バーのすぐ下に続けて見せる */
.actions .btn { padding: 0 10px; }

/* 文字だけの小さなボタン(リプレイの保存・読み込み) */
.link-btn {
  appearance: none;
  padding: 6px 0 5px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.link-btn:hover { color: var(--ink); border-color: var(--ink); }
.overlay .link-btn { margin-top: 14px; }
/* 始まる前の秒読み(エリアは隠さず、最初の絵の上に数字だけを出す) */
.count {
  position: absolute;
  left: 50%;
  top: clamp(10px, calc(var(--area) * 0.05), 24px);
  z-index: 4;
  transform: translateX(-50%);
  font-size: clamp(22px, calc(var(--area) * 0.09), 44px);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* ---------- 止められないモード(ほかのプログラムから動かされているとき) ---------- */
/* 離れている間(カーソルを自機の位置へ戻すまで動かせない): 自機を目立たせる */
.app[data-away="1"] .player { box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.7), 0 0 0 5px var(--player), 0 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent); }

.replay-files { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 26px; margin-top: 12px; }
.replay-status {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.replay-status[data-kind="ok"] { color: var(--accent); }
.replay-status[data-kind="ng"] { color: var(--alert); }

/* ---------- クレジット ---------- */
.credits {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--ink) 80%, var(--bg));
  overflow-wrap: anywhere;
}
.credits p { margin: 0; }
.credits .label { display: inline; margin-right: 0.9em; }
.credits a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 0.2s, color 0.2s;
}
.credits a:hover { color: var(--ink); border-color: var(--ink); }
.credits:empty { display: none; }
.credits .list-link { margin-left: auto; border-bottom-color: transparent; color: var(--muted); letter-spacing: 0.1em; }
.credits .list-link + .template-link { margin-left: 0; }
.credits .list-link ~ .list-link { margin-left: 0; }
.credits .template-link {
  margin-left: auto;
  border-bottom-color: transparent;
  color: var(--muted);
  letter-spacing: 0.1em;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 横向きのスマホなど、高さが足りない画面 ----------
   スコアとクレジットを左、エリアを右に並べて、エリアをできるだけ大きくする */
@media (orientation: landscape) and (max-height: 540px) {
  .app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto 1fr;
    column-gap: 26px;
    row-gap: 10px;
    align-items: start;
  }
  .top, .scoreboard, .result-panel, .credits { grid-column: 1; width: auto; }
  .wrap { grid-column: 2; grid-row: 1 / -1; width: auto; }
  .result-panel { margin-top: 0; }
  .score-value { font-size: 40px; }
  .credits { align-self: end; }
}

/* ---------- 一時停止中 ----------
   マウス操作では自機を幕の上に出し、そこへカーソルを戻してもらう */
.app[data-state="paused"] .player { z-index: 3; }
.app[data-state="paused"][data-input="mouse"] .player {
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.7), 0 0 0 5px var(--player);
  animation: beacon 1.4s ease-out infinite;
}
.app[data-state="paused"][data-input="mouse"] .overlay { cursor: default; }
/* 案内の文字は、自機と重ならない側に寄せる */
.app[data-state="paused"][data-text-side="top"] .overlay { align-items: flex-start; padding-top: 9%; }
.app[data-state="paused"][data-text-side="bottom"] .overlay { align-items: flex-end; padding-bottom: 9%; }
.player.nudge { animation: nudge 0.45s var(--ease) 2 !important; }
@keyframes beacon {
  0% { box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.7), 0 0 0 4px var(--player), 0 0 0 4px color-mix(in srgb, var(--player) 70%, transparent); }
  100% { box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.7), 0 0 0 4px var(--player), 0 0 0 26px transparent; }
}
@keyframes nudge {
  50% { box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.7), 0 0 0 5px var(--player), 0 0 0 16px var(--accent); }
}

/* 外のサイトへ行く前の確認 */
.leave {
  width: min(26em, calc(100vw - 40px));
  padding: 22px 22px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--bg);
  color: var(--ink);
}
.leave::backdrop { background: var(--veil); }
.leave p { margin: 0; }
.leave-url { margin: 12px 0 20px !important; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; user-select: all; }
.leave-actions { display: flex; justify-content: flex-end; gap: 10px; }
.leave-actions .btn { min-height: 40px; padding: 0 18px; }
