/* ==========================================================================
 * SAFETY PATROL: Misi Zero Accident & /game/ Hub Stylesheet
 * Responsive Desktop (1280px+) & Mobile (390px), Dark Mode, Zero Overflow
 * ========================================================================== */

:root {
  color-scheme: light dark;

  --sp-card-light: #ffffff;
  --sp-card-dark: #131e1b;
  --sp-subtle-light: #f1f5f3;
  --sp-subtle-dark: #192824;
  --sp-border-light: #d7e2dd;
  --sp-border-dark: #283d37;
  --sp-text-light: #1e2d28;
  --sp-text-dark: #dbe7e2;
  --sp-muted-light: #52665f;
  --sp-muted-dark: #93aba3;
  --sp-heading-light: #0f1d19;
  --sp-heading-dark: #f2f8f5;
  --sp-brand-light: #0f6b54;
  --sp-brand-dark: #2fb591;
  --sp-brand-soft-light: #e6f5f0;
  --sp-brand-soft-dark: #13332a;
  --sp-amber-light: #b45309;
  --sp-amber-dark: #fbbf24;
  --sp-amber-soft-light: #fef3c7;
  --sp-amber-soft-dark: #33260d;

  --sp-card: var(--sp-card-light);
  --sp-subtle: var(--sp-subtle-light);
  --sp-border: var(--sp-border-light);
  --sp-text: var(--sp-text-light);
  --sp-muted: var(--sp-muted-light);
  --sp-heading: var(--sp-heading-light);
  --sp-brand: var(--sp-brand-light);
  --sp-brand-soft: var(--sp-brand-soft-light);
  --sp-amber: var(--sp-amber-light);
  --sp-amber-soft: var(--sp-amber-soft-light);

  @media (prefers-color-scheme: dark) {
    --sp-card: var(--sp-card-dark);
    --sp-subtle: var(--sp-subtle-dark);
    --sp-border: var(--sp-border-dark);
    --sp-text: var(--sp-text-dark);
    --sp-muted: var(--sp-muted-dark);
    --sp-heading: var(--sp-heading-dark);
    --sp-brand: var(--sp-brand-dark);
    --sp-brand-soft: var(--sp-brand-soft-dark);
    --sp-amber: var(--sp-amber-dark);
    --sp-amber-soft: var(--sp-amber-soft-dark);
  }

  @supports (color: light-dark(white, black)) {
    --sp-card: light-dark(var(--sp-card-light), var(--sp-card-dark));
    --sp-subtle: light-dark(var(--sp-subtle-light), var(--sp-subtle-dark));
    --sp-border: light-dark(var(--sp-border-light), var(--sp-border-dark));
    --sp-text: light-dark(var(--sp-text-light), var(--sp-text-dark));
    --sp-muted: light-dark(var(--sp-muted-light), var(--sp-muted-dark));
    --sp-heading: light-dark(var(--sp-heading-light), var(--sp-heading-dark));
    --sp-brand: light-dark(var(--sp-brand-light), var(--sp-brand-dark));
    --sp-brand-soft: light-dark(var(--sp-brand-soft-light), var(--sp-brand-soft-dark));
    --sp-amber: light-dark(var(--sp-amber-light), var(--sp-amber-dark));
    --sp-amber-soft: light-dark(var(--sp-amber-soft-light), var(--sp-amber-soft-dark));
  }
}

:root[data-theme="dark"] {
  --sp-card: var(--sp-card-dark);
  --sp-subtle: var(--sp-subtle-dark);
  --sp-border: var(--sp-border-dark);
  --sp-text: var(--sp-text-dark);
  --sp-muted: var(--sp-muted-dark);
  --sp-heading: var(--sp-heading-dark);
  --sp-brand: var(--sp-brand-dark);
  --sp-brand-soft: var(--sp-brand-soft-dark);
  --sp-amber: var(--sp-amber-dark);
  --sp-amber-soft: var(--sp-amber-soft-dark);
}

