/* ============================================
   コマセ巻きシミュレーター
   配色: モダンマリン + funatsuri-yoso.com 本体整合
   ライトテーマ + ターコイズ海 + 本体CTAオレンジ
   ============================================ */
:root {
  /* 背景・カード */
  --bg:         #f0f9ff;    /* 淡シアン (D) */
  --card:       #fff;
  --panel:      #fff;
  --border:     #bae6fd;
  --border-soft:#e0f2fe;

  /* テキスト */
  --text:       #0c4a6e;    /* ダークシアン */
  --sub:        #5a6a7a;    /* 本体 sub */
  --muted:      #8a96a4;    /* 本体 muted */

  /* ヘッダー (本体準拠) */
  --hdr:        #0d2b4a;
  --hdr-text:   #fff;

  /* 中央キャンバス (海中) */
  --sea-deep:   #075985;
  --sea-mid:    #0891b2;
  --sea-up:     #06b6d4;
  --seabed:     #1e3a52;

  /* CTA・アクション (本体準拠) */
  --cta:        #e85d04;    /* CTA・しゃくる (本体準拠) */
  --cta2:       #d04e00;    /* CTA hover */
  --coral:      #f97316;    /* コマセ粒子・コマセ系 */
  --gold:       #fbbf24;    /* 付けエサ・針・巻く */
  --gold-deep:  #d4a017;
  --pos:        #1a9d56;    /* 落とす・成功 (本体準拠) */
  --neg:        #d43333;    /* 警告 (本体準拠) */
  --warn:       #d4a017;    /* 注意 (本体准拠) */
  --prem:       #7c3aed;    /* 最適化バッジ (本体準拠) */

  /* 線 */
  --line:       rgba(12, 74, 110, 0.12);
  --line-strong:rgba(12, 74, 110, 0.25);

  /* レガシー名残（既存コードのため一時保持・将来削除） */
  --ink:        var(--hdr);
  --paper:      var(--text);
  --paper-dim:  var(--sub);
  --paper-soft: var(--card);
  --vermilion:  var(--cta);
  --vermilion-soft: #fdba74;
  --rust:       var(--cta2);
  --amber:      var(--gold);
  --amber-soft: var(--gold);
  --moss:       var(--pos);
  --lead:       #94a3b8;
  --brass:      var(--gold-deep);

  /* フォント (本体 system-ui 準拠) */
  --serif: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  --sans:  system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  --mono:  ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
@media (min-width: 769px) {
  html { zoom: clamp(0.75, calc(100vw / 1380px), 1.0); }
}
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ===== layout ===== */
.app {
  display: grid;
  grid-template-columns: 300px 1fr 320px;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "head head head"
    "left main right"
    "left controls right";
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  gap: 0;
}

.app__head { grid-area: head; }
.app__left { grid-area: left; }
.app__main { grid-area: main; }
.app__controls { grid-area: controls; }
.app__right { grid-area: right; }

/* ===== header (本体準拠 ダークネイビー) ===== */
.head {
  padding: 18px 28px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  background: var(--hdr);
  color: var(--hdr-text);
}
.head__title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--hdr-text);
}
.head__title .kanji-accent {
  color: var(--cta);
  margin-right: 2px;
}
.head__ver {
  font-size: 13px;
  font-weight: 500;
  color: var(--cta);
  letter-spacing: 0.06em;
  margin-left: 6px;
}
.head__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.head__link {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  letter-spacing: 0.05em;
  padding: 4px 0;
}
.head__link:hover { color: var(--cta); }
.head__btn {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.15s, border-color 0.15s;
}
.head__btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
}
.head__btn--x { }
.head__btn--follow {
  background: var(--cta);
  border-color: var(--cta);
  color: #fff;
}
.head__btn--follow:hover {
  background: var(--cta);
  filter: brightness(1.1);
}
.head__sub {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
  letter-spacing: 0.15em;
}
.head__meta {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  text-align: right;
  line-height: 1.6;
  letter-spacing: 0.05em;
}
.head__meta b { color: var(--cta); font-weight: 600; }

/* ===== side panels (ライト) ===== */
.panel {
  padding: 18px 20px;
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: calc(100vh - 84px);
  color: var(--text);
}
.panel--right {
  border-right: none;
  border-left: 1px solid var(--border);
}

.panel__section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}
.panel__section:last-child { border-bottom: none; }

