
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fe;
  --line: #dce2f0;
  --text: #23314d;
  --muted: #63708a;
  --primary: #5b6cf0;
  --primary-2: #4958d1;
  --danger: #df5e5e;
  --success: #2da46d;
  --shadow: 0 12px 32px rgba(58, 74, 110, 0.12);
  --radius: 20px;
  --radius-sm: 14px;
  --font-jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  --app-width: 100vw;
  --app-height: 100dvh;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; min-height: 100%; overscroll-behavior: none; }
body {
  font-family: var(--font-jp);
  background: linear-gradient(180deg, #f8fbff 0%, #f3f5fb 100%);
  color: var(--text);
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #eef2ff;
  border-radius: 8px;
  padding: 0.15rem 0.45rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(220, 226, 240, 0.88);
}

.header-inner,
.footer-inner,
.page-shell {
  width: min(1180px, calc(100vw - 24px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5b6cf0, #86a0ff);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.brand strong { display: block; font-size: 1rem; }
.brand small { display: block; color: var(--muted); }

.main-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.main-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
}
.main-nav a:hover {
  background: #eef2ff;
  color: var(--primary-2);
}

.page-shell {
  padding: 24px 0 48px;
}

.site-footer {
  padding: 28px 0 50px;
  color: var(--muted);
}
.footer-inner {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(220, 226, 240, 0.9);
  border-radius: 20px;
  padding: 18px 20px;
}
.footer-inner p {
  margin: 0;
}
.footer-inner p + p { margin-top: 6px; }

.card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(220, 226, 240, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.button {
  appearance: none;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.button:hover {
  transform: translateY(-1px);
  background: #e7edff;
}
.button:active { transform: translateY(0); }
.button-primary {
  background: linear-gradient(135deg, var(--primary), #7d8fff);
  color: #fff;
  box-shadow: 0 10px 20px rgba(91, 108, 240, 0.25);
}
.button-primary:hover { background: linear-gradient(135deg, var(--primary-2), #7285ff); }
.button-danger {
  background: rgba(223, 94, 94, 0.12);
  color: #b64c4c;
}
.button-small {
  padding: 10px 14px;
  font-size: 0.86rem;
}
.button-ghost {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(184, 195, 226, 0.95);
  color: var(--primary-2);
  box-shadow: 0 8px 18px rgba(67, 84, 142, 0.12);
}
.button-ghost:hover {
  background: rgba(243, 247, 255, 0.96);
}

.flash-stack {
  width: min(1180px, calc(100vw - 24px));
  margin: 16px auto 0;
  display: grid;
  gap: 10px;
}
.flash {
  padding: 14px 18px;
  border-radius: 16px;
  font-weight: 700;
}
.flash-success { background: rgba(45, 164, 109, 0.14); color: #237d54; }
.flash-error { background: rgba(223, 94, 94, 0.14); color: #b64c4c; }

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-bottom: 28px;
}
.hero-copy,
.hero-panel {
  padding: 28px;
}
.hero-copy h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.08;
  margin: 0 0 16px;
}
.hero-copy p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}
.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 10px;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.hero-stats > div {
  background: var(--surface-2);
  border-radius: 18px;
  padding: 18px 14px;
  text-align: center;
}
.hero-stats strong {
  display: block;
  font-size: 1.45rem;
  margin-bottom: 6px;
}
.hero-stats span {
  color: var(--muted);
  font-size: 0.86rem;
}
.check-list {
  margin: 18px 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.7;
}

.section {
  margin-top: 28px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
.section-head h1,
.section-head h2 {
  margin: 0;
}
.section-text {
  margin: 0 0 16px;
  color: var(--muted);
}
.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.stage-card {
  overflow: hidden;
}
.stage-thumb {
  height: 130px;
  background-size: cover;
  background-position: center;
}
.stage-card-body {
  padding: 18px;
}
.stage-card h3 {
  margin: 0 0 10px;
}
.stage-card p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.6;
}
.stage-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 8px;
  letter-spacing: 0.08em;
}
.stage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.87rem;
  margin-bottom: 16px;
}
.stage-meta span {
  background: var(--surface-2);
  padding: 6px 10px;
  border-radius: 999px;
}

.split-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.split-section .card {
  padding: 22px;
}
.steps {
  margin: 10px 0 0;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.8;
}
.results-list {
  display: grid;
  gap: 10px;
}
.result-row {
  display: grid;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 16px;
  padding: 12px 14px;
}
.result-row span,
.result-row small {
  color: var(--muted);
}

.inline-search {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.inline-search input {
  min-width: min(100%, 280px);
}
.kanji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}
.kanji-pill {
  padding: 18px 10px 16px;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.kanji-pill:hover {
  transform: translateY(-2px);
  border-color: #c9d3ff;
}
.kanji-pill-char {
  display: block;
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 6px;
}
.kanji-pill small {
  color: var(--muted);
}

.play-body {
  background: linear-gradient(180deg, #edf3ff 0%, #f6f7fb 100%);
}
.play-wrap {
  position: relative;
  display: grid;
  gap: 18px;
}
.play-wrap::before {
  content: "";
  position: absolute;
  inset: 72px 0 0;
  z-index: 0;
  border-radius: 28px;
  background-image: var(--stage-bg);
  background-size: cover;
  background-position: center;
  opacity: 0.34;
}
.play-wrap > * {
  position: relative;
  z-index: 1;
}
.play-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 20px 24px;
}
.play-top h1 {
  margin: 0 0 8px;
}
.play-top p {
  margin: 0;
  color: var(--muted);
}
.play-top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.play-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.battle-side,
.trace-side {
  padding: 22px;
}

.wave-badge {
  margin-bottom: 14px;
}
.wave-badge span {
  display: inline-flex;
  padding: 9px 14px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary);
  font-weight: 800;
  font-size: 0.88rem;
}

.enemy-panel {
  text-align: center;
  margin-bottom: 18px;
}
.enemy-image {
  width: min(100%, 240px);
  margin: 0 auto 12px;
  filter: drop-shadow(0 16px 18px rgba(53, 69, 103, 0.16));
}
.enemy-panel h2 {
  margin: 0 0 6px;
  font-size: 1.45rem;
}
.muted {
  color: var(--muted);
}
.hp-box,
.player-panel {
  margin-top: 16px;
}
.hp-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}
.bar {
  width: 100%;
  height: 16px;
  border-radius: 999px;
  background: #e7ecfa;
  overflow: hidden;
}
.bar-player {
  height: 14px;
}
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #61d17a, #2da46d);
  transition: width 0.3s ease;
}
.battle-log {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: var(--surface-2);
}
.battle-log h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}
#battle-log-body {
  min-height: 64px;
  line-height: 1.7;
}

.trace-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}
.current-kanji {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 4rem);
  line-height: 1;
}
.spell-mini {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 18px;
}
.spell-mini img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 16px;
}
.spell-mini strong {
  display: block;
  margin-bottom: 4px;
}
.spell-mini small {
  color: var(--muted);
}

.trace-area {
  display: grid;
  place-items: center;
}
.canvas-frame {
  position: relative;
  width: min(100%, 520px);
  aspect-ratio: 1 / 1;
  border-radius: 26px;
  border: 2px solid #d6ddf2;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,255,0.96)),
    radial-gradient(circle at center, rgba(91,108,240,0.08), rgba(91,108,240,0));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.85);
}
.canvas-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#guide-canvas {
  z-index: 1;
}
#draw-canvas {
  z-index: 2;
  touch-action: none;
  cursor: crosshair;
}
.spell-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(255,255,255,0.05), rgba(91,108,240,0.12));
  transition: opacity 0.2s ease;
}
.spell-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.spell-overlay img {
  width: 38%;
  filter: drop-shadow(0 14px 24px rgba(68, 82, 150, 0.25));
  animation: spellPulse 0.9s ease;
}
.spell-score-burst {
  position: absolute;
  top: 14%;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary);
  font-weight: 900;
  box-shadow: var(--shadow);
  animation: riseUp 0.9s ease;
}
@keyframes spellPulse {
  0% { transform: scale(0.5) rotate(-8deg); opacity: 0; }
  30% { transform: scale(1.1) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes riseUp {
  0% { transform: translateY(16px); opacity: 0; }
  25% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-14px); opacity: 0; }
}

.trace-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.score-chip {
  background: var(--surface-2);
  border-radius: 18px;
  padding: 14px;
  text-align: center;
}
.score-chip span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.score-chip strong {
  font-size: 1.35rem;
}

.note-box {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(91,108,240,0.08), rgba(91,108,240,0.03));
}
.note-box strong {
  display: block;
  margin-bottom: 8px;
}
.note-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.play-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.play-actions .button {
  min-width: 180px;
}

.result-panel {
  padding: 24px;
}
.result-panel.hidden {
  display: none;
}
.result-panel h2 {
  margin-top: 0;
}
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.admin-login-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 240px);
}
.admin-login-card {
  width: min(480px, 100%);
  padding: 28px;
}
.admin-login-card h1 {
  margin-top: 0;
}

.stack-form {
  display: grid;
  gap: 16px;
}
.form-card {
  padding: 24px;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.stack-form label,
.form-row label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}
.stack-form span,
.form-row span {
  font-size: 0.92rem;
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}
textarea {
  resize: vertical;
}
.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}
.checkbox-row input {
  width: auto;
}
.image-preview {
  width: 180px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.image-preview-wide {
  width: min(100%, 420px);
}
.image-preview img {
  width: 100%;
  display: block;
}
.narrow {
  max-width: 720px;
}
.table-card {
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 740px;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid #edf0f8;
  vertical-align: middle;
}
.data-table thead th {
  background: #f8faff;
  font-size: 0.9rem;
}
.compact-table input,
.compact-table select {
  min-width: 90px;
}
.thumb-cell {
  width: 96px;
}
.thumb {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  background: #f5f7fd;
}
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.kanji-cell {
  font-size: 1.6rem;
  font-weight: 800;
}
.admin-shortcuts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat-card {
  padding: 22px;
  text-align: center;
}
.stat-card strong {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 6px;
}
.stat-card span { color: var(--muted); }
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.admin-menu {
  display: grid;
  gap: 10px;
}
.admin-menu a {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-2);
  font-weight: 700;
}
.entries-table-wrap {
  overflow: auto;
  margin-bottom: 16px;
}
.stage-editor-grid {
  margin-top: 18px;
}

@media (max-width: 1024px) {
  .hero,
  .split-section,
  .admin-grid,
  .play-grid,
  .stage-grid {
    grid-template-columns: 1fr;
  }
  .play-grid {
    gap: 16px;
  }
  .play-top {
    flex-direction: column;
    align-items: stretch;
  }
  .play-top-actions {
    justify-content: flex-start;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
  }
  .hero-copy,
  .hero-panel,
  .battle-side,
  .trace-side,
  .play-top,
  .split-section .card,
  .form-card,
  .admin-login-card {
    padding: 18px;
  }
  .hero-stats,
  .trace-info {
    grid-template-columns: 1fr;
  }
  .spell-mini {
    width: 100%;
  }
  .trace-header {
    flex-direction: column;
    align-items: stretch;
  }
  .play-actions .button {
    width: 100%;
  }
  .main-nav {
    width: 100%;
  }
  .main-nav a {
    flex: 1 1 auto;
    text-align: center;
    background: #f5f7ff;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* --- One-screen battle layout v2 --- */
body.play-body {
  background:
    linear-gradient(180deg, rgba(10, 18, 42, 0.14), rgba(10, 18, 42, 0.26)),
    var(--stage-bg, linear-gradient(180deg, #edf3ff 0%, #f6f7fb 100%));
  overflow: hidden;
  height: var(--app-height);
  touch-action: manipulation;
}
body.play-body .site-header,
body.play-body .site-footer {
  display: none;
}
body.play-body .page-shell {
  width: 100%;
  min-width: 0;
  max-width: none;
  min-height: var(--app-height);
  height: var(--app-height);
  padding: 0;
  overflow: hidden;
}
.play-wrap {
  position: relative;
  min-height: var(--app-height);
  height: var(--app-height);
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background-image:
    linear-gradient(135deg, rgba(13, 18, 46, 0.36), rgba(11, 16, 36, 0.2)),
    var(--stage-bg);
  background-size: cover;
  background-position: center;
}
.play-wrap::before {
  display: none;
}
.battle-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  min-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 18px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(243, 247, 255, 0.86));
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 24px 48px rgba(23, 34, 73, 0.22);
  overflow: hidden;
}
.battle-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0));
}
.battle-screen-head,
.battle-hud,
.play-grid,
.result-panel {
  position: relative;
  z-index: 1;
}
.battle-screen-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.battle-screen-title {
  min-width: 0;
}
.battle-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.battle-title-row h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  line-height: 1.1;
}
.battle-caption {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 68ch;
}
.battle-screen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.wave-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 900;
  white-space: nowrap;
}
.battle-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(170px, 0.55fr);
  gap: 12px;
}
.hud-card {
  border-radius: 20px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(220, 226, 240, 0.9);
  box-shadow: 0 12px 28px rgba(47, 61, 102, 0.08);
}
.hud-score-card {
  display: grid;
  place-items: center;
  text-align: center;
}
.hud-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.hud-score-card strong {
  font-size: clamp(1.4rem, 3vw, 2rem);
}
.play-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.96fr) minmax(320px, 1.04fr);
  gap: 16px;
  min-height: 0;
  align-items: stretch;
}
.glass-panel {
  display: grid;
  min-height: 0;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(220, 226, 240, 0.9);
  box-shadow: 0 16px 28px rgba(47, 61, 102, 0.08);
  backdrop-filter: blur(14px);
}
.trace-side {
  grid-template-rows: auto minmax(0, 1fr);
}
.battle-side {
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.compact-trace-header {
  align-items: flex-start;
  margin-bottom: 14px;
}
.kanji-head {
  min-width: 0;
}
.kanji-ruby-wrap {
  display: inline-flex;
  align-items: flex-end;
  gap: 10px;
  padding: 0 2px 6px;
}
.current-kanji-ruby {
  font-weight: 900;
  line-height: 1;
}
.current-kanji-ruby rb {
  font-size: clamp(2.8rem, 6.6vw, 4.8rem);
}
.current-kanji-ruby rt {
  font-size: clamp(0.9rem, 1.8vw, 1.15rem);
  color: var(--primary);
  letter-spacing: 0.08em;
  font-weight: 800;
}
.kanji-note-text {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}
.compact-spell-mini {
  min-width: 210px;
}
.trace-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  min-height: 0;
}
.trace-area {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 4px 0 8px;
}
.canvas-frame {
  position: relative;
  width: min(100%, min(50vh, 36vw, 520px));
  aspect-ratio: 1 / 1;
  border-radius: 26px;
  border: 2px solid #d6ddf2;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,255,0.96)),
    radial-gradient(circle at center, rgba(91,108,240,0.09), rgba(91,108,240,0));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.92);
}
.canvas-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#guide-canvas {
  z-index: 1;
}
#draw-canvas {
  z-index: 2;
  touch-action: none;
  cursor: crosshair;
}
.battle-chips {
  margin-top: 8px;
}
.trace-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.score-chip {
  background: rgba(245, 247, 255, 0.88);
  border-radius: 18px;
  padding: 12px 14px;
  text-align: center;
  border: 1px solid rgba(220, 226, 240, 0.74);
}
.score-chip span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.score-chip strong {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
}
.compact-actions {
  margin-top: 12px;
}
.play-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.play-actions .button {
  min-width: 0;
}
.enemy-card-head {
  margin-bottom: 12px;
}
.enemy-card-head h2 {
  margin: 0 0 4px;
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
}
.enemy-card-head p {
  margin: 0;
}
.arena-frame {
  position: relative;
  min-height: 0;
  border-radius: 26px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.08)),
    linear-gradient(180deg, rgba(52, 83, 167, 0.16), rgba(88, 139, 239, 0.04)),
    var(--stage-bg);
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.28);
}
.arena-shine {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 18%, rgba(255,255,255,0.72), rgba(255,255,255,0) 34%),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0));
  pointer-events: none;
}
.enemy-shadow {
  position: absolute;
  height: 22px;
  border-radius: 999px;
  background: rgba(27, 39, 71, 0.18);
  filter: blur(8px);
  transform-origin: center;
  transition: transform 0.12s linear;
}
.enemy-sprite {
  position: absolute;
  left: 0;
  top: 0;
  width: 180px;
  max-width: none;
  will-change: transform;
  filter: drop-shadow(0 18px 18px rgba(24, 34, 73, 0.22));
  animation: enemyHover 2.8s ease-in-out infinite;
}
@keyframes enemyHover {
  0%, 100% { filter: drop-shadow(0 18px 18px rgba(24, 34, 73, 0.18)); }
  50% { filter: drop-shadow(0 26px 22px rgba(24, 34, 73, 0.22)); }
}
.enemy-hit {
  animation: enemyStoneHit 0.34s ease;
}
.enemy-defeated {
  animation: enemyDefeated 0.72s ease forwards;
}
.enemy-attacking {
  animation: enemyAttack 0.44s ease;
}
@keyframes enemyHit {
  0% { filter: brightness(1) drop-shadow(0 18px 18px rgba(24, 34, 73, 0.22)); }
  35% { filter: brightness(1.28) drop-shadow(0 10px 14px rgba(255, 94, 94, 0.34)); }
  100% { filter: brightness(1) drop-shadow(0 18px 18px rgba(24, 34, 73, 0.22)); }
}
@keyframes enemyDefeated {
  0% { opacity: 1; filter: brightness(1.1) saturate(1.1); }
  60% { opacity: 1; transform: translateY(-18px) scale(1.08); }
  100% { opacity: 0; transform: translateY(-44px) scale(0.8); }
}
@keyframes enemyAttack {
  0% { transform: translate(0, 0) scale(1); }
  40% { transform: translate(-18px, 4px) scale(1.06); }
  100% { transform: translate(0, 0) scale(1); }
}
.screen-shake {
  animation: screenShake 0.38s ease;
}
@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.spell-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(255,255,255,0.06), rgba(91,108,240,0.22));
  transition: opacity 0.2s ease;
}
.spell-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.spell-overlay img {
  width: clamp(120px, 30%, 220px);
  filter: drop-shadow(0 14px 24px rgba(68, 82, 150, 0.28));
  animation: spellPulse 0.9s ease;
}
.spell-score-burst {
  position: absolute;
  top: 12%;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--primary);
  font-weight: 900;
  box-shadow: var(--shadow);
  animation: riseUp 0.9s ease;
}
.damage-burst {
  position: absolute;
  right: 12%;
  top: 16%;
  z-index: 6;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #ff6b6b, #e04563);
  box-shadow: 0 16px 22px rgba(224, 69, 99, 0.24);
  animation: damageFloat 0.85s ease forwards;
}
.damage-burst.defeated {
  background: linear-gradient(135deg, #ff9a44, #ff6b1f);
}
.damage-burst.hidden {
  display: none;
}
@keyframes damageFloat {
  0% { transform: translateY(18px) scale(0.7); opacity: 0; }
  25% { transform: translateY(0) scale(1.02); opacity: 1; }
  100% { transform: translateY(-16px) scale(0.96); opacity: 0; }
}
.compact-battle-log {
  margin-top: 12px;
  min-height: 104px;
  background: rgba(247, 249, 255, 0.84);
}
#battle-log-body {
  min-height: 52px;
  line-height: 1.65;
}
.result-panel {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 27, 58, 0.28);
}
.result-panel.hidden {
  display: none;
}
.result-panel-card {
  width: min(560px, calc(100vw - 40px));
  padding: 24px;
}
.result-panel-card h2 {
  margin-top: 0;
}
.result-panel-card p {
  margin-bottom: 0;
  line-height: 1.7;
  color: var(--muted);
}
@media (max-width: 1180px) {
  .mode-hero {
    background-position: center 72%;
  }

  .battle-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hud-score-card {
    grid-column: 1 / -1;
  }
}
@media (max-width: 980px) {
  body.play-body {
    overflow: auto;
  }
  body.play-body .page-shell {
    min-height: auto;
  }
  .battle-shell {
    min-height: auto;
  }
  .play-grid {
    grid-template-columns: 1fr;
  }
  .battle-side {
    min-height: 420px;
  }
  .canvas-frame {
    width: min(100%, 420px);
  }
}
@media (max-width: 820px) and (orientation: landscape) {
  .play-wrap {
    padding: 8px;
  }
  .battle-shell {
    min-height: calc(100dvh - 16px);
    gap: 10px;
    padding: 12px;
  }
  .battle-screen-head {
    gap: 10px;
  }
  .battle-caption {
    font-size: 0.88rem;
    margin-top: 6px;
  }
  .glass-panel {
    padding: 12px;
  }
  .compact-spell-mini {
    min-width: 160px;
  }
  .compact-spell-mini img {
    width: 52px;
    height: 52px;
  }
  .trace-info {
    gap: 8px;
  }
  .score-chip {
    padding: 10px 12px;
  }
  .play-actions .button,
  .battle-screen-actions .button {
    padding: 10px 12px;
    font-size: 0.82rem;
  }
  .enemy-card-head {
    margin-bottom: 8px;
  }
  .compact-battle-log {
    min-height: 82px;
    margin-top: 8px;
  }
  .current-kanji-ruby rb {
    font-size: clamp(2.4rem, 7vw, 4rem);
  }
}
@media (max-width: 720px) {
  .battle-screen-head {
    flex-direction: column;
  }
  .battle-screen-actions {
    justify-content: flex-start;
  }
  .compact-trace-header {
    flex-direction: column;
    align-items: stretch;
  }
  .compact-spell-mini {
    width: 100%;
    min-width: 0;
  }
  .trace-info,
  .play-actions,
  .battle-hud {
    grid-template-columns: 1fr;
  }
  .result-panel-card {
    padding: 20px;
  }
}
.kanji-pill-reading {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-weight: 700;
}