:root[data-theme="light"] {
  --sp-card: var(--sp-card-light);
  --sp-subtle: var(--sp-subtle-light);
  --sp-border: var(--sp-border-light);
  --sp-text: var(--sp-text-light);
  --sp-muted: var(--sp-muted-light);
  --sp-heading: var(--sp-heading-light);
  --sp-brand: var(--sp-brand-light);
  --sp-brand-soft: var(--sp-brand-soft-light);
  --sp-amber: var(--sp-amber-light);
  --sp-amber-soft: var(--sp-amber-soft-light);
}

/* ── Native Modal <dialog> Scroll Containment & Top Layer ─────────────────── */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(5, 13, 11, 0.74);
  backdrop-filter: blur(4px);
}

/* ── Shared Layout & Breadcrumbs ──────────────────────────────────────────── */
.sp-hub-main,
.sp-game-main {
  padding: 1.1rem 0 3rem;
}

.sp-hub-container,
.sp-game-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem;
}

.sp-breadcrumb {
  font-size: 0.82rem;
  color: var(--sp-muted);
  margin-bottom: 0.85rem;
}

.sp-breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
}

.sp-breadcrumb a {
  color: var(--sp-muted);
  text-decoration: none;
}

.sp-breadcrumb a:hover {
  color: var(--sp-brand);
  text-decoration: underline;
}

.sp-breadcrumb span[aria-current="page"] {
  color: var(--sp-heading);
  font-weight: 600;
}

/* ── Badges & Buttons ─────────────────────────────────────────────────────── */
.sp-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: var(--sp-subtle);
  color: var(--sp-text);
}

.sp-badge--emerald {
  background: var(--sp-brand-soft);
  color: var(--sp-brand);
  border-color: transparent;
}

.sp-badge--amber {
  background: var(--sp-amber-soft);
  color: var(--sp-amber);
  border-color: transparent;
}

.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.62rem 1.15rem;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--sp-border);
  background: var(--sp-card);
  color: var(--sp-heading);
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.sp-btn:hover {
  border-color: var(--sp-brand);
}

.sp-btn--primary {
  background: #0f765c;
  color: #ffffff;
  border-color: #0d654f;
}

.sp-btn--primary:hover {
  background: #0b5c47;
  color: #ffffff;
}

.sp-btn--wa {
  background: #15803d;
  color: #ffffff;
  border-color: #166534;
}

.sp-btn--wa:hover {
  background: #166534;
  color: #ffffff;
}

.sp-btn--li {
  background: #0a66c2;
  color: #ffffff;
  border-color: #084e96;
}

.sp-btn--li:hover {
  background: #004182;
  color: #ffffff;
  border-color: #003366;
}

.sp-btn--ghost {
  background: var(--sp-subtle);
  color: var(--sp-heading);
}

.sp-btn--lg {
  padding: 0.78rem 1.4rem;
  font-size: 0.98rem;
}

/* ── /game/ Hub Sections ──────────────────────────────────────────────────── */
.sp-hub-hero {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 1.75rem;
  align-items: center;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 18px;
  padding: clamp(1.15rem, 2.5vw, 2rem);
  margin-bottom: 2rem;
}

.sp-hub-title {
  font-size: clamp(1.55rem, 1.1rem + 2vw, 2.35rem);
  line-height: 1.18;
  font-weight: 800;
  color: var(--sp-heading);
  margin-bottom: 0.75rem;
}

.sp-hub-lead {
  font-size: 0.98rem;
  color: var(--sp-muted);
  margin-bottom: 1.2rem;
  max-width: 60ch;
}

.sp-hub-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.sp-hub-progress-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  background: var(--sp-subtle);
  border: 1px solid var(--sp-border);
}

.sp-hub-progress-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: cover;
}

.sp-hub-progress-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sp-muted);
}

.sp-hub-progress-val {
  font-size: 0.86rem;
  color: var(--sp-heading);
}

.sp-hub-poster-card {
  position: relative;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--sp-border);
  aspect-ratio: 16 / 9;
  background: #0b1512;
  text-decoration: none;
}

.sp-hub-poster-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sp-hub-poster-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.8rem 1rem 0.95rem;
  background: linear-gradient(to top, rgba(6, 15, 12, 0.94), rgba(6, 15, 12, 0));
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sp-poster-tag {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: #10b981;
  color: #042018;
  margin-bottom: 0.2rem;
}

.sp-hub-poster-overlay strong {
  font-size: 1.05rem;
}

