:root {
  --bg: #0f141e;
  --surface: #171e2c;
  --border: rgba(255, 255, 255, 0.12);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #d97706;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

.topbar {
  background: rgba(15, 20, 30, 0.94);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-back {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}

.page-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.engine-badge {
  margin-left: auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-size: 12px;
  font-weight: 700;
}

.play-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 20px;
  align-items: start;
}

.board-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.status-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.pill {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 700;
}

.pill-turn {
  background: #fef3c7;
  color: #92400e;
  border-color: #fbbf24;
}

.play-board-wrap {
  width: min(68vh, 92vw, 560px);
  height: min(68vh, 92vw, 560px);
}

.go-board-svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.go-board-svg.is-interactive .go-hit-cell { cursor: pointer; }

.yukkuri-bar {
  width: min(680px, 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
}

.yukkuri-mini {
  flex: 0 0 68px;
  width: 68px;
  height: 58px;
  position: relative;
}

.yukkuri-stage { position: relative; width: 100%; height: 100%; }
#char-reimu .yukkuri-stage { transform: scaleX(-1); }
.yukkuri-part { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.yukkuri-bubble {
  flex: 1;
  min-width: 0;
}

.speaker-tag {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 3px;
}

.speaker-reimu { background: #be185d; }
.speaker-marisa { background: #92400e; }

.bubble-text {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.tts-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ctrl-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: #475569;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.ctrl-btn.is-on { background: #dcfce7; color: #15803d; }
.ctrl-btn svg { width: 15px; height: 15px; fill: currentColor; }

.rate-btn {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.control-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.panel-title {
  margin: 0 0 12px;
  font-size: 14.5px;
  font-weight: 800;
}

.field {
  margin-bottom: 10px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f141e;
  color: var(--text);
  font-size: 13px;
}

.btn-primary-full {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary-full:hover { filter: brightness(1.08); }

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-action {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f141e;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-action:hover { background: #1e293b; }
.btn-blue { background: #1d4ed8; border-color: #3b82f6; }
.btn-amber { background: #b45309; border-color: #d97706; }

.score-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0b0f17;
  border: 1px solid var(--border);
  font-size: 12.5px;
  line-height: 1.65;
}

@media (max-width: 900px) {
  .play-layout { grid-template-columns: 1fr; }
}
