/* ============================================================================
   LUDO OVERDRIVE — Neo-Arcade Urban Pop UI Stylesheet
   ============================================================================ */

:root {
  --bg-deep: #070a14;
  --bg-panel: rgba(15, 22, 42, 0.86);
  --bg-card: rgba(20, 30, 56, 0.78);
  --border-subtle: rgba(148, 163, 184, 0.16);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --active-accent: #38c6e0;
  --active-glow: rgba(56, 198, 224, 0.45);
  --font-display: 'Orbitron', 'Rajdhani', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(45, 212, 191, 0.35) transparent;
}

/* Sleek Custom Neon Scrollbars — No ugly white default Windows scrollbars! */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.45), rgba(242, 181, 68, 0.45));
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.8), rgba(242, 181, 68, 0.8));
}

*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.flag-svg {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(241, 85, 111, 0.45);
  flex-shrink: 0;
}

html, body {
  width: 100%;
  height: 100vh;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Dynamic ambient cyberpunk backdrop */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 18% 15%, var(--active-glow), transparent 42%),
    radial-gradient(circle at 82% 85%, rgba(180, 138, 240, 0.16), transparent 46%),
    linear-gradient(160deg, #070a14 0%, #0d1428 55%, #090d1a 100%);
  transition: background 0.6s ease;
  z-index: -2;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
  z-index: -1;
}

/* ============================================================================
   Top Navigation & Event Bar
   ============================================================================ */

.app-shell {
  max-width: 1460px;
  margin: 0 auto;
  padding: 8px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100vh;
  overflow: hidden;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 2.2px;
  background: linear-gradient(90deg, #38c6e0, #ecc94b, #ef5b7a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-pill {
  font-size: 0.64rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(56, 198, 224, 0.14);
  border: 1px solid rgba(56, 198, 224, 0.45);
  color: #a5e4ee;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.event-banner {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 11px;
  font-size: 0.78rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.65);
  transition: all 0.35s ease;
  overflow: hidden;
}

.event-banner.active {
  border-color: var(--event-color, #ecc94b);
  background: color-mix(in srgb, var(--event-color, #ecc94b) 16%, #0b1120);
  box-shadow: 0 0 18px color-mix(in srgb, var(--event-color, #ecc94b) 35%, transparent);
  animation: bannerPulse 2s ease-in-out infinite;
}

.ev-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.74rem;
  letter-spacing: 0.8px;
  color: var(--event-color, #e2e8f0);
  white-space: nowrap;
}

.ev-desc {
  color: #cbd5e1;
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ev-timer {
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.68rem;
  background: rgba(0, 0, 0, 0.45);
  color: var(--event-color, #ecc94b);
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.meta-badge {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 9px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.meta-badge.reversed {
  border-color: #ef5b7a;
  color: #ff7a9c;
  background: rgba(239, 91, 122, 0.16);
  box-shadow: 0 0 12px rgba(239, 91, 122, 0.3);
}

.icon-btn {
  height: 31px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.8);
  color: #f8fafc;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--active-accent);
  background: rgba(30, 41, 59, 1);
  transform: translateY(-1px);
}

/* ============================================================================
   Main 3-Column Zero-Scroll Arena Grid
   ============================================================================ */

.arena-grid {
  display: grid;
  grid-template-columns: 270px minmax(360px, calc(100vh - 108px)) 310px;
  gap: 12px;
  align-items: stretch;
  justify-content: center;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.side-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: 100%;
}

.cards-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* ============================================================================
   Center Board Stage & Animated Pawns
   ============================================================================ */

.board-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 0;
  height: 100%;
}

.board-perspective-wrap {
  width: min(100%, calc(100vh - 112px));
  perspective: 1200px;
  display: flex;
  justify-content: center;
}

.board-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  padding: 5px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(15, 23, 42, 0.92));
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.22),
    0 18px 46px rgba(0, 0, 0, 0.72),
    0 0 38px var(--active-glow);
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s ease;
}

.board-stage.tilt-3d {
  transform: rotateX(15deg) scale(0.96);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 34px 70px rgba(0, 0, 0, 0.85),
    0 14px 0 rgba(12, 18, 38, 0.95),
    0 0 54px var(--active-glow);
}

#board-svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 19px;
}

/* Interactive SVG Map Micro-Animations */
.board-tile-group {
  cursor: pointer;
}

.board-tile-group .tile-rect {
  transition: filter 0.16s ease, stroke-width 0.16s ease;
}

.board-tile-group:hover .tile-rect {
  filter: brightness(1.38) drop-shadow(0 0 8px rgba(255, 255, 255, 0.25));
}

.hero-yard-group {
  cursor: pointer;
  opacity: 0.78;
  transition: opacity 0.35s ease, filter 0.35s ease;
}

.hero-yard-group:hover {
  opacity: 0.95;
}

.hero-yard-group.yard-active {
  opacity: 1;
  filter: drop-shadow(0 0 18px var(--active-glow));
}

.hero-home-lane {
  opacity: 0.78;
  transition: opacity 0.35s ease, filter 0.35s ease;
}

.hero-home-lane.lane-active {
  opacity: 1;
  filter: drop-shadow(0 0 10px var(--active-glow));
}

.svg-spin-center {
  transform-box: fill-box;
  transform-origin: center;
  animation: spinSlow 20s linear infinite;
}

.svg-dash-flow {
  animation: dashFlow 1.2s linear infinite;
}

@keyframes dashFlow {
  from { stroke-dashoffset: 56; }
  to { stroke-dashoffset: 0; }
}

/* Map Bottom HUD Strip (Tactical Inspector + 2.5D Toggle) */
.map-hud-strip {
  width: min(100%, calc(100vh - 112px));
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tile-inspector {
  flex: 1;
  min-height: 30px;
  display: flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--bg-panel);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.tile-inspector.active {
  border-color: var(--active-accent);
  color: #f8fafc;
  box-shadow: 0 0 14px color-mix(in srgb, var(--active-accent) 24%, transparent);
}

.tilt-toggle-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: var(--bg-panel);
  color: #e2e8f0;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.tilt-toggle-btn:hover,
.tilt-toggle-btn.active {
  border-color: #2dd4bf;
  color: #2dd4bf;
  background: rgba(45, 212, 191, 0.12);
  box-shadow: 0 0 14px rgba(45, 212, 191, 0.22);
}

.pawns-layer {
  position: absolute;
  inset: 6px;
  pointer-events: none;
}

.fx-canvas {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  pointer-events: none;
  z-index: 60;
}

/* 3D-Sculpted Pawn Tokens */
.pawn-token {
  position: absolute;
  width: 6.4%;
  height: 6.4%;
  transform: translate(-50%, -50%);
  border: none;
  background: transparent;
  padding: 0;
  pointer-events: auto;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    left 125ms cubic-bezier(0.34, 1.56, 0.64, 1),
    top 125ms cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 160ms ease;
}

.pawn-shadow {
  position: absolute;
  bottom: -4px;
  width: 76%;
  height: 28%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.68);
  filter: blur(3px);
  pointer-events: none;
}

.pawn-token.hopping .pawn-core {
  animation: pawnHopArc 125ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pawnHopArc {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.22); }
  100% { transform: translateY(0) scale(1); }
}

.pawn-core {
  width: 88%;
  height: 88%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #1e293b, #070b16);
  border: 2.5px solid var(--hero-color);
  box-shadow:
    0 0 12px var(--hero-glow),
    inset 0 0 8px var(--hero-glow),
    0 4px 8px rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.85rem, 1.8vw, 1.25rem);
  line-height: 1;
  transition: transform 0.16s ease;
}

.pawn-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  pointer-events: none;
}

.pawn-token.is-stacked .pawn-core {
  transform: scale(0.82);
}

.pawn-token.is-ace .pawn-core {
  border-color: #ecc94b;
  box-shadow: 0 0 16px rgba(236, 201, 75, 0.85), inset 0 0 10px var(--hero-glow);
}

.pawn-token.is-shielded .pawn-ring {
  inset: -5px;
  border: 2.5px solid #a5e4ee;
  box-shadow: 0 0 12px rgba(56, 198, 224, 0.65);
  animation: spinSlow 4s linear infinite;
}

.pawn-token.is-finished {
  opacity: 0.72;
  transform: translate(-50%, -50%) scale(0.75);
}

.pawn-token.selectable {
  cursor: pointer;
}

.pawn-token.selectable .pawn-core {
  transform: scale(1.16);
  border-color: #ffffff;
  box-shadow: 0 0 22px var(--hero-color), 0 0 10px #ffffff;
  animation: pawnBounce 0.65s ease-in-out infinite alternate;
}

.pawn-token.selectable .pawn-ring {
  inset: -8px;
  border: 3px solid #ffffff;
  animation: targetPulse 0.9s ease-out infinite;
}

.pawn-token.is-enemy-target .pawn-ring {
  border-color: #ef5b7a;
}

.pawn-badge {
  position: absolute;
  top: -7px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0f172a;
  border: 1.5px solid #ecc94b;
  font-size: 0.65rem;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

/* Floating Combat Text */
.fx-float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.8px;
  pointer-events: none;
  z-index: 80;
  white-space: nowrap;
  animation: floatUp 0.95s ease-out forwards;
}

.fx-float-text.fx-big {
  font-size: 1.35rem;
  animation: floatUpBig 1.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ============================================================================
   Hero HUD Cards
   ============================================================================ */

.hero-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 8px 10px;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: transform 0.2s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.hero-card.active {
  border-color: var(--hero-color);
  box-shadow: 0 0 22px color-mix(in srgb, var(--hero-color) 32%, transparent);
  transform: translateY(-1px);
}

.hero-card.offline {
  opacity: 0.38;
  filter: grayscale(0.8);
}

.hero-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.hero-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #090e1d;
  border: 2px solid var(--hero-color);
  padding: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 10px var(--hero-glow);
}

.hero-avatar svg {
  width: 100%;
  height: 100%;
}

.hero-meta {
  flex: 1;
  min-width: 0;
}

.hero-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.hero-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--hero-color);
  letter-spacing: 0.8px;
}

.role-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
}

.role-pill.human {
  border-color: var(--hero-color);
  color: var(--hero-color);
}

.hero-stats-row {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.finish-dots {
  display: inline-flex;
  gap: 4px;
}

.finish-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--hero-color);
  background: rgba(15, 23, 42, 0.8);
}

.finish-dot.done {
  background: var(--hero-color);
  box-shadow: 0 0 8px var(--hero-color);
}

.ko-stat {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fbbf24;
}

.buff-chip {
  font-size: 0.64rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--hero-color);
  color: #070a14;
}