.sp-hub-poster-overlay span:last-child {
  font-size: 0.8rem;
  color: #cbd5e1;
}

.sp-section {
  margin: 2.2rem 0;
}

.sp-section-title {
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.55rem);
  font-weight: 800;
  color: var(--sp-heading);
  margin-bottom: 0.3rem;
}

.sp-section-sub {
  font-size: 0.92rem;
  color: var(--sp-muted);
  margin-bottom: 1.15rem;
}

.sp-game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
}

.sp-game-card {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 15px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sp-game-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
}

.sp-game-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b1512;
}

.sp-game-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sp-status-chip {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--sp-subtle);
  color: var(--sp-muted);
  border: 1px solid var(--sp-border);
  margin-bottom: 0.5rem;
  align-self: flex-start;
}

.sp-status-chip--live {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(6, 24, 19, 0.88);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.45);
  margin: 0;
}

.sp-game-card-body {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sp-game-meta {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--sp-brand);
  margin-bottom: 0.35rem;
}

.sp-game-card-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--sp-heading);
  margin-bottom: 0.5rem;
}

.sp-game-card-title a {
  color: inherit;
  text-decoration: none;
}

.sp-game-card-title a:hover {
  color: var(--sp-brand);
}

.sp-game-card-desc {
  font-size: 0.9rem;
  color: var(--sp-muted);
  margin-bottom: 0.9rem;
}

.sp-reg-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.sp-reg-tags span {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--sp-subtle);
  color: var(--sp-text);
  border: 1px solid var(--sp-border);
}

.sp-game-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ── Game Page Header Compact Strip ───────────────────────────────────────── */
.sp-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.sp-page-title {
  font-size: clamp(1.3rem, 1.05rem + 1.2vw, 1.85rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--sp-heading);
}

.sp-page-subtitle {
  font-size: 0.88rem;
  color: var(--sp-muted);
  margin-top: 0.2rem;
}

/* ── Tactical Game Cabinet (Forced Dark Console Surface for High Contrast) ── */
.sp-cabinet {
  color-scheme: dark;
  background: #0c1513;
  color: #e2ece8;
  border: 1px solid #243b34;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.22);
}

.sp-cabinet:fullscreen,
.sp-cabinet.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  border-radius: 0;
  border: 0;
  display: flex;
  flex-direction: column;
}

/* ── Top HUD Bar ──────────────────────────────────────────────────────────── */
.sp-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: #101d1a;
  border-bottom: 1px solid #223831;
  flex-wrap: wrap;
}

.sp-hud-left,
.sp-hud-center,
.sp-hud-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.sp-hud-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #10b981;
  object-fit: cover;
  flex-shrink: 0;
}

.sp-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.28rem 0.6rem;
  border-radius: 8px;
  background: #162823;
  border: 1px solid #27423a;
  font-size: 0.8rem;
  font-weight: 700;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sp-stat-pill--combo {
  background: #2b210d;
  border-color: #854d0e;
  color: #fde047;
}

.sp-stat-pill--urgent {
  background: #3b1216;
  border-color: #dc2626;
  color: #fecaca;
}

.sp-hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  border: 1px solid #29453c;
  background: #172924;
  color: #e2ece8;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.sp-hud-btn:hover {
  background: #203831;
  border-color: #34d399;
}

/* ── Canvas Stage Viewport ────────────────────────────────────────────────── */
.sp-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9.5;
  background: #16211e;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.sp-cabinet:fullscreen .sp-viewport,
.sp-cabinet.is-pseudo-fullscreen .sp-viewport {
  flex: 1 1 auto;
  aspect-ratio: auto;
  min-height: 0;
}

#sp-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ── Non-Intrusive Micro-Education Regulatory Toast ───────────────────────── */
.sp-edu-banner {
  position: absolute;
  top: 0.65rem;
  left: 50%;
  translate: -50% 0;
  z-index: 12;
  width: min(94%, 660px);
  padding: 0.55rem 0.85rem;
  border-radius: 11px;
  background: rgba(9, 22, 18, 0.93);
  border: 1px solid #10b981;
  color: #f1f5f9;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sp-edu-banner.is-visible {
  opacity: 1;
}

.sp-edu-banner.is-warning {
  border-color: #f59e0b;
  background: rgba(30, 17, 7, 0.94);
}

