/* ============================================================
   ROM v2 試合タイマー系ページの共通スタイル (timer.css)

   12v-timer.html / 6v-timer.html / 6v6-score.html が共有する
   白いカード・下部固定の操作バー・ボタン・トグル・マップ拡大・タイム表など。
   読み込み順: common.css → timer.css → ページ固有 <style>（後に読むものが勝つ）
   1ページだけ見た目を変えるときは、ここではなくページ側 <style> に差分を書く。
   ============================================================ */

:root {
  --primary: #3463b1;
  --primary-dark: #1e3a6e;
  --gold: #e9c33a;
  --gold-dark: #a68e20;
  --gold-light: #ffe58a;
  --laneM: #d4a04a;
  --laneM-dark: #8a5a1c;
  --laneM-bg: #fdf5e0;
  --neutral: #9aa6b8;
  --neutral-bg: #eef1f5;
  --card: #ffffff;
  --border: #cfdbec;
  --border-strong: #9fb3d1;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(36, 60, 120, .10);
  --font: "Noto Sans JP", "Hiragino Kaku Gothic Pro", Meiryo, sans-serif;
  --num: "Barlow", "Noto Sans JP", sans-serif;
  --sky-btn: #6ba6e8;
  /* 注記・補足の文字色（白やチップの淡色の上で 4.5:1 以上） */
  --ink-note: #56657b;
  /* ON 状態のトグル・音声ボタンの色（ページごとに上書き） */
  --on: var(--primary);
  --on-bg: #e8f1fd;
}

body {
  margin: 0;
  color: #1a2942;
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  background: var(--bg-night);
  background-attachment: fixed;
  overflow-x: hidden;
  /* 下部固定バーぶん。バーは画面幅で折り返して高さが変わるので、
     実寸を js/match-timer.js の MatchTimer.watchActionBar() が --ab-h に入れる */
  padding-bottom: calc(var(--ab-h, 96px) + 16px);
}

a { color: var(--sky-ink); }

.wrap { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 0 12px; }

/* common.css の既定（18px 4px 10px）より上余白を広くして、sticky なボード（タイマー・スコア）との間隔を保つ */
header.site { padding: 24px 4px 10px; }