/* --- One-screen battle board update --- */
.play-body-unified {
  background: linear-gradient(180deg, #eaf0ff 0%, #f6f8fd 100%);
}
.unified-play-wrap {
  min-height: var(--app-height);
  height: var(--app-height);
  display: flex;
}
.battle-shell-unified {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}
.battle-screen-head-unified {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.15fr) auto;
  gap: 18px;
  align-items: start;
}
.battle-screen-enemy-title h1,
.battle-screen-stage-title h2 {
  margin: 0;
}
.battle-screen-stage-title h2 {
  font-size: clamp(1.15rem, 2.2vw, 1.72rem);
  line-height: 1.15;
}
.battle-screen-actions-unified {
  align-self: start;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
#fullscreen-button[hidden] {
  display: none;
}
#fullscreen-button.is-active {
  background: linear-gradient(135deg, rgba(91,108,240,0.16), rgba(91,108,240,0.06));
  color: var(--primary-2);
}
.battle-board {
  min-height: 0;
  display: grid;
}
.unified-arena {
  --trace-dock-width: clamp(286px, 31vw, 360px);
  position: relative;
  min-height: 0;
  height: 100%;
  padding: 0;
  border-radius: 26px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.05)),
    linear-gradient(180deg, rgba(26, 51, 104, 0.14), rgba(44, 84, 174, 0.05)),
    var(--stage-bg);
  background-size: cover;
  background-position: center;
}
.unified-arena::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 30%, rgba(22, 34, 64, 0.06));
  pointer-events: none;
}
.arena-scenery {
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  pointer-events: none;
  background:
    radial-gradient(120% 120% at 20% 100%, rgba(140, 213, 114, 0.48) 0 32%, transparent 33%),
    radial-gradient(120% 120% at 55% 100%, rgba(116, 196, 95, 0.42) 0 38%, transparent 39%),
    radial-gradient(120% 120% at 88% 100%, rgba(158, 223, 130, 0.32) 0 31%, transparent 32%),
    linear-gradient(180deg, rgba(141, 220, 124, 0), rgba(141, 220, 124, 0.18) 42%, rgba(121, 198, 96, 0.34));
}
.battle-board-top {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  width: min(460px, calc(100% - var(--trace-dock-width) - 44px));
}
.board-hud-card {
  padding: 10px 12px;
  background: rgba(255,255,255,0.9);
}
.board-hud-card .hp-label {
  margin-bottom: 6px;
  font-size: 0.84rem;
}
.board-hud-card .bar,
.board-hud-card .bar-player {
  height: 12px;
}
.board-score-card {
  grid-column: 1 / -1;
  justify-self: end;
  min-width: 132px;
  padding: 10px 14px;
  display: grid;
  gap: 2px;
  place-items: center;
  background: rgba(255,255,255,0.92);
}
.board-score-card strong {
  font-size: 1.45rem;
  line-height: 1;
}
.hud-sub {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}
.enemy-node {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  will-change: transform;
  pointer-events: none;
}
.enemy-node .enemy-sprite {
  display: block;
  width: 100%;
  max-width: none;
  transform-origin: center center;
}
.enemy-sprite {
  animation-duration: 2.4s;
}
.trace-dock {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 7;
  width: var(--trace-dock-width);
  max-width: calc(100% - 32px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-radius: 24px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(215, 222, 240, 0.95);
  box-shadow: 0 18px 36px rgba(36, 49, 86, 0.16);
  backdrop-filter: blur(12px);
}
.trace-dock-head {
  display: grid;
  gap: 8px;
}
.trace-reading-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.trace-reading-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 800;
}
.trace-reading-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  background: #f1f3ff;
  color: var(--primary);
  font-weight: 900;
  letter-spacing: 0.08em;
}
.trace-target-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.trace-target-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(91,108,240,0.12), rgba(91,108,240,0.04));
  color: var(--primary);
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1;
}
.trace-dock .kanji-note-text {
  margin: 0;
  font-size: 0.86rem;
}
.trace-area-unified {
  padding: 0;
}
.canvas-frame-unified {
  width: min(100%, clamp(220px, 28vw, 320px));
  max-width: none;
  justify-self: center;
  border-radius: 22px;
  aspect-ratio: 1 / 1;
}
.trace-footer {
  display: grid;
  gap: 10px;
}
.trace-info-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.trace-info-compact .score-chip {
  padding: 10px 8px;
  border-radius: 16px;
}
.trace-info-compact .score-chip span {
  margin-bottom: 4px;
  font-size: 0.72rem;
}
.trace-info-compact .score-chip strong {
  font-size: 1rem;
}
.trace-spell-mini {
  padding: 8px 10px;
  border-radius: 16px;
  background: #f6f8ff;
}
.trace-spell-mini img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}
.trace-spell-mini strong {
  font-size: 0.95rem;
}
.trace-spell-mini small {
  font-size: 0.78rem;
}
.floating-battle-log {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 6;
  width: min(360px, calc(100% - var(--trace-dock-width) - 52px));
  margin: 0;
  background: rgba(247,249,255,0.9);
  border: 1px solid rgba(220, 226, 240, 0.82);
}
.floating-battle-log h3 {
  margin-bottom: 8px;
}
.floating-battle-log #battle-log-body {
  min-height: 42px;
  font-size: 0.94rem;
}
.spell-overlay {
  z-index: 8;
}
.damage-burst {
  z-index: 9;
}
@media (max-width: 1180px) {
  .mode-hero {
    background-position: center 72%;
  }

  .unified-arena {
    --trace-dock-width: clamp(260px, 30vw, 320px);
  }
  .battle-board-top {
    width: min(420px, calc(100% - var(--trace-dock-width) - 40px));
  }
}
@media (max-width: 980px) {
  .battle-screen-head-unified {
    grid-template-columns: 1fr;
  }
  .battle-screen-actions-unified {
    justify-content: flex-start;
  }
  .unified-arena {
    min-height: 720px;
  }
  .trace-dock {
    position: relative;
    right: auto;
    bottom: auto;
    margin: calc(100% - 100% + 16px) 16px 16px auto;
    width: min(100%, 420px);
    max-width: calc(100% - 32px);
  }
  .battle-board-top,
  .floating-battle-log {
    width: calc(100% - 32px);
  }
  .floating-battle-log {
    bottom: auto;
    top: 108px;
  }
}
@media (max-width: 860px) {
  .unified-arena {
    min-height: 640px;
  }
  .battle-board-top {
    grid-template-columns: 1fr;
  }
  .board-score-card {
    justify-self: stretch;
  }
  .floating-battle-log {
    position: relative;
    left: auto;
    top: auto;
    bottom: auto;
    width: calc(100% - 32px);
    margin: 16px;
  }
  .trace-dock {
    margin-top: 280px;
  }
}
@media (max-width: 820px) and (orientation: landscape) {
  .unified-arena {
    --trace-dock-width: clamp(228px, 31vw, 268px);
    min-height: 520px;
  }
  .trace-dock {
    position: absolute;
    margin: 0;
    width: var(--trace-dock-width);
  }
  .battle-board-top {
    width: min(320px, calc(100% - var(--trace-dock-width) - 40px));
  }
  .floating-battle-log {
    position: absolute;
    top: auto;
    width: min(300px, calc(100% - var(--trace-dock-width) - 48px));
  }
  .trace-target-char {
    min-width: 40px;
    min-height: 40px;
    font-size: 1.6rem;
  }
  .trace-spell-mini {
    display: none;
  }
}
@media (max-width: 720px) {
  .unified-arena {
    min-height: 620px;
  }
  .battle-board-top,
  .floating-battle-log,
  .trace-dock {
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    left: 12px;
    right: 12px;
  }
  .battle-board-top {
    top: 12px;
  }
  .trace-dock {
    position: absolute;
    top: 176px;
    bottom: 12px;
    margin: 0;
  }
  .floating-battle-log {
    top: 104px;
    bottom: auto;
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  .play-wrap {
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }
  .battle-shell-unified {
    gap: 8px;
    padding: 8px;
    border-radius: 18px;
  }
  .battle-screen-head-unified {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.1fr) auto;
    gap: 8px;
    align-items: center;
  }
  .battle-screen-head-unified .eyebrow,
  .battle-screen-head-unified .battle-caption {
    display: none;
  }
  .battle-screen-enemy-title,
  .battle-screen-stage-title {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 14px;
    background: rgba(255,255,255,0.82);
    border: 1px solid rgba(215, 222, 240, 0.92);
    backdrop-filter: blur(10px);
  }
  .battle-screen-enemy-title h1,
  .battle-screen-stage-title h2 {
    font-size: 0.96rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .battle-title-row {
    gap: 6px;
  }
  .wave-pill {
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.72rem;
  }
  .battle-screen-actions-unified {
    gap: 6px;
    justify-content: flex-end;
  }
  .battle-screen-actions-unified .button {
    padding: 8px 10px;
    font-size: 0.76rem;
  }
  .unified-arena {
    --trace-dock-width: clamp(188px, 27vw, 236px);
    min-height: 0;
    height: 100%;
    border-radius: 18px;
  }
  .battle-board-top {
    top: 10px;
    left: 10px;
    gap: 6px;
    width: min(274px, calc(100% - var(--trace-dock-width) - 28px));
  }
  .board-hud-card {
    padding: 6px 8px;
    border-radius: 12px;
  }
  .board-hud-card .hp-label {
    margin-bottom: 4px;
    font-size: 0.68rem;
  }
  .board-hud-card .bar,
  .board-hud-card .bar-player {
    height: 8px;
  }
  .board-score-card {
    min-width: 90px;
    padding: 7px 8px;
  }
  .board-score-card .hud-label {
    margin-bottom: 2px;
    font-size: 0.66rem;
  }
  .board-score-card strong {
    font-size: 1.02rem;
  }
  .trace-dock {
    position: absolute;
    top: auto;
    left: auto;
    right: 10px;
    bottom: 10px;
    margin: 0;
    gap: 8px;
    padding: 8px;
    width: var(--trace-dock-width);
    border-radius: 16px;
    max-height: calc(100% - 20px);
  }
  .trace-dock-head {
    gap: 6px;
  }
  .trace-reading-row {
    gap: 6px;
  }
  .trace-reading-label {
    font-size: 0.68rem;
  }
  .trace-reading-chip {
    min-height: 24px;
    padding: 0 10px;
    font-size: 0.74rem;
  }
  .trace-target-char {
    min-width: 34px;
    min-height: 34px;
    border-radius: 12px;
    font-size: 1.35rem;
  }
  .trace-dock .kanji-note-text {
    display: none;
  }
  .canvas-frame-unified {
    width: min(100%, min(220px, calc(var(--app-height) - 162px)));
    border-radius: 18px;
  }
  .trace-footer {
    gap: 8px;
  }
  .trace-info-compact {
    gap: 6px;
  }
  .trace-info-compact .score-chip {
    padding: 6px 4px;
    border-radius: 12px;
  }
  .trace-info-compact .score-chip span {
    margin-bottom: 2px;
    font-size: 0.62rem;
  }
  .trace-info-compact .score-chip strong {
    font-size: 0.86rem;
  }
  .trace-spell-mini {
    display: none;
  }
  .compact-actions {
    margin-top: 0;
  }
  .compact-actions .button {
    padding: 8px 10px;
    font-size: 0.75rem;
  }
  .floating-battle-log {
    position: absolute;
    top: auto;
    left: 10px;
    bottom: 10px;
    margin: 0;
    width: min(220px, calc(100% - var(--trace-dock-width) - 30px));
    padding: 10px 12px;
    border-radius: 14px;
  }
  .floating-battle-log h3 {
    margin-bottom: 4px;
    font-size: 0.76rem;
  }
  .floating-battle-log #battle-log-body {
    min-height: 28px;
    font-size: 0.78rem;
    line-height: 1.4;
  }
  .spell-overlay img {
    width: clamp(88px, 18vw, 136px);
  }
  .damage-burst {
    top: 12%;
    right: 14%;
    padding: 6px 10px;
    font-size: 0.88rem;
  }
}

body.mobile-landscape-compact.immersive-mode .battle-screen-head-unified .eyebrow,
body.mobile-landscape-compact.immersive-mode .battle-screen-head-unified .battle-caption {
  display: none;
}
body.mobile-landscape-compact.immersive-mode .battle-screen-head-unified {
  gap: 8px;
}
body.mobile-landscape-compact.immersive-mode .battle-screen-enemy-title,
body.mobile-landscape-compact.immersive-mode .battle-screen-stage-title {
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(215, 222, 240, 0.9);
  backdrop-filter: blur(10px);
}
body.mobile-landscape-compact.immersive-mode .battle-screen-enemy-title h1,
body.mobile-landscape-compact.immersive-mode .battle-screen-stage-title h2 {
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.mobile-landscape-compact.immersive-mode .battle-shell-unified {
  gap: 8px;
}
body.mobile-landscape-compact.immersive-mode .board-hud-card {
  padding: 8px 10px;
}
body.mobile-landscape-compact.immersive-mode .board-hud-card .hp-label {
  margin-bottom: 4px;
}
body.mobile-landscape-compact.immersive-mode .trace-dock .kanji-note-text {
  display: none;
}
body.mobile-landscape-compact.immersive-mode .trace-spell-mini {
  display: none;
}
body.mobile-landscape-compact.immersive-mode .floating-battle-log {
  background: rgba(247,249,255,0.88);
}

.enemy-hit {
  animation: enemyStoneHit 0.34s ease;
}
.enemy-attacking {
  animation: enemyAttackSprite 0.44s ease;
}
.enemy-defeated {
  animation: enemyDefeatedSprite 0.72s ease forwards;
}
@keyframes enemyHitSprite {
  0% { filter: brightness(1) drop-shadow(0 18px 18px rgba(24, 34, 73, 0.22)); }
  35% { filter: brightness(1.3) saturate(1.1) drop-shadow(0 14px 16px rgba(255, 94, 94, 0.36)); }
  100% { filter: brightness(1) drop-shadow(0 18px 18px rgba(24, 34, 73, 0.22)); }
}
@keyframes enemyAttackSprite {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.18) contrast(1.08) saturate(1.05); }
  100% { filter: brightness(1); }
}
@keyframes enemyDefeatedSprite {
  0% { opacity: 1; filter: brightness(1.08) saturate(1.08); }
  60% { opacity: 1; filter: brightness(1.26) saturate(0.9); }
  100% { opacity: 0; filter: brightness(1.4) saturate(0.25); }
}

