/* 天下盤上 — web 版の見た目。iOS 版の暗い藍色を踏襲する。 */
:root {
  --ink: #0b0d18;
  --ink2: #141828;
  --line: rgba(255,255,255,.14);
  --text: #f2f2f5;
  --dim: rgba(242,242,245,.6);
  --gold: #f3b53f;
  --player: #63b3ff;
  --enemy: #ff6b7a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#app { min-height: 100%; display: flex; flex-direction: column; align-items: center; }

/* 画面ぜんたい */
.screen {
  width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 8px calc(12px + env(safe-area-inset-bottom));
}

/* タイトル。絵を全面に敷き、下半分の暗がりに文字を置く（iOS 版と同じ組み） */
.title-screen {
  position: fixed; inset: 0; max-width: none; padding: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  text-align: center; gap: 0; overflow: hidden;
}
.title-art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}
.title-veil {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom,
    rgba(0,0,0,.22) 0%, transparent 22%, transparent 55%, rgba(0,0,0,.42) 100%);
}
.title-plate {
  position: relative; padding: 0 30px calc(40px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.title-name { font-size: clamp(34px, 11vw, 46px); font-weight: 900; letter-spacing: .18em; margin: 0;
  text-shadow: 0 2px 18px rgba(0,0,0,.8); }
.title-sub { font-size: clamp(13px, 4vw, 16px); letter-spacing: .3em; margin: 0 0 2px;
  text-shadow: 0 2px 10px rgba(0,0,0,.8); }
.title-tag { font-size: 12px; color: var(--dim); margin: 0 0 18px; }
.title-plate button.primary { width: 100%; letter-spacing: .5em; padding: 16px 0; border-radius: 14px; }
.title-mark { font-size: 9px; letter-spacing: .5em; color: rgba(255,255,255,.45); margin-top: 14px; }

button {
  font: inherit; color: inherit; cursor: pointer;
  background: rgba(255,255,255,.1); border: 1px solid var(--line);
  border-radius: 999px; padding: 11px 18px; min-height: 44px;   /* 指で押せる大きさ */
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
button:hover:not(:disabled) { background: rgba(255,255,255,.18); }
button:disabled { opacity: .35; cursor: default; }
button.primary {
  background: linear-gradient(90deg, #f7943d, #f4576c);
  border: none; color: #17111a; font-weight: 700; padding: 14px 34px; font-size: 17px;
}

/* 上の帯。スマホでは一行に収める */
.hud { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: nowrap; }
.hud > span:first-child { flex: 0 1 auto; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.hud button { min-height: 34px; padding: 6px 12px; font-size: 12px; flex: none; }
.hud .enemy-log { flex: 0 1 auto; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.hud .grow { flex: 1; }
.hud b, .hud .gold, .hud .tag { flex: none; white-space: nowrap; }
.hud .gold { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.hud .enemy-log { color: var(--enemy); font-size: 11px; }
.tag { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.12); }
.tag.preach { color: #ff9ad2; }
.tag.fog { color: #8fe3ff; }

/* 盤 */
.board { display: grid; gap: 2px; width: 100%; aspect-ratio: 1; touch-action: manipulation; }
.cell {
  position: relative; border-radius: 3px; overflow: visible;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: rgba(255,255,255,.45);
  cursor: pointer; user-select: none;
}
.cell .glyph { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cell.owned-player { box-shadow: inset 0 0 0 2px var(--player); }
.cell.owned-enemy  { box-shadow: inset 0 0 0 2px var(--enemy); }
.cell.movable::after {
  content: ''; position: absolute; inset: 28%;
  border-radius: 50%; background: rgba(120,200,255,.55);
}
.cell.attackable { box-shadow: inset 0 0 0 3px #ff4d63; }
.cell.droppable::after {
  content: ''; position: absolute; inset: 30%;
  border-radius: 4px; background: rgba(255,210,120,.6);
}
.cell.selected { outline: 2px solid #fff; outline-offset: -2px; }
.cell.focus { animation: blip 1s ease-out; }
@keyframes blip { from { background-color: rgba(255,120,120,.6); } }

.unit { position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); width: 96%; pointer-events: none; }
.unit img { width: 100%; display: block; image-rendering: pixelated; }
.unit.enemy img { transform: scaleX(-1); }
.ears { position: absolute; left: 50%; top: -18%; transform: translateX(-50%); width: 52%; }
.hpbar {
  position: absolute; left: 8%; right: 8%; bottom: 2px; height: 3px;
  background: rgba(0,0,0,.55); border-radius: 2px; overflow: hidden; pointer-events: none;
}
.hpbar i { display: block; height: 100%; background: var(--player); }
.unit-enemy-hp i { background: var(--enemy); }
.pip { position: absolute; top: 1px; right: 2px; font-size: 9px; font-weight: 700; }

/* 下の操作盤 */
.panel { border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px; background: var(--ink2); }
.panel h3 { margin: 0 0 6px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--dim); font-size: 12px; }
.log { font-size: 12px; min-height: 1.4em; }

/* 全画面の覆い */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4,5,10,.92);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; text-align: center;
}
.overlay .inner { max-width: 520px; width: 100%; max-height: 100%; overflow: auto; }
.cutin { position: fixed; inset: 0; z-index: 60; background: #04050a; display: grid; place-items: center; }
.cutin::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent 45%, rgba(4,5,10,.9) 82%);
}
.cutin .caption { z-index: 1; }
.cutin img.seal { max-height: 62vh; image-rendering: pixelated; filter: drop-shadow(0 0 22px currentColor); }
.cutin .caption { position: absolute; left: 0; right: 0; bottom: 12%; padding: 0 24px; }
.cutin .who { font-size: 13px; font-weight: 700; color: #7fe7ff; }
.cutin .label { font-size: 34px; font-weight: 900; text-shadow: 0 0 14px #ff5c9d; margin: 2px 0; }
.cutin .line { font-size: 13px; font-weight: 700; }
.rings { position: absolute; inset: 0; pointer-events: none; }

.result-rows { border-radius: 10px; overflow: hidden; margin: 10px 0; }
.result-rows div { display: flex; justify-content: space-between; padding: 7px 14px; font-size: 13px; }
.result-rows div:nth-child(odd) { background: rgba(255,255,255,.06); }
.result-rows span:first-child { color: var(--dim); font-size: 12px; }
.result-rows span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }

/* 会話 */
.tale-bg { position: absolute; inset: 0; object-fit: cover; width: 100%; height: 100%; opacity: .35; }
.tale { position: relative; z-index: 1; text-align: left; }
.tale .who { font-size: 11px; color: #7fe7ff; font-weight: 700; }
.tale .text { font-size: 15px; line-height: 1.7; margin-bottom: 12px; }
.tale-title { color: var(--gold); font-size: 20px; font-weight: 900; margin: 0 0 10px; }
.tale-cg { width: 100%; border-radius: 10px; margin-bottom: 10px; }

/* 全国図 */
.map-wrap { position: relative; width: 100%; aspect-ratio: 3/4; overflow: hidden; border-radius: 12px; background: #05070f; }
.map-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .55; }
.pin {
  position: absolute; transform: translate(-50%, -50%);
  border-radius: 8px; padding: 3px 6px; font-size: 10px; line-height: 1.25;
  border: 1px solid var(--line); background: rgba(10,14,26,.85); white-space: nowrap;
}
.pin.mine { border-color: var(--player); color: var(--player); }
.pin.target { border-color: var(--gold); color: var(--gold); }
.pin b { display: block; font-size: 11px; }

.voice-bubble {
  position: fixed; left: 50%; bottom: 14%; transform: translateX(-50%);
  z-index: 70; background: rgba(8,10,20,.92); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 14px; max-width: 86%; text-align: center;
}
.voice-bubble .who { font-size: 10px; color: #7fe7ff; font-weight: 700; }
.voice-bubble .text { font-size: 13px; }