/* Overdrive Energy Bar */
.energy-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.energy-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.energy-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(7, 10, 20, 0.85);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.energy-fill {
  height: 100%;
  background: linear-gradient(90deg, color-mix(in srgb, var(--hero-color) 65%, #fff), var(--hero-color));
  border-radius: 999px;
  transition: width 0.35s ease;
}

.energy-fill.full {
  box-shadow: 0 0 12px var(--hero-color);
  animation: energyGlow 1.1s ease-in-out infinite alternate;
}

.hero-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 26px;
}

.mini-dice-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mini-dice-pill {
  font-size: 0.82rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 7px;
  padding: 1px 5px;
}

.mini-dice-empty {
  font-size: 0.7rem;
  color: #64748b;
}

.skill-trigger-btn {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 8px;
  border: none;
  background: var(--hero-color);
  color: #070a14;
  cursor: pointer;
  box-shadow: 0 0 14px var(--hero-glow);
  animation: pawnBounce 0.75s ease-in-out infinite alternate;
}

.skill-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Emote Pop Bubble */
.emote-anchor {
  position: absolute;
  top: -10px;
  right: 10px;
  z-index: 45;
  pointer-events: none;
}

.emote-bubble {
  background: #ffffff;
  color: #090d1a;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 5px 11px;
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  animation: emotePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

/* ============================================================================
   Tactical Dice Dock & Battle Feed
   ============================================================================ */

.dock-panel {
  flex: 1;
  min-height: 0;
  background: var(--bg-panel);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 11px 12px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  overflow-y: auto;
}

.turn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.turn-kicker {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

#turn-hero-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.96rem;
  letter-spacing: 0.9px;
}

#turn-prompt {
  font-size: 0.75rem;
  color: #cbd5e1;
  min-height: 17px;
}

.cancel-skill-btn {
  display: none;
  padding: 3px 9px;
  border-radius: 8px;
  border: 1px solid #fb7185;
  background: rgba(251, 113, 133, 0.16);
  color: #fda4af;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

/* 3D Neon Dice Stage */
.dice-stage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(7, 10, 20, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 13px;
  padding: 8px 10px;
}

.dice-cube {
  --dice-color: #e2e8f0;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, #1d2846, #0b1122);
  border: 2.5px solid var(--dice-color);
  box-shadow:
    0 0 16px color-mix(in srgb, var(--dice-color) 45%, transparent),
    inset 0 2px 6px rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.dice-cube.rolling {
  animation: diceTumble 0.22s linear infinite;
}

.dice-pip-grid {
  width: 38px;
  height: 38px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
}

.pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
}

.pip.on {
  background: var(--dice-color);
  box-shadow: 0 0 8px var(--dice-color);
}

.dice-big-icon {
  font-size: 1.6rem;
}

.dice-big-val {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--dice-color);
  line-height: 1;
}

.dice-sub-val {
  font-size: 0.66rem;
  font-weight: 800;
  color: #fb7185;
}

.dice-info-label {
  font-size: 0.72rem;
  line-height: 1.32;
  color: #cbd5e1;
}

/* Dice Loadout Chips */
.dice-loadout {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.dice-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dice-chip:hover:not(:disabled) {
  border-color: var(--chip-color);
  transform: translateY(-1px);
}

.dice-chip.selected {
  border-color: var(--chip-color);
  background: color-mix(in srgb, var(--chip-color) 20%, #0b1120);
  box-shadow: 0 0 12px color-mix(in srgb, var(--chip-color) 40%, transparent);
}

.dice-chip:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.chip-qty {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--chip-color);
}

.roll-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Power-Hold Roll Button */
.roll-btn {
  position: relative;
  width: 100%;
  height: 46px;
  border-radius: 13px;
  border: 2px solid var(--hero-color, #38c6e0);
  background: linear-gradient(135deg, color-mix(in srgb, var(--hero-color, #38c6e0) 25%, #0f172a), #0b1122);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 1.4px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 0 20px color-mix(in srgb, var(--hero-color, #38c6e0) 32%, transparent);
  transition: transform 0.12s ease, opacity 0.2s ease;
}

.roll-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.roll-btn:active:not(:disabled),
.roll-btn.charging {
  transform: scale(0.98);
}

.roll-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.power-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(56, 198, 224, 0.35), rgba(236, 201, 75, 0.55), rgba(239, 91, 122, 0.65));
  pointer-events: none;
}

.roll-btn-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.roll-hint {
  text-align: center;
  font-size: 0.66rem;
  color: var(--text-muted);
}

.dock-skill-btn {
  display: none;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 11px;
  border: none;
  background: var(--hero-color, #38c6e0);
  color: #070a14;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.76rem;
  letter-spacing: 0.9px;
  cursor: pointer;
  box-shadow: 0 0 18px var(--active-glow);
}

/* Quick Emote Card (Bottom of Left Column) */
.emote-panel {
  background: var(--bg-panel);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.emote-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.emote-btn {
  flex: 1 1 auto;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.78);
  color: #e2e8f0;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s ease;
}

.emote-btn:hover {
  border-color: #ecc94b;
  transform: translateY(-1px);
}

/* Battle Feed Log (Fills Exact Remaining Height!) */
.log-panel {
  flex: 1;
  min-height: 0;
  background: var(--bg-panel);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.panel-mini-title {
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.battle-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 3px;
}

.log-item {
  font-size: 0.72rem;
  line-height: 1.32;
  color: #cbd5e1;
  padding: 4px 7px;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.65);
  border-left: 3px solid #38bdf8;
}

/* ============================================================================
   Modals (Setup Lobby, How-to-Play, Victory)
   ============================================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.82);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 780px;
  max-height: 92vh;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(19, 24, 48, 0.98), rgba(9, 13, 28, 0.98));
  border: 1.5px solid rgba(45, 212, 191, 0.35);
  border-radius: 22px;
  padding: 20px 22px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.85), 0 0 46px rgba(45, 212, 191, 0.16);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-setup {
  padding: 0;
  gap: 0;
}

.modal-setup .modal-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.02);
}

.modal-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(7, 10, 20, 0.72);
}

.theme-mode-combo {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 1.4px;
  background: linear-gradient(90deg, #2dd4bf, #f2b544);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.mode-card {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
  cursor: pointer;
  text-align: left;
  color: #f1f5f9;
  transition: all 0.18s ease;
}

.mode-card.selected {
  border-color: #2dd4bf;
  background: rgba(45, 212, 191, 0.12);
  box-shadow: 0 0 16px rgba(45, 212, 191, 0.22);
}

.mode-card h4 {
  font-family: var(--font-display);
  font-size: 0.82rem;
  margin-bottom: 2px;
}

.mode-card p {
  font-size: 0.73rem;
  color: var(--text-muted);
}

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

.setup-hero-card {
  padding: 9px 11px;
  border-radius: 13px;
  border: 1.5px solid color-mix(in srgb, var(--hero-color) 48%, transparent);
  background: rgba(15, 23, 42, 0.78);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setup-hero-card.off {
  opacity: 0.45;
  border-color: rgba(148, 163, 184, 0.2);
}

.setup-hero-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.setup-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid var(--hero-color);
  background: #070b16;
  padding: 2px;
  flex-shrink: 0;
}

.setup-hero-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.84rem;
  color: var(--hero-color);
}

.setup-hero-skill {
  font-size: 0.7rem;
  font-weight: 700;
  color: #e2e8f0;
}

.setup-hero-desc {
  font-size: 0.71rem;
  color: var(--text-muted);
  line-height: 1.3;
  flex: 1;
}

.role-toggle-btn {
  width: 100%;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #0b1122;
  color: #f8fafc;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s ease;
}

.role-toggle-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.role-toggle-btn.human {
  border-color: var(--hero-color);
  background: color-mix(in srgb, var(--hero-color) 20%, #0b1122);
  color: var(--hero-color);
}

.role-toggle-btn.ai {
  border-color: #38bdf8;
  color: #7dd3fc;
}

.primary-cta {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(90deg, #38c6e0, #ecc94b);
  color: #070a14;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 0 26px rgba(56, 198, 224, 0.35);
  transition: transform 0.15s ease;
}

.primary-cta:hover:not(:disabled) {
  transform: translateY(-2px);
}

.primary-cta:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.setup-error {
  text-align: center;
  font-size: 0.8rem;
  color: #fb7185;
  min-height: 18px;
}

/* Guide Modal */
.guide-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-section h4 {
  font-family: var(--font-display);
  font-size: 0.86rem;
  color: #a5e4ee;
  letter-spacing: 0.8px;
}

.guide-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.4;
}

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

.guide-item {
  background: rgba(15, 23, 42, 0.72);
  border-left: 3px solid #38c6e0;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.77rem;
  color: #cbd5e1;
}

/* Victory Modal */
.victory-card {
  max-width: 480px;
  text-align: center;
  align-items: center;
}

.victory-avatar {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  border: 3px solid var(--hero-color, #ecc94b);
  background: #070b16;
  padding: 8px;
  box-shadow: 0 0 32px rgba(236, 201, 75, 0.45);
}

.victory-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.85);
  border-left: 4px solid var(--hero-color);
  font-size: 0.84rem;
  font-weight: 700;
}

.rank-num {
  font-family: var(--font-display);
  color: #ecc94b;
}

.victory-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.secondary-cta {
  padding: 13px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.85);
  color: #f8fafc;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
}

/* ============================================================================
   Keyframe Animations
   ============================================================================ */

@keyframes pawnBounce {
  from { transform: scale(1.12) translateY(0); }
  to { transform: scale(1.22) translateY(-4px); }
}

@keyframes targetPulse {
  0% { transform: scale(0.88); opacity: 0.95; }
  100% { transform: scale(1.38); opacity: 0; }
}

@keyframes diceTumble {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-14deg) scale(1.08); }
  50% { transform: rotate(10deg) scale(0.94); }
  75% { transform: rotate(-8deg) scale(1.06); }
  100% { transform: rotate(0deg) scale(1); }
}

@keyframes floatUp {
  0% { opacity: 1; transform: translate(-50%, -40%) scale(0.85); }
  25% { opacity: 1; transform: translate(-50%, -90%) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -180%) scale(0.95); }
}

@keyframes floatUpBig {
  0% { opacity: 1; transform: translate(-50%, -30%) scale(0.5); }
  22% { opacity: 1; transform: translate(-50%, -95%) scale(1.25); }
  75% { opacity: 1; transform: translate(-50%, -140%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -210%) scale(0.9); }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes energyGlow {
  from { filter: brightness(1); }
  to { filter: brightness(1.35); }
}

@keyframes bannerPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

@keyframes emotePop {
  0% { transform: scale(0.3) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.shake-light {
  animation: shakeLight 0.28s ease;
}

.shake-heavy {
  animation: shakeHeavy 0.38s ease;
}

@keyframes shakeLight {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -2px); }
  75% { transform: translate(-2px, -1px); }
}

@keyframes shakeHeavy {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-7px, 4px); }
  30% { transform: translate(7px, -5px); }
  45% { transform: translate(-5px, -4px); }
  60% { transform: translate(5px, 4px); }
  80% { transform: translate(-3px, 2px); }
}

/* ============================================================================
   Responsive Layout for Tablets & Smaller Viewports
   ============================================================================ */