/* ===== 2026-04 arcade modes update ===== */
.mode-hero {
  position: relative;
  min-height: clamp(640px, 84vh, 920px);
  padding: clamp(24px, 4vw, 42px);
  border-radius: 32px;
  overflow: hidden;
  background-image:
    linear-gradient(120deg, rgba(8, 16, 32, 0.62), rgba(8, 16, 32, 0.26) 42%, rgba(8, 16, 32, 0.14) 65%, rgba(8, 16, 32, 0.36) 100%),
    var(--top-hero-image);
  background-size: cover;
  background-position: center 68%;
  box-shadow: 0 32px 80px rgba(26, 40, 86, 0.18);
}
.mode-hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 78%, rgba(255,255,255,0.18), transparent 26%), radial-gradient(circle at 50% 90%, rgba(126, 228, 120, 0.10), transparent 18%), linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0));
  pointer-events: none;
}
.mode-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 0.9fr);
  align-items: start;
  min-height: inherit;
}
.mode-copy-card,
.mode-card {
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.66);
}
.mode-copy-card {
  max-width: 560px;
  padding: clamp(26px, 3vw, 38px);
}
.mode-hero-copy {
  align-self: start;
}
.mode-hero .eyebrow,
.eyebrow {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6f7ff1;
}
.mode-copy-card h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.12;
}
.mode-subtitle {
  margin: 10px 0 18px;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  color: #52607d;
  font-weight: 700;
}
.mode-copy-text {
  color: #27344f;
  line-height: 1.8;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}
.mode-select-grid {
  display: grid;
  gap: 18px;
  align-self: end;
}
.mode-card {
  padding: 24px;
}
.mode-card h2 {
  margin: 6px 0 10px;
}
.mode-label {
  margin: 0;
  color: #7e8aa5;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.mode-points {
  margin: 16px 0 20px;
  padding-left: 18px;
  color: #31415d;
  line-height: 1.8;
}
.split-section {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.hero-stats-wide {
  margin-bottom: 18px;
}
.compact-steps {
  margin: 0;
  padding-left: 20px;
  line-height: 1.9;
}
.small-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.results-list {
  display: grid;
  gap: 10px;
}
.result-row {
  display: grid;
  grid-template-columns: 1.2fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface-2);
  color: #2f3b54;
}
.result-row small {
  color: #7d89a1;
}
.image-preview-wide img {
  width: 100%;
  max-width: 640px;
  border-radius: 20px;
  display: block;
}

.play-body-arcade .page-shell {
  width: 100%;
  max-width: none;
}
.unified-play-wrap {
  padding: 0;
}
.battle-shell-arcade {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.battle-screen-head-unified {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.15fr) auto;
  gap: 12px;
  align-items: stretch;
}
.battle-screen-head-unified .battle-screen-title,
.battle-screen-actions-unified {
  min-height: 64px;
  padding: 16px 18px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid rgba(99, 114, 173, 0.12);
  box-shadow: 0 12px 28px rgba(24, 40, 86, 0.08);
}
.battle-screen-title h1,
.battle-screen-title h2 {
  margin: 2px 0 0;
  font-size: clamp(1.15rem, 2vw, 1.7rem);
}
.battle-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.battle-screen-actions-unified {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.arcade-arena {
  position: relative;
  min-height: clamp(600px, calc(var(--app-height, 100vh) - 210px), 980px);
  padding: 18px;
  border-radius: 34px;
  overflow: hidden;
  background-image: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)), var(--stage-bg);
  background-size: cover;
  background-position: center center;
  border: 1px solid rgba(116, 131, 188, 0.18);
  box-shadow: 0 20px 48px rgba(24, 40, 86, 0.14);
}
.arcade-arena::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(13,20,33,0.08));
  pointer-events: none;
}
.arena-shine,
.arena-scenery {
  display: none;
}
.battle-board-top {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  width: min(980px, calc(100% - 380px));
}
.board-hud-card {
  min-height: 92px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 26px rgba(24, 40, 86, 0.08);
}
.board-score-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.3rem;
}
.magic-bar {
  margin-top: 8px;
}
.enemy-node {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  will-change: transform;
}
.enemy-shadow {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  height: 22px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(12,18,28,0.28), rgba(12,18,28,0));
  filter: blur(2px);
  will-change: transform;
}
.enemy-sprite {
  width: 100%;
  height: auto;
  transform-origin: center bottom;
  transition: transform 0.16s ease, filter 0.18s ease;
  filter: drop-shadow(0 18px 24px rgba(10, 12, 26, 0.2));
}
.damage-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.damage-pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 4px 14px rgba(18, 28, 50, 0.5);
  animation: damageFloat 0.74s ease forwards;
}
.damage-pop-damage { color: #fffae8; }
.damage-pop-finisher { color: #ffe6ff; font-size: 1.8rem; }
.damage-pop-magic { color: #cbf7ff; font-size: 1.2rem; }
@keyframes damageFloat {
  0% { opacity: 0; transform: translate(-50%, -26%) scale(0.8); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -130%) scale(1.12); }
}
/* PROJECTILE_RACK_THEME_V1 */
.stone-zone {
  position: absolute;
  left: 22px;
  bottom: 26px;
  z-index: 3;
  width: min(330px, calc(100% - 420px));
  padding: 16px 18px 14px;
  border-radius: 24px;
  background: rgba(255,255,255,0.84);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 26px rgba(24, 40, 86, 0.09);
}
.stone-zone-copy {
  display: grid;
  gap: 4px;
}
.stone-zone-copy strong {
  color: #223252;
}
.stone-zone-copy small {
  color: #5e6c88;
  line-height: 1.55;
}
.stone-launchpad {
  position: relative;
  height: 132px;
  margin-top: 8px;
  overflow: visible;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(95, 110, 170, 0.12), rgba(95, 110, 170, 0.06));
  border: 1px dashed rgba(91, 108, 240, 0.26);
}
.stone-ball {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: grab;
  background: radial-gradient(circle at 32% 28%, #ffffff, #d2dae8 42%, #93a0b8 100%);
  box-shadow: inset -4px -6px 10px rgba(40, 54, 84, 0.24), 0 7px 14px rgba(26, 40, 86, 0.18);
  touch-action: none;
  user-select: none;
  will-change: transform;
}
.stone-ball::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, rgba(255,255,255,0.7), rgba(255,255,255,0));
}
.stone-ball.is-dragging { cursor: grabbing; transform-origin: center center; }
.stone-ball.is-hidden,
.stone-ball.is-disabled { opacity: 0; pointer-events: none; }
.trace-dock {
  z-index: 5;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
}
.trace-reading-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.trace-reading-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #7a86a2;
}
.trace-reading-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 14px;
  background: #eef1ff;
  color: #586af1;
  font-weight: 800;
  line-height: 1.4;
}
.trace-target-row {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.trace-target-char {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  line-height: 1;
  color: #6174f4;
}
.trace-area-unified {
  margin-top: 12px;
}
.canvas-frame-unified {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 28px;
  overflow: hidden;
  background: rgba(245, 248, 255, 0.88);
  border: 1px solid rgba(100, 118, 192, 0.18);
}
.canvas-frame-unified canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.trace-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(242, 245, 255, 0.76);
  z-index: 6;
}
.trace-lock-overlay.hidden {
  display: none;
}
.trace-lock-card {
  width: min(250px, 100%);
  padding: 18px 18px 16px;
  border-radius: 20px;
  text-align: center;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 12px 24px rgba(24, 40, 86, 0.12);
}
.trace-lock-card strong {
  display: block;
  margin-bottom: 8px;
}
.trace-lock-card p {
  margin: 0;
  color: #5b6780;
  line-height: 1.6;
}
.trace-footer {
  display: grid;
  gap: 14px;
}
.trace-spell-mini {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--surface-2);
}
.trace-spell-mini img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.compact-actions {
  display: flex;
  gap: 10px;
}
.compact-actions > * { flex: 1; }
.floating-battle-log {
  z-index: 4;
  background: rgba(255,255,255,0.84);
  backdrop-filter: blur(10px);
}
.spell-overlay {
  z-index: 8;
}
.mode-hero .button,
.compact-actions .button,
.hero-actions .button {
  min-height: 46px;
}
.enemy-stone-hit { animation: enemyStoneHit 0.34s ease; }
@keyframes enemyStoneHit {
  0% { transform: translateX(0) scale(1); }
  20% { transform: translateX(-8px) scale(1.03); }
  40% { transform: translateX(8px) scale(0.99); }
  60% { transform: translateX(-6px) scale(1.02); }
  100% { transform: translateX(0) scale(1); }
}

@media (max-width: 1180px) {
  .mode-hero {
    background-position: center 72%;
  }

  .mode-hero-inner,
  .split-section {
    grid-template-columns: 1fr;
  }
  .battle-screen-head-unified {
    grid-template-columns: 1fr;
  }
  .battle-screen-actions-unified {
    justify-content: flex-start;
  }
  .battle-board-top {
    width: calc(100% - 24px);
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}

@media (max-width: 980px) {
  .stone-zone {
    width: min(300px, calc(100% - 340px));
  }
  .result-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

@media (orientation: landscape) and (max-height: 760px) {
  .arcade-arena {
    min-height: clamp(420px, calc(var(--app-height, 100vh) - 150px), 740px);
  }
  .battle-screen-head-unified .battle-screen-title,
  .battle-screen-actions-unified {
    padding: 12px 14px;
    min-height: 56px;
  }
  .battle-board-top {
    grid-template-columns: repeat(5, minmax(98px, 1fr));
    gap: 8px;
    width: min(900px, calc(100% - 312px));
  }
  .board-hud-card {
    min-height: 76px;
    padding: 12px;
  }
  .stone-zone {
    width: min(280px, calc(100% - 320px));
    padding: 12px 14px 10px;
  }
  .stone-launchpad {
    height: 104px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .arcade-arena {
    min-height: clamp(380px, calc(var(--app-height, 100vh) - 120px), 620px);
    padding: 12px;
  }
  .battle-board-top {
    width: min(860px, calc(100% - 270px));
    gap: 6px;
  }
  .board-hud-card {
    min-height: 66px;
    padding: 10px;
    border-radius: 18px;
  }
  .board-hud-card strong,
  .board-score-card strong {
    font-size: 1.05rem;
  }
  .stone-zone {
    width: min(246px, calc(100% - 286px));
    bottom: 16px;
    left: 16px;
    border-radius: 20px;
  }
  .stone-launchpad {
    height: 84px;
  }
  .trace-dock {
    width: clamp(184px, 24vw, 240px);
    padding: 12px;
    border-radius: 22px;
  }
  .trace-reading-chip {
    min-height: 32px;
    padding: 0 12px;
    font-size: 0.88rem;
  }
  .trace-target-char {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
  }
  .trace-dock .kanji-note-text,
  .battle-screen-head-unified .battle-caption,
  .battle-screen-head-unified .eyebrow,
  .stone-zone-copy small {
    font-size: 0.78rem;
  }
  .floating-battle-log {
    width: min(280px, calc(100% - 310px));
    padding: 12px 14px;
    border-radius: 18px;
  }
}

/* --- compact battle polish + KanjiVG hint --- */
.battle-screen-head-compact {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}
.battle-topbar-main {
  min-height: auto;
  display: grid;
  gap: 8px;
}
.battle-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.battle-title-row-main {
  min-width: 0;
}
.battle-mode-name {
  margin: 0;
  font-size: clamp(1.08rem, 2vw, 1.45rem);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.battle-enemy-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(91, 108, 240, 0.07);
  color: #25355d;
  white-space: nowrap;
}
.battle-enemy-inline-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary);
}
.battle-enemy-inline strong {
  overflow: hidden;
  text-overflow: ellipsis;
}
.battle-topbar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.battle-topbar-caption,
.battle-topbar-enemy-caption {
  margin: 0;
  color: #61718f;
  font-size: 0.9rem;
}
.battle-topbar-caption {
  flex: 1 1 auto;
}
.battle-topbar-enemy-caption {
  flex: 0 0 auto;
  max-width: 34%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hp-label-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}
.hp-label-compact strong {
  white-space: nowrap;
}
.board-score-card-current,
.board-score-card-total {
  min-width: 112px;
}
.board-score-card-magic {
  min-width: 172px;
}
.trace-guide-button {
  margin-left: auto;
  flex-shrink: 0;
}
.trace-reading-row {
  flex-wrap: wrap;
}
.stone-zone {
  z-index: 7;
}
.floating-battle-log {
  z-index: 5;
  top: 136px;
  bottom: auto;
  left: 18px;
  width: min(320px, calc(100% - var(--trace-dock-width) - 44px));
}
.battle-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.battle-log-head h3 {
  margin: 0;
}
.battle-log-close {
  appearance: none;
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #eef1ff;
  color: var(--primary-2);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}
.battle-log-toggle {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 6;
}
.battle-log-toggle.hidden {
  display: none;
}
.battle-log-toggle-button {
  box-shadow: 0 10px 24px rgba(24, 40, 86, 0.16);
}
#battle-log-panel.is-collapsed {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}
.kanjivg-guide-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 22, 42, 0.64);
  backdrop-filter: blur(8px);
}
.kanjivg-guide-modal.hidden {
  display: none;
}
.kanjivg-guide-card {
  width: min(920px, 100%);
  max-height: min(92vh, 980px);
  padding: 18px;
  display: grid;
  gap: 16px;
}
.kanjivg-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.kanjivg-guide-head strong {
  display: block;
  font-size: 1.1rem;
}
.kanjivg-guide-head small {
  color: var(--muted);
}
.kanjivg-guide-body {
  display: grid;
  gap: 14px;
  min-height: 0;
}
.kanjivg-guide-image-wrap {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 22px;
  background: #f7f9ff;
  border: 1px solid rgba(91, 108, 240, 0.12);
}
.kanjivg-guide-image-wrap img {
  max-width: min(100%, 420px);
  max-height: min(62vh, 520px);
  object-fit: contain;
}
.kanjivg-guide-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.license-card {
  display: grid;
  gap: 12px;
}
.license-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 1180px) {
  .battle-board-top {
    width: min(760px, calc(100% - 320px));
    grid-template-columns: repeat(4, minmax(108px, 1fr));
  }
  .board-score-card-total {
    grid-column: span 1;
  }
}