.sp-edu-banner.is-danger {
  border-color: #ef4444;
  background: rgba(40, 10, 12, 0.95);
}

.sp-edu-reg {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
  margin-bottom: 0.18rem;
}

.sp-edu-banner.is-warning .sp-edu-reg {
  background: rgba(245, 158, 11, 0.24);
  color: #fcd34d;
}

.sp-edu-banner.is-danger .sp-edu-reg {
  background: rgba(239, 68, 68, 0.28);
  color: #fca5a5;
}

.sp-edu-text {
  font-size: 0.8rem;
  line-height: 1.38;
  color: #f8fafc;
}

/* ── Proximity Action Hint Chip ───────────────────────────────────────────── */
.sp-context-prompt {
  position: absolute;
  bottom: 0.65rem;
  left: 50%;
  translate: -50% 0;
  z-index: 10;
  max-width: 92%;
  padding: 0.35rem 0.78rem;
  border-radius: 999px;
  background: rgba(8, 20, 17, 0.9);
  border: 1px solid #34d399;
  color: #ecfdf5;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.sp-context-prompt[hidden] {
  display: none;
}

/* ── Start & Pause Overlays inside Viewport ───────────────────────────────── */
.sp-stage-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: radial-gradient(circle at center, rgba(10, 24, 20, 0.80), rgba(6, 13, 11, 0.92));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.sp-stage-overlay[hidden] {
  display: none;
}

.sp-start-card {
  width: min(100%, 560px);
  background: rgba(16, 30, 26, 0.96);
  border: 1px solid #2d4f44;
  border-radius: 16px;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  text-align: center;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
}

.sp-start-kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.35);
  margin-bottom: 0.55rem;
}

.sp-start-title {
  font-size: clamp(1.25rem, 1rem + 1.4vw, 1.75rem);
  font-weight: 900;
  color: #f8fafc;
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.sp-start-desc {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 0.85rem;
}

.sp-start-highscore {
  font-size: 0.8rem;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 9px;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.9rem;
}

.sp-start-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.sp-sponsor-line {
  font-size: 0.74rem;
  color: #94a3b8;
}

.sp-sponsor-line a {
  color: #6ee7b7;
  font-weight: 700;
  text-decoration: none;
}

.sp-sponsor-line a:hover {
  text-decoration: underline;
}

/* ── APAR Media Sub-Choice Overlay (Crisis #7) ────────────────────────────── */
.sp-apar-choice {
  position: absolute;
  inset: 0;
  z-index: 22;
  background: rgba(8, 16, 14, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sp-apar-choice[hidden] {
  display: none;
}

.sp-apar-card {
  width: min(100%, 460px);
  background: #13221e;
  border: 2px solid #f59e0b;
  border-radius: 15px;
  padding: 1.15rem;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

.sp-apar-card h2 {
  font-size: 1.05rem;
  color: #fef3c7;
  margin-bottom: 0.35rem;
}

.sp-apar-card p {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-bottom: 0.9rem;
}

.sp-apar-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.sp-apar-opt-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.6rem;
  border-radius: 11px;
  border: 1px solid #334d46;
  background: #1a2f29;
  color: #f8fafc;
  cursor: pointer;
  font-family: inherit;
  min-height: 76px;
}

.sp-apar-opt-btn:hover {
  border-color: #38bdf8;
  background: #213b34;
}

.sp-apar-opt-btn strong {
  font-size: 0.85rem;
}

.sp-apar-opt-btn span {
  font-size: 0.72rem;
  color: #94a3b8;
}

/* ── Controls Dock (5-Slot Safety Bag + Mobile Virtual Gamepad) ───────────── */
.sp-controls-dock {
  background: #0e1a17;
  border-top: 1px solid #223831;
  padding: 0.6rem 0.75rem 0.75rem;
}

.sp-inventory-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.42rem;
  margin-bottom: 0.6rem;
}

.sp-slot-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.14rem;
  min-height: 54px;
  padding: 0.35rem 0.25rem;
  border-radius: 10px;
  border: 1px solid #28423a;
  background: #152621;
  color: #cbd5e1;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.sp-slot-btn:hover {
  border-color: #34d399;
}

.sp-slot-btn.is-active {
  background: #13392e;
  border-color: #10b981;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px #10b981;
}

.sp-slot-key {
  position: absolute;
  top: 4px;
  left: 5px;
  font-size: 0.64rem;
  font-weight: 800;
  color: #6ee7b7;
  opacity: 0.9;
}

.sp-slot-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.sp-slot-name {
  font-size: 0.69rem;
  font-weight: 700;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Desktop Control Bar vs Mobile Touch Gamepad */
.sp-desktop-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sp-shortcut-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.76rem;
  color: #94a3b8;
}

.sp-shortcut-hints kbd {
  display: inline-block;
  padding: 0.1rem 0.38rem;
  border-radius: 5px;
  background: #192d27;
  border: 1px solid #2d4c43;
  color: #e2e8f0;
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 700;
}

.sp-desktop-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sp-touch-pad {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding-top: 0.25rem;
}

.sp-joystick-zone {
  position: relative;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26, 48, 41, 0.95) 0%, rgba(15, 28, 24, 0.98) 100%);
  border: 2px solid #2e5246;
  flex-shrink: 0;
  touch-action: none;
}