@media (max-width: 1180px) {
  html, body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .top-bar {
    flex-wrap: wrap;
  }

  .arena-grid {
    grid-template-columns: 1fr;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    overflow: visible;
  }

  .board-perspective-wrap,
  .map-hud-strip {
    width: 100%;
    max-width: 650px;
  }

  .side-col {
    height: auto;
  }

  .battle-log {
    max-height: 160px;
  }

  .board-col {
    order: 1;
  }

  .right-col {
    order: 2;
  }

  .left-col {
    order: 3;
  }

  #left-cards, #right-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

@media (max-width: 640px) {
  .mode-grid,
  .setup-heroes-grid,
  .guide-grid,
  .theme-picker-row,
  .online-split {
    grid-template-columns: 1fr;
  }

  .ev-desc {
    display: none;
  }
}

/* ============================================================================
   Nusantara Cyberpunk Theme Overrides
   ============================================================================ */

body[data-theme="nusantara"] {
  --bg-deep: #0b0714;
  --bg-panel: rgba(24, 15, 40, 0.88);
  --bg-card: rgba(31, 20, 52, 0.82);
}

body[data-theme="nusantara"]::before {
  background:
    radial-gradient(circle at 15% 15%, var(--active-glow), transparent 44%),
    radial-gradient(circle at 86% 82%, rgba(242, 181, 68, 0.16), transparent 46%),
    linear-gradient(155deg, #0b0714 0%, #1a102c 52%, #110b1f 100%);
}

body[data-theme="nusantara"] .brand-logo {
  background: linear-gradient(90deg, #2dd4bf, #f2b544, #f1556f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body[data-theme="nusantara"] .brand-pill {
  background: rgba(242, 181, 68, 0.16);
  border-color: rgba(242, 181, 68, 0.55);
  color: #efcf86;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-color: rgba(242, 181, 68, 0.45);
  color: #efcf86;
}

.room-pill {
  border-color: #2dd4bf;
  color: #2dd4bf;
  background: rgba(45, 212, 191, 0.12);
}

/* ============================================================================
   KO Finisher Cinematic Splash Banner
   ============================================================================ */

.ko-splash-banner {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translate(-50%, -50%);
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(10, 12, 24, 0.94), color-mix(in srgb, var(--ko-color, #f1556f) 32%, #0a0c18));
  border: 2.5px solid var(--ko-color, #f1556f);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1rem, 2.2vw, 1.45rem);
  letter-spacing: 2px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow:
    0 0 36px color-mix(in srgb, var(--ko-color, #f1556f) 75%, transparent),
    0 12px 30px rgba(0, 0, 0, 0.75);
  animation: koSlam 1.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ko-splash-icon {
  font-size: 1.5em;
}

@keyframes koSlam {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.1) rotate(-4deg); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(0.95) rotate(1deg); }
  26% { opacity: 1; transform: translate(-50%, -50%) scale(1.04) rotate(0deg); }
  78% { opacity: 1; transform: translate(-50%, -54%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -85%) scale(0.92); }
}

/* ============================================================================
   Lobby Tabs, Theme Picker & Online Multiplayer Room UI
   ============================================================================ */

.lobby-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(7, 10, 20, 0.65);
  padding: 5px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.lobby-tab {
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.lobby-tab.active {
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.22), rgba(242, 181, 68, 0.22));
  color: #ffffff;
  border: 1px solid rgba(242, 181, 68, 0.45);
  box-shadow: 0 0 14px rgba(242, 181, 68, 0.18);
}

.theme-picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.theme-card {
  padding: 8px 11px;
  border-radius: 12px;
  border: 1.5px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.18s ease;
}

.theme-card strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.6px;
}

.theme-card span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.theme-card.selected {
  border-color: #f2b544;
  background: rgba(242, 181, 68, 0.13);
  box-shadow: 0 0 16px rgba(242, 181, 68, 0.24);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.tab-panel.active {
  display: flex;
}

.online-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.online-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.75);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.online-name-row label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
}

.online-name-row input,
.join-input-row input {
  flex: 1;
  background: #070b16;
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  outline: none;
}

.online-name-row input:focus,
.join-input-row input:focus {
  border-color: #2dd4bf;
}

.online-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.online-card {
  padding: 13px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.online-card h4 {
  font-family: var(--font-display);
  font-size: 0.86rem;
  color: #a5e4ee;
}

.online-card p {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
}

.join-input-row {
  display: flex;
  gap: 8px;
}

.join-input-row input {
  text-transform: uppercase;
  letter-spacing: 3px;
  text-align: center;
  max-width: 110px;
  font-family: var(--font-display);
}

.small-cta {
  padding: 10px 14px;
  font-size: 0.82rem;
}

.room-code-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.14), rgba(242, 181, 68, 0.14));
  border: 1.5px solid #2dd4bf;
}

.room-code-big {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: #f2b544;
}

.room-share-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.danger-btn {
  border-color: rgba(241, 85, 111, 0.55);
  color: #fda4af;
}

.lan-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  background: rgba(7, 10, 20, 0.6);
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  word-break: break-all;
}

.lan-hint code {
  color: #2dd4bf;
  font-weight: 700;
}


/* ============================================================================
   v2 — SVG Icon System
   ============================================================================ */

.ico {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.16em;
}

.icon-btn,
.meta-badge,
.lobby-tab,
.primary-cta,
.secondary-cta,
.panel-mini-title,
.mode-card h4,
.online-card h4,
.role-toggle-btn,
.tilt-toggle-btn,
.cancel-skill-btn,
.emote-btn,
.dice-chip,
.ko-stat,
.role-pill,
.skill-trigger-btn,
.buff-chip,
.rank-val,
.tile-inspector,
.setup-hero-skill,
.lan-hint,
.section-label,
.style-note,
.guide-section h4,
.guide-ko,
.emote-bubble,
.roll-btn-text,
.mini-dice-empty,
.hero-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.primary-cta,
.secondary-cta,
.role-toggle-btn,
.lobby-tab,
.icon-btn {
  justify-content: center;
}

.panel-mini-title,
.section-label,
.guide-section h4 {
  display: flex;
}

.icon-btn .ico {
  width: 16px;
  height: 16px;
}

.icon-btn.icon-only {
  width: 31px;
  padding: 0;
}

.icon-btn.muted {
  color: #fb7185;
  border-color: rgba(251, 113, 133, 0.45);
}

.meta-badge {
  gap: 5px;
}

.meta-badge .ico {
  width: 13px;
  height: 13px;
  opacity: 0.85;
}

.brand-mark {
  width: 26px;
  height: 26px;
  color: var(--active-accent);
  filter: drop-shadow(0 0 6px var(--active-glow));
  transition: color 0.4s ease;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ev-icon {
  display: inline-flex;
  color: var(--event-color, #94a3b8);
}

.ev-icon .ico {
  width: 16px;
  height: 16px;
}

kbd {
  font-family: var(--font-display);
  font-size: 0.85em;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
}

/* Tile inspector */
.tile-inspector {
  display: flex;
  gap: 7px;
}

.tile-inspector .ico {
  width: 15px;
  height: 15px;
  color: #efcf86;
}

.tile-inspector.active .ico {
  color: var(--insp-color, var(--active-accent));
}

.tile-inspector span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tilt-toggle-btn .ico {
  width: 14px;
  height: 14px;
}

/* ============================================================================
   v2 — Pawn Skins (SVG tokens)
   ============================================================================ */

.pawn-core {
  width: 94%;
  height: 94%;
  border-radius: 0;
  background: none;
  border: none;
  box-shadow: none;
  font-size: 0;
  filter: drop-shadow(0 0 5px var(--hero-glow)) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.75));
}

.pawn-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

body[data-pawn-skin="bidak"] .pawn-core {
  width: 104%;
  height: 104%;
  transform-origin: 50% 85%;
}

.pawn-token.is-ace .pawn-core {
  border: none;
  box-shadow: none;
  filter: drop-shadow(0 0 7px rgba(236, 201, 75, 0.95)) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.75));
}