@media (orientation: landscape) and (max-height: 720px) {
  .battle-screen-head-compact .battle-screen-title,
  .battle-screen-head-compact .battle-screen-actions {
    padding: 12px 14px;
    min-height: auto;
    border-radius: 18px;
  }
  .battle-topbar-caption,
  .battle-topbar-enemy-caption {
    font-size: 0.82rem;
  }
  .battle-board-top {
    top: 12px;
    left: 12px;
    gap: 8px;
    width: min(640px, calc(100% - 270px));
    grid-template-columns: repeat(4, minmax(86px, 1fr));
  }
  .board-hud-card {
    min-height: 72px;
    padding: 10px 12px;
    border-radius: 18px;
  }
  .board-hud-card .hp-label {
    font-size: 0.78rem;
  }
  .board-score-card strong {
    font-size: 1.05rem;
  }
  .board-score-card .hud-label,
  .board-score-card small,
  #magic-hit-hint {
    font-size: 0.72rem;
  }
  .stone-zone {
    left: 16px;
    bottom: 16px;
    width: min(248px, calc(100% - 286px));
    padding: 12px 14px 10px;
    border-radius: 20px;
  }
  .stone-launchpad {
    height: 88px;
  }
  .trace-dock {
    right: 12px;
    bottom: 12px;
    width: clamp(184px, 25vw, 230px);
    padding: 10px;
    border-radius: 20px;
  }
  .trace-reading-chip {
    min-height: 30px;
    padding: 0 11px;
    font-size: 0.84rem;
  }
  .trace-guide-button {
    padding: 7px 10px;
    font-size: 0.74rem;
  }
  .canvas-frame-unified {
    border-radius: 20px;
  }
  .trace-dock .kanji-note-text,
  .trace-spell-mini,
  .battle-topbar-caption,
  .battle-topbar-enemy-caption {
    font-size: 0.76rem;
  }
  .trace-spell-mini {
    display: none;
  }
  .floating-battle-log {
    width: min(254px, calc(100% - 300px));
    top: 104px;
    left: 16px;
    padding: 12px 14px;
    border-radius: 18px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .battle-screen-head-compact {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .battle-topbar-row {
    gap: 8px;
  }
  .battle-enemy-inline {
    max-width: 42%;
    padding: 7px 10px;
  }
  .battle-topbar-meta {
    display: none;
  }
  .battle-screen-head-compact .battle-screen-actions {
    gap: 6px;
  }
  .battle-screen-head-compact .button {
    padding: 8px 10px;
    font-size: 0.74rem;
  }
  .battle-board-top {
    width: min(520px, calc(100% - 232px));
    grid-template-columns: repeat(3, minmax(80px, 1fr));
    gap: 6px;
  }
  .board-score-card-current,
  .board-score-card-total {
    min-width: 0;
  }
  .board-hud-card,
  .board-score-card {
    min-height: 62px;
    padding: 8px 9px;
  }
  .board-score-card .hud-label,
  .board-score-card small,
  #magic-hit-hint,
  .board-hud-card .hp-label {
    font-size: 0.66rem;
  }
  .board-score-card strong,
  .hp-label-compact strong {
    font-size: 0.96rem;
  }
  .stone-zone {
    width: min(214px, calc(100% - 238px));
    padding: 10px 12px 9px;
  }
  .stone-zone-copy small {
    display: none;
  }
  .stone-launchpad {
    height: 82px;
    margin-top: 6px;
  }
  .stone-ball {
    width: 36px;
    height: 36px;
  }
  .trace-dock {
    width: clamp(170px, 26vw, 208px);
    padding: 9px;
    gap: 8px;
  }
  .trace-reading-row {
    gap: 6px;
  }
  .trace-target-char {
    font-size: clamp(1.55rem, 3vw, 2rem);
  }
  .trace-dock .kanji-note-text {
    display: none;
  }
  .trace-info-compact .score-chip {
    padding: 8px 6px;
  }
  .compact-actions .button {
    min-height: 38px;
    font-size: 0.82rem;
    padding: 8px 10px;
  }
  .floating-battle-log {
    top: auto;
    bottom: 126px;
    width: min(220px, calc(100% - 252px));
    padding: 10px 12px;
  }
  #battle-log-body {
    font-size: 0.8rem;
    line-height: 1.5;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .battle-log-collapsed .trace-dock,
  .compact-landscape .trace-dock {
    width: clamp(162px, 25vw, 192px);
  }
  .battle-screen-head-compact .battle-screen-title,
  .battle-screen-head-compact .battle-screen-actions {
    padding: 10px 12px;
  }
  .battle-mode-name {
    font-size: 0.96rem;
  }
  .wave-pill {
    min-height: 26px;
    padding: 0 9px;
    font-size: 0.7rem;
  }
  .battle-board-top {
    width: min(470px, calc(100% - 208px));
  }
  .trace-reading-chip {
    min-height: 28px;
    font-size: 0.8rem;
  }
  .trace-guide-button {
    padding: 6px 8px;
    font-size: 0.7rem;
  }
  .battle-log-toggle {
    left: 14px;
    bottom: 14px;
  }
  .battle-log-toggle-button {
    min-height: 34px;
    padding: 8px 10px;
    font-size: 0.74rem;
  }
}



/* MAGIC_BARRAGE_PHASE_V1 */
.magic-barrage-panel {
  position: absolute;
  top: clamp(96px, 11vh, 168px);
  right: calc(var(--trace-dock-width, 320px) + clamp(12px, 1.4vw, 24px));
  bottom: clamp(18px, 2vh, 28px);
  width: clamp(72px, 6vw, 96px);
  z-index: 9;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  pointer-events: none;
}
.magic-barrage-panel.hidden {
  display: none !important;
}
.magic-barrage-title,
#magic-barrage-hint {
  pointer-events: none;
  text-align: center;
  color: #f5f7ff;
  text-shadow: 0 2px 12px rgba(21, 27, 56, 0.45);
}
.magic-barrage-title {
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}
#magic-barrage-hint {
  font-size: 0.68rem;
  line-height: 1.45;
}
.magic-launchpad {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 280px;
  border-radius: 24px;
  border: 2px solid rgba(98, 128, 255, 0.66);
  background: linear-gradient(180deg, rgba(26, 38, 88, 0.24), rgba(43, 63, 132, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 14px 28px rgba(31, 47, 92, 0.18);
  overflow: visible;
  pointer-events: none;
}
.magic-orb {
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.98), rgba(255,255,255,0.74) 16%, rgba(166, 196, 255, 0.42) 17%, rgba(68, 107, 255, 0.86) 58%, rgba(54, 74, 170, 0.96) 82%, rgba(30, 44, 116, 0.98));
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.34),
    0 0 24px rgba(71, 109, 255, 0.46),
    0 12px 22px rgba(20, 31, 82, 0.22);
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
  will-change: transform;
  overflow: hidden;
}
.magic-orb::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-image: var(--orb-image, none);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 60%;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.4));
}
.magic-orb::after {
  content: "";
  position: absolute;
  inset: 8% 12% auto auto;
  width: 32%;
  height: 24%;
  border-radius: 50%;
  background: rgba(255,255,255,0.72);
  filter: blur(0.5px);
}
.magic-orb.is-dragging {
  cursor: grabbing;
}
.magic-orb.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.magic-orb.is-spent {
  opacity: 0.1;
}
.magic-finisher-layer {
  position: absolute;
  left: 50%;
  top: 58%;
  width: min(44vw, 540px);
  height: min(60vh, 430px);
  transform: translate(-50%, -50%);
  z-index: 10;
  display: grid;
  place-items: center;
  pointer-events: none;
  filter: drop-shadow(0 0 32px rgba(74, 130, 255, 0.32)) drop-shadow(0 20px 42px rgba(30, 44, 116, 0.18));
}
.magic-finisher-layer.hidden {
  display: none !important;
}
.magic-finisher-video,
.magic-finisher-poster {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}
.magic-finisher-poster.hidden,
.magic-finisher-video.hidden {
  display: none !important;
}
.enemy-arena.barrage-active .trace-area {
  opacity: 0.92;
}
@media (orientation: landscape) and (max-height: 720px) {
  .magic-barrage-panel {
    right: calc(var(--trace-dock-width, 260px) + 10px);
    top: 112px;
    width: clamp(60px, 6.8vw, 84px);
    bottom: 10px;
    gap: 8px;
  }
  .magic-launchpad {
    min-height: 220px;
    border-radius: 18px;
  }
  .magic-orb {
    width: 40px;
    height: 40px;
  }
  .magic-finisher-layer {
    width: min(40vw, 360px);
    height: min(48vh, 290px);
    top: 58%;
  }
}
@media (orientation: landscape) and (max-height: 540px) {
  .magic-barrage-panel {
    width: clamp(54px, 6vw, 74px);
    top: 98px;
    bottom: 10px;
  }
  .magic-launchpad {
    min-height: 188px;
  }
  .magic-orb {
    width: 34px;
    height: 34px;
  }
  .magic-finisher-layer {
    width: min(36vw, 300px);
    height: min(40vh, 230px);
    top: 60%;
  }
}


/* MOBILE_FULLSCREEN_LAYOUT_FIX_V1 */
.mobile-landscape-compact body,
body.mobile-landscape-compact {
  overflow: hidden;
}
body.mobile-landscape-compact .play-wrap {
  padding: 6px;
}
body.mobile-landscape-compact .battle-shell-arcade {
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
}
body.mobile-landscape-compact .battle-screen-head-unified {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr) auto;
  gap: 6px;
}
body.mobile-landscape-compact .battle-screen-head-unified .battle-screen-title,
body.mobile-landscape-compact .battle-screen-actions-unified {
  min-height: 50px;
  padding: 10px 12px;
  border-radius: 16px;
}
body.mobile-landscape-compact .battle-topbar-meta,
body.mobile-landscape-compact .battle-screen-head-unified .battle-caption {
  display: none;
}
body.mobile-landscape-compact .battle-screen-title h1,
body.mobile-landscape-compact .battle-screen-title h2 {
  font-size: 0.92rem;
}
body.mobile-landscape-compact .battle-enemy-inline {
  padding: 6px 8px;
  max-width: 48%;
}
body.mobile-landscape-compact .battle-enemy-inline strong {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.mobile-landscape-compact .unified-arena {
  --trace-dock-width: clamp(176px, 23vw, 206px);
  border-radius: 16px;
}
body.mobile-landscape-compact .battle-board-top {
  top: 8px;
  left: 8px;
  width: min(204px, calc(100% - var(--trace-dock-width) - 20px));
  grid-template-columns: 1fr;
  gap: 4px;
}
body.mobile-landscape-compact .board-hud-card,
body.mobile-landscape-compact .board-score-card {
  min-height: 54px;
  padding: 7px 8px;
  border-radius: 12px;
}
body.mobile-landscape-compact .board-score-card {
  min-width: 0;
}
body.mobile-landscape-compact .board-hud-card .hp-label,
body.mobile-landscape-compact .board-score-card .hud-label,
body.mobile-landscape-compact .board-score-card small,
body.mobile-landscape-compact #magic-hit-hint,
body.mobile-landscape-compact .hud-sub {
  font-size: 0.60rem;
}
body.mobile-landscape-compact .board-hud-card strong,
body.mobile-landscape-compact .board-score-card strong,
body.mobile-landscape-compact .hp-label-compact strong {
  font-size: 0.9rem;
}
body.mobile-landscape-compact .trace-dock {
  right: 8px;
  bottom: 8px;
  width: var(--trace-dock-width);
  max-width: var(--trace-dock-width);
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
}
body.mobile-landscape-compact .trace-reading-label {
  font-size: 0.62rem;
}
body.mobile-landscape-compact .trace-reading-chip {
  min-height: 22px;
  padding: 0 8px;
  font-size: 0.68rem;
}
body.mobile-landscape-compact .trace-guide-button {
  padding: 5px 7px;
  font-size: 0.64rem;
}
body.mobile-landscape-compact .trace-target-char {
  min-width: 28px;
  min-height: 28px;
  border-radius: 10px;
  font-size: 1.12rem;
}
body.mobile-landscape-compact .canvas-frame-unified {
  width: min(100%, 156px);
  border-radius: 14px;
}
body.mobile-landscape-compact .trace-info-compact {
  gap: 4px;
}
body.mobile-landscape-compact .trace-info-compact .score-chip {
  padding: 4px 3px;
  border-radius: 10px;
}
body.mobile-landscape-compact .trace-info-compact .score-chip span {
  font-size: 0.52rem;
}
body.mobile-landscape-compact .trace-info-compact .score-chip strong {
  font-size: 0.72rem;
}
body.mobile-landscape-compact .compact-actions .button {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 0.7rem;
}
body.mobile-landscape-compact .floating-battle-log {
  left: 8px;
  bottom: 8px;
  width: min(150px, calc(100% - var(--trace-dock-width) - 18px));
  padding: 8px 10px;
  border-radius: 14px;
}
body.mobile-landscape-compact .floating-battle-log h3 {
  font-size: 0.7rem;
}
body.mobile-landscape-compact .floating-battle-log #battle-log-body {
  min-height: 22px;
  font-size: 0.72rem;
}
body.mobile-landscape-compact .stone-zone {
  left: 8px;
  bottom: 8px;
  width: min(148px, calc(100% - var(--trace-dock-width) - 18px));
  padding: 8px 9px 8px;
  border-radius: 14px;
}
body.mobile-landscape-compact .stone-zone-copy small {
  display: none;
}
body.mobile-landscape-compact .stone-launchpad {
  height: 74px;
  margin-top: 6px;
}
body.mobile-landscape-compact .stone-ball {
  width: 30px;
  height: 30px;
}
body.mobile-landscape-compact .phase-video-slot-stone {
  left: 6px;
  bottom: 6px;
  width: 56px;
  height: 56px;
}
body.mobile-landscape-compact .magic-barrage-panel {
  top: 76px;
  right: calc(var(--trace-dock-width) + 6px);
  bottom: 6px;
  width: 48px;
  gap: 6px;
}
body.mobile-landscape-compact .magic-launchpad {
  min-height: 150px;
  border-radius: 14px;
}
body.mobile-landscape-compact .magic-orb {
  width: 28px;
  height: 28px;
}
body.mobile-landscape-compact .magic-finisher-layer {
  left: 42%;
  top: 58%;
  width: min(42vw, 210px);
  height: min(32vh, 150px);
}
/* SITE_MEDIA_ADMIN_V1 */
.brand-logo-wrap {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(91, 108, 240, 0.12);
  border: 1px solid rgba(91, 108, 240, 0.18);
  box-shadow: var(--shadow);
}
.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(180px, 34vw);
  max-width: 100%;
  margin-bottom: 10px;
}
.hero-logo {
  width: 100%;
  max-height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(33, 46, 90, 0.18));
}
.image-preview-logo {
  width: min(260px, 100%);
  padding: 12px;
}
.image-preview-logo img {
  width: 100%;
  max-height: 110px;
  object-fit: contain;
}
.media-preview {
  width: min(360px, 100%);
  border: 1px solid rgba(220, 226, 240, 0.9);
  border-radius: 18px;
  background: rgba(247, 249, 254, 0.95);
  padding: 12px;
}
.media-preview video {
  width: 100%;
  border-radius: 14px;
  display: block;
  background: rgba(18, 24, 40, 0.08);
}

.table-video-thumb {
  width: 148px;
  max-width: 100%;
  border-radius: 14px;
  display: block;
  background: rgba(18, 24, 40, 0.08);
}

/* PHASE_VIDEO_SLOTS_V1 */
.phase-video-slot {
  position: absolute;
  z-index: 9;
  pointer-events: none;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 14px 26px rgba(27, 40, 76, 0.14));
}
.phase-video-slot.hidden {
  display: none !important;
}
.phase-video-slot-stone {
  left: clamp(10px, 1.6vw, 24px);
  bottom: clamp(8px, 1vw, 18px);
  width: clamp(104px, 11vw, 168px);
  height: clamp(104px, 11vw, 168px);
}
.phase-video-slot-magic {
  right: calc(var(--trace-dock-width, 320px) + clamp(12px, 1.4vw, 24px));
  bottom: clamp(8px, 1vw, 20px);
  width: clamp(116px, 12vw, 186px);
  height: clamp(116px, 12vw, 186px);
}
.phase-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  border: 0;
}
.phase-video-flip {
  transform: scaleX(-1);
}

@media (max-width: 1180px) {
  .phase-video-slot-stone {
    width: clamp(92px, 12vw, 142px);
    height: clamp(92px, 12vw, 142px);
  }
  .phase-video-slot-magic {
    width: clamp(102px, 12vw, 154px);
    height: clamp(102px, 12vw, 154px);
  }
}

@media (orientation: landscape) and (max-height: 720px) {
  .phase-video-slot-stone {
    width: clamp(74px, 9vw, 122px);
    height: clamp(74px, 9vw, 122px);
    left: 8px;
    bottom: 8px;
  }
  .phase-video-slot-magic {
    width: clamp(86px, 10vw, 136px);
    height: clamp(86px, 10vw, 136px);
    bottom: 8px;
    right: calc(var(--trace-dock-width, 260px) + 10px);
  }
  .hero-logo-wrap {
    width: min(140px, 30vw);
  }
}

@media (max-width: 820px) {
  .brand-logo-wrap,
  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }
  .brand strong {
    font-size: 0.95rem;
  }
  .brand small {
    font-size: 0.76rem;
  }
  .media-preview {
    width: 100%;
  }
}