.panel__h {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.10em;
  color: var(--hdr);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel__h::before {
  content: "";
  width: 3px;
  height: 14px;
  background: var(--cta);
  border-radius: 2px;
}
.panel__h--clickable {
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s;
}
.panel__h--clickable:hover { opacity: 0.78; }
.panel__chevron {
  display: inline-block;
  width: 12px;
  font-size: 9px;
  color: var(--paper-dim);
  margin-right: 2px;
  text-align: center;
}
.panel__section--closed {
  margin-bottom: 8px;
  padding-bottom: 6px;
}
.panel__section--closed .panel__h { margin-bottom: 0; }

/* ===== form controls ===== */
.field {
  margin-bottom: 12px;
}
.field__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.field__label {
  font-size: 12px;
  color: var(--sub);
  letter-spacing: 0.05em;
}
.field__value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
}
.field__value .unit {
  font-size: 10px;
  color: var(--muted);
  margin-left: 3px;
  font-weight: 400;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  margin: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--cta);
  cursor: pointer;
  margin-top: 0;
  box-shadow: 0 1px 3px rgba(13, 43, 74, 0.15);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--cta);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(13, 43, 74, 0.15);
}

.seg {
  display: flex;
  gap: 0;
  background: var(--border-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.seg__btn {
  flex: 1;
  padding: 7px 4px;
  background: transparent;
  border: none;
  color: var(--sub);
  font-family: var(--sans);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  border-right: 1px solid var(--border);
}
.seg__btn:last-child { border-right: none; }
.seg__btn:hover { color: var(--text); background: #fff; }
.seg__btn.is-on {
  background: var(--cta);
  color: #fff;
  font-weight: 600;
}

select.select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 4px;
  outline: none;
}
select.select:focus { border-color: var(--cta); }

/* ===== main stage ===== */
.stage {
  grid-area: main;
  position: relative;
  overflow: hidden;
  background: var(--sea-deep);
  min-height: 600px;
}

.stage__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.stage__overlay {
  position: absolute;
  pointer-events: none;
  top: 0; left: 0; right: 0; bottom: 0;
}

.stage__legend {
  position: absolute;
  top: 16px; right: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 11px;
  font-family: var(--sans);
  color: var(--sub);
  line-height: 1.7;
  letter-spacing: 0.04em;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(13, 43, 74, 0.10);
}
.stage__legend b { color: var(--text); font-weight: 600; }
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}

.stage__hud {
  position: absolute;
  top: 14px; left: 14px;
  width: 180px;
  box-sizing: border-box;
  padding: 10px 14px;
  background: rgba(13, 43, 74, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.06em;
  line-height: 1.7;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.stage__hud .hud-big {
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  display: block;
  margin-top: 4px;
}

/* ===== controls bar ===== */
.controls {
  grid-area: controls;
  padding: 12px 18px;
  background: var(--card);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 72px;
}

.controls__group {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 0 12px;
  border-right: 1px dashed var(--border);
}
.controls__group:last-child { border-right: none; }
.controls__group:first-child { padding-left: 0; }

.controls__group--stats {
  flex: 1;
  justify-content: flex-end;
  gap: 22px;
  padding-right: 0;
}

.btn-action {
  min-width: 76px;
  height: 50px;
  padding: 6px 12px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.12em;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: transparent;
  color: var(--text);
  white-space: nowrap;
}
.btn-action small {
  font-size: 9px;
  letter-spacing: 0.06em;
  opacity: 0.78;
  font-weight: 500;
  font-family: var(--sans);
}
.btn-action:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(13, 43, 74, 0.12); }
.btn-action:active { transform: translateY(0) scale(0.97); }
.btn-action:disabled {
  background: #e2e8f0;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  border-color: transparent;
  box-shadow: none;
}
.btn-action:disabled small { opacity: 0.5; }

/* シミュ速度切替 (1x/2x/3x) */
.speed-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  height: 50px;
}
.speed-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--sub);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  letter-spacing: 0.04em;
}
.speed-btn:last-child { border-right: none; }
.speed-btn:hover { background: rgba(13, 43, 74, 0.06); color: var(--text); }
.speed-btn.is-active {
  background: var(--cta);
  color: #fff;
}

/* Variant: primary action CTAオレンジ (しゃくる) */
.btn-action.is-primary,
.shakuri-btn.btn-action {
  background: var(--cta);
  color: #fff;
  border-color: var(--cta);
  box-shadow: 0 1px 0 0 rgba(232, 93, 4, 0.25);
}
.btn-action.is-primary:hover,
.shakuri-btn.btn-action:hover { background: var(--cta2); border-color: var(--cta2); }