.pawn-token.selectable .pawn-core {
  border: none;
  box-shadow: none;
  filter: drop-shadow(0 0 9px var(--hero-color)) drop-shadow(0 0 3px #ffffff);
}

.pawn-badge {
  width: 17px;
  height: 17px;
  color: #ecc94b;
  z-index: 3;
}

.pawn-badge .ico {
  width: 11px;
  height: 11px;
}

.pawn-badge[data-kind="shield"] {
  color: #a5e4ee;
  border-color: #a5e4ee;
}

/* ============================================================================
   v2 — Dice Skins (.die[data-skin])
   ============================================================================ */

.die {
  --die: 56px;
  --dice-color: #e2e8f0;
  position: relative;
  width: var(--die);
  height: var(--die);
  flex-shrink: 0;
  border-radius: calc(var(--die) * 0.24);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.die .dice-pip-grid {
  width: 70%;
  height: 70%;
}

.die .pip {
  width: calc(var(--die) * 0.15);
  height: calc(var(--die) * 0.15);
}

.die .dice-big-icon,
.die .dice-big-val {
  display: inline-flex;
  color: var(--dice-color);
}

.die .dice-big-icon .ico {
  width: calc(var(--die) * 0.5);
  height: calc(var(--die) * 0.5);
}

.die .dice-big-val .ico {
  width: calc(var(--die) * 0.42);
  height: calc(var(--die) * 0.42);
}

/* Neon Core */
.die[data-skin="neon"] {
  background: linear-gradient(145deg, #1d2846, #0b1122);
  border: 2.5px solid var(--dice-color);
  box-shadow:
    0 0 16px color-mix(in srgb, var(--dice-color) 45%, transparent),
    inset 0 2px 6px rgba(255, 255, 255, 0.15);
}

.die[data-skin="neon"] .pip.on {
  background: var(--dice-color);
  box-shadow: 0 0 8px var(--dice-color);
}

/* Gading Klasik */
.die[data-skin="gading"] {
  background: radial-gradient(circle at 30% 25%, #fffdf7, #efe4cc 58%, #d6c39c);
  border: 2px solid #c9b48a;
  box-shadow:
    inset -3px -4px 7px rgba(120, 90, 40, 0.35),
    inset 2px 2px 4px rgba(255, 255, 255, 0.9),
    0 4px 12px rgba(0, 0, 0, 0.55);
}

.die[data-skin="gading"] .pip.on {
  background: radial-gradient(circle at 35% 35%, #4a4038, #120e0a);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

.die[data-skin="gading"].face-1 .pip.on {
  background: radial-gradient(circle at 35% 35%, #ff5a6a, #a3101f);
  transform: scale(1.7);
}

.die[data-skin="gading"] .dice-big-icon,
.die[data-skin="gading"] .dice-big-val {
  color: #2a2119;
}

/* Hologram */
.die[data-skin="kaca"] {
  background: linear-gradient(135deg, rgba(165, 228, 238, 0.3), rgba(176, 140, 240, 0.24) 50%, rgba(255, 255, 255, 0.06));
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(6px);
  box-shadow:
    inset 0 0 14px rgba(255, 255, 255, 0.25),
    0 0 18px rgba(165, 228, 238, 0.35);
}

.die[data-skin="kaca"]::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.45) 50%, transparent 60%);
  animation: holoSweep 2.8s ease-in-out infinite;
  pointer-events: none;
}

.die[data-skin="kaca"] .pip.on {
  background: #ffffff;
  box-shadow: 0 0 8px #a5e4ee, 0 0 2px #fff;
}

.die[data-skin="kaca"] .dice-big-icon,
.die[data-skin="kaca"] .dice-big-val {
  color: #ffffff;
  filter: drop-shadow(0 0 6px #a5e4ee);
}

/* Emas 24K */
.die[data-skin="emas"] {
  background: linear-gradient(145deg, #fff3c4 0%, #f5c542 28%, #c98b0f 62%, #7a4f00 100%);
  border: 2px solid #ffe9a8;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.8),
    inset 0 -4px 8px rgba(80, 45, 0, 0.5),
    0 0 18px rgba(255, 196, 0, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.55);
}

.die[data-skin="emas"] .pip.on {
  background: radial-gradient(circle at 40% 35%, #5a3a00, #1c1000);
  box-shadow: 0 1px 0 rgba(255, 240, 190, 0.8), inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

.die[data-skin="emas"] .dice-big-icon,
.die[data-skin="emas"] .dice-big-val {
  color: #3b2500;
}

/* Batik Sogan */
.die[data-skin="batik"] {
  background:
    radial-gradient(circle at 0 0, transparent 7px, rgba(243, 226, 191, 0.2) 8px, transparent 9.5px) 0 0 / 16px 16px,
    radial-gradient(circle at 8px 8px, rgba(243, 226, 191, 0.14) 2px, transparent 3px) 0 0 / 16px 16px,
    linear-gradient(145deg, #74492a, #3e2612);
  border: 2px solid #c8a46a;
  box-shadow:
    inset 0 2px 4px rgba(255, 230, 180, 0.25),
    0 0 14px rgba(200, 164, 106, 0.3),
    0 4px 10px rgba(0, 0, 0, 0.55);
}

.die[data-skin="batik"] .pip.on {
  background: radial-gradient(circle at 40% 35%, #fff8e6, #e5cc97);
  box-shadow: 0 0 4px rgba(255, 230, 180, 0.6);
}

.die[data-skin="batik"] .dice-big-icon,
.die[data-skin="batik"] .dice-big-val {
  color: #f3e2bf;
}

/* Special dice on non-neon skins still signal their type with an outer ring */
.dice-cube.special:not([data-skin="neon"]) {
  outline: 2px solid var(--dice-color);
  outline-offset: 3px;
}

.dice-cube {
  overflow: visible;
}

.dice-cube[data-skin="kaca"] {
  overflow: hidden;
}

.dice-info-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dice-info-label strong {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  letter-spacing: 0.5px;
}

.dice-info-label em {
  font-style: normal;
  font-size: 0.64rem;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
}

.dice-info-label span {
  color: var(--text-muted);
}

.chip-icon {
  display: inline-flex;
  color: var(--chip-color);
}

.mini-dice-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--chip-color, #e2e8f0);
  border-color: color-mix(in srgb, var(--chip-color, #94a3b8) 45%, transparent);
  padding: 3px 5px;
}

.mini-dice-pill .ico {
  width: 13px;
  height: 13px;
}

@keyframes holoSweep {
  0% { transform: translateX(-60%); }
  60%, 100% { transform: translateX(60%); }
}

/* ============================================================================
   v2 — HUD polish
   ============================================================================ */

.log-item {
  border-left-color: var(--log-color, #38bdf8);
  background: linear-gradient(90deg, color-mix(in srgb, var(--log-color, #38bdf8) 10%, rgba(15, 23, 42, 0.7)), rgba(15, 23, 42, 0.55));
  animation: logIn 0.28s ease-out;
}

@keyframes logIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: none; }
}

.panel-mini-title .ico {
  width: 13px;
  height: 13px;
  color: var(--active-accent);
}

.emote-btn {
  justify-content: center;
}

.emote-btn .ico {
  width: 13px;
  height: 13px;
  color: #efcf86;
}

.emote-bubble .ico {
  width: 15px;
  height: 15px;
  color: #f1556f;
}

.ko-stat {
  gap: 3px;
}

.ko-stat .ico {
  width: 13px;
  height: 13px;
}

.role-pill {
  gap: 3px;
  max-width: 96px;
  overflow: hidden;
  white-space: nowrap;
}

.role-pill .ico {
  width: 11px;
  height: 11px;
}

.energy-label span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.energy-label .ico {
  width: 12px;
  height: 12px;
  color: var(--hero-color);
}

.skill-trigger-btn .ico,
.buff-chip .ico {
  width: 12px;
  height: 12px;
}

.skill-hint {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.turn-header-main {
  min-width: 0;
}

#turn-hero-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#turn-hero-name > span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.turn-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid currentColor;
  background: #070b16;
  padding: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 10px var(--active-glow);
}

.turn-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.loadout-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.roll-btn-text .ico {
  width: 18px;
  height: 18px;
}

.dock-skill-btn .ico {
  width: 15px;
  height: 15px;
}

.cancel-skill-btn .ico {
  width: 12px;
  height: 12px;
}

.ko-splash-icon {
  display: inline-flex;
  font-size: 1em;
}

.ko-splash-icon .ico {
  width: 1.35em;
  height: 1.35em;
  color: var(--ko-color, #f1556f);
  filter: drop-shadow(0 0 8px var(--ko-color, #f1556f));
}

/* ============================================================================
   v2 — Lobby, Skin Picker & Modals
   ============================================================================ */

.lobby-tabs {
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.lobby-tab .ico {
  width: 15px;
  height: 15px;
}

.section-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-label .ico {
  width: 14px;
  height: 14px;
  color: #efcf86;
}

.tab-panel {
  gap: 8px;
}

.mode-card h4 .ico,
.online-card h4 .ico {
  width: 15px;
  height: 15px;
  color: #efcf86;
}

.theme-card strong .ico {
  width: 16px;
  height: 16px;
  color: #b48af0;
}

.setup-hero-meta {
  min-width: 0;
}

.setup-hero-name small {
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0;
  margin-left: 4px;
}

.setup-hero-skill {
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.68rem;
}

.setup-hero-skill .ico {
  width: 12px;
  height: 12px;
  color: var(--hero-color);
}

.setup-hero-skill .sep {
  opacity: 0.4;
}

.setup-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.role-toggle-btn .ico {
  width: 14px;
  height: 14px;
}

.role-toggle-btn.off {
  color: var(--text-muted);
}

.setup-error.info {
  color: #a5e4ee;
}

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  background: #64748b;
}

.conn-dot.on {
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.conn-dot.wait {
  background: #fbbf24;
  animation: energyGlow 0.8s ease-in-out infinite alternate;
}

.lan-hint {
  display: flex;
  align-items: flex-start;
}

.lan-hint .ico {
  margin-top: 2px;
  color: #2dd4bf;
}

.primary-cta .ico {
  width: 18px;
  height: 18px;
}

.primary-cta {
  background: linear-gradient(90deg, #2dd4bf, #ecc94b 60%, #f2b544);
  position: relative;
  overflow: hidden;
}

.primary-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.45) 50%, transparent 65%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.primary-cta:hover:not(:disabled)::after {
  transform: translateX(100%);
}

/* Arena & Skin picker */
.style-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.skin-grid-dice {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.skin-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 13px;
  border: 1.5px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.72);
  color: #f1f5f9;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.skin-card:hover {
  transform: translateY(-2px);
  border-color: rgba(239, 207, 134, 0.55);
}

.skin-card.selected {
  border-color: #f2b544;
  background: rgba(242, 181, 68, 0.1);
  box-shadow: 0 0 16px rgba(242, 181, 68, 0.22);
}

.skin-preview {
  height: 66px;
  border-radius: 9px;
  background: rgba(5, 8, 18, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.skin-grid-map .skin-preview {
  height: 92px;
  padding: 4px;
}

.map-preview {
  height: 100%;
  aspect-ratio: 1;
  display: block;
}

.pawn-preview-row {
  display: flex;
  gap: 2px;
  align-items: center;
}

.pawn-preview {
  width: 30px;
  height: 30px;
  display: block;
  filter: drop-shadow(0 0 4px var(--hero-glow)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.7));
}

.dice-preview-row {
  display: flex;
  gap: 8px;
}

.dice-preview-row .die {
  --die: 38px;
}

.skin-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.skin-text strong {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skin-text span {
  font-size: 0.64rem;
  line-height: 1.25;
  color: var(--text-muted);
}

.skin-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  background: #f2b544;
  color: #070a14;
  box-shadow: 0 0 10px rgba(242, 181, 68, 0.6);
}

.skin-check .ico {
  width: 12px;
  height: 12px;
}

.skin-card.selected .skin-check {
  display: flex;
}

.style-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  align-items: flex-start;
}

.style-note .ico {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  color: #a5e4ee;
}

/* Guide */
.help-body {
  gap: 14px;
}

.guide-section h4 .ico {
  width: 16px;
  height: 16px;
}

.guide-item {
  border-left-color: var(--item-color, #38c6e0);
}

.guide-item-head {
  display: flex;
  align-items: center;
  gap: 7px;
}

.guide-item-head strong {
  color: var(--item-color);
}

.guide-item-head em {
  font-style: normal;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-left: 4px;
}

.guide-avatar,
.guide-glyph {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--item-color);
}

.guide-avatar svg {
  width: 100%;
  height: 100%;
}

.guide-glyph .ico {
  width: 18px;
  height: 18px;
}

.guide-ko {
  color: #f2b544;
  font-weight: 700;
}

.guide-ko .ico {
  width: 13px;
  height: 13px;
}

/* Victory */
.victory-card {
  position: relative;
  border-color: color-mix(in srgb, var(--hero-color, #ecc94b) 60%, transparent);
}

.victory-trophy {
  color: #ecc94b;
  filter: drop-shadow(0 0 14px rgba(236, 201, 75, 0.7));
  animation: pawnBounce 0.9s ease-in-out infinite alternate;
}

.victory-trophy .ico {
  width: 40px;
  height: 40px;
}

.victory-avatar svg {
  width: 100%;
  height: 100%;
}

.rank-row {
  justify-content: flex-start;
  gap: 10px;
}

.rank-row.first {
  background: linear-gradient(90deg, color-mix(in srgb, var(--hero-color) 18%, #0f172a), rgba(15, 23, 42, 0.85));
}

.rank-num {
  width: 26px;
  display: inline-flex;
  justify-content: center;
}

.rank-avatar {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.rank-avatar svg {
  width: 100%;
  height: 100%;
}

.rank-name {
  flex: 1;
  text-align: left;
  color: var(--hero-color);
}

.rank-val {
  gap: 4px;
  color: #cbd5e1;
}

.rank-val .ico {
  width: 13px;
  height: 13px;
}

/* ============================================================================
   v2 — Loading Screen
   ============================================================================ */

.loading-screen {
  --ld-accent: #f2b544;
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--ld-accent) 16%, transparent), transparent 55%),
    radial-gradient(circle at 15% 90%, rgba(45, 212, 191, 0.1), transparent 45%),
    radial-gradient(circle at 85% 10%, rgba(241, 85, 111, 0.1), transparent 45%),
    #06040d;
  opacity: 0;
  transition: opacity 0.38s ease, transform 0.38s ease;
}

.loading-screen.show {
  display: flex;
  opacity: 1;
}

.loading-screen[hidden] {
  display: none !important;
}

.loading-screen.leaving {
  opacity: 0;
  transform: scale(1.04);
}

.ld-glow {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 45%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 20%, transparent 70%);
  animation: gridDrift 6s linear infinite;
  pointer-events: none;
}

@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 44px, 44px 0; }
}

.ld-center {
  position: relative;
  width: min(640px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.ld-brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  letter-spacing: 10px;
  padding-left: 10px;
  background: linear-gradient(90deg, #2dd4bf, #f2b544, #f1556f, #b08cf0, #2dd4bf);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brandShift 3s linear infinite;
  filter: drop-shadow(0 0 18px rgba(242, 181, 68, 0.25));
}

@keyframes brandShift {
  to { background-position: 200% 0; }
}

.ld-sub {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--ld-accent);
  margin-top: -6px;
}

.ld-stage {
  position: relative;
  width: 230px;
  height: 230px;
  display: grid;
  place-items: center;
  perspective: 700px;
  margin: 6px 0;
}

.ld-stage::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--ld-accent) 45%, transparent);
  animation: spinSlow 14s linear infinite reverse;
}

.ld-cube3d {
  --cube: 82px;
  --die: var(--cube);
  position: relative;
  width: var(--cube);
  height: var(--cube);
  transform-style: preserve-3d;
  animation: cubeTumble 2.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.ld-cube3d .cube-face {
  --die: var(--cube);
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
}

.ld-cube3d .cube-face[data-skin="kaca"] {
  backdrop-filter: none;
  background: linear-gradient(135deg, rgba(60, 140, 160, 0.9), rgba(110, 60, 150, 0.9));
}

.cf-0 { transform: translateZ(calc(var(--cube) / 2)); }
.cf-1 { transform: rotateY(180deg) translateZ(calc(var(--cube) / 2)); }
.cf-2 { transform: rotateY(90deg) translateZ(calc(var(--cube) / 2)); }
.cf-3 { transform: rotateY(-90deg) translateZ(calc(var(--cube) / 2)); }
.cf-4 { transform: rotateX(90deg) translateZ(calc(var(--cube) / 2)); }
.cf-5 { transform: rotateX(-90deg) translateZ(calc(var(--cube) / 2)); }

@keyframes cubeTumble {
  0% { transform: rotateX(-24deg) rotateY(0deg) rotateZ(0deg); }
  50% { transform: rotateX(160deg) rotateY(200deg) rotateZ(20deg); }
  100% { transform: rotateX(336deg) rotateY(360deg) rotateZ(0deg); }
}

.ld-orbit {
  position: absolute;
  inset: 0;
  animation: spinSlow 7s linear infinite;
}

.ld-orbit-pawn {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  transform: rotate(calc(var(--i) * 90deg)) translateY(-96px) rotate(calc(var(--i) * -90deg));
  filter: drop-shadow(0 0 8px var(--hero-glow));
}

.ld-orbit-pawn > svg {
  width: 100%;
  height: 100%;
  animation: spinSlow 7s linear infinite reverse;
}

.ld-lineup {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.ld-fighter {
  width: 104px;
  padding: 8px 6px;
  border-radius: 14px;
  border: 1.5px solid var(--hero-color);
  background: linear-gradient(180deg, color-mix(in srgb, var(--hero-color) 16%, #0a0f1e), #070b16);
  box-shadow: 0 0 18px color-mix(in srgb, var(--hero-color) 25%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0;
  animation: fighterIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--d);
}

.ld-fighter-avatar {
  width: 46px;
  height: 46px;
}

.ld-fighter-avatar svg {
  width: 100%;
  height: 100%;
}

.ld-fighter-name {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 900;
  color: var(--hero-color);
  letter-spacing: 0.6px;
}

.ld-fighter-role {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
}

.ld-fighter-role .ico {
  width: 11px;
  height: 11px;
}

.ld-vs {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.72rem;
  color: #f1556f;
  text-shadow: 0 0 10px rgba(241, 85, 111, 0.7);
}

@keyframes fighterIn {
  from { opacity: 0; transform: translateY(14px) scale(0.9); }
  to { opacity: 1; transform: none; }
}

.ld-progress-wrap {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.ld-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.ld-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2dd4bf, var(--ld-accent), #f1556f);
  box-shadow: 0 0 14px var(--ld-accent);
}

.ld-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #cbd5e1;
}

.ld-pct {
  font-family: var(--font-display);
  color: var(--ld-accent);
}

.ld-tip {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 440px;
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-align: left;
}

.ld-tip:empty {
  display: none;
}

.ld-tip .ico {
  color: #efcf86;
  width: 15px;
  height: 15px;
}

.loading-screen[data-kind="boot"] .ld-stage {
  width: 190px;
  height: 190px;
}

.loading-screen[data-kind="boot"] .ld-orbit-pawn {
  transform: rotate(calc(var(--i) * 90deg)) translateY(-78px) rotate(calc(var(--i) * -90deg));
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
}

/* Map-tinted ambient backdrop */
body::before,
body[data-theme="nusantara"]::before {
  background:
    radial-gradient(circle at 15% 15%, var(--active-glow), transparent 44%),
    radial-gradient(circle at 86% 82%, var(--map-ambient, rgba(242, 181, 68, 0.16)), transparent 46%),
    linear-gradient(155deg, #0b0714 0%, #161028 52%, #0e0a1c 100%);
}

/* ============================================================================
   v2 — Responsive & Accessibility
   ============================================================================ */

@media (max-width: 900px) {
  .skin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .skin-grid-dice {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .lobby-tab span {
    font-size: 0.66rem;
  }

  .brand-pill {
    display: none;
  }

  .top-actions .theme-btn span,
  #lobby-btn span {
    display: none;
  }

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

  .ld-fighter {
    width: 84px;
  }

  .ld-vs {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid #efcf86;
  outline-offset: 2px;
}

/* ============================================================================
   v2 — Brand logo (SVG wordmark)
   ============================================================================ */

.brand-logo,
body[data-theme="nusantara"] .brand-logo {
  display: inline-flex;
  align-items: center;
  height: 22px;
  background: none;
  -webkit-text-fill-color: initial;
  filter: drop-shadow(0 0 8px rgba(45, 212, 191, 0.25));
}

.ludoz-logo {
  height: 100%;
  width: auto;
  display: block;
}

.ld-brand {
  background: none;
  -webkit-text-fill-color: initial;
  animation: logoFloat 2.4s ease-in-out infinite alternate;
  padding: 0;
  filter: drop-shadow(0 0 22px rgba(45, 212, 191, 0.3));
}

.ld-brand .ludoz-logo {
  width: min(300px, 70vw);
  height: auto;
}

@keyframes logoFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

/* v2 — mobile overflow fixes */
@media (max-width: 1180px) {
  .arena-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .side-col,
  .board-col,
  .hero-card {
    min-width: 0;
  }

  #left-cards,
  #right-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .top-bar {
    gap: 6px;
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
  }

  .event-banner {
    order: 3;
    flex-basis: 100%;
  }
}

@media (max-width: 480px) {
  #left-cards,
  #right-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ============================================================================
   v3 — Stepped Lobby (1. Pilih Permainan → 2. Pilih Pemain)
   ============================================================================ */

.modal-setup {
  max-width: 720px;
}

.modal-setup .modal-scroll-body {
  gap: 14px;
  padding: 14px 20px 16px;
}

/* Stepper */
.lobby-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.8);
  font-size: 0.78rem;
  transition: all 0.25s ease;
}

.step-pill.active {
  color: #f8fafc;
}

.step-pill.active .step-num {
  border-color: #f2b544;
  background: #f2b544;
  color: #070a14;
  box-shadow: 0 0 14px rgba(242, 181, 68, 0.45);
}

.step-pill.done {
  color: #2dd4bf;
}

.step-pill.done .step-num {
  border-color: #2dd4bf;
  color: #2dd4bf;
  background: rgba(45, 212, 191, 0.12);
}

.step-line {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.5), rgba(148, 163, 184, 0.2));
}

/* Step 1 — game setup */
.game-setup {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: stepIn 0.3s ease-out;
}

.setup-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-picker-row {
  gap: 10px;
}

.theme-card {
  position: relative;
  padding: 14px;
  gap: 10px;
  border-radius: 16px;
}

.theme-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.theme-card strong {
  font-size: 0.84rem;
}

.theme-card .skin-check {
  position: static;
}

.theme-card.selected .skin-check {
  display: flex;
}

.theme-avatars {
  display: flex;
  gap: 8px;
}

.theme-avatar {
  width: 46px;
  height: 46px;
  padding: 3px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--hero-color) 60%, transparent);
  background: #070b16;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.theme-card.selected .theme-avatar {
  border-color: var(--hero-color);
  box-shadow: 0 0 10px color-mix(in srgb, var(--hero-color) 45%, transparent);
}

.theme-card:hover .theme-avatar {
  transform: translateY(-2px);
}

.theme-card .theme-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.theme-card:not(.selected) {
  opacity: 0.72;
}

.theme-card:not(.selected):hover {
  opacity: 1;
}

.mode-grid {
  gap: 10px;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
}

.mode-card:not(.selected) {
  opacity: 0.72;
}

.mode-card:not(.selected):hover {
  opacity: 1;
}

.mode-card h4 {
  font-size: 0.9rem;
  margin-bottom: 3px;
}

.mode-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mode-pawns {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 14px;
  background: rgba(5, 8, 18, 0.8);
  border: 1.5px solid rgba(148, 163, 184, 0.2);
  display: grid;
  grid-template-columns: repeat(2, 14px);
  justify-content: center;
  align-content: center;
  gap: 8px;
}

.mode-pawns i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #2dd4bf 45%, #0b6b62);
  box-shadow: 0 0 8px rgba(45, 212, 191, 0.5);
}

.mode-pawns.four i {
  background: radial-gradient(circle at 35% 30%, #fff, #f2b544 45%, #7a5200);
  box-shadow: 0 0 8px rgba(242, 181, 68, 0.5);
}

.mode-card.selected .mode-pawns {
  border-color: currentColor;
}

/* Step 2 — players */
.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#tab-local.active {
  animation: stepIn 0.3s ease-out;
}

@keyframes stepIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px solid color-mix(in srgb, var(--hero-color) 45%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--hero-color) 10%, rgba(15, 23, 42, 0.85)), rgba(15, 23, 42, 0.78));
  transition: opacity 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}

.player-row.off {
  opacity: 0.5;
  filter: grayscale(0.6);
  border-color: rgba(148, 163, 184, 0.18);
}

.player-row .setup-avatar {
  width: 44px;
  height: 44px;
}

.player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.player-skill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
  min-width: 0;
}

.player-skill span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-skill .ico {
  width: 12px;
  height: 12px;
  color: var(--hero-color);
}

.role-seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 11px;
  background: rgba(5, 8, 18, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  flex-shrink: 0;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.seg-btn .ico {
  width: 13px;
  height: 13px;
}

.seg-btn:hover:not(.on) {
  color: #f1f5f9;
  background: rgba(148, 163, 184, 0.1);
}

.seg-btn.human.on {
  background: var(--hero-color);
  color: #070a14;
  box-shadow: 0 0 12px var(--hero-glow);
}

.seg-btn.ai.on {
  background: #38bdf8;
  color: #04121c;
}

.seg-btn.off.on {
  background: rgba(148, 163, 184, 0.3);
  color: #f1f5f9;
}

/* Footer */
.modal-footer {
  display: flex;
  gap: 10px;
}

.modal-footer .primary-cta {
  flex: 1;
}

.back-cta {
  flex: 0 0 auto;
  padding: 13px 18px;
}

.back-cta .ico {
  width: 16px;
  height: 16px;
}

.setup-error:empty {
  display: none;
}

@media (max-width: 640px) {
  .player-row {
    flex-wrap: wrap;
  }

  .role-seg {
    width: 100%;
  }

  .seg-btn {
    flex: 1;
    justify-content: center;
  }

  .theme-avatar {
    width: 38px;
    height: 38px;
  }

  .step-pill span:last-child {
    font-size: 0.66rem;
  }
}

/* ============================================================================
   v4 — Emote bubble stays inside the card (no clipping at the top edge)
   ============================================================================ */

.emote-anchor {
  top: 6px;
  right: 8px;
  left: 56px;
  display: flex;
  justify-content: flex-end;
  z-index: 50;
}

.emote-bubble {
  display: inline-flex;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 12px;
  padding: 6px 11px;
  font-size: 0.76rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55), 0 0 0 2px var(--hero-color);
}

.emote-bubble span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================================
   v4 — Calm mode: fewer always-on animations, softer glow & shake
   ============================================================================ */

.svg-spin-center,
.hero-home-lane .svg-dash-flow,
.event-banner.active,
.energy-fill.full,
.skill-trigger-btn,
.ld-stage::before {
  animation: none;
}

.svg-dash-flow {
  animation-duration: 2.4s;
}

.skill-trigger-btn {
  box-shadow: 0 0 10px var(--hero-glow);
}

.pawn-token.selectable .pawn-core {
  animation: pawnBreathe 1.4s ease-in-out infinite alternate;
}

.pawn-token.selectable .pawn-ring {
  animation-duration: 1.6s;
}

@keyframes pawnBreathe {
  from { transform: scale(1.06); }
  to { transform: scale(1.14); }
}

.hero-yard-group.yard-active {
  filter: drop-shadow(0 0 8px var(--active-glow));
}

.hero-home-lane.lane-active {
  filter: none;
}

.board-stage {
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.22),
    0 18px 46px rgba(0, 0, 0, 0.72),
    0 0 22px var(--active-glow);
}

.hero-card.active {
  box-shadow: 0 0 14px color-mix(in srgb, var(--hero-color) 26%, transparent);
  transform: none;
}

.die[data-skin="kaca"]::after {
  animation-duration: 6s;
}

@keyframes shakeHeavy {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -2px); }
  75% { transform: translate(-2px, 1px); }
}

@keyframes shakeLight {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(1.5px, -1px); }
}

/* Toast */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(12, 16, 30, 0.96);
  border: 1.5px solid #fb7185;
  color: #f8fafc;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-toast .ico {
  width: 16px;
  height: 16px;
  color: #fb7185;
}

/* ============================================================================
   v5 — Calm palette: no neon halos, flat accents, softer ambient light
   ============================================================================ */

body::before,
body[data-theme="nusantara"]::before {
  background:
    radial-gradient(circle at 15% 12%, color-mix(in srgb, var(--active-accent) 9%, transparent), transparent 45%),
    linear-gradient(160deg, #0c0916 0%, #120e20 55%, #0d0a18 100%);
}

body::after {
  opacity: 0.5;
}

.board-stage,
.board-stage.tilt-3d {
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.18),
    0 18px 40px rgba(0, 0, 0, 0.6);
}

.hero-card.active {
  box-shadow: none;
  background: color-mix(in srgb, var(--hero-color) 9%, var(--bg-card));
}

.hero-avatar,
.turn-avatar,
.victory-avatar,
.flag-svg,
.finish-dot.done,
.energy-fill.full,
.skill-trigger-btn,
.dock-skill-btn,
.dice-chip.selected,
.lobby-tab.active,
.theme-card.selected,
.theme-card.selected .theme-avatar,
.mode-card.selected,
.skin-card.selected,
.skin-check,
.step-pill.active .step-num,
.seg-btn.human.on,
.mode-pawns i,
.event-banner.active,
.tile-inspector.active,
.meta-badge.reversed,
.conn-dot.on,
.ld-bar,
.pawn-badge {
  box-shadow: none;
}

.lobby-tab.active {
  background: rgba(242, 181, 68, 0.12);
  border-color: rgba(242, 181, 68, 0.45);
}

.primary-cta {
  background: #f2b544;
  color: #17110a;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.primary-cta:hover:not(:disabled) {
  filter: brightness(1.06);
}

.roll-btn {
  background: color-mix(in srgb, var(--hero-color, #38c6e0) 18%, #10162a);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.modal-card {
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.8);
}

.brand-logo,
body[data-theme="nusantara"] .brand-logo,
.brand-mark,
.ld-brand {
  filter: none;
}

.die[data-skin="neon"] {
  border-width: 2px;
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.12), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.die[data-skin="neon"] .pip.on {
  box-shadow: none;
}

.die[data-skin="kaca"] {
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.2), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.die[data-skin="emas"],
.die[data-skin="batik"] {
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.5), 0 4px 10px rgba(0, 0, 0, 0.45);
}

.pawn-core {
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.7));
}