/* FULLSCREEN_ROOT_AND_DELAY_FIX_V1 */
.play-wrap.immersive-mode,
#game-root:fullscreen,
#game-root:-webkit-full-screen {
  position: fixed;
  inset: 0;
  z-index: 999;
  width: 100vw;
  min-width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background-size: cover;
  background-position: center center;
}
body.immersive-mode,
body.immersive-mode .page-shell {
  overflow: hidden;
}
body.immersive-mode .page-shell {
  width: 100vw;
  max-width: 100vw;
  min-height: 100dvh;
  height: 100dvh;
  padding: 0;
}
.play-wrap.immersive-mode .battle-shell-arcade,
#game-root:fullscreen .battle-shell-arcade,
#game-root:-webkit-full-screen .battle-shell-arcade {
  width: 100%;
  max-width: none;
  min-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  border-radius: 22px;
}
body.immersive-mode:not(.mobile-landscape-compact) .battle-shell-arcade {
  gap: 14px;
}
body.immersive-mode:not(.mobile-landscape-compact) .battle-screen-head-unified {
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.15fr) auto;
  gap: 12px;
}
body.immersive-mode:not(.mobile-landscape-compact) .battle-screen-head-unified .battle-screen-title,
body.immersive-mode:not(.mobile-landscape-compact) .battle-screen-actions-unified {
  min-height: 64px;
  padding: 16px 18px;
}
body.immersive-mode:not(.mobile-landscape-compact) .battle-topbar-meta,
body.immersive-mode:not(.mobile-landscape-compact) .battle-screen-head-unified .battle-caption {
  display: block;
}
body.immersive-mode:not(.mobile-landscape-compact) .battle-board-top {
  width: min(980px, calc(100% - 380px));
}
body.immersive-mode:not(.mobile-landscape-compact) .trace-dock {
  width: clamp(286px, 31vw, 360px);
  max-width: clamp(286px, 31vw, 360px);
}
body.mobile-landscape-compact.immersive-mode .battle-shell-arcade,
body.mobile-landscape-compact #game-root.immersive-mode .battle-shell-arcade,
#game-root:fullscreen.mobile-landscape-compact .battle-shell-arcade,
#game-root:-webkit-full-screen.mobile-landscape-compact .battle-shell-arcade {
  border-radius: 16px;
}
/* SPELL_VIDEO_DIAG_AND_MOBILE_FIX_V1 */
body.mobile-landscape-compact .page-shell {
  width: 100vw;
  max-width: 100vw;
  overflow-x: hidden;
}
body.mobile-landscape-compact .play-wrap,
body.mobile-landscape-compact.play-body .play-wrap,
body.mobile-landscape-compact #game-root.immersive-mode,
#game-root:fullscreen.mobile-landscape-compact,
#game-root:-webkit-full-screen.mobile-landscape-compact {
  width: 100vw;
  min-width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  padding: 4px;
}
body.mobile-landscape-compact .battle-screen-head-unified {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
}
body.mobile-landscape-compact .battle-screen-title,
body.mobile-landscape-compact .battle-screen-actions-unified {
  min-width: 0;
}
body.mobile-landscape-compact .battle-screen-title {
  padding-right: 8px;
}
body.mobile-landscape-compact .battle-topbar-row {
  gap: 6px;
  flex-wrap: wrap;
}
body.mobile-landscape-compact .battle-title-row-main {
  gap: 6px;
}
body.mobile-landscape-compact .battle-mode-name {
  font-size: 0.94rem;
}
body.mobile-landscape-compact .wave-pill {
  padding: 4px 8px;
  font-size: 0.68rem;
}
body.mobile-landscape-compact .battle-enemy-inline {
  max-width: 46%;
  padding: 4px 6px;
}
body.mobile-landscape-compact .battle-enemy-inline strong {
  font-size: 0.78rem;
}
body.mobile-landscape-compact .battle-screen-head-unified .battle-screen-title,
body.mobile-landscape-compact .battle-screen-actions-unified {
  min-height: 42px;
  padding: 8px 10px;
}
body.mobile-landscape-compact .battle-screen-actions-unified {
  gap: 6px;
}
body.mobile-landscape-compact .battle-screen-actions-unified .button {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 0.68rem;
}
body.mobile-landscape-compact .arcade-arena {
  min-height: calc(var(--app-height, 100vh) - 88px);
  padding: 6px;
  border-radius: 16px;
}
body.mobile-landscape-compact .unified-arena {
  --trace-dock-width: clamp(132px, 19vw, 156px);
}
body.mobile-landscape-compact .battle-board-top {
  top: 6px;
  left: 6px;
  width: min(132px, calc(100% - var(--trace-dock-width) - 10px));
}
body.mobile-landscape-compact .trace-dock {
  right: 6px;
  bottom: 6px;
  width: var(--trace-dock-width);
  max-width: var(--trace-dock-width);
  gap: 3px;
  padding: 4px;
}
body.mobile-landscape-compact .trace-dock-head {
  gap: 4px;
}
body.mobile-landscape-compact .trace-target-char {
  min-width: 24px;
  min-height: 24px;
  font-size: 0.94rem;
}
body.mobile-landscape-compact .canvas-frame-unified {
  width: min(100%, 120px);
  border-radius: 12px;
}
body.mobile-landscape-compact .trace-info-compact {
  gap: 3px;
}
body.mobile-landscape-compact .trace-info-compact .score-chip {
  padding: 3px 2px;
}
body.mobile-landscape-compact .trace-info-compact .score-chip strong {
  font-size: 0.66rem;
}
body.mobile-landscape-compact .floating-battle-log {
  width: min(116px, calc(100% - var(--trace-dock-width) - 10px));
  padding: 6px 8px;
}
body.mobile-landscape-compact .stone-zone {
  width: min(116px, calc(100% - var(--trace-dock-width) - 10px));
  padding: 6px 7px;
}
body.mobile-landscape-compact .stone-launchpad {
  height: 68px;
}
body.mobile-landscape-compact .stone-ball {
  width: 26px;
  height: 26px;
}
body.mobile-landscape-compact .phase-video-slot-stone {
  left: 4px;
  bottom: 4px;
  width: 48px;
  height: 48px;
}
body.mobile-landscape-compact .magic-barrage-panel {
  top: 60px;
  right: calc(var(--trace-dock-width) + 4px);
  bottom: 4px;
  width: 40px;
  gap: 4px;
}
body.mobile-landscape-compact .magic-launchpad {
  min-height: 126px;
  border-radius: 12px;
}
body.mobile-landscape-compact .magic-orb {
  width: 24px;
  height: 24px;
}
body.mobile-landscape-compact .magic-finisher-layer {
  left: 40%;
  top: 56%;
  width: min(34vw, 148px);
  height: min(26vh, 118px);
}

body.mobile-landscape-compact.immersive-mode .battle-screen-head-unified,
#game-root:fullscreen.mobile-landscape-compact .battle-screen-head-unified,
#game-root:-webkit-full-screen.mobile-landscape-compact .battle-screen-head-unified {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
}
body.mobile-landscape-compact.immersive-mode .battle-shell-arcade,
#game-root:fullscreen.mobile-landscape-compact .battle-shell-arcade,
#game-root:-webkit-full-screen.mobile-landscape-compact .battle-shell-arcade {
  gap: 6px;
  padding: 6px;
}
body.mobile-landscape-compact.immersive-mode .arcade-arena,
#game-root:fullscreen.mobile-landscape-compact .arcade-arena,
#game-root:-webkit-full-screen.mobile-landscape-compact .arcade-arena {
  min-height: calc(100dvh - 74px);
  padding: 6px;
}

/* FULLSCREEN_RESPONSIVE_REBUILD_V2 */
body.play-body.play-body-arcade {
  background: #0d1528;
}
body.play-body.play-body-arcade .page-shell {
  width: 100vw;
  max-width: 100vw;
  min-height: var(--app-height, 100dvh);
  height: var(--app-height, 100dvh);
  padding: 0;
}
body.play-body.play-body-arcade .unified-play-wrap {
  min-height: var(--app-height, 100dvh);
  height: var(--app-height, 100dvh);
  padding: 0;
}
body.play-body.play-body-arcade .battle-shell-arcade,
body.play-body.play-body-arcade.immersive-mode .battle-shell-arcade,
body.play-body.play-body-arcade #game-root.immersive-mode .battle-shell-arcade,
body.play-body.play-body-arcade #game-root:fullscreen .battle-shell-arcade,
body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-shell-arcade {
  min-height: var(--app-height, 100dvh);
  height: var(--app-height, 100dvh);
  gap: 10px;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
body.play-body.play-body-arcade .battle-shell-arcade::after {
  display: none;
}
body.play-body.play-body-arcade .battle-screen-head-unified,
body.immersive-mode.play-body.play-body-arcade .battle-screen-head-unified,
#game-root:fullscreen .battle-screen-head-unified,
#game-root:-webkit-full-screen .battle-screen-head-unified {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
body.play-body.play-body-arcade .battle-screen-head-unified .battle-screen-title,
body.play-body.play-body-arcade .battle-screen-actions-unified {
  min-height: 0;
}
body.play-body.play-body-arcade .battle-screen-actions-unified {
  justify-content: flex-end;
  flex-wrap: wrap;
}
body.play-body.play-body-arcade .battle-board {
  min-height: 0;
  flex: 1 1 auto;
}
body.play-body.play-body-arcade .arcade-arena {
  min-height: 0;
  height: 100%;
}
body.play-body.play-body-arcade .arena-mobile-playfield-spacer {
  display: none;
}

@media (orientation: portrait) and (max-width: 1100px), (max-width: 680px) {
  body.play-body.play-body-arcade .battle-shell-arcade,
  body.play-body.play-body-arcade #game-root.immersive-mode .battle-shell-arcade,
  body.play-body.play-body-arcade #game-root:fullscreen .battle-shell-arcade,
  body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-shell-arcade {
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  body.play-body.play-body-arcade .battle-screen-head-unified,
  body.immersive-mode.play-body.play-body-arcade .battle-screen-head-unified,
  #game-root:fullscreen .battle-screen-head-unified,
  #game-root:-webkit-full-screen .battle-screen-head-unified {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body.play-body.play-body-arcade .battle-screen-head-unified .battle-screen-title,
  body.play-body.play-body-arcade .battle-screen-actions-unified {
    padding: 12px 14px;
    border-radius: 18px;
  }

  body.play-body.play-body-arcade .battle-screen-actions-unified {
    justify-content: flex-start;
  }

  body.play-body.play-body-arcade .arcade-arena {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    height: auto;
    min-height: 0;
    padding: 12px;
    overflow: auto;
  }

  body.play-body.play-body-arcade .battle-board-top,
  body.play-body.play-body-arcade .stone-zone,
  body.play-body.play-body-arcade .trace-dock,
  body.play-body.play-body-arcade .floating-battle-log,
  body.play-body.play-body-arcade .battle-log-toggle,
  body.play-body.play-body-arcade .magic-barrage-panel {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  body.play-body.play-body-arcade .battle-board-top {
    order: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.play-body.play-body-arcade .board-hud-card,
  body.play-body.play-body-arcade .board-score-card {
    min-height: 72px;
    padding: 12px;
    border-radius: 18px;
  }

  body.play-body.play-body-arcade .board-score-card {
    grid-column: auto;
    justify-self: stretch;
    min-width: 0;
  }

  body.play-body.play-body-arcade .board-score-card strong {
    font-size: 1.1rem;
  }

  body.play-body.play-body-arcade .arena-mobile-playfield-spacer {
    display: block;
    order: 2;
    flex: 0 0 clamp(240px, 34svh, 420px);
    border-radius: 18px;
    pointer-events: none;
  }

  body.play-body.play-body-arcade .magic-barrage-panel {
    order: 3;
    align-self: flex-end;
    width: min(100%, 96px);
    min-height: 0;
    height: auto;
    padding: 0;
  }

  body.play-body.play-body-arcade .magic-launchpad {
    min-height: 240px;
    height: 240px;
  }

  body.play-body.play-body-arcade .stone-zone {
    order: 4;
    padding: 12px 14px;
    border-radius: 18px;
  }

  body.play-body.play-body-arcade .stone-launchpad {
    height: 86px;
  }

  body.play-body.play-body-arcade .trace-dock {
    order: 5;
    width: 100%;
    max-width: none;
    gap: 10px;
    padding: 14px;
    border-radius: 18px;
    grid-template-rows: auto auto auto;
  }

  body.play-body.play-body-arcade .trace-target-row {
    align-items: center;
  }

  body.play-body.play-body-arcade .trace-area-unified {
    display: flex;
    justify-content: center;
  }

  body.play-body.play-body-arcade .canvas-frame-unified {
    width: min(100%, 440px);
  }

  body.play-body.play-body-arcade .trace-info-compact {
    gap: 8px;
  }

  body.play-body.play-body-arcade .floating-battle-log {
    order: 6;
    padding: 12px 14px;
    border-radius: 18px;
  }

  body.play-body.play-body-arcade .battle-log-toggle {
    order: 6;
  }

  body.play-body.play-body-arcade .phase-video-slot-stone {
    display: none !important;
  }
}

@media (max-width: 520px) {
  body.play-body.play-body-arcade .battle-board-top {
    grid-template-columns: 1fr;
  }

  body.play-body.play-body-arcade .battle-topbar-row {
    align-items: flex-start;
  }

  body.play-body.play-body-arcade .battle-title-row-main {
    gap: 6px;
  }

  body.play-body.play-body-arcade .battle-mode-name {
    font-size: 1rem;
  }

  body.play-body.play-body-arcade .battle-enemy-inline {
    max-width: 100%;
  }

  body.play-body.play-body-arcade .arena-mobile-playfield-spacer {
    flex-basis: clamp(210px, 30svh, 300px);
  }

  body.play-body.play-body-arcade .canvas-frame-unified {
    width: 100%;
  }
}


/* FULLSCREEN_AND_ENEMY_VISIBILITY_FIX_V2 */
body.play-body.play-body-arcade #game-root.immersive-mode,
body.play-body.play-body-arcade #game-root:fullscreen,
body.play-body.play-body-arcade #game-root:-webkit-full-screen {
  width: 100vw;
  min-width: 100vw;
  max-width: 100vw;
  min-height: 100dvh;
  height: 100dvh;
}
body.play-body.play-body-arcade #game-root.immersive-mode .battle-shell-arcade,
body.play-body.play-body-arcade #game-root:fullscreen .battle-shell-arcade,
body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-shell-arcade {
  width: 100%;
  min-height: 100%;
  height: 100%;
}
body.mobile-landscape-compact .battle-board-top {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(196px, calc(100% - var(--trace-dock-width) - 12px));
}
body.mobile-landscape-compact .board-score-card {
  grid-column: auto;
  justify-self: stretch;
}
body.mobile-landscape-compact .board-hud-card,
body.mobile-landscape-compact .board-score-card {
  min-height: 46px;
}
body.mobile-landscape-compact .board-hud-card strong,
body.mobile-landscape-compact .board-score-card strong,
body.mobile-landscape-compact .hp-label-compact strong {
  font-size: 0.84rem;
}
body.mobile-landscape-compact .enemy-node {
  z-index: 5;
}


/* FULLSCREEN_WIDTH_AND_MAGIC_PANEL_FIX_V3 */
body.play-body.play-body-arcade .unified-play-wrap,
body.play-body.play-body-arcade #game-root.immersive-mode,
body.play-body.play-body-arcade #game-root:fullscreen,
body.play-body.play-body-arcade #game-root:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-width: 100vw;
}
body.play-body.play-body-arcade .battle-shell-arcade,
body.play-body.play-body-arcade #game-root.immersive-mode .battle-shell-arcade,
body.play-body.play-body-arcade #game-root:fullscreen .battle-shell-arcade,
body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-shell-arcade {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
body.play-body.play-body-arcade .battle-screen-head.battle-screen-head-unified.battle-screen-head-compact,
body.play-body.play-body-arcade #game-root.immersive-mode .battle-screen-head.battle-screen-head-unified.battle-screen-head-compact,
body.play-body.play-body-arcade #game-root:fullscreen .battle-screen-head.battle-screen-head-unified.battle-screen-head-compact,
body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-screen-head.battle-screen-head-unified.battle-screen-head-compact {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}
body.play-body.play-body-arcade .battle-screen-actions-unified,
body.play-body.play-body-arcade #game-root.immersive-mode .battle-screen-actions-unified,
body.play-body.play-body-arcade #game-root:fullscreen .battle-screen-actions-unified,
body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-screen-actions-unified {
  width: auto;
  justify-self: end;
}
body.play-body.play-body-arcade .battle-board,
body.play-body.play-body-arcade .arcade-arena {
  width: 100%;
}

/* OBSTACLE_MODE_V1 */
.mode-card-obstacle {
  box-shadow: 0 20px 44px rgba(84, 104, 214, 0.12);
  border-color: rgba(152, 170, 255, 0.62);
}
.mode-card-obstacle h2 {
  color: #4456cd;
}
.obstacle-shell .trace-target-char {
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
}
.obstacle-target-row {
  gap: 10px;
}
.obstacle-dock {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
}
.obstacle-trace-area {
  margin-top: 4px;
}
.obstacle-canvas-frame {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  min-height: clamp(320px, 50vh, 560px);
  aspect-ratio: auto;
  background:
    linear-gradient(180deg, rgba(252, 253, 255, 0.96), rgba(242, 246, 255, 0.92)),
    linear-gradient(90deg, rgba(95, 112, 240, 0.04), transparent 36%, rgba(95, 112, 240, 0.03));
}
.obstacle-phrase-progress {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
}
.obstacle-phrase-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: rgba(233, 237, 255, 0.92);
  border: 1px solid rgba(141, 158, 244, 0.28);
  color: #6072da;
  font-weight: 900;
  font-size: 1.15rem;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.obstacle-phrase-char.is-active {
  background: linear-gradient(135deg, rgba(109, 124, 244, 0.18), rgba(137, 161, 255, 0.22));
  color: #4053d6;
  transform: translateY(-1px);
}
.obstacle-phrase-char.is-complete {
  background: linear-gradient(135deg, rgba(113, 219, 138, 0.16), rgba(187, 246, 181, 0.2));
  color: #2b8454;
  border-color: rgba(104, 191, 126, 0.26);
}
.runner-svg {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: clamp(230px, 32vh, 420px);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 18%, rgba(110, 125, 242, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 243, 255, 0.94));
  box-shadow: inset 0 0 0 1px rgba(123, 141, 223, 0.14);
}
.runner-grid-line {
  stroke: rgba(132, 148, 228, 0.2);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}
.runner-grid-line-strong {
  stroke: rgba(116, 132, 224, 0.38);
}
.runner-path {
  fill: none;
  stroke: rgba(174, 184, 216, 0.82);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 2px 4px rgba(92, 108, 189, 0.08));
}
.runner-path.is-active {
  stroke: rgba(96, 114, 224, 0.92);
}
.runner-path.is-complete {
  stroke: rgba(92, 195, 124, 0.9);
}
.runner-trap {
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.runner-trap.is-passed {
  opacity: 0.26;
}
.runner-trap-pit {
  fill: rgba(45, 57, 104, 0.72);
  stroke: rgba(20, 28, 58, 0.4);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}
.runner-trap-mark {
  fill: none;
  stroke: rgba(255, 201, 84, 0.96);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.runner-avatar-group {
  transform-origin: center center;
  transition: transform 0.08s linear;
}
.runner-avatar-group.is-falling {
  opacity: 0.92;
}
.runner-avatar-image {
  overflow: visible;
}
.runner-avatar-fallback {
  fill: rgba(98, 191, 118, 0.88);
  stroke: rgba(31, 108, 49, 0.16);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}
.runner-avatar-shadow {
  fill: rgba(22, 35, 68, 0.22);
}
.obstacle-fall-banner {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(90%, 320px);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 247, 231, 0.96);
  color: #9a5b1e;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 14px 28px rgba(84, 56, 10, 0.14);
  z-index: 7;
}
.button-accent {
  background: linear-gradient(135deg, #ffbc58, #f08a42);
  color: #fff;
  box-shadow: 0 10px 20px rgba(240, 138, 66, 0.24);
}
.button-accent:hover {
  background: linear-gradient(135deg, #ffb046, #ea7c2f);
}
.button.is-jumping,
.button-accent.is-jumping {
  transform: translateY(-2px) scale(1.02);
}
.obstacle-actions {
  align-items: stretch;
}
.obstacle-actions .button {
  min-height: 52px;
}
@media (max-width: 1100px) {
  .obstacle-canvas-frame {
    min-height: clamp(280px, 42vh, 460px);
  }
}
@media (max-width: 720px) {
  .obstacle-canvas-frame {
    padding: 12px;
    min-height: clamp(250px, 42vh, 380px);
  }
  .obstacle-phrase-char {
    min-width: 2.1rem;
    min-height: 2.1rem;
    font-size: 1rem;
  }
  .runner-svg {
    min-height: 220px;
  }
}
body.mobile-landscape-compact .obstacle-dock {
  gap: 10px;
}
body.mobile-landscape-compact .obstacle-canvas-frame {
  min-height: 0;
  padding: 10px;
  gap: 8px;
}
body.mobile-landscape-compact .runner-svg {
  min-height: 0;
}
body.mobile-landscape-compact .obstacle-phrase-progress {
  gap: 5px;
  min-height: 28px;
}
body.mobile-landscape-compact .obstacle-phrase-char {
  min-width: 1.7rem;
  min-height: 1.7rem;
  padding: 0 0.3rem;
  font-size: 0.84rem;
}
body.mobile-landscape-compact .obstacle-actions .button {
  min-height: 42px;
  padding: 9px 12px;
}
body.mobile-landscape-compact .obstacle-fall-banner {
  bottom: 8px;
  padding: 8px 12px;
  font-size: 0.76rem;
}

/* OBSTACLE_RUNNER_GLYPH_TRACK_V3 */
body.play-body.play-body-obstacle-runner {
  --runner-stage-overlay: linear-gradient(180deg, rgba(9, 17, 36, 0.12), rgba(9, 17, 36, 0.28));
}

body.play-body.play-body-obstacle-runner .page-shell {
  display: block;
}

.obstacle-runner-root {
  min-height: var(--app-height);
  height: var(--app-height);
  width: 100%;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04)),
    var(--runner-stage-overlay),
    var(--runner-stage-bg, linear-gradient(180deg, #eef4ff 0%, #f7f8fc 100%));
  background-size: cover;
  background-position: center;
  padding: clamp(12px, 2.2vw, 22px);
  overflow: hidden;
}

.obstacle-runner-root.immersive-mode {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.obstacle-runner-shell {
  width: 100%;
  max-width: none;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.obstacle-runner-header,
.obstacle-runner-board {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(216, 224, 243, 0.96);
  box-shadow: 0 16px 30px rgba(47, 62, 105, 0.12);
}

.obstacle-runner-header {
  border-radius: 26px;
  padding: clamp(14px, 2vw, 20px);
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto minmax(180px, 1fr);
  gap: 14px 16px;
  align-items: start;
}

.obstacle-runner-header-main {
  min-width: 0;
}

.obstacle-runner-header-copy {
  grid-column: 1 / -1;
}

.obstacle-runner-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.obstacle-runner-title-row h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.8vw, 2.6rem);
  line-height: 1.05;
}

.obstacle-runner-pill-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.obstacle-runner-pill {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
  padding: 11px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(242, 245, 255, 0.98), rgba(234, 239, 252, 0.95));
  border: 1px solid rgba(214, 221, 243, 0.95);
  color: var(--text);
}

.obstacle-runner-pill small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.obstacle-runner-pill strong {
  font-size: 1.03rem;
}

.obstacle-runner-caption,
.obstacle-runner-note {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.obstacle-runner-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  justify-self: end;
}

.obstacle-runner-control-rack {
  justify-self: center;
  align-self: start;
  width: min(100%, 700px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.obstacle-runner-control-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  padding: 8px 10px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(243, 247, 255, 0.58));
  border: 1px solid rgba(217, 225, 245, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.obstacle-runner-control-hint {
  display: block;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.obstacle-runner-board {
  border-radius: 32px;
  padding: clamp(14px, 2vw, 18px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.72fr);
  gap: 16px;
  overflow: hidden;
}

.obstacle-runner-stage-panel {
  min-width: 0;
  min-height: 0;
  border-radius: 28px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(239, 243, 253, 0.72)),
    rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(217, 224, 245, 0.92);
}

.obstacle-stage-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: clamp(440px, 70dvh, 860px);
  overflow-x: auto;
  overflow-y: hidden;
  padding: clamp(18px, 2vw, 26px) clamp(18px, 2vw, 26px) clamp(30px, 3.4vw, 42px);
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 108, 240, 0.4) rgba(224, 230, 246, 0.55);
  scrollbar-gutter: stable both-edges;
}

.obstacle-stage-viewport::-webkit-scrollbar {
  height: 14px;
}

.obstacle-stage-viewport::-webkit-scrollbar-thumb {
  background: rgba(91, 108, 240, 0.38);
  border-radius: 999px;
  border: 3px solid rgba(240, 244, 252, 0.8);
}

.obstacle-stage-viewport::-webkit-scrollbar-track {
  background: rgba(227, 233, 247, 0.65);
  border-radius: 999px;
}

.obstacle-word-strip {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  gap: clamp(10px, 1.2vw, 18px);
  min-width: 100%;
  width: max-content;
  min-height: 100%;
  padding-top: clamp(18px, 2vw, 26px);
  padding-right: 22px;
  padding-bottom: clamp(26px, 3vw, 40px);
  transition: padding-top 0.24s ease;
}

.obstacle-stage-viewport.is-reading-phase .obstacle-word-strip {
  padding-top: clamp(88px, 10.5vh, 122px);
}

.obstacle-char-card {
  position: relative;
  width: clamp(180px, 18vw, 260px);
  min-width: clamp(180px, 18vw, 260px);
  min-height: min(100%, clamp(360px, 72dvh, 760px));
  border-radius: 28px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(247, 248, 255, 0.98), rgba(236, 241, 255, 0.92));
  border: 1px solid rgba(209, 218, 244, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.obstacle-char-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 24px;
  border: 1px dashed rgba(189, 199, 232, 0.35);
  pointer-events: none;
}

.obstacle-char-card.is-active {
  background: linear-gradient(180deg, rgba(243, 246, 255, 0.99), rgba(230, 236, 255, 0.95));
  border-color: rgba(138, 157, 240, 0.88);
  box-shadow: 0 18px 28px rgba(89, 105, 195, 0.16);
}

.obstacle-char-card.is-complete {
  background: linear-gradient(180deg, rgba(240, 255, 247, 0.98), rgba(228, 248, 237, 0.94));
  border-color: rgba(83, 181, 123, 0.54);
}

.obstacle-char-card.is-provisional {
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.99), rgba(255, 243, 225, 0.95));
  border-color: rgba(226, 168, 85, 0.56);
}

.obstacle-char-card.is-fallback {
  background: linear-gradient(180deg, rgba(255, 246, 246, 0.99), rgba(255, 236, 236, 0.95));
  border-color: rgba(225, 117, 117, 0.48);
}

.obstacle-track-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: rgba(126, 82, 10, 0.96);
  background: rgba(255, 244, 213, 0.95);
  border: 1px solid rgba(226, 177, 90, 0.46);
  box-shadow: 0 8px 18px rgba(177, 134, 60, 0.12);
  pointer-events: none;
}