/* Variant: 巻く ゴールド */
.maki-btn.btn-action {
  background: var(--gold);
  color: #4a3500;
  border-color: var(--gold);
}
.maki-btn.btn-action:hover { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff; }

/* Variant: 落とす 成功グリーン */
.drop-btn.btn-action {
  background: var(--pos);
  color: #fff;
  border-color: var(--pos);
}
.drop-btn.btn-action:hover { background: #168a4a; border-color: #168a4a; }

/* Variant: 投入 (sub action, ghost green) */
.btn-cast.btn-action {
  background: rgba(26, 157, 86, 0.10);
  border-color: var(--pos);
  color: var(--pos);
}
.btn-cast.btn-action:hover { background: rgba(26, 157, 86, 0.20); }

/* Variant: 仕掛け回収 (ghost gold) */
.btn-rig.btn-action {
  background: transparent;
  border-color: var(--gold-deep);
  color: var(--gold-deep);
}
.btn-rig.btn-action:hover {
  background: rgba(212, 160, 23, 0.12);
  border-color: var(--gold-deep);
  color: var(--gold-deep);
}

/* Variant: sim ctrl (一時停止/リセット, outlined) */
.btn-sim.btn-action {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  min-width: 58px;
  height: 50px;
  border-color: var(--border);
  color: var(--sub);
  background: var(--card);
}
.btn-sim.btn-action:hover {
  border-color: var(--text);
  color: var(--text);
  background: var(--border-soft);
}
.btn-sim.btn-action.is-running {
  background: var(--cta);
  border-color: var(--cta);
  color: #fff;
}

/* Skip button is on top of dropping phase */
.btn-skip.btn-action {
  background: rgba(212, 160, 23, 0.18);
  border-color: var(--gold-deep);
  color: var(--gold-deep);
  animation: skipPulse 1.4s ease-in-out infinite;
}
.btn-skip.btn-action:hover {
  background: rgba(212, 160, 23, 0.32);
}

/* ===== stats in controls ===== */
.ctl-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--mono);
  line-height: 1.1;
}
.ctl-stat__label {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 4px;
  font-family: var(--sans);
  font-weight: 500;
}
.ctl-stat__value {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}
.ctl-stat__value small {
  font-size: 10px;
  color: var(--muted);
  margin-left: 2px;
  font-weight: 400;
}

.btn {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 9px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 600;
}
.btn:hover { border-color: var(--text); background: var(--border-soft); }
.btn.is-primary {
  background: var(--cta);
  color: #fff;
  border-color: var(--cta);
}
.btn.is-primary:hover { background: var(--cta2); border-color: var(--cta2); }
.btn.is-active {
  background: var(--cta);
  color: #fff;
  border-color: var(--cta);
}

@keyframes skipPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 160, 23, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(212, 160, 23, 0); }
}

@keyframes toastFade {
  0% { opacity: 0; transform: translate(-50%, -8px); }
  10% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}

.lock {
  display: inline-block;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-right: 5px;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  opacity: 0.55;
  vertical-align: middle;
  transition: opacity 0.15s, transform 0.1s;
}
.lock:hover { opacity: 1; transform: scale(1.15); }
.lock.is-locked {
  opacity: 1;
  color: var(--gold-deep);
}

/* ===== right metrics ===== */
.metric {
  margin-bottom: 14px;
}
.metric__label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--sub);
  margin-bottom: 6px;
  font-weight: 500;
}
.metric__num {
  font-family: var(--sans);
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.metric__num .small { font-size: 16px; color: var(--muted); margin-left: 4px; font-weight: 500; }
.metric__bar {
  margin-top: 8px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.metric__bar > i {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--cta);
  display: block;
  transition: width 0.3s;
}

.grade {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 44px;
  color: var(--cta);
  margin-right: 12px;
  line-height: 1;
}
.grade--ok { color: var(--pos); }
.grade--bad { color: var(--muted); opacity: 0.6; }

.histogram {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 60px;
  margin-top: 4px;
}
.histogram > i {
  flex: 1;
  background: var(--coral);
  min-height: 1px;
  opacity: 0.78;
  transition: height 0.3s;
  border-radius: 1px 1px 0 0;
}
.histogram > i.is-hook { background: var(--pos); opacity: 1; }
.histogram__axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.05em;
}