.pawn-token.is-ace .pawn-core {
  filter: drop-shadow(0 0 3px rgba(236, 201, 75, 0.9)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.7));
}

.pawn-token.selectable .pawn-core {
  filter: drop-shadow(0 0 3px #ffffff) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6));
}

.hero-yard-group.yard-active {
  filter: none;
}

.ld-orbit-pawn,
.pawn-preview {
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6));
}

.ld-fighter {
  box-shadow: none;
}

.event-banner.active {
  background: color-mix(in srgb, var(--event-color, #ecc94b) 10%, #0f1324);
}

/* ============================================================================
   v5 — Mobile game layout (≤ 900px)
   Top bar → player strip → board → sticky dice dock → feed & emotes
   ============================================================================ */

@media (max-width: 900px) {
  html,
  body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    padding: 6px 8px 0;
    gap: 6px;
    overflow: visible;
  }

  /* Compact top bar */
  .top-bar {
    flex-wrap: wrap;
    padding: 5px 8px;
    gap: 6px;
    border-radius: 12px;
  }

  .brand-pill,
  .theme-btn,
  .event-banner.idle {
    display: none;
  }

  .brand-logo,
  body[data-theme="nusantara"] .brand-logo {
    height: 18px;
  }

  .top-actions {
    margin-left: auto;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .meta-badge {
    padding: 4px 7px;
    font-size: 0.58rem;
  }

  .meta-badge .ico {
    display: none;
  }

  .icon-btn {
    height: 30px;
  }

  .icon-btn.icon-only,
  #lobby-btn {
    width: 30px;
    padding: 0;
  }

  #lobby-btn span {
    display: none;
  }

  .event-banner.active {
    order: 3;
    flex-basis: 100%;
    min-width: 0;
    padding: 4px 8px;
  }

  /* Single column with reordered panels */
  .arena-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
    overflow: visible;
  }

  .side-col {
    display: contents;
  }

  #left-cards { order: 1; }
  #right-cards { order: 2; }
  .board-col { order: 3; }
  .dock-panel { order: 4; }
  .log-panel { order: 5; }
  .emote-panel { order: 6; margin-bottom: 10px; }

  /* Compact player strip (2 x 2) */
  #left-cards,
  #right-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .hero-card {
    padding: 6px 8px;
    gap: 4px;
    border-radius: 11px;
  }

  .hero-card-head {
    gap: 7px;
  }

  .hero-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border-width: 1.5px;
    padding: 1px;
  }

  .hero-name {
    font-size: 0.7rem;
    letter-spacing: 0.4px;
  }

  .role-pill {
    font-size: 0.54rem;
    padding: 1px 5px;
  }

  .role-pill .ico {
    display: none;
  }

  .hero-stats-row {
    margin-top: 1px;
    gap: 6px;
  }

  .finish-dot {
    width: 8px;
    height: 8px;
  }

  .ko-stat {
    font-size: 0.64rem;
  }

  .buff-chip,
  .energy-label,
  .hero-card-foot {
    display: none;
  }

  .energy-track {
    height: 5px;
  }

  .emote-anchor {
    top: 4px;
    left: 36px;
    right: 6px;
  }

  .emote-bubble {
    font-size: 0.66rem;
    padding: 4px 8px;
  }

  /* Board */
  .board-perspective-wrap {
    width: 100%;
    max-width: none;
  }

  .board-stage {
    border-radius: 14px;
    padding: 3px;
  }

  #board-svg {
    border-radius: 12px;
  }

  .map-hud-strip {
    display: none;
  }

  /* Sticky dice dock */
  .dock-panel {
    position: sticky;
    bottom: 0;
    z-index: 40;
    flex: none;
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "dice turn turn"
      "dice prompt prompt"
      "load load roll"
      "skill skill skill";
    column-gap: 10px;
    row-gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    margin: 0 -8px;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    background: rgba(14, 11, 26, 0.97);
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.5);
    overflow: visible;
  }

  .turn-header {
    grid-area: turn;
    min-width: 0;
  }

  .turn-kicker,
  .dice-info-label,
  .roll-hint,
  .loadout-block .panel-mini-title {
    display: none;
  }

  #turn-hero-name {
    font-size: 0.78rem;
    gap: 6px;
  }

  .turn-avatar {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border-width: 1.5px;
    padding: 1px;
  }

  #turn-prompt {
    grid-area: prompt;
    font-size: 0.7rem;
    min-height: 0;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dice-stage-row {
    grid-area: dice;
    padding: 0;
    background: none;
    border: none;
    align-self: center;
  }

  .dice-cube {
    --die: 48px;
  }

  .loadout-block {
    grid-area: load;
    min-width: 0;
    align-self: center;
  }

  .dice-loadout {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 1px;
  }

  .dice-loadout::-webkit-scrollbar {
    display: none;
  }

  .dice-chip {
    flex-shrink: 0;
    padding: 6px 8px;
    font-size: 0.66rem;
  }

  .roll-group {
    grid-area: roll;
    min-width: 0;
  }

  .roll-btn {
    height: 44px;
    font-size: 0.74rem;
    letter-spacing: 0.6px;
  }

  .roll-btn-text span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dock-skill-btn {
    grid-area: skill;
  }

  .cancel-skill-btn {
    padding: 2px 7px;
    font-size: 0.64rem;
  }

  /* Feed & emotes */
  .log-panel {
    flex: none;
  }

  .battle-log {
    max-height: 150px;
  }

  .emote-bar {
    flex-wrap: wrap;
  }

  /* Bigger touch targets for pawns */
  .pawn-token {
    width: 7%;
    height: 7%;
  }

  .ko-splash-banner {
    font-size: 0.9rem;
    padding: 8px 14px;
  }
}