.obstacle-char-card.is-fallback .obstacle-track-badge {
  color: rgba(148, 52, 52, 0.96);
  background: rgba(255, 236, 236, 0.96);
  border-color: rgba(219, 112, 112, 0.42);
  box-shadow: 0 8px 18px rgba(173, 77, 77, 0.10);
}

/* OBSTACLE_REFERENCE_MATCH_V1 */
.obstacle-char-glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(8rem, 14vw, 14rem);
  font-weight: 900;
  color: rgba(83, 102, 210, 0.12);
  letter-spacing: -0.08em;
  user-select: none;
  pointer-events: none;
}

.obstacle-char-card.is-complete .obstacle-char-glyph {
  color: rgba(39, 141, 89, 0.14);
}

.obstacle-char-card.is-complete .obstacle-model-path {
  stroke: rgba(47, 168, 101, 0.16);
}

.obstacle-char-svg {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.obstacle-model-path,
.obstacle-guide-path,
.obstacle-progress-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.obstacle-model-path {
  stroke: rgba(88, 106, 212, 0.18);
  stroke-width: 28;
}

.obstacle-guide-path {
  stroke: rgba(110, 127, 214, 0.22);
  stroke-width: 17.2;
}

.obstacle-progress-path {
  stroke: rgba(66, 88, 210, 0.96);
  stroke-width: 17.8;
  transition: stroke 0.18s ease, opacity 0.18s ease;
}

.obstacle-progress-path.is-complete {
  stroke: rgba(47, 168, 101, 0.92);
}

.obstacle-progress-path.is-current {
  stroke: rgba(59, 82, 215, 1);
}

.obstacle-pit {
  transition: transform 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
}

.obstacle-pit-rim {
  fill: rgba(94, 106, 152, 0.86);
}

.obstacle-pit-shadow {
  fill: rgba(39, 44, 68, 0.92);
}

.obstacle-pit-core {
  fill: rgba(14, 17, 28, 1);
}

.obstacle-pit.is-cleared {
  opacity: 0.34;
  filter: saturate(0.4);
}

.obstacle-pit.is-hit {
  filter: drop-shadow(0 0 10px rgba(255, 84, 84, 0.35)) brightness(1.06);
}

.obstacle-runner-sprite {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(86px, 9.6vw, 132px);
  aspect-ratio: 1 / 1;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
  z-index: 20;
  transform-origin: 56% 80%;
  transform: translate(-56%, -80%) translateY(var(--runner-extra-y, 0px)) scaleX(var(--runner-scale-x, 1)) scale(var(--runner-scale, 1));
  opacity: var(--runner-opacity, 1);
  transition: filter 0.18s ease, opacity 0.18s ease;
  filter: drop-shadow(0 14px 16px rgba(23, 33, 71, 0.22));
}

.obstacle-runner-sprite.is-jumping {
  filter: drop-shadow(0 18px 18px rgba(59, 82, 215, 0.18));
}

.obstacle-runner-sprite.is-falling {
  filter: drop-shadow(0 10px 10px rgba(17, 24, 45, 0.18));
}

.obstacle-runner-sprite img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.obstacle-runner-sprite:focus-visible,
.obstacle-shooter-dock:focus-visible {
  outline: 3px solid rgba(84, 103, 222, 0.42);
  outline-offset: 3px;
  border-radius: 999px;
}

.obstacle-stage-loading {
  position: absolute;
  inset: 20px;
  display: none;
  place-items: center;
  border-radius: 24px;
  background: rgba(245, 248, 255, 0.92);
  color: var(--primary-2);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  z-index: 26;
}

.obstacle-stage-loading.is-visible {
  display: grid;
}

/* OBSTACLE_READING_SHOT_PHASE_V1 */
/* OBSTACLE_READING_LAYOUT_AND_F_KEY_V1 */
/* OBSTACLE_TOP_READING_AND_HEADER_ACTIONS_V1 */
.obstacle-footer-reading-shell {
  min-width: 0;
}

.obstacle-reading-overlay {
  position: absolute;
  left: clamp(18px, 2vw, 26px);
  right: clamp(18px, 2vw, 26px);
  top: clamp(14px, 1.8vw, 22px);
  z-index: 28;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.obstacle-reading-overlay.is-hidden {
  opacity: 0;
  transform: translateY(-10px);
}

.obstacle-reading-lane {
  display: grid;
  grid-template-columns: clamp(80px, 8vw, 104px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(14px, 1.8vw, 22px);
  pointer-events: none;
}

.obstacle-shooter-dock {
  position: relative;
  width: clamp(72px, 8vw, 96px);
  aspect-ratio: 1 / 1;
  appearance: none;
  border: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  place-items: center;
  justify-self: start;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
}

.obstacle-shooter-dock.is-firing {
  animation: obstacleShooterKick 0.18s ease;
}

@keyframes obstacleShooterKick {
  0% { transform: translateX(0) scale(1); }
  48% { transform: translateX(4px) scale(0.97); }
  100% { transform: translateX(0) scale(1); }
}

.obstacle-shooter-dock img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(31, 42, 93, 0.18));
}

.obstacle-reading-targets {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(clamp(60px, 8vw, 88px), 1fr);
  gap: clamp(18px, 2vw, 28px);
  min-width: 0;
  align-items: center;
}

.obstacle-reading-target {
  position: relative;
  min-width: 0;
  min-height: clamp(54px, 7vw, 76px);
  padding: 2px 2px 4px;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  transition: transform 0.18s ease, opacity 0.24s ease, filter 0.18s ease;
}

.obstacle-reading-target.is-current {
  transform: translateY(-2px) scale(1.04);
  filter: drop-shadow(0 10px 18px rgba(73, 92, 204, 0.14));
}

.obstacle-reading-target.is-hit {
  animation: enemyStoneHit 0.34s ease;
}

.obstacle-reading-target.is-broken {
  opacity: 0;
  transform: translateY(-14px) scale(0.74) rotate(-8deg);
  filter: saturate(0.3) blur(1px);
}

.obstacle-reading-target-label {
  display: block;
  color: rgba(31, 42, 93, 0.96);
  font-weight: 900;
  font-size: clamp(1.5rem, 2.5vw, 2.08rem);
  line-height: 1;
}

.obstacle-reading-target-hits {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.obstacle-reading-hit-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(111, 129, 231, 0.28);
  box-shadow: inset 0 0 0 1px rgba(84, 103, 222, 0.18);
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.obstacle-reading-hit-dot.is-on {
  background: rgba(84, 103, 222, 0.95);
}

.obstacle-reading-hit-dot.is-off {
  opacity: 0.2;
  transform: scale(0.7);
}

.obstacle-reading-projectiles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.obstacle-reading-shot {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(24px, 3vw, 34px);
  height: clamp(10px, 1.3vw, 14px);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(78, 104, 241, 0.15), rgba(78, 104, 241, 0.52) 34%, rgba(119, 235, 255, 0.94) 76%, rgba(255,255,255,1));
  box-shadow: 0 0 14px rgba(110, 209, 255, 0.46);
  transform-origin: center;
}

.obstacle-reading-shot::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.98);
  transform: translateY(-50%);
  box-shadow: 0 0 10px rgba(163, 240, 255, 0.72);
}

.obstacle-runner-sprite.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.obstacle-runner-side {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

.obstacle-message-card,
.obstacle-status-card,
.obstacle-help-card {
  background: linear-gradient(180deg, rgba(250, 251, 255, 0.98), rgba(241, 245, 255, 0.94));
  border: 1px solid rgba(216, 223, 244, 0.95);
  border-radius: 24px;
  padding: 16px;
}

.obstacle-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.obstacle-side-head h2 {
  margin: 0;
  font-size: 1rem;
}

.obstacle-message-card p {
  margin: 0;
  line-height: 1.8;
  color: var(--text);
}

.obstacle-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.obstacle-score-chip {
  min-height: 84px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.86);
}

.obstacle-help-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.8;
}

.obstacle-runner-footer {
  border-radius: 28px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.obstacle-runner-footer-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.obstacle-runner-footer-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.obstacle-runner-footer-copy strong {
  font-size: 1rem;
}

.obstacle-runner-footer-copy small {
  color: var(--muted);
}

.obstacle-runner-footer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.obstacle-jump-button {
  min-width: 150px;
}

body.play-body.play-body-obstacle-runner .result-panel {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 15, 34, 0.46);
}

body.play-body.play-body-obstacle-runner .result-panel.hidden {
  display: none;
}

@media (max-width: 1280px) {
  .obstacle-runner-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .obstacle-runner-control-rack {
    grid-column: 1 / -1;
    width: min(100%, 760px);
  }
}

@media (max-width: 1100px) {
  .obstacle-runner-board {
    grid-template-columns: minmax(0, 1fr);
  }

  .obstacle-runner-side {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: none;
  }
}

@media (max-width: 860px) {
  .obstacle-runner-root {
    padding: 10px;
  }

  .obstacle-runner-shell {
    gap: 10px;
  }

  .obstacle-runner-header {
    grid-template-columns: 1fr;
  }

  .obstacle-runner-header-actions,
  .obstacle-runner-footer-actions,
  .obstacle-runner-control-buttons {
    justify-content: flex-start;
  }

  .obstacle-runner-control-rack {
    width: 100%;
    justify-self: stretch;
    align-items: stretch;
  }

  .obstacle-runner-control-hint {
    text-align: left;
  }

  .obstacle-runner-side {
    grid-template-columns: 1fr;
  }

  .obstacle-stage-viewport {
    min-height: clamp(340px, 56dvh, 620px);
  }

  .obstacle-reading-lane {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 10px;
  }

  .obstacle-reading-target {
    min-height: 46px;
  }

  .obstacle-char-card {
    width: clamp(136px, 34vw, 200px);
    min-width: clamp(136px, 34vw, 200px);
    min-height: clamp(300px, 52dvh, 500px);
  }

  .obstacle-char-glyph {
    font-size: clamp(6.4rem, 24vw, 10rem);
  }
}

@media (max-width: 640px) {
  .obstacle-runner-header {
    border-radius: 20px;
    padding: 12px;
  }

  .obstacle-runner-board {
    border-radius: 24px;
    padding: 10px;
  }

  .obstacle-runner-stage-panel {
    border-radius: 20px;
  }

  .obstacle-stage-viewport {
    min-height: clamp(300px, 50dvh, 500px);
    padding: 12px 12px 24px;
  }

  .obstacle-stage-viewport.is-reading-phase .obstacle-word-strip {
    padding-top: 72px;
  }

  .obstacle-reading-overlay {
    left: 12px;
    right: 12px;
    top: 12px;
  }

  .obstacle-reading-lane {
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 8px;
  }

  .obstacle-reading-targets {
    gap: 6px;
  }

  .obstacle-word-strip {
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 22px;
  }

  .obstacle-char-card {
    width: clamp(112px, 36vw, 160px);
    min-width: clamp(112px, 36vw, 160px);
    min-height: clamp(250px, 44dvh, 360px);
    border-radius: 20px;
  }

  .obstacle-char-card::after {
    inset: 7px;
    border-radius: 16px;
  }

  .obstacle-guide-path {
    stroke-width: 11.5;
  }

  .obstacle-progress-path {
    stroke-width: 12.2;
  }

  .obstacle-runner-sprite {
    width: 72px;
  }

  .obstacle-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .obstacle-runner-control-buttons,
  .obstacle-runner-footer-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .obstacle-jump-button {
    min-width: 0;
  }
}