/* 白いカード・操作バーの上では金色のフォーカス枠が見えにくいので紺にする（common.css の --focus-ring） */
.card, .actionbar { --focus-ring: var(--primary-dark); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px; margin-top: 12px; }
.card h2 { margin: 0 0 10px; font-size: 15.5px; font-weight: 900; color: var(--primary-dark); display: flex; align-items: center; gap: 7px; }
.card h2 .ic { color: var(--gold-dark); }
/* 本文の注記。フッターの footer.note（common.css）と別の名前にしている */
.page-note { font-size: var(--fs-sm); color: var(--ink-note); margin: 8px 0 0; line-height: 1.65; }
.page-note b { color: #1a2942; }

/* ===== ダンジョン選択（6v / 6v6） ===== */
.dsel { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.dbtn { position: relative; border: 2px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; background: #000; padding: 0; display: block; aspect-ratio: 16/9; transition: .15s; }
.dbtn img { width: 100%; height: 100%; object-fit: cover; opacity: .72; transition: .15s; display: block; }
.dbtn span { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 4px; font-weight: 900; font-size: var(--fs-md); color: #fff; text-shadow: 0 2px 6px #000; background: linear-gradient(0deg, rgba(0, 0, 0, .72), transparent); }
.dbtn.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(233, 195, 58, .4); }
.dbtn.active img { opacity: 1; }
.dbtn.active span { color: var(--gold-light); }

/* ===== 固定タイマーボード（12v / 6v） ===== */
.timerbar { position: sticky; top: 0; z-index: 40; margin-top: 10px; border-radius: var(--radius); padding: 10px 12px 12px; box-shadow: 0 6px 18px rgba(28, 50, 100, .18); }
.clock-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.timerbar .clock { font-family: var(--num); font-weight: 800; font-size: 56px; line-height: 1; letter-spacing: .02em; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
/* 大きい文字なので 3:1 以上（#b86e00 は白地で 3.99） */
.timerbar .clock.notice { color: #b86e00; text-shadow: 0 0 12px rgba(233, 160, 0, .4); }
.timerbar .clock.over { color: #a8351f; }
.timerbar .clock.prep { color: #1f9d4d; text-shadow: 0 0 12px rgba(46, 192, 106, .35); }
.prep-line { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: var(--fs-sm); font-weight: 800; color: #157a3b; margin-top: 4px; letter-spacing: .04em; }
.prep-line input[type=range] { width: 140px; height: 32px; accent-color: #1f9d4d; }   /* 高さはタップ領域（標準スライダーは線を中央に描く） */
.prep-line b { font-family: var(--num); font-size: 15px; font-variant-numeric: tabular-nums; min-width: 40px; }
.clock-label { font-size: var(--fs-sm); font-weight: 800; color: var(--ink-note); text-align: center; letter-spacing: .08em; }
.syncseg { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
/* 試合中に押すので、タップ領域を 44px 以上にする */
.syncseg button { border: none; background: #fff; padding: 9px 10px; min-height: 44px; font-family: var(--num); font-weight: 700; font-size: var(--fs-md); cursor: pointer; color: #3d4d66; border-left: 1px solid var(--border); min-width: 44px; }
.syncseg button:first-child { border-left: none; }
.syncseg button:active { background: var(--neutral-bg); }
.syncseg button:focus-visible { outline-offset: -3px; }
.progress { display: flex; height: 7px; border-radius: var(--radius-pill); overflow: hidden; margin-top: 9px; background: var(--neutral-bg); border: 1px solid var(--border); }
.progress i { display: block; transition: width .3s linear; }
.nextchips { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 9px; }
.chip { border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 5px 4px 6px; text-align: center; background: var(--neutral-bg); transition: .15s; }
.chip__lane { font-weight: 900; font-size: var(--fs-sm); line-height: 1.3; }
.chip__t { font-family: var(--num); font-weight: 800; font-size: 20px; line-height: 1.15; font-variant-numeric: tabular-nums; color: #1a2942; }
.chip__sub { font-size: var(--fs-xs); color: var(--ink-note); line-height: 1.3; }
.chip--m { border-color: var(--laneM); background: var(--laneM-bg); }
.chip--m .chip__lane { color: var(--laneM-dark); }
.chip.soon { animation: chipPulse 1s ease-in-out infinite; }
@keyframes chipPulse { 50% { box-shadow: 0 0 0 4px rgba(224, 138, 0, .35); transform: scale(1.02); } }
.chip.done { opacity: .45; }

/* ===== 設定 ===== */
.set-grid { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-start; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-sm); color: var(--ink-note); font-weight: 800; }
.time-input { display: flex; align-items: center; gap: 5px; }
.time-input input { width: 64px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 6px; font-size: 19px; font-family: var(--num); font-weight: 700; text-align: center; color: #1a2942; background: #fff; }
.time-input input:disabled { background: var(--neutral-bg); color: #8a97a8; }
.time-input .colon { font-family: var(--num); font-weight: 800; font-size: 19px; color: #1a2942; }
.minibtn { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; padding: 9px 12px; font-size: var(--fs-md); font-weight: 800; cursor: pointer; color: #3d4d66; font-family: var(--font); }
.minibtn:active { background: var(--neutral-bg); }
.minibtn:disabled { opacity: .45; }
.range-wrap { display: flex; align-items: center; gap: 8px; }
.range-wrap input[type=range] { width: 150px; height: 32px; accent-color: var(--primary); }
.range-val { font-family: var(--num); font-weight: 800; font-size: 15px; color: var(--primary-dark); min-width: 44px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 800; font-size: var(--fs-md); color: #1a2942; }
.switch input { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--neutral); position: relative; cursor: pointer; transition: .15s; outline: none; margin: 0; flex: 0 0 auto; }
.switch input:checked { background: var(--on); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked::after { left: 20px; }
/* 上の outline:none はクリック時の枠を消すためのもの。キーボード操作時は枠を出す */
.switch input:focus-visible { outline: 2px solid var(--focus-ring, #ffe088); outline-offset: 2px; }

/* ===== マップ（タップで拡大） ===== */
.map-box { text-align: center; }
/* 画像を包む拡大ボタン。見た目は画像そのまま */
.zoom-btn { display: inline-block; position: relative; margin: 0; padding: 0; border: 0; background: none; line-height: 0; cursor: zoom-in; border-radius: var(--radius-sm); font: inherit; }
.map { max-width: 100%; width: auto; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; background: #0b1220; }
.mapspot-wrap { margin: 2px auto 0; }
.map-cap { font-size: var(--fs-xs); color: var(--ink-note); text-align: center; margin-top: 5px; line-height: 1.5; }

/* バフボールのマーカー（6v / 6v6。座標は js/match-timer.js の BUFF_MAPS） */
.buff-spots { position: absolute; inset: 0; pointer-events: none; }
.buff-mk { position: absolute; width: 13px; height: 13px; border-radius: 50%; background: #ff9a3a; border: 2px solid #fff; box-shadow: 0 0 8px rgba(255, 150, 50, .9); transform: translate(-50%, -50%); }
.buff-mk::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid #ff9a3a; opacity: 0; }
.buff-mk.soon::after { animation: buffRing 1s ease-out infinite; }
@keyframes buffRing { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }
.buff-mk.pop { animation: buffPop .5s ease-out 4; }
@keyframes buffPop { 50% { transform: translate(-50%, -50%) scale(1.6); } }

/* 画像の拡大表示（js/match-timer.js の MatchTimer.lightbox） */
.lightbox { display: none; position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .85); align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.lightbox.show { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 12px 48px rgba(0, 0, 0, .7); }
.lightbox__close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; width: 44px; height: 44px; border: 1px solid rgba(255, 255, 255, .5); border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-family: var(--font); font-size: 24px; line-height: 1; cursor: pointer; }

/* ===== タイム表（12v / 6v） ===== */
table.sched { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.sched th, .sched td { border: 1px solid var(--border); padding: 6px 4px; text-align: center; }
.sched th { background: var(--neutral-bg); font-size: var(--fs-sm); color: #3d4d66; line-height: 1.35; }
.sched td.t { font-family: var(--num); font-weight: 800; font-variant-numeric: tabular-nums; }
.sched td .d { display: inline-block; width: 13px; height: 13px; border-radius: 50%; vertical-align: middle; }
.sched tr.done td { opacity: .35; }
.sched tr.next td { background: #fff8dc; }
.sched tr.next td.t { color: #8a5d00; }
.sched tfoot td { font-weight: 900; background: var(--neutral-bg); font-size: var(--fs-sm); }

/* ===== 下部固定 操作バー ===== */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(255, 255, 255, .97); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 2px solid var(--gold); box-shadow: 0 -6px 20px rgba(28, 50, 100, .18); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
/* 入りきらない幅では折り返す（ボタンの文字は折り返さない） */
.actionbar .inner { max-width: 760px; margin: 0 auto; padding: 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border: none; border-radius: var(--radius-sm); font-family: var(--font); font-weight: 800; font-size: 15.5px; padding: 13px 10px; cursor: pointer; color: #fff; box-shadow: var(--shadow-sm); transition: .12s; letter-spacing: .02em; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
/* 白文字で 4.5:1 以上になる濃さ（緑 4.57〜5.41・橙 4.64〜5.96・灰 4.52〜6.42） */
.btn--start { background: linear-gradient(180deg, #1a8743, #157a3b); flex: 1; }
.btn--stop { background: linear-gradient(180deg, #b25f00, #9a5000); flex: 1; }
.btn--reset { background: linear-gradient(180deg, #6a778e, #555f73); padding: 12px 16px; }
.btn[disabled] { opacity: .5; }
.voicebtn { border: 2px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; padding: 10px 12px; font-size: 20px; line-height: 1; cursor: pointer; transition: .12s; }
.voicebtn.on { border-color: var(--on); background: var(--on-bg); }
.voicebtn.off { filter: grayscale(1); opacity: .6; }

/* iOS はフォーム部品の文字が 16px 未満だとフォーカス時に自動で拡大する。
   .time-input input は 19px なので対象外。16px 未満の select 等はページ側で max-width:600px のとき 16px にする */
@media (max-width: 560px) {
  .timerbar .clock { font-size: 46px; }
  .chip__t { font-size: 17px; }
  .range-wrap input[type=range] { width: 120px; }
  .prep-line input[type=range] { width: 110px; }
  .dbtn span { font-size: var(--fs-sm); }
}
/* 狭い画面でも「スタート・リセット・音声」を1行に収める */
@media (max-width: 400px) {
  .actionbar .inner { gap: 6px; }
  .btn { font-size: var(--fs-md); letter-spacing: 0; }
  .btn--reset { padding: 12px 11px; }
  .voicebtn { padding: 10px 9px; }
}
@media (max-width: 340px) {
  .btn { font-size: var(--fs-md); padding-left: 8px; padding-right: 8px; }
  .btn--reset { padding-left: 9px; padding-right: 9px; }
}

/* 点滅・拡大の演出を止める（状態は枠の色で残す） */
@media (prefers-reduced-motion: reduce) {
  .chip.soon { animation: none; box-shadow: 0 0 0 3px rgba(224, 138, 0, .45); }
  .buff-mk.soon::after { animation: none; opacity: .9; transform: scale(1.4); }
  .buff-mk.pop { animation: none; }
  .progress i, .btn, .voicebtn, .chip, .dbtn, .dbtn img { transition: none; }
}