@media (max-width: 380px) {
  .meta-badge#dir-badge:not(.reversed) {
    display: none;
  }

  .dock-panel {
    grid-template-columns: 46px minmax(0, 1fr) minmax(0, 1.1fr);
  }

  .dice-cube {
    --die: 44px;
  }
}

/* ============================================================================
   v6 — Mobile lobby & loading screen
   ============================================================================ */

@media (max-width: 640px) {
  /* Modal shell */
  .modal-backdrop {
    padding: 8px;
    align-items: stretch;
  }

  .modal-card {
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }

  .modal-setup {
    max-width: none;
  }

  .modal-setup .modal-header {
    padding: 12px 14px 10px;
  }

  .modal-title {
    font-size: 0.98rem;
    letter-spacing: 0.8px;
  }

  .modal-setup .modal-sub {
    display: none;
  }

  .modal-setup .modal-scroll-body {
    padding: 12px 14px;
    gap: 12px;
  }

  .modal-footer {
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
    gap: 8px;
  }

  .modal-footer .primary-cta {
    padding: 13px 10px;
    font-size: 0.84rem;
    letter-spacing: 0.8px;
  }

  .back-cta {
    padding: 12px 12px;
    font-size: 0.76rem;
  }

  .back-cta span {
    display: none;
  }

  /* Tabs: icon on top, label below */
  .lobby-tab {
    flex-direction: column;
    gap: 3px;
    padding: 7px 4px;
    font-size: 0.6rem;
    letter-spacing: 0.4px;
    line-height: 1.15;
  }

  .lobby-tab span {
    font-size: 0.6rem;
  }

  /* Stepper */
  .lobby-stepper {
    gap: 8px;
  }

  .step-pre {
    display: none;
  }

  .step-pill {
    font-size: 0.68rem;
    gap: 6px;
  }

  .step-num {
    width: 24px;
    height: 24px;
  }

  .step-line {
    min-width: 16px;
  }

  /* Step 1 cards stack in one column */
  .modal-setup .theme-picker-row,
  .modal-setup .online-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .theme-card {
    padding: 11px 12px;
    gap: 8px;
  }

  .theme-card strong {
    font-size: 0.76rem;
  }

  .theme-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .modal-setup .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mode-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 11px;
  }

  .mode-pawns {
    width: 42px;
    height: 42px;
    gap: 5px;
    grid-template-columns: repeat(2, 11px);
  }

  .mode-pawns i {
    width: 11px;
    height: 11px;
  }

  .mode-card h4 {
    font-size: 0.8rem;
  }

  .mode-card p {
    font-size: 0.68rem;
  }

  /* Online tab */
  .online-name-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .online-name-row label {
    width: 100%;
  }

  .online-name-row input {
    min-width: 0;
    width: 100%;
  }

  .online-card {
    padding: 12px;
  }

  .join-input-row input {
    max-width: none;
    min-width: 0;
    flex: 1;
  }

  .join-input-row .secondary-cta {
    flex-shrink: 0;
  }

  .room-code-banner {
    padding: 10px 12px;
  }

  .room-code-big {
    font-size: 1.4rem;
    letter-spacing: 4px;
  }

  .room-share-actions {
    width: 100%;
  }

  .room-share-actions .icon-btn {
    flex: 1;
  }

  #online-seats-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Skin picker */
  .skin-grid,
  .skin-grid-dice {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .skin-grid-map .skin-preview {
    height: 80px;
  }

  /* Guide & victory */
  .guide-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .victory-card {
    padding: 18px 14px;
    align-self: center;
  }

  .victory-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .rank-row {
    gap: 6px;
    padding: 8px 10px;
    font-size: 0.74rem;
  }
}

/* Loading screen on phones: everything fits, lineup stays on one row */
@media (max-width: 640px), (max-height: 720px) {
  .loading-screen {
    overflow-y: auto;
    align-items: safe center;
    padding: 16px 12px;
  }

  .ld-center {
    gap: 8px;
    margin: auto 0;
  }

  .ld-brand .ludoz-logo {
    width: min(200px, 56vw);
  }

  .ld-sub {
    font-size: 0.62rem;
    letter-spacing: 3px;
    margin-top: -2px;
  }

  .ld-stage,
  .loading-screen[data-kind="boot"] .ld-stage {
    width: 170px;
    height: 170px;
    margin: 2px 0;
  }

  .ld-cube3d {
    --cube: 60px;
  }

  .ld-cube3d .cube-face {
    border-radius: 9px;
  }

  .ld-orbit-pawn,
  .loading-screen[data-kind="boot"] .ld-orbit-pawn {
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    transform: rotate(calc(var(--i) * 90deg)) translateY(-70px) rotate(calc(var(--i) * -90deg));
  }

  .ld-lineup {
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    justify-content: center;
  }

  .ld-vs {
    display: none;
  }

  .ld-fighter {
    width: auto;
    flex: 0 1 78px;
    min-width: 0;
    padding: 6px 4px;
    border-radius: 11px;
    gap: 3px;
  }

  .ld-fighter-avatar {
    width: 32px;
    height: 32px;
  }

  .ld-fighter-name {
    font-size: 0.56rem;
    letter-spacing: 0.2px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ld-fighter-role {
    font-size: 0.56rem;
  }

  .ld-progress-wrap {
    width: min(300px, 100%);
    margin-top: 4px;
  }

  .ld-progress-meta {
    font-size: 0.68rem;
  }

  .ld-tip {
    font-size: 0.68rem;
    line-height: 1.35;
  }
}

/* Very short screens (landscape phones): drop the orbit, keep it compact */
@media (max-height: 480px) {
  .ld-stage,
  .loading-screen[data-kind="boot"] .ld-stage {
    width: 100px;
    height: 100px;
  }

  .ld-orbit,
  .ld-stage::before,
  .ld-tip {
    display: none;
  }
}

/* ============================================================================
   v7 — Credit: Built by yumastudio.digital
   ============================================================================ */

.app-credit,
.modal-credit,
.ld-credit {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.3px;
}

.app-credit a,
.modal-credit a,
.ld-credit a {
  color: #efcf86;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(239, 207, 134, 0.45);
}

.app-credit a:hover,
.modal-credit a:hover,
.ld-credit a:hover {
  color: #ffffff;
  border-bottom-color: #ffffff;
}

.app-credit {
  flex-shrink: 0;
  padding: 2px 0 0;
}

.modal-credit {
  padding: 0 14px 10px;
  background: rgba(7, 10, 20, 0.72);
}

.guide-credit {
  background: none;
  padding: 6px 0 2px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.ld-credit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(14px + env(safe-area-inset-bottom));
}

@media (max-width: 900px) {
  .app-credit {
    order: 7;
    padding: 4px 0 14px;
  }

  .emote-panel {
    margin-bottom: 0;
  }
}

@media (max-height: 480px) {
  .ld-credit {
    position: static;
    margin-top: 8px;
  }
}

/* v8 — busy spinner for online buttons */
.btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  display: inline-block;
  animation: spinSlow 0.7s linear infinite;
}