/* CALM_TRACE_ENEMY_ONLY_SHAKE_V1 */
.battle-shell.screen-shake {
  animation: none !important;
}


/* MAZE_MODE_V1 */
.mode-card-maze {
  box-shadow: 0 20px 44px rgba(58, 118, 180, 0.14);
  border-color: rgba(120, 202, 255, 0.62);
}
.mode-card-maze h2 {
  color: #1f6faf;
}

/* TRACE_PANEL_SIZE_BUTTON_V1 */
.trace-reading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.trace-size-button {
  white-space: nowrap;
}

.mode-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.practice-section-head {
  align-items: flex-start;
  gap: 14px;
}

.practice-page-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.practice-grade-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.practice-summary-text {
  margin-top: 0;
}

#game-root.trace-size-large .unified-arena {
  --trace-dock-width: clamp(332px, 34vw, 420px);
}

#game-root.trace-size-large .canvas-frame-unified {
  width: min(100%, clamp(280px, 32vw, 390px));
}

#game-root.trace-size-xlarge .unified-arena {
  --trace-dock-width: clamp(382px, 40vw, 500px);
}

#game-root.trace-size-xlarge .canvas-frame-unified {
  width: min(100%, clamp(320px, 36vw, 460px));
}

#game-root.trace-size-large .trace-dock,
#game-root.trace-size-xlarge .trace-dock {
  gap: 12px;
}

#game-root.trace-size-xlarge .trace-dock {
  padding: 14px;
}

#game-root.trace-size-large .trace-target-char {
  font-size: clamp(2.2rem, 4.4vw, 3.25rem);
}

#game-root.trace-size-xlarge .trace-target-char {
  font-size: clamp(2.35rem, 4.8vw, 3.5rem);
}

body.play-body.play-body-arcade #game-root.trace-size-large .canvas-frame-unified {
  width: min(100%, 520px);
}

body.play-body.play-body-arcade #game-root.trace-size-xlarge .canvas-frame-unified {
  width: min(100%, 620px);
}

@media (max-width: 1180px) {
  #game-root.trace-size-large .unified-arena {
    --trace-dock-width: clamp(300px, 36vw, 380px);
  }

  #game-root.trace-size-xlarge .unified-arena {
    --trace-dock-width: clamp(332px, 40vw, 420px);
  }
}

@media (max-width: 860px) {
  .trace-reading-row {
    flex-wrap: wrap;
  }

  .trace-reading-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .practice-page-actions {
    justify-items: stretch;
    width: 100%;
  }
}

/* BATTLE_DESKTOP_FIT_AND_PROJECTILE_V2 */
body.play-body.play-body-arcade:not(.immersive-mode),
body.play-body.play-body-arcade:not(.immersive-mode) .page-shell {
  overflow-x: hidden;
  overflow-y: auto;
}

body.play-body.play-body-arcade:not(.immersive-mode) .unified-play-wrap,
body.play-body.play-body-arcade:not(.immersive-mode) #game-root {
  min-height: auto;
  height: auto;
}

body.play-body.play-body-arcade:not(.immersive-mode) .battle-shell-unified,
body.play-body.play-body-arcade:not(.immersive-mode) .battle-shell-arcade {
  min-height: 0;
  height: auto;
}

body.play-body.play-body-arcade .battle-screen-head-unified,
body.immersive-mode.play-body.play-body-arcade .battle-screen-head-unified {
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px;
  align-items: start;
}

body.play-body.play-body-arcade .battle-screen-head-unified .battle-screen-title,
body.immersive-mode.play-body.play-body-arcade .battle-screen-head-unified .battle-screen-title {
  min-width: 0;
  min-height: auto;
  padding: 14px 16px;
}

body.play-body.play-body-arcade .battle-screen-actions-unified,
body.immersive-mode.play-body.play-body-arcade .battle-screen-actions-unified {
  min-width: 0;
  width: fit-content;
  min-height: auto;
  align-self: start;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 14px;
  gap: 8px;
}

body.play-body.play-body-arcade .battle-topbar-row {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

body.play-body.play-body-arcade .battle-topbar-meta {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

body.play-body.play-body-arcade .battle-topbar-caption,
body.play-body.play-body-arcade .battle-topbar-enemy-caption,
body.play-body.play-body-arcade .battle-screen-head-unified .battle-caption {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.55;
}

body.play-body.play-body-arcade .battle-enemy-inline {
  max-width: min(44vw, 380px);
}

body.play-body.play-body-arcade .battle-mode-name {
  font-size: clamp(1.05rem, 1.8vw, 1.6rem);
}

body.play-body.play-body-arcade .wave-pill {
  min-height: 28px;
  padding: 0 10px;
}

body.play-body.play-body-arcade .unified-arena {
  --trace-dock-width: clamp(300px, 27vw, 360px);
}

body.play-body.play-body-arcade .arcade-arena {
  min-height: clamp(500px, calc(var(--app-height, 100vh) - 180px), 760px);
  padding: 14px;
  border-radius: 30px;
}

body.play-body.play-body-arcade .battle-board-top {
  top: 12px;
  left: 12px;
  width: min(430px, calc(100% - var(--trace-dock-width) - 36px));
  gap: 8px;
}

body.play-body.play-body-arcade .board-hud-card,
body.play-body.play-body-arcade .board-score-card {
  min-height: 0;
  padding: 10px 12px;
  border-radius: 18px;
}

body.play-body.play-body-arcade .board-hud-card .hp-label {
  margin-bottom: 4px;
}

body.play-body.play-body-arcade .board-score-card strong {
  margin-top: 4px;
  font-size: 1.12rem;
}

body.play-body.play-body-arcade .board-score-card .hud-label,
body.play-body.play-body-arcade .hud-sub,
body.play-body.play-body-arcade #magic-hit-hint,
body.play-body.play-body-arcade #mode-chip-label {
  font-size: 0.68rem;
  line-height: 1.4;
}

body.play-body.play-body-arcade .stone-zone {
  left: 12px;
  bottom: 12px;
  width: min(280px, calc(100% - var(--trace-dock-width) - 36px));
  padding: 12px 14px;
  border-radius: 20px;
}

body.play-body.play-body-arcade .stone-launchpad {
  height: 108px;
}

body.play-body.play-body-arcade .trace-dock {
  right: 12px;
  bottom: 12px;
  width: var(--trace-dock-width);
  max-width: min(var(--trace-dock-width), calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 12px;
  gap: 10px;
}

body.play-body.play-body-arcade .trace-area-unified {
  margin-top: 8px;
  display: grid;
  justify-items: center;
}

body.play-body.play-body-arcade .canvas-frame-unified {
  width: min(100%, 340px);
}

body.play-body.play-body-arcade .trace-footer {
  gap: 8px;
}

body.play-body.play-body-arcade .trace-spell-mini {
  padding: 8px 10px;
}

body.play-body.play-body-arcade .floating-battle-log {
  left: 12px;
  bottom: 12px;
  width: min(300px, calc(100% - var(--trace-dock-width) - 40px));
}

body.play-body.play-body-arcade .compact-actions-three {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#game-root.trace-size-large .unified-arena {
  --trace-dock-width: clamp(360px, 34vw, 470px) !important;
}

#game-root.trace-size-large .trace-dock {
  width: min(52vw, 500px);
  max-width: min(52vw, 500px);
}

#game-root.trace-size-large .canvas-frame-unified {
  width: min(100%, 470px) !important;
}

#game-root.trace-size-large .trace-target-char {
  font-size: clamp(2.35rem, 3.8vw, 3.4rem);
}

#game-root.trace-size-xlarge .unified-arena {
  --trace-dock-width: clamp(430px, 54vw, 640px) !important;
}

#game-root.trace-size-xlarge .trace-dock {
  width: min(76vw, 640px);
  max-width: min(76vw, 640px);
  padding: 16px 18px;
  gap: 14px;
  box-shadow: 0 22px 40px rgba(28, 38, 76, 0.22);
}

#game-root.trace-size-xlarge .trace-dock-head {
  gap: 10px;
}

#game-root.trace-size-xlarge .trace-area-unified {
  margin-top: 4px;
}

#game-root.trace-size-xlarge .canvas-frame-unified {
  width: min(100%, 560px) !important;
}

#game-root.trace-size-xlarge .trace-target-char {
  font-size: clamp(2.6rem, 4.2vw, 3.7rem);
}

#game-root.trace-size-xlarge .trace-info-compact .score-chip {
  padding: 11px 10px;
}

#game-root.trace-size-xlarge .trace-spell-mini img {
  width: 58px;
  height: 58px;
}

.phase-media-fallback-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.phase-media-fallback-image.hidden {
  display: none !important;
}

.phase-media-fallback-image-stone {
  transform: scaleX(-1);
}

.stone-ball.has-image {
  border-radius: 0;
  background: var(--stone-image) center / contain no-repeat;
  border: none;
  box-shadow: none;
  filter: drop-shadow(0 7px 12px rgba(20, 31, 82, 0.22));
}

.stone-ball.has-image::after {
  display: none;
}

.magic-barrage-panel {
  width: clamp(108px, 8.8vw, 140px);
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
}

.magic-barrage-status {
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.magic-charge-chip {
  padding: 8px 10px;
  border-radius: 16px;
  background: rgba(245, 249, 255, 0.16);
  border: 1px solid rgba(255,255,255,0.24);
  color: #f8fbff;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 18px rgba(22, 31, 72, 0.18);
  backdrop-filter: blur(12px);
}

.magic-stack-zone {
  position: relative;
  min-height: 112px;
  padding: 12px 10px 54px;
  border-radius: 18px;
  border: 1px dashed rgba(157, 183, 255, 0.66);
  background: linear-gradient(180deg, rgba(72, 97, 196, 0.34), rgba(24, 35, 84, 0.2));
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.14),
    0 14px 24px rgba(22, 31, 72, 0.16);
  display: grid;
  place-items: center;
  gap: 4px;
  text-align: center;
  pointer-events: auto;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.magic-stack-zone::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: none;
}

.magic-stack-zone-label {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: rgba(245, 249, 255, 0.88);
}

.magic-stack-zone strong {
  font-size: 1.45rem;
  line-height: 1;
  color: #ffffff;
}

.magic-stack-zone small {
  font-size: 0.66rem;
  line-height: 1.45;
  color: rgba(245, 249, 255, 0.84);
}

.magic-stack-zone.is-active {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(208, 227, 255, 0.94);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.22),
    0 18px 32px rgba(20, 31, 82, 0.26);
}

.magic-stack-zone.has-combo {
  background: linear-gradient(180deg, rgba(87, 116, 255, 0.56), rgba(27, 43, 122, 0.34));
}

.magic-combo-core {
  position: absolute;
  left: 0;
  top: 0;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 28% 26%, rgba(255,255,255,0.96), rgba(255,255,255,0.24) 24%, rgba(115, 151, 255, 0.2) 25%, rgba(70, 103, 255, 0.84) 62%, rgba(35, 53, 132, 0.98));
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.36),
    0 0 28px rgba(103, 138, 255, 0.54),
    0 16px 26px rgba(20, 31, 82, 0.26);
  cursor: grab;
  pointer-events: auto;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  will-change: transform;
}

.magic-combo-core::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--orb-image, none);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 62%;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.42));
}

.magic-combo-core::after {
  content: attr(data-stack);
  position: absolute;
  right: -6px;
  top: -8px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(196,216,255,0.94));
  color: #2a46a6;
  font-size: 0.74rem;
  font-weight: 900;
  box-shadow: 0 10px 16px rgba(18, 26, 64, 0.22);
}

.magic-combo-core.hidden {
  display: none !important;
}

.magic-orb,
.magic-combo-core {
  transition: opacity 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.magic-orb.is-dragging,
.magic-combo-core.is-dragging {
  cursor: grabbing;
  filter: brightness(calc(1 + (var(--launch-power, 1) - 1) * 0.18));
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.42),
    0 0 30px rgba(82, 124, 255, 0.58),
    0 18px 32px rgba(20, 31, 82, 0.28);
}

.magic-orb.is-flying,
.magic-combo-core.is-flying {
  filter: brightness(calc(1 + (var(--launch-power, 1) - 1) * 0.24));
}

.arcane-burst {
  position: absolute;
  width: 96px;
  height: 96px;
  transform: translate(-50%, -50%) scale(var(--burst-scale, 1));
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(255,255,255,0.9) 0 10%, rgba(180, 208, 255, 0.84) 18%, rgba(89, 122, 255, 0.5) 34%, rgba(56, 78, 184, 0.18) 58%, rgba(56, 78, 184, 0) 76%);
  mix-blend-mode: screen;
  z-index: 11;
  animation: arcaneBurstPop 0.72s ease-out forwards;
}

.arcane-burst::before,
.arcane-burst::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid rgba(255,255,255,0.42);
  opacity: 0.78;
}

.arcane-burst::after {
  inset: 18%;
  border-width: 1px;
  opacity: 0.56;
}

.arcane-burst.charge {
  background:
    radial-gradient(circle, rgba(255,255,255,0.96) 0 12%, rgba(176, 241, 255, 0.88) 20%, rgba(85, 193, 255, 0.52) 38%, rgba(37, 111, 200, 0.18) 60%, rgba(37, 111, 200, 0) 78%);
}

.arcane-burst.combo {
  background:
    radial-gradient(circle, rgba(255,255,255,0.98) 0 12%, rgba(255, 229, 176, 0.88) 22%, rgba(152, 191, 255, 0.64) 38%, rgba(94, 125, 255, 0.24) 60%, rgba(94, 125, 255, 0) 80%);
}

.arcane-burst.stone {
  width: 72px;
  height: 72px;
  background:
    radial-gradient(circle, rgba(255,255,255,0.86) 0 10%, rgba(215, 228, 255, 0.72) 22%, rgba(113, 128, 183, 0.3) 42%, rgba(113, 128, 183, 0) 72%);
}

@keyframes arcaneBurstPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(calc(var(--burst-scale, 1) * 0.36));
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(calc(var(--burst-scale, 1) * 1.28));
  }
}

.magic-finisher-layer {
  transform: translate(-50%, -50%) scale(var(--finisher-scale, 1));
  filter:
    brightness(var(--finisher-brightness, 1))
    drop-shadow(0 0 34px rgba(74, 130, 255, 0.34))
    drop-shadow(0 20px 42px rgba(30, 44, 116, 0.18));
  transition: transform 0.18s ease, filter 0.18s ease;
}

.magic-finisher-video,
.magic-finisher-poster {
  filter: brightness(var(--finisher-brightness, 1));
}

@media (max-width: 1280px) {
  body.play-body.play-body-arcade .battle-screen-head-unified,
  body.immersive-mode.play-body.play-body-arcade .battle-screen-head-unified {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.play-body.play-body-arcade .battle-screen-actions-unified,
  body.immersive-mode.play-body.play-body-arcade .battle-screen-actions-unified {
    width: 100%;
    justify-content: flex-start;
  }

  body.play-body.play-body-arcade .arcade-arena {
    min-height: clamp(470px, calc(var(--app-height, 100vh) - 170px), 700px);
  }

  body.play-body.play-body-arcade .unified-arena {
    --trace-dock-width: clamp(290px, 32vw, 380px);
  }

  body.play-body.play-body-arcade .battle-board-top {
    width: min(400px, calc(100% - var(--trace-dock-width) - 30px));
  }

  body.play-body.play-body-arcade .stone-zone,
  body.play-body.play-body-arcade .floating-battle-log {
    width: min(240px, calc(100% - var(--trace-dock-width) - 30px));
  }

  #game-root.trace-size-large .trace-dock {
    width: min(60vw, 470px);
    max-width: min(60vw, 470px);
  }

  #game-root.trace-size-xlarge .trace-dock {
    width: min(84vw, 560px);
    max-width: min(84vw, 560px);
  }

  #game-root.trace-size-xlarge .canvas-frame-unified {
    width: min(100%, 520px) !important;
  }
}

@media (max-width: 980px) {
  body.play-body.play-body-arcade .battle-board-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(340px, calc(100% - var(--trace-dock-width) - 26px));
  }

  body.play-body.play-body-arcade .board-score-card {
    grid-column: span 1;
  }

  body.play-body.play-body-arcade .trace-dock {
    width: clamp(280px, 40vw, 360px);
  }

  #game-root.trace-size-large .trace-dock,
  #game-root.trace-size-xlarge .trace-dock {
    width: min(90vw, 520px);
    max-width: min(90vw, 520px);
  }
}