.note {
  font-size: 11px;
  color: var(--sub);
  line-height: 1.7;
  margin-top: 10px;
}
.note b { color: var(--text); font-weight: 600; }

/* preset chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--sans);
  font-size: 11px;
  padding: 6px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--sub);
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.12s;
}
.chip:hover { border-color: var(--text); color: var(--text); background: var(--border-soft); }
.chip.is-on {
  border-color: var(--cta);
  color: #fff;
  background: var(--cta);
  font-weight: 600;
}

/* compact preset layout: side label + tight chips */
.preset-group {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 10px;
}
.preset-group__label {
  flex-shrink: 0;
  width: 38px;
  padding-top: 4px;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-size: 9px;
  font-weight: 600;
}
.chips--compact { gap: 3px; flex: 1; }
.chip--compact {
  font-size: 10px;
  padding: 3px 8px;
  letter-spacing: 0;
  line-height: 1.2;
  white-space: nowrap;
  border-radius: 10px;
  min-height: 36px;
}

/* small footnote */
.foot {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
  text-align: center;
  padding: 8px;
  letter-spacing: 0.18em;
}

/* tweaks-style toggle */
.tog-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--sub);
  padding: 6px 0;
}
.tog {
  width: 32px;
  height: 16px;
  background: var(--border);
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.tog::after {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: left 0.2s;
  box-shadow: 0 1px 2px rgba(13, 43, 74, 0.18);
}
.tog.is-on { background: var(--cta); }
.tog.is-on::after { left: 18px; }

/* ── Mobile: PC では mob-only 要素を非表示 ── */
.mob-strip, .mob-overlay, .mob-drawer { display: none; }
.mob-settings-btn { display: none; }

@media (max-width: 768px) {
  html, body { min-width: 0; }

  /* ── レイアウト ── */
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas: "head" "strip" "main" "controls";
    height: 100dvh;
    overflow: hidden;
  }
  .app__left, .app__right { display: none; }

  /* ── ヘッダー: タイトル + ⚙ ボタンの1行に圧縮 ── */
  .head {
    padding: 8px 14px;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
  }
  .head > div:first-child {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .head__title { font-size: 15px; }
  .head__ver { font-size: 11px; }
  .head__actions { margin-top: 0; flex-wrap: nowrap; }
  .head__link,
  .head__btn--x,
  .head__btn--follow,
  .head__meta { display: none; }

  /* ⚙ 設定ボタン: オレンジで目立たせる */
  .mob-settings-btn {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--cta); color: #fff;
    border: none; border-radius: 8px;
    padding: 8px 16px; font-size: 13px; font-weight: 700;
    font-family: var(--sans); cursor: pointer;
    white-space: nowrap; flex-shrink: 0;
  }
  .mob-settings-btn:active { filter: brightness(0.9); }

  /* ── mob-strip ── */
  .mob-strip {
    grid-area: strip; display: flex; gap: 0; align-items: stretch;
    background: var(--hdr);
    border-bottom: 1px solid rgba(186,230,253,.15); flex-shrink: 0;
  }
  .mob-strip__item {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; flex: 1;
    padding: 5px 4px;
    border-right: 1px solid rgba(186,230,253,.1);
  }
  .mob-strip__item:last-of-type { border-right: none; }
  .mob-strip__lbl { font-size: 9px; color: rgba(255,255,255,.5); margin-bottom: 1px; }
  .mob-strip__val { font-size: 15px; font-weight: 700; color: #fff; line-height: 1; }
  .mob-strip__phase {
    display: flex; align-items: center; justify-content: center;
    padding: 0 12px; font-size: 10px; font-weight: 700;
    color: var(--cta); white-space: nowrap;
    border-left: 1px solid rgba(186,230,253,.1);
  }

  /* ── キャンバスエリア ── */
  .stage { min-height: 0; }
  .stage__legend { display: none; }
  /* HUD: 左上の小さなチップ。コマセ残量は mob-strip に表示済みなので非表示 */
  .stage__hud {
    top: 6px; left: 6px; right: auto;
    padding: 4px 8px; width: auto; min-width: 60px;
    font-size: 9px; text-align: center;
    background: rgba(13,43,74,.82);
  }
  .stage__hud > div:first-child { font-size: 9px; letter-spacing: .05em; opacity: .7; }
  .stage__hud .hud-big { font-size: 17px; }
  .hud__chum { display: none; }
  .hud__drop-detail { display: none; }

  /* ── コントロールバー: 2段・画面下部固定 ── */
  .controls {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    border-right: none;
    padding: 4px 6px env(safe-area-inset-bottom, 6px);
    background: var(--hdr);
    border-top: 1px solid rgba(186,230,253,.25);
    flex-wrap: wrap;
    overflow: hidden;
    gap: 0;
    min-height: auto;
    align-items: stretch;
  }
  /* キャンバスが fixed controls に隠れないよう下に余白 */
  .stage { padding-bottom: 120px; }
  /* 段1: 投入 ・ しゃくる/巻く/落とす ・ 仕掛け回収 */
  .controls__group:nth-child(1),
  .controls__group:nth-child(2),
  .controls__group:nth-child(3) {
    flex: 1;
    min-width: 0;
    padding: 2px 4px;
    border-right: 1px dashed rgba(186,230,253,.15);
    justify-content: center;
    gap: 4px;
  }
  .controls__group:nth-child(3) { border-right: none; }
  /* 段2: 一時停止・速度・リセット（全幅） */
  .controls__group:nth-child(4) {
    width: 100%;
    border-right: none;
    border-top: 1px dashed rgba(186,230,253,.15);
    padding: 3px 8px 2px;
    justify-content: center;
    gap: 8px;
    margin-top: 2px;
  }
  .controls__group--stats { display: none; }

  /* ボタンサイズ調整 */
  .btn-action {
    min-width: 0; height: 46px;
    font-size: 10px; padding: 4px 2px;
    flex: 1;
    overflow: hidden; white-space: nowrap;
  }
  .controls__group:nth-child(4) .btn-action {
    flex: 0 0 auto; min-width: 68px; height: 36px; font-size: 11px;
  }
  .speed-group { height: 36px; }

  /* ── ドロワー ── */
  .mob-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 60;
  }
  .mob-drawer {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    height: 75%; background: var(--bg); border-radius: 18px 18px 0 0;
    z-index: 70; flex-direction: column; overflow: hidden;
    box-shadow: 0 -4px 32px rgba(13,43,74,.3);
  }
  .mob-drawer__handle {
    width: 36px; height: 4px; background: var(--border); border-radius: 2px;
    margin: 10px auto 0; flex-shrink: 0; cursor: pointer;
  }
  .mob-drawer__title {
    font-size: 13px; font-weight: 700; padding: 8px 16px 0;
    color: var(--text); flex-shrink: 0;
  }
  .mob-drawer__tabs {
    display: flex; border-bottom: 1px solid var(--border);
    flex-shrink: 0; margin-top: 6px;
  }
  .mob-drawer__tab {
    flex: 1; padding: 9px 4px; text-align: center;
    font-size: 12px; font-weight: 600; color: var(--sub);
    border-bottom: 2px solid transparent; cursor: pointer;
    background: none; border-top: none; border-left: none; border-right: none;
    font-family: var(--sans);
  }
  .mob-drawer__tab.is-active { color: var(--text); border-bottom-color: var(--cta); }
  .mob-drawer__body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .mob-drawer .panel {
    display: block; max-height: none; border-right: none; border-left: none; padding: 12px 16px;
  }
  .mob-drawer__loading {
    position: absolute; inset: 0; border-radius: 18px 18px 0 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(13, 43, 74, 0.88); z-index: 5; gap: 16px;
    pointer-events: none;
  }
  .mob-drawer__loading-text {
    color: var(--text); font-family: var(--sans); font-size: 13px;
    font-weight: 600; letter-spacing: .08em;
  }
  @keyframes mob-spin { to { transform: rotate(360deg); } }
  .mob-drawer__spinner {
    width: 38px; height: 38px; border-radius: 50%;
    border: 3px solid rgba(232, 93, 4, 0.25);
    border-top-color: var(--cta);
    animation: mob-spin 0.75s linear infinite;
  }
}

/* ── sim-footer (T-8: 出典・免責) ── */
.sim-footer {
  grid-column: 1 / -1;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(243, 234, 215, 0.75);
  font-size: 11px;
  text-align: center;
  line-height: 1.6;
  flex-shrink: 0;
}
.sim-footer a {
  color: rgba(243, 234, 215, 0.75);
  text-decoration: underline;
}
.sim-footer a:hover { color: var(--paper); }