.primary-cta:disabled .btn-spinner,
.secondary-cta:disabled .btn-spinner {
  opacity: 1;
}

.secondary-cta:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ============================================================================
   v9 — Battle Feed Removed + Native Single-Screen Mobile Layout (100dvh)
   ============================================================================ */

/* Desktop: anchor Emote + Credit cleanly to bottom of Left Column */
@media (min-width: 901px) {
  .left-col .emote-panel {
    margin-top: auto;
  }
}

/* Touch-safe press-and-hold roll button across all touch devices */
.roll-btn {
  touch-action: none;
  -webkit-user-select: none;
}

@media (max-width: 900px) {
  html, body {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    min-height: 100dvh;
    padding: 5px 8px calc(4px + env(safe-area-inset-bottom));
    gap: 5px;
    overflow: hidden;
  }

  .top-bar {
    padding: 4px 8px;
    gap: 5px;
    flex-shrink: 0;
  }

  .arena-grid {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow: hidden;
  }

  #left-cards { order: 1; flex-shrink: 0; }
  #right-cards { order: 2; flex-shrink: 0; }
  .board-col {
    order: 3;
    flex: 1;
    min-height: 0;
    width: 100%;
    container-type: size;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .emote-panel {
    order: 4;
    flex-shrink: 0;
    padding: 4px 6px;
    border-radius: 10px;
    margin: 0;
  }
  .dock-panel {
    order: 5;
    position: static;
    flex-shrink: 0;
    margin: 0 -8px;
    padding: 7px 10px 7px;
    border-radius: 15px 15px 0 0;
  }
  .app-credit {
    order: 6;
    flex-shrink: 0;
    padding: 1px 0 0;
    font-size: 0.58rem;
    opacity: 0.72;
  }

  /* Compact 2x2 Hero cards */
  #left-cards,
  #right-cards {
    gap: 5px;
  }

  .hero-card {
    padding: 5px 7px;
    gap: 3px;
    border-radius: 10px;
  }

  .hero-avatar {
    width: 26px;
    height: 26px;
  }

  .hero-name {
    font-size: 0.66rem;
  }

  .energy-track {
    height: 4px;
  }

  /* Dynamic square board via container query — auto-adapts when Event Banner or Overdrive button shows! */
  .board-perspective-wrap {
    width: min(100cqw, 100cqh);
    height: min(100cqw, 100cqh);
    max-width: 540px;
    max-height: 540px;
  }

  .board-stage {
    width: 100%;
    height: 100%;
    border-radius: 13px;
    padding: 3px;
  }

  /* Slim 1-row horizontally scrollable Emote strip right above Dock */
  .emote-panel .panel-mini-title {
    display: none;
  }

  .emote-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 5px;
  }

  .emote-bar::-webkit-scrollbar {
    display: none;
  }

  .emote-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 4px 9px;
    font-size: 0.66rem;
    border-radius: 999px;
  }

  /* Expanded thumb-friendly invisible tap target on selectable pawns */
  .pawn-token.selectable::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
  }

  /* Keep toast neatly above the bottom dock on phones */
  .app-toast {
    bottom: auto;
    top: 52px;
    max-width: calc(100vw - 24px);
    font-size: 0.72rem;
    padding: 7px 12px;
  }
}

/* Very small / landscape phones: allow smooth scroll so nothing gets crushed */
@media (max-width: 900px) and (max-height: 610px) {
  html, body, .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .arena-grid {
    height: auto;
    overflow: visible;
  }

  .board-col {
    flex: none;
    container-type: normal;
  }

  .board-perspective-wrap {
    width: min(100%, 380px);
    height: auto;
    aspect-ratio: 1 / 1;
  }
}

/* ============================================================================
   v10 — Click-to-Roll 3D Dice Pad + Revamped Hero Cards & Tactical Dice Cards
   ============================================================================ */

/* ---- Revamped Hero Cards (Neon Spine + Active Glass Wash + Turn Beacon) ---- */
.hero-card {
  position: relative;
  overflow: visible;
  background: linear-gradient(135deg, rgba(25, 20, 44, 0.9), rgba(14, 12, 28, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 16px rgba(0, 0, 0, 0.35);
  padding-left: 13px;
}

.hero-spine {
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: color-mix(in srgb, var(--hero-color) 50%, transparent);
  transition: all 0.25s ease;
}

.hero-card.active {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--hero-color) 18%, rgba(22, 18, 42, 0.95)),
    rgba(13, 11, 26, 0.96)
  );
  border-color: color-mix(in srgb, var(--hero-color) 85%, #ffffff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 22px color-mix(in srgb, var(--hero-color) 32%, transparent),
    0 8px 20px rgba(0, 0, 0, 0.45);
}

.hero-card.active .hero-spine {
  top: 2px;
  bottom: 2px;
  width: 4.5px;
  border-radius: 10px 4px 4px 10px;
  background: var(--hero-color);
  box-shadow: 0 0 14px var(--hero-color);
}

.emote-bubble.persisted {
  animation: none;
}

.emote-bubble.fading {
  opacity: 0;
  transform: translateY(-6px) scale(0.92);
  transition: opacity 0.42s ease, transform 0.42s ease;
}

.hero-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.turn-beacon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hero-color);
  box-shadow: 0 0 8px var(--hero-color), 0 0 14px var(--hero-color);
  flex-shrink: 0;
  animation: beaconPulse 1.1s ease-in-out infinite;
}

@keyframes beaconPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.65; }
}

/* ---- Revamped Dock Status Row (No Duplicated Hero Name!) ---- */
.dock-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.turn-prompt {
  font-size: 0.76rem;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.3;
  min-width: 0;
}

/* ---- Interactive Click-to-Roll 3D Dice Pad ---- */
.dice-action-stage {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(145deg, rgba(10, 12, 26, 0.85), rgba(18, 16, 36, 0.82));
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  padding: 10px 12px;
}