.sp-joystick-zone::before {
  content: '';
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 1px dashed rgba(110, 231, 183, 0.28);
}

.sp-joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 50%;
  background: linear-gradient(145deg, #34d399, #059669);
  border: 2px solid #ecfdf5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.sp-touch-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  min-width: 0;
}

.sp-touch-hint {
  font-size: 0.7rem;
  line-height: 1.3;
  color: #94a3b8;
}

.sp-touch-right {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
}

.sp-action-btn-big {
  min-width: 118px;
  min-height: 68px;
  padding: 0.5rem 0.85rem;
  border-radius: 14px;
  border: 2px solid #34d399;
  background: linear-gradient(160deg, #10b981, #047857);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.35);
  touch-action: manipulation;
}

.sp-action-btn-big.is-ready {
  background: linear-gradient(160deg, #f59e0b, #d97706);
  border-color: #fde68a;
  color: #0c1412;
  @media (prefers-reduced-motion: no-preference) {
    animation: sp-pulse-ready 1.1s ease-in-out infinite alternate;
  }
}

@keyframes sp-pulse-ready {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

/* ── AdSense Safe Zone (Strictly Separated Below Game Controls) ───────────── */
.sp-ad-safe-zone {
  margin: 2.5rem auto;
  padding-top: 0.75rem;
  max-width: 760px;
}

/* ── Reference Table, Tools Cross-Sell, Author Card & FAQ ─────────────────── */
.sp-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--sp-border);
  border-radius: 12px;
  background: var(--sp-card);
}

.sp-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.sp-ref-table th,
.sp-ref-table td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--sp-border);
  vertical-align: top;
}

.sp-ref-table th {
  background: var(--sp-subtle);
  color: var(--sp-heading);
  font-weight: 700;
  font-size: 0.8rem;
}

.sp-ref-table tr:last-child td {
  border-bottom: 0;
}

.sp-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.sp-tool-link-card {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  text-decoration: none;
  color: var(--sp-text);
  transition: border-color 0.16s ease;
}

.sp-tool-link-card:hover {
  border-color: var(--sp-brand);
}

.sp-tool-emoji {
  font-size: 1.65rem;
  line-height: 1;
  flex-shrink: 0;
}

.sp-tool-link-card strong {
  display: block;
  font-size: 0.95rem;
  color: var(--sp-heading);
  margin-bottom: 0.2rem;
}

.sp-tool-link-card span:last-child {
  display: block;
  font-size: 0.82rem;
  color: var(--sp-muted);
}

.sp-author-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 14px;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
}

.sp-author-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--sp-brand);
  object-fit: cover;
  flex-shrink: 0;
}

.sp-author-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--sp-heading);
  margin-bottom: 0.2rem;
}

.sp-author-meta {
  font-size: 0.8rem;
  color: var(--sp-muted);
  margin-bottom: 0.45rem;
}

.sp-author-text {
  font-size: 0.88rem;
  color: var(--sp-text);
}

.sp-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sp-faq-item {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 11px;
  padding: 0.85rem 1rem;
}

.sp-faq-item summary {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--sp-heading);
  cursor: pointer;
}