/* ARCADE_LAYOUT_SCROLL_FREE_V4 */
body.play-body.play-body-arcade #game-root.arcade-layout-fit,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-shell-arcade,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-board,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .arcade-arena {
  overflow: hidden;
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-shell-arcade {
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-board {
  min-height: 0;
  height: var(--battle-board-height, auto);
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .arcade-arena {
  min-height: 0;
  height: 100%;
  border-radius: 28px;
}

@media (min-width: 1040px) {
  body.play-body.play-body-arcade .battle-screen-head-unified,
  body.immersive-mode.play-body.play-body-arcade .battle-screen-head-unified,
  body.play-body.play-body-arcade #game-root:fullscreen .battle-screen-head-unified,
  body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-screen-head-unified {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  body.play-body.play-body-arcade .battle-screen-actions-unified,
  body.immersive-mode.play-body.play-body-arcade .battle-screen-actions-unified {
    width: auto !important;
    justify-self: end;
  }
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-screen-head-unified {
  gap: 8px;
  align-items: stretch;
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-screen-head-unified .battle-screen-title {
  padding: 12px 14px;
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-screen-actions-unified {
  padding: 10px 12px;
  align-self: stretch;
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-topbar-meta {
  gap: 2px;
  margin-top: 6px;
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-topbar-caption,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-topbar-enemy-caption,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-screen-head-unified .battle-caption {
  font-size: 0.86rem;
  line-height: 1.45;
}

body.play-body.play-body-arcade #game-root.immersive-mode.arcade-layout-fit .battle-topbar-meta,
body.play-body.play-body-arcade #game-root:fullscreen .battle-topbar-meta,
body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-topbar-meta {
  display: none;
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .unified-arena {
  --trace-dock-width: clamp(296px, 26vw, 356px);
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-board-top {
  top: 10px;
  left: 10px;
  gap: 8px;
  width: min(420px, calc(100% - var(--trace-dock-width) - 32px));
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .board-hud-card,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .board-score-card {
  padding: 10px 12px;
  border-radius: 18px;
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .stone-zone {
  left: 10px;
  bottom: 10px;
  width: min(260px, calc(100% - var(--trace-dock-width) - 32px));
  padding: 12px 14px;
  border-radius: 20px;
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .stone-launchpad {
  height: 92px;
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .trace-dock {
  right: 10px;
  bottom: 10px;
  width: var(--trace-dock-width);
  max-width: min(var(--trace-dock-width), calc(100% - 20px));
  max-height: calc(100% - 20px);
  padding: 12px;
  gap: 10px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: rgba(255, 255, 255, 0.96);
}

body.play-body.play-body-arcade #game-root.arcade-layout-fit .canvas-frame-unified {
  width: min(100%, 340px);
}

body.play-body.play-body-arcade #game-root.trace-size-large .unified-arena {
  --trace-dock-width: clamp(352px, 31vw, 430px) !important;
}

body.play-body.play-body-arcade #game-root.trace-size-large .trace-dock {
  width: min(44vw, 430px) !important;
  max-width: min(44vw, 430px) !important;
}

body.play-body.play-body-arcade #game-root.trace-size-large .canvas-frame-unified {
  width: min(100%, 410px) !important;
}

body.play-body.play-body-arcade #game-root.trace-size-xlarge .unified-arena {
  --trace-dock-width: clamp(392px, 36vw, 500px) !important;
}

body.play-body.play-body-arcade #game-root.trace-size-xlarge .trace-dock {
  width: min(50vw, 500px) !important;
  max-width: min(50vw, 500px) !important;
  padding: 14px 16px;
}

body.play-body.play-body-arcade #game-root.trace-size-xlarge .canvas-frame-unified {
  width: min(100%, 460px) !important;
}

body.play-body.play-body-arcade #game-root.magic-phase-compact-dock .unified-arena {
  --trace-dock-width: clamp(272px, 24vw, 320px) !important;
}

body.play-body.play-body-arcade #game-root.magic-phase-compact-dock .trace-dock {
  width: min(320px, calc(100% - 20px)) !important;
  max-width: min(320px, calc(100% - 20px)) !important;
  padding: 12px;
  gap: 8px;
}

body.play-body.play-body-arcade #game-root.magic-phase-compact-dock .canvas-frame-unified {
  width: min(100%, 300px) !important;
}

body.play-body.play-body-arcade #game-root.magic-phase-compact-dock .trace-spell-mini {
  display: none;
}

body.play-body.play-body-arcade #game-root.magic-phase-compact-dock .trace-lock-overlay {
  background: rgba(244, 247, 255, 0.94);
  backdrop-filter: blur(10px);
}

body.play-body.play-body-arcade #game-root.magic-phase-compact-dock .magic-barrage-panel {
  right: calc(var(--trace-dock-width) + 12px);
  width: clamp(110px, 9vw, 138px);
}

/* TRACE_SIZE_LEFT_TOP_V1 */
.trace-dock-utility-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.trace-size-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: max-content;
  max-width: 100%;
}

.trace-size-preset {
  position: relative;
  z-index: 16;
  min-width: 58px;
  padding-inline: 12px;
  white-space: nowrap;
  pointer-events: auto;
}

.trace-size-preset.is-active {
  background: linear-gradient(135deg, rgba(91, 108, 240, 0.16), rgba(91, 108, 240, 0.08));
  color: var(--primary-2);
  box-shadow: inset 0 0 0 1px rgba(91, 108, 240, 0.22);
}

body.play-body.play-body-arcade .trace-dock-head {
  position: relative;
  z-index: 10;
}

body.play-body.play-body-arcade .trace-dock-utility-row {
  position: sticky;
  top: 0;
  z-index: 18;
  margin: -2px -2px 0;
  padding: 2px 2px 6px;
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(255,255,255,0.94) 72%, rgba(255,255,255,0));
}

body.play-body.play-body-arcade .trace-reading-row {
  position: relative;
  z-index: 11;
  align-items: flex-start;
  flex-wrap: wrap;
}

body.play-body.play-body-arcade .trace-reading-actions {
  margin-left: auto;
  row-gap: 6px;
  justify-content: flex-end;
}

body.play-body.play-body-arcade #game-root.trace-size-xlarge .trace-reading-actions,
body.play-body.play-body-arcade #game-root.magic-phase-compact-dock .trace-reading-actions {
  width: auto;
  margin-left: auto;
  justify-content: flex-end;
}

body.play-body.play-body-arcade #game-root.trace-size-xlarge .trace-size-toolbar,
body.play-body.play-body-arcade #game-root.magic-phase-compact-dock .trace-size-toolbar {
  position: relative;
  top: auto;
  z-index: 18;
  padding-top: 0;
  background: none;
}

body.play-body.play-body-arcade .trace-lock-overlay {
  background: rgba(244, 247, 255, 0.9);
  backdrop-filter: blur(8px);
}

body.play-body.play-body-arcade .trace-lock-card {
  box-shadow: 0 16px 28px rgba(24, 40, 86, 0.16);
}

body.play-body.play-body-arcade .magic-barrage-panel {
  padding: 8px 10px 10px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(14, 22, 60, 0.76), rgba(29, 43, 108, 0.62));
  box-shadow: 0 18px 32px rgba(16, 23, 56, 0.24);
  backdrop-filter: blur(12px);
}

body.play-body.play-body-arcade .magic-charge-chip {
  background: linear-gradient(180deg, rgba(18, 30, 82, 0.94), rgba(55, 86, 188, 0.8));
  border-color: rgba(223, 236, 255, 0.42);
  color: #ffffff;
}

body.play-body.play-body-arcade .magic-stack-zone {
  background: linear-gradient(180deg, rgba(76, 104, 224, 0.92), rgba(31, 47, 122, 0.82));
  border-color: rgba(220, 236, 255, 0.74);
}

body.play-body.play-body-arcade .magic-launchpad {
  background: linear-gradient(180deg, rgba(22, 32, 76, 0.9), rgba(37, 55, 124, 0.76));
  border-color: rgba(132, 165, 255, 0.74);
}

body.play-body.play-body-arcade .magic-orb,
body.play-body.play-body-arcade .magic-combo-core {
  opacity: 1;
}

body.play-body.play-body-arcade .magic-orb.is-dragging,
body.play-body.play-body-arcade .magic-combo-core.is-dragging {
  opacity: 1;
  filter: none;
}

@media (max-width: 1039px) {
  body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-board {
    height: auto;
  }

  body.play-body.play-body-arcade .trace-size-toolbar {
    justify-content: flex-start;
  }
}

body.play-body.play-body-arcade .trace-size-toolbar-left {
  justify-content: flex-start;
}

body.play-body.play-body-arcade .trace-size-toolbar-left .trace-size-preset {
  box-shadow: 0 6px 14px rgba(27, 39, 88, 0.08);
}


/* TRACE_LAYOUT_SPEC_V2 */
body.play-body.play-body-arcade .battle-screen-head-unified,
body.play-body.play-body-arcade #game-root.immersive-mode .battle-screen-head-unified,
body.play-body.play-body-arcade #game-root:fullscreen .battle-screen-head-unified,
body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-screen-head-unified {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0;
}

body.play-body.play-body-arcade .battle-topbar-meta,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-topbar-meta,
body.play-body.play-body-arcade #game-root.immersive-mode.arcade-layout-fit .battle-topbar-meta,
body.play-body.play-body-arcade #game-root:fullscreen .battle-topbar-meta,
body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-topbar-meta {
  display: none !important;
}

body.play-body.play-body-arcade .battle-screen-head-compact .battle-screen-title,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-screen-head-unified .battle-screen-title {
  padding: 14px 18px;
}

.battle-utility-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  padding: 0 10px;
}

.battle-utility-spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.battle-utility-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.battle-utility-bar .trace-size-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 10px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(208, 217, 245, 0.92);
  box-shadow: 0 16px 28px rgba(29, 42, 94, 0.08);
}

.battle-utility-bar .trace-size-preset {
  min-width: 72px;
  padding-inline: 14px;
}

.battle-utility-actions {
  min-width: 0;
  width: auto !important;
  padding: 10px 12px !important;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(208, 217, 245, 0.92);
  box-shadow: 0 16px 28px rgba(29, 42, 94, 0.08);
}

body.play-body.play-body-arcade .trace-dock {
  padding-top: 10px;
}

body.play-body.play-body-arcade .trace-dock-head,
body.play-body.play-body-arcade #game-root.trace-size-xlarge .trace-dock-head {
  gap: 6px;
}

body.play-body.play-body-arcade .trace-reading-row {
  align-items: center;
}

body.play-body.play-body-arcade .trace-target-row-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
}

body.play-body.play-body-arcade .trace-target-char {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: clamp(2.15rem, 4.2vw, 4rem);
  line-height: 1;
  box-shadow: none;
}

body.play-body.play-body-arcade .kanji-note-strip {
  margin: 0;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(239, 243, 255, 0.96), rgba(247, 249, 255, 0.92));
  border: 1px solid rgba(191, 205, 246, 0.55);
  color: #51607f;
  font-size: 0.82rem;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

body.play-body.play-body-arcade .trace-area-unified {
  margin-top: 4px;
}

body.play-body.play-body-arcade .canvas-frame-unified,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .canvas-frame-unified {
  width: min(100%, 360px);
}

body.play-body.play-body-arcade #game-root.trace-size-large .canvas-frame-unified {
  width: min(100%, 430px) !important;
}

body.play-body.play-body-arcade #game-root.trace-size-xlarge .canvas-frame-unified {
  width: min(100%, 500px) !important;
}

body.play-body.play-body-arcade #game-root.trace-size-xlarge .trace-dock {
  width: min(52vw, 540px) !important;
  max-width: min(52vw, 540px) !important;
}

body.play-body.play-body-arcade #game-root.trace-size-xlarge .trace-target-char {
  font-size: clamp(2.4rem, 4.8vw, 4.4rem);
}

@media (max-width: 1039px) {
  .battle-utility-bar {
    justify-content: space-between;
    padding-inline: 8px;
  }

  .battle-utility-spacer {
    display: none;
  }

  .battle-utility-tools {
    width: 100%;
    justify-content: space-between;
  }

  .battle-utility-bar .trace-size-toolbar,
  .battle-utility-actions {
    box-shadow: 0 10px 20px rgba(29, 42, 94, 0.06);
  }
}

@media (max-width: 720px) {
  .battle-utility-tools {
    gap: 8px;
  }

  .battle-utility-bar .trace-size-toolbar,
  .battle-utility-actions {
    width: 100%;
    justify-content: center;
  }

  .battle-utility-bar .trace-size-toolbar {
    order: 1;
  }

  .battle-utility-actions {
    order: 2;
  }
}

/* TRACE_UI_MINIMAL_V1 */
body.play-body.play-body-arcade .battle-topbar-meta,
body.play-body.play-body-arcade .battle-topbar-caption,
body.play-body.play-body-arcade .battle-topbar-enemy-caption,
body.play-body.play-body-arcade #enemy-description,
body.play-body.play-body-arcade .kanji-note-strip,
body.play-body.play-body-arcade #kanji-note {
  display: none !important;
}

body.play-body.play-body-arcade .battle-shell-arcade,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-shell-arcade,
body.play-body.play-body-arcade #game-root.immersive-mode .battle-shell-arcade,
body.play-body.play-body-arcade #game-root:fullscreen .battle-shell-arcade,
body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-shell-arcade {
  gap: 8px;
}

body.play-body.play-body-arcade .battle-screen-head-compact .battle-screen-title,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .battle-screen-head-unified .battle-screen-title,
body.play-body.play-body-arcade #game-root.immersive-mode .battle-screen-head-unified .battle-screen-title,
body.play-body.play-body-arcade #game-root:fullscreen .battle-screen-head-unified .battle-screen-title,
body.play-body.play-body-arcade #game-root:-webkit-full-screen .battle-screen-head-unified .battle-screen-title {
  padding: 10px 16px !important;
}

body.play-body.play-body-arcade .battle-topbar-main {
  gap: 0;
}

body.play-body.play-body-arcade .battle-topbar-row,
body.play-body.play-body-arcade .battle-title-row-main {
  gap: 10px;
}

body.play-body.play-body-arcade .battle-utility-bar {
  justify-content: flex-end;
  gap: 8px;
  padding: 0 4px 2px;
}

body.play-body.play-body-arcade .battle-utility-spacer {
  display: none !important;
}

body.play-body.play-body-arcade .battle-utility-tools {
  gap: 8px;
  margin-left: auto;
}

body.play-body.play-body-arcade .battle-utility-bar .trace-size-toolbar,
body.play-body.play-body-arcade .battle-utility-actions {
  padding: 6px 8px !important;
  border-radius: 18px;
  box-shadow: 0 10px 20px rgba(29, 42, 94, 0.07);
}

body.play-body.play-body-arcade .battle-utility-bar .trace-size-preset,
body.play-body.play-body-arcade .battle-utility-actions .button {
  min-width: 64px;
  padding-inline: 12px;
}

body.play-body.play-body-arcade .trace-dock,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .trace-dock,
body.play-body.play-body-arcade #game-root.trace-size-xlarge .trace-dock {
  padding-top: 8px;
}

body.play-body.play-body-arcade .trace-dock-head,
body.play-body.play-body-arcade #game-root.trace-size-xlarge .trace-dock-head {
  gap: 4px;
}

body.play-body.play-body-arcade .trace-reading-row {
  margin-bottom: 0;
}

body.play-body.play-body-arcade .trace-target-row-centered {
  margin-top: 0;
  margin-bottom: 0;
}

body.play-body.play-body-arcade .trace-area-unified,
body.play-body.play-body-arcade #game-root.arcade-layout-fit .trace-area-unified,
body.play-body.play-body-arcade #game-root.trace-size-xlarge .trace-area-unified {
  margin-top: 0;
}

@media (max-width: 720px) {
  body.play-body.play-body-arcade .battle-utility-bar {
    padding-inline: 0;
  }

  body.play-body.play-body-arcade .battle-utility-tools {
    width: 100%;
    justify-content: flex-end;
  }

  body.play-body.play-body-arcade .battle-utility-bar .trace-size-toolbar,
  body.play-body.play-body-arcade .battle-utility-actions {
    width: auto;
  }
}

/* MAGIC_ORB_FLIGHT_VISIBLE_V1 */
.magic-combo-core {
  opacity: 1 !important;
  z-index: 24;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,1) 0 14%, rgba(255,244,173,0.98) 19%, rgba(115,171,255,0.96) 45%, rgba(64,96,255,0.98) 70%, rgba(27,42,128,1) 100%);
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.52),
    0 0 24px rgba(118, 166, 255, 0.92),
    0 0 48px rgba(89, 122, 255, 0.54),
    0 18px 28px rgba(13, 21, 60, 0.34);
  transform-origin: center center;
  overflow: visible;
}

.magic-combo-core::before {
  inset: 8%;
  border-radius: 50%;
  background-size: 70%;
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.72)) drop-shadow(0 0 16px rgba(106,150,255,0.55));
}

.magic-combo-core::after {
  right: -8px;
  top: -10px;
  background: linear-gradient(135deg, rgba(255,255,255,1), rgba(255,230,122,0.98));
  color: #233da3;
  box-shadow: 0 10px 18px rgba(15, 24, 64, 0.28), 0 0 0 2px rgba(255,255,255,0.58);
}

.magic-stack-zone.has-combo {
  border-color: rgba(255, 234, 139, 0.94);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.22),
    0 0 22px rgba(120, 155, 255, 0.36),
    0 18px 32px rgba(20, 31, 82, 0.28);
}

.magic-stack-zone.has-combo::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 64%;
  width: var(--stack-aura-size, 64px);
  height: var(--stack-aura-size, 64px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.32), rgba(124,164,255,0.22) 44%, rgba(124,164,255,0) 72%);
  pointer-events: none;
  z-index: 1;
}

.magic-combo-core.combo-grow-pulse {
  animation: comboCoreGrowPulse 0.26s ease-out both;
}

.magic-orb.is-flying,
.magic-combo-core.is-flying {
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 80;
  transition: none !important;
  filter: brightness(calc(1.12 + (var(--launch-power, 1) - 1) * 0.24)) drop-shadow(0 0 16px rgba(115, 165, 255, 0.82));
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.5),
    0 0 28px rgba(102, 148, 255, 0.88),
    0 0 54px rgba(72, 107, 255, 0.46),
    0 18px 30px rgba(13, 21, 60, 0.3);
}

.magic-combo-core:not(.is-flying) {
  transition: opacity 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

@keyframes comboCoreGrowPulse {
  0% { filter: brightness(1.45); }
  60% { filter: brightness(1.16); }
  100% { filter: brightness(1); }
}

body.play-body.play-body-arcade .magic-orb.is-flying,
body.play-body.play-body-arcade .magic-combo-core.is-flying,
body.play-body.play-body-arcade .magic-combo-core.is-dragging {
  opacity: 1 !important;
  filter: brightness(calc(1.12 + (var(--launch-power, 1) - 1) * 0.24)) drop-shadow(0 0 16px rgba(115, 165, 255, 0.82));
}