.dice-roll-pad {
  position: relative;
  flex-shrink: 0;
  width: 92px;
  padding: 9px 8px 10px;
  border-radius: 16px;
  border: 1.5px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(160deg, rgba(28, 34, 62, 0.92), rgba(10, 13, 28, 0.96));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  transition: transform 0.14s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.dice-roll-pad.ready {
  border-color: var(--hero-color, #2dd4bf);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--hero-color, #2dd4bf) 22%, rgba(20, 24, 48, 0.96)),
    rgba(10, 12, 26, 0.98)
  );
  box-shadow:
    0 0 22px color-mix(in srgb, var(--hero-color, #2dd4bf) 38%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.dice-roll-pad.ready:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 0 28px color-mix(in srgb, var(--hero-color, #2dd4bf) 55%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.dice-roll-pad.ready:active,
.dice-roll-pad.charging {
  transform: scale(0.95);
}

.dice-roll-pad:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.dice-pad-halo {
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  border: 2px solid var(--hero-color, #2dd4bf);
  opacity: 0;
  pointer-events: none;
}

.dice-roll-pad.ready .dice-pad-halo {
  animation: dicePadPulse 1.6s ease-out infinite;
}

@keyframes dicePadPulse {
  0% { transform: scale(0.94); opacity: 0.7; }
  100% { transform: scale(1.08); opacity: 0; }
}

.dice-roll-pad .dice-cube {
  --die: 56px;
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.dice-roll-pad.ready .dice-cube:not(.rolling) {
  animation: diceIdleFloat 2s ease-in-out infinite;
}

@keyframes diceIdleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}

.dice-pad-badge {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.9px;
  color: #cbd5e1;
  background: rgba(7, 10, 20, 0.72);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  white-space: nowrap;
}

.dice-roll-pad.ready .dice-pad-badge {
  background: var(--hero-color, #2dd4bf);
  color: #070a14;
  border-color: transparent;
  box-shadow: 0 0 10px color-mix(in srgb, var(--hero-color, #2dd4bf) 50%, transparent);
}

.dice-power-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 3;
}

.dice-power-track .power-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #00f5d4, #ffb703, #ff2a5f);
}

/* ---- Revamped Collectible Tactical Dice Cards ---- */
.dice-loadout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.dice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 6px 7px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(160deg, rgba(24, 29, 54, 0.92), rgba(11, 14, 28, 0.96));
  color: #e2e8f0;
  font-family: var(--font-body);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.dice-card-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--chip-color, #94a3b8);
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.dice-card-qty {
  position: absolute;
  top: 5px;
  right: 5px;
  font-family: var(--font-display);
  font-size: 0.56rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(5, 8, 18, 0.78);
  color: var(--chip-color, #e2e8f0);
  border: 1px solid color-mix(in srgb, var(--chip-color, #94a3b8) 38%, transparent);
  line-height: 1.2;
}

.dice-card-ico {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--chip-color, #94a3b8) 14%, rgba(6, 9, 20, 0.85));
  border: 1px solid color-mix(in srgb, var(--chip-color, #94a3b8) 34%, transparent);
  color: var(--chip-color, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.dice-card-ico .ico {
  width: 14px;
  height: 14px;
}

.dice-card-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dice-card-tag {
  font-family: var(--font-display);
  font-size: 0.54rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.dice-card:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--chip-color) 75%, transparent);
}

.dice-card.selected {
  transform: translateY(-2px);
  border-color: var(--chip-color);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--chip-color) 24%, rgba(20, 24, 48, 0.96)),
    rgba(10, 13, 28, 0.98)
  );
  box-shadow:
    0 0 14px color-mix(in srgb, var(--chip-color) 36%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.dice-card.selected .dice-card-bar {
  opacity: 1;
  height: 3.5px;
  box-shadow: 0 0 10px var(--chip-color);
}

.dice-card.selected .dice-card-tag {
  color: var(--chip-color);
}

.dice-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Mobile Native Thumb-Zone Revamp (<= 900px) ---- */
@media (max-width: 900px) {
  .hero-card {
    padding: 5px 7px 5px 10px;
    border-radius: 11px;
  }

  .hero-spine {
    top: 5px;
    bottom: 5px;
    width: 3px;
  }

  .hero-card.active .hero-spine {
    width: 3.5px;
  }

  /* Clean 2-Zone Mobile Dock: Cards on Left, Clickable 3D Dice Pad on Right! */
  .dock-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px;
    grid-template-areas:
      "skill skill"
      "status dice"
      "cards dice";
    column-gap: 10px;
    row-gap: 5px;
    align-items: center;
    padding: 8px 10px 8px;
    margin: 0 -8px;
    border-radius: 18px 18px 0 0;
    background: linear-gradient(180deg, rgba(20, 15, 38, 0.97), rgba(11, 9, 22, 0.99));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.55);
  }

  .dock-skill-btn {
    grid-area: skill;
    padding: 7px 10px;
    font-size: 0.7rem;
  }

  .dock-status-row {
    grid-area: status;
    min-width: 0;
  }

  .turn-prompt {
    font-size: 0.68rem;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dice-action-stage {
    grid-area: dice;
    padding: 0;
    background: none;
    border: none;
    justify-content: center;
  }

  .dice-roll-pad {
    width: 82px;
    padding: 7px 6px 8px;
    border-radius: 15px;
    gap: 5px;
  }

  .dice-roll-pad .dice-cube {
    --die: 50px;
  }

  .dice-pad-badge {
    font-size: 0.52rem;
    padding: 2px 6px;
  }

  .loadout-block {
    grid-area: cards;
    min-width: 0;
  }

  .dice-loadout {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding: 3px 8px 2px 1px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent 100%);
    mask-image: linear-gradient(to right, #000 88%, transparent 100%);
  }

  .dice-loadout::-webkit-scrollbar {
    display: none;
  }

  .dice-card {
    flex: 0 0 66px;
    padding: 7px 4px 5px;
    border-radius: 11px;
    gap: 2px;
    scroll-snap-align: start;
  }

  .dice-card-ico {
    width: 22px;
    height: 22px;
    border-radius: 7px;
  }

  .dice-card-ico .ico {
    width: 12px;
    height: 12px;
  }

  .dice-card-name {
    font-size: 0.62rem;
  }

  .dice-card-tag {
    font-size: 0.5rem;
  }

  .dice-card-qty {
    top: 4px;
    right: 4px;
    font-size: 0.5rem;
    padding: 1px 3.5px;
  }

  /* Safe-area spacing so credit never collides with iPhone home indicator */
  .app-credit {
    padding: 3px 0 calc(6px + env(safe-area-inset-bottom));
    font-size: 0.58rem;
  }
}

@media (max-width: 380px) {
  .dock-panel {
    grid-template-columns: minmax(0, 1fr) 74px;
    column-gap: 8px;
  }

  .dice-roll-pad {
    width: 74px;
    padding: 6px 5px 7px;
  }

  .dice-roll-pad .dice-cube {
    --die: 46px;
  }

  .dice-card {
    flex: 0 0 60px;
  }
}

/* ============================================================================
   v11 — Interactive Tooltips, Online Turn Timer & Enhanced Game-Feel FX
   ============================================================================ */

.hero-card[data-hero-id] {
  cursor: pointer;
}

/* Online Anti-AFK Turn Timer Pill */
.turn-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(45, 212, 191, 0.45);
  color: #5eead4;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.turn-timer-pill .ico {
  width: 11px;
  height: 11px;
}

.turn-timer-pill.warn {
  border-color: rgba(242, 181, 68, 0.7);
  color: #f6c969;
  background: rgba(242, 181, 68, 0.14);
}

.turn-timer-pill.urgent {
  border-color: #f1556f;
  color: #ffffff;
  background: rgba(241, 85, 111, 0.35);
  box-shadow: 0 0 12px rgba(241, 85, 111, 0.55);
  animation: urgentPulse 0.65s ease-in-out infinite alternate;
}

@keyframes urgentPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* Live Dice Card Effect Tooltip */
.dice-card-tip {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tip-color, #2dd4bf) 16%, rgba(12, 15, 32, 0.96)), rgba(10, 12, 24, 0.96));
  border: 1px solid color-mix(in srgb, var(--tip-color, #2dd4bf) 55%, transparent);
  font-size: 0.68rem;
  line-height: 1.3;
  color: #e2e8f0;
  animation: tipFadeIn 0.16s ease-out;
}

.dice-card-tip.show {
  display: flex;
}

.dice-card-tip .ico {
  width: 13px;
  height: 13px;
  color: var(--tip-color, #2dd4bf);
  flex-shrink: 0;
}

.dice-card-tip strong {
  color: var(--tip-color, #2dd4bf);
  white-space: nowrap;
}

.dice-card-tip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes tipFadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .dock-panel {
    position: relative;
  }

  /* Float the Dice Card Effect Tooltip cleanly right above the mobile dock so it never shifts layout! */
  .dice-card-tip {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(100% + 6px);
    z-index: 65;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.68);
    white-space: normal;
  }

  .dice-card-tip span {
    white-space: normal;
  }
}

/* Interactive Hero Skill & KO Popover (Tap any Hero Card) */
.hero-info-popover {
  position: fixed;
  left: 50%;
  top: 58px;
  transform: translateX(-50%) translateY(-8px) scale(0.96);
  width: min(330px, calc(100vw - 24px));
  z-index: 180;
  background: linear-gradient(155deg, rgba(22, 18, 42, 0.98), rgba(10, 12, 26, 0.98));
  border: 1.5px solid var(--hero-color, #2dd4bf);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.78),
    0 0 28px color-mix(in srgb, var(--hero-color, #2dd4bf) 35%, transparent);
  display: flex;
  flex-direction: column;
  gap: 9px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-info-popover.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.hip-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hip-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid var(--hero-color);
  background: #070a14;
  padding: 2px;
  flex-shrink: 0;
}

.hip-title-wrap {
  flex: 1;
  min-width: 0;
}

.hip-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--hero-color);
  letter-spacing: 0.6px;
}

.hip-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.hip-close {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.8);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.hip-close .ico {
  width: 13px;
  height: 13px;
}

.hip-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(7, 10, 20, 0.58);
  padding: 7px 9px;
  border-radius: 10px;
  border-left: 3px solid var(--hero-color);
}

.hip-row p {
  font-size: 0.72rem;
  color: #cbd5e1;
  line-height: 1.35;
}

.hip-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--hero-color);
  letter-spacing: 0.5px;
}

.hip-badge.ko {
  color: #f6c969;
}

.hip-badge .ico {
  width: 12px;
  height: 12px;
}

/* Enhanced Dice Pad Game-Feel: High-Charge Jitter & Roll-6 Golden Jackpot Pop! */
.dice-roll-pad.high-charge {
  animation: chargeJitter 0.14s linear infinite;
  box-shadow:
    0 0 28px rgba(242, 181, 68, 0.62),
    inset 0 0 14px rgba(241, 85, 111, 0.35);
}

@keyframes chargeJitter {
  0%, 100% { transform: scale(0.95) translate(0, 0); }
  25% { transform: scale(0.95) translate(-1.5px, 1px); }
  50% { transform: scale(0.95) translate(1.5px, -1px); }
  75% { transform: scale(0.95) translate(-1px, -1px); }
}

.dice-roll-pad.jackpot-pop {
  border-color: #ffb703 !important;
  box-shadow:
    0 0 36px rgba(255, 183, 3, 0.85),
    0 0 14px rgba(255, 255, 255, 0.7) !important;
  animation: jackpotPop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.dice-roll-pad.jackpot-pop .dice-pad-badge {
  background: #ffb703;
  color: #070a14;
}

@keyframes jackpotPop {
  0% { transform: scale(0.9); }
  40% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ============================================================================
   v12 — High-Contrast Active Turn Dock States & Clean In-Game Focus
   ============================================================================ */

.dock-panel {
  transition:
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    background 0.28s ease,
    opacity 0.28s ease,
    transform 0.28s ease,
    filter 0.28s ease;
}

/* Your turn to roll: bold neon border + glowing aura */
.dock-panel.is-my-turn {
  border: 2px solid color-mix(in srgb, var(--hero-color, #2dd4bf) 88%, #ffffff);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--hero-color, #2dd4bf) 15%, rgba(20, 18, 40, 0.96)),
    rgba(11, 13, 28, 0.96)
  );
  box-shadow:
    0 0 28px color-mix(in srgb, var(--hero-color, #2dd4bf) 32%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* Your turn, choosing a pawn on the board: shift focus to board */
.dock-panel.is-pawn-phase {
  border-color: color-mix(in srgb, var(--hero-color, #2dd4bf) 42%, transparent);
}

.dock-panel.is-pawn-phase .dice-action-stage,
.dock-panel.is-pawn-phase .loadout-block {
  opacity: 0.68;
}

/* Opponent / AI turn: dim & recede so eyes stay on the board */
.dock-panel.is-opponent-turn {
  opacity: 0.56;
  filter: saturate(0.68);
  transform: scale(0.985);
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: none;
}

@media (max-width: 900px) {
  .dock-panel {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .dock-panel.is-my-turn {
    border-width: 2px 0 0 0;
    border-top-color: var(--hero-color, #2dd4bf);
    box-shadow:
      0 -8px 26px color-mix(in srgb, var(--hero-color, #2dd4bf) 28%, rgba(0, 0, 0, 0.6));
  }

  .dock-panel.is-opponent-turn {
    opacity: 0.62;
    transform: none;
  }
}

/* ============================================================================
   v13 — Pawn Status Visuals (Shield Dome & Dizzy Stars), Board Targeting & Emote Controls
   ============================================================================ */

/* 1. Translucent Glowing Energy Dome around Shielded Pawns */
.pawn-dome {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at 35% 28%,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(56, 189, 248, 0.28) 45%,
    rgba(45, 212, 191, 0.42) 78%,
    transparent 100%
  );
  border: 2px solid #7dd3fc;
  box-shadow:
    0 0 16px rgba(56, 189, 248, 0.75),
    inset 0 0 10px rgba(125, 211, 252, 0.55);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.pawn-token.is-shielded .pawn-dome {
  opacity: 1;
  animation: shieldDomePulse 1.3s ease-in-out infinite alternate;
}

@keyframes shieldDomePulse {
  from { transform: scale(0.96); filter: brightness(0.95); }
  to { transform: scale(1.08); filter: brightness(1.25); }
}

/* 2. Orbiting Dizzy Stars above Stunned / Slimed / Bounced Pawns */
.pawn-dizzy {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 34px;
  height: 14px;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 50;
}

.pawn-dizzy i {
  font-style: normal;
  font-size: 0.66rem;
  color: #fde047;
  text-shadow: 0 0 6px #f59e0b, 0 1px 3px rgba(0, 0, 0, 0.9);
  animation: dizzyStarBob 0.75s ease-in-out infinite alternate;
}

.pawn-dizzy i:nth-child(2) {
  font-size: 0.78rem;
  color: #ffffff;
  animation-delay: 0.22s;
}

.pawn-dizzy i:nth-child(3) {
  animation-delay: 0.44s;
}

.pawn-token.is-dizzy .pawn-dizzy {
  display: flex;
  animation: dizzyOrbit 1.4s ease-in-out infinite;
}

@keyframes dizzyStarBob {
  from { transform: translateY(1px) rotate(-12deg) scale(0.9); }
  to { transform: translateY(-3px) rotate(14deg) scale(1.18); }
}

@keyframes dizzyOrbit {
  0%, 100% { transform: translateX(-50%) rotate(-5deg); }
  50% { transform: translateX(-50%) rotate(5deg); }
}

/* 3. Armed Overdrive Buff Aura on Pawns (Phase Dash / Split Step) */
.pawn-token.is-buffed .pawn-ring {
  inset: -6px;
  border: 2px solid var(--hero-color);
  box-shadow: 0 0 14px var(--hero-color);
  animation: targetPulse 1.1s ease-out infinite;
}

/* 4. Pulsing Highlight on Board Tiles during Skill Targeting */
.skill-target-tile {
  animation: tileTargetBlink 0.75s ease-in-out infinite alternate;
}

@keyframes tileTargetBlink {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

/* 5. Emote Mute Button, Anti-Spam Cooldown & Contextual KO Highlight */
.emote-mute-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.88);
  color: #94a3b8;
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.16s ease;
}

.emote-mute-btn .ico {
  width: 12px;
  height: 12px;
}

.emote-mute-btn:hover {
  border-color: #38bdf8;
  color: #e2e8f0;
}

.emote-mute-btn.muted {
  border-color: #f1556f;
  background: rgba(241, 85, 111, 0.18);
  color: #fda4af;
}

.emote-btn {
  position: relative;
}

.emote-btn.cooldown {
  opacity: 0.45;
  cursor: not-allowed;
}

.emote-btn.cooldown::after {
  content: attr(data-cd);
  position: absolute;
  top: -5px;
  right: -3px;
  padding: 1px 4px;
  border-radius: 6px;
  background: #0f172a;
  border: 1px solid #f59e0b;
  color: #fde047;
  font-family: var(--font-display);
  font-size: 0.52rem;
  font-weight: 800;
}

.emote-btn.ctx-highlight {
  border-color: #ffb703 !important;
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.28), rgba(241, 85, 111, 0.25)) !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(255, 183, 3, 0.6);
  animation: pawnBounce 0.65s ease-in-out infinite alternate;
}

@media (max-width: 900px) {
  .emote-mute-btn {
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.6rem;
  }
}