.sp-faq-item p {
  margin-top: 0.55rem;
  font-size: 0.86rem;
  color: var(--sp-muted);
}

/* ── Native <dialog> Modals (Guide, Summary, Leaderboard) ─────────────────── */
.sp-modal {
  margin: auto;
  width: min(94vw, 600px);
  max-height: 88dvh;
  padding: 0;
  border: 1px solid var(--sp-border);
  border-radius: 16px;
  background: var(--sp-card);
  color: var(--sp-text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.sp-modal[open] {
  display: flex;
  flex-direction: column;
}

.sp-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--sp-border);
}

.sp-modal-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--sp-heading);
  margin: 0;
}

.sp-modal-close {
  min-width: 38px;
  min-height: 38px;
  border-radius: 9px;
  border: 1px solid var(--sp-border);
  background: var(--sp-subtle);
  color: var(--sp-heading);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.sp-modal-body {
  padding: 1.15rem 1.2rem;
  overflow-y: auto;
}

.sp-summary-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem;
  border-radius: 12px;
  background: var(--sp-subtle);
  border: 1px solid var(--sp-border);
  margin-bottom: 1rem;
}

.sp-summary-crest {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
}

.sp-summary-stars {
  font-size: 1.35rem;
  letter-spacing: 0.1em;
  line-height: 1.1;
}

.sp-summary-rank {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--sp-heading);
}

.sp-summary-note {
  font-size: 0.82rem;
  color: var(--sp-muted);
}

.sp-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.sp-metric-box {
  padding: 0.65rem 0.5rem;
  border-radius: 10px;
  background: var(--sp-subtle);
  border: 1px solid var(--sp-border);
  text-align: center;
}

.sp-metric-box span {
  display: block;
  font-size: 0.7rem;
  color: var(--sp-muted);
}

.sp-metric-box strong {
  font-size: 1.02rem;
  color: var(--sp-heading);
  font-variant-numeric: tabular-nums;
}

.sp-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.sp-summary-tools {
  border-top: 1px solid var(--sp-border);
  padding-top: 0.9rem;
  margin-top: 0.75rem;
}

.sp-summary-tools h2 {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--sp-heading);
  margin-bottom: 0.5rem;
}

.sp-mini-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.sp-mini-links a {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: var(--sp-subtle);
  border: 1px solid var(--sp-border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sp-heading);
  text-decoration: none;
}

.sp-mini-links a:hover {
  border-color: var(--sp-brand);
  color: var(--sp-brand);
}

/* ── Responsive Breakpoints (Tablet & Mobile 390px) ───────────────────────── */
@media (max-width: 900px) {
  .sp-hub-hero,
  .sp-game-card--featured {
    grid-template-columns: 1fr;
  }

  .sp-game-grid {
    grid-template-columns: 1fr;
  }

  .sp-desktop-bar {
    display: none;
  }

  .sp-touch-pad {
    display: flex;
  }

  .sp-viewport {
    aspect-ratio: 4 / 3.35;
  }

  .sp-edu-banner {
    left: 0.55rem;
    translate: 0 0;
    width: calc(100% - 134px);
    padding: 0.42rem 0.65rem;
  }

  .sp-edu-text {
    font-size: 0.73rem;
  }
}

@media (max-width: 640px) {
  .sp-hub-container,
  .sp-game-container {
    padding: 0 0.65rem;
  }

  .sp-hud {
    padding: 0.45rem 0.5rem;
    gap: 0.35rem;
  }

  .sp-hud-avatar {
    width: 30px;
    height: 30px;
  }

  .sp-stat-pill {
    padding: 0.22rem 0.44rem;
    font-size: 0.73rem;
  }

  .sp-hud-btn {
    min-width: 34px;
    min-height: 34px;
    padding: 0.2rem 0.4rem;
    font-size: 0.78rem;
  }

  .sp-slot-btn {
    min-height: 50px;
    padding: 0.28rem 0.15rem;
  }

  .sp-slot-name {
    font-size: 0.62rem;
  }

  .sp-apar-options,
  .sp-tools-grid,
  .sp-mini-links {
    grid-template-columns: 1fr;
  }

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

  .sp-author-card {
    flex-direction: column;
  }
}
