:root {
  --bg-page: #b9d7b8;
  --surface-card: #fffdf8;
  --surface-soft: #f3efe4;
  --ink-primary: #1f2a24;
  --ink-muted: #56635c;
  --accent: #216e52;
  --accent-strong: #17523c;
  --accent-warm: #d48324;
  --danger: #c6382b;
  --border-soft: rgba(31, 42, 36, 0.14);
  --shadow-hud: 0 8px 24px rgba(18, 32, 24, 0.16);
  --radius-pill: 999px;
  --radius-card: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink-primary);
  background: var(--bg-page);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #0b57d0;
  outline-offset: 2px;
}

/* Utilitas aksesibilitas */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.game-viewport {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

#world-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 600px;
}

.map-hover-pill {
  position: fixed;
  top: 6.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  background: rgba(24, 38, 31, 0.9);
  color: #ffffff;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  pointer-events: none;
  box-shadow: var(--shadow-hud);
}

/* HUD Atas */
.hud-top {
  position: fixed;
  inset-block-start: 0.75rem;
  inset-inline: 0.75rem;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
}

.hud-brand-pill,
.hud-top-actions {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.hud-brand-pill {
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 0.45rem 0.85rem;
  box-shadow: var(--shadow-hud);
}

.brand-badge {
  display: flex;
  flex-direction: column;
  padding-inline-end: 0.75rem;
  border-inline-end: 1px solid var(--border-soft);
  min-width: 8.5rem;
}

.brand-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent-strong);
}

.brand-sub {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.lv-pill {
  background: #216e52;
  color: #ffffff;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.xp-bar {
  width: 100%;
  height: 5px;
  margin-top: 0.25rem;
  accent-color: var(--accent);
}

.hud-time-box {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-inline-end: 0.65rem;
  border-inline-end: 1px solid var(--border-soft);
  font-size: 0.82rem;
}

.hud-date {
  font-weight: 700;
}

.hud-clock {
  font-variant-numeric: tabular-nums;
  background: var(--surface-soft);
  padding: 0.15rem 0.45rem;
  border-radius: 8px;
  font-weight: 700;
}

.speed-controls {
  display: flex;
  gap: 0.2rem;
}

.speed-btn {
  border: 1px solid var(--border-soft);
  background: var(--surface-card);
  border-radius: 8px;
  padding: 0.2rem 0.42rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.speed-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.hud-stats-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.cash-chip strong {
  color: var(--accent-strong);
}

.pill-btn,
.pill-stat,
.icon-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 0.45rem 0.78rem;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: var(--shadow-hud);
}

.bonus-btn {
  background: linear-gradient(135deg, #b83b2b, #d46b24);
  color: #ffffff;
  border-color: transparent;
}

.diamond-pill {
  background: #eff7ff;
  color: #164f8a;
}

.event-pill {
  background: #fef9e7;
  color: #7c4d0f;
}

.cheat-trigger-btn {
  background: linear-gradient(135deg, #1b2234, #2f3b5c);
  color: #f8d86b;
  border-color: rgba(248, 216, 107, 0.45);
}

.cheat-trigger-btn[aria-expanded="true"] {
  box-shadow: 0 0 0 2px #f8d86b, var(--shadow-hud);
}

/* Rail Kiri & Kanan */
.hud-rail {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hud-rail-left {
  left: 0.75rem;
}

.hud-rail-right {
  right: 0.75rem;
}

.rail-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 4.35rem;
  min-height: 3.9rem;
  padding: 0.35rem 0.25rem;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  box-shadow: var(--shadow-hud);
  transition: transform 0.12s ease;
}

.rail-btn:hover {
  transform: translateY(-1px);
}

.rail-icon {
  font-size: 1.3rem;
  line-height: 1.1;
}

.rail-label {
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.sub-tag {
  position: absolute;
  top: -0.35rem;
  right: -0.25rem;
  background: #b83b2b;
  color: #ffffff;
  font-size: 0.64rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}

.badge-count {
  position: absolute;
  top: -0.35rem;
  right: -0.3rem;
  min-width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0 0.25rem;
}

.icon-pill-btn {
  position: relative;
}

/* Kamera */
.camera-controls {
  position: fixed;
  right: 0.75rem;
  bottom: 5.2rem;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cam-btn {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 253, 248, 0.94);
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: var(--shadow-hud);
}

/* Navigasi Bawah */
.hud-bottom {
  position: fixed;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.55rem;
  padding: 0.35rem;
  max-width: calc(100vw - 1.5rem);
  overflow-x: auto;
}

.bottom-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 5.2rem;
  min-height: 3.7rem;
  padding: 0.45rem 0.75rem;
  background: rgba(255, 253, 248, 0.95);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: var(--shadow-hud);
  flex: none;
}

.bottom-icon {
  font-size: 1.25rem;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 5.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
}

.toast-item {
  background: rgba(24, 38, 31, 0.92);
  color: #ffffff;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-hud);
}

/* Modal Dialogs (Panduan modern-web-guidance) */
dialog {
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  padding: 0;
  background: var(--surface-card);
  color: var(--ink-primary);
  box-shadow: 0 24px 64px rgba(12, 22, 18, 0.35);
  max-width: min(760px, calc(100vw - 2rem));
  max-height: min(86dvh, 780px);
}

/* Jangan atur display pada dialog secara unconditional; scope ke dialog[open] */
dialog[open] {
  display: flex;
  flex-direction: column;
}

/* MANDATORY: Cegah scroll halaman di balik modal dialog */
dialog:modal {
  overscroll-behavior: contain;
}

/* Scope backdrop blur/dim ke dialog modal saja agar Cheat Panel non-modal tidak mengaburkan game */
#setup-dialog::backdrop,
#game-dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(15, 25, 20, 0.55);
  backdrop-filter: blur(3px);
}

#cheat-panel::backdrop {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

#setup-dialog {
  width: min(460px, calc(100vw - 2rem));
  padding: 1.5rem;
}

#game-dialog {
  width: min(760px, calc(100vw - 2rem));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.dialog-h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.dialog-sub {
  margin: 0.35rem 0 1rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.close-btn {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: #ffffff;
  font-weight: 800;
  flex: none;
}

.modal-body {
  padding: 1.2rem 1.35rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Story & Onboarding */
.story-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.story-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: #e2f2eb;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.text-link-btn {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: underline;
}

.story-art {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.comic-panel {
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 7.5rem;
}

.comic-caption {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.comic-emoji {
  font-size: 1.85rem;
  text-align: right;
}

.story-desc {
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0.5rem 0 1.15rem;
}

.onboarding-card {
  text-align: center;
}

.onboarding-icon {
  font-size: 2.5rem;
  margin-bottom: 0.35rem;
}

#setup-form {
  text-align: left;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-block-end: 1.15rem;
}

.field-group label {
  font-weight: 700;
  font-size: 0.9rem;
}

.field-hint {
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.field-group input[type="text"],
.field-group input[type="number"] {
  font: inherit;
  font-size: max(1rem, 1em);
  padding: 0.65rem 0.85rem;
  min-height: 48px;
  border: 2px solid #767676;
  border-radius: 12px;
  background: #ffffff;
}

:is(:user-invalid, .user-invalid-fallback) {
  border-color: #d93025 !important;
  background-color: #fce8e6 !important;
}

:is(:user-valid, .user-valid-fallback) {
  border-color: #188038 !important;
}

.error-msg {
  display: none;
  color: #c5221f;
  font-size: 0.84rem;
  font-weight: 600;
}

:is(:user-invalid, .user-invalid-fallback) + .error-msg {
  display: block;
}

.gender-fieldset {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 0.75rem;
  margin-block-end: 1.15rem;
}

.gender-fieldset legend {
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0 0.35rem;
}

.radio-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem;
  min-height: 48px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  background: #ffffff;
}

.radio-card input {
  accent-color: var(--accent);
}

.sandbox-checkbox {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
  margin-block-end: 1rem;
  min-height: 44px;
}

.sandbox-checkbox input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}

/* Tombol & Kartu Konten Modal */
.primary-btn {
  background: var(--accent);
  color: #ffffff;
  border: 0;
  border-radius: 12px;
  min-height: 46px;
  padding: 0.65rem 1.1rem;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.secondary-btn {
  background: var(--surface-soft);
  color: var(--ink-primary);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  min-height: 42px;
  padding: 0.5rem 0.9rem;
  font-weight: 700;
}

.danger-soft-btn {
  background: #fdeceb;
  color: #a6261d;
  border: 1px solid #f5c2be;
  border-radius: 10px;
  min-height: 40px;
  padding: 0.45rem 0.8rem;
  font-weight: 700;
}

.full-width {
  width: 100%;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.info-card {
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.info-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.info-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.pill-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #e1ede7;
  color: var(--accent-strong);
}

.pill-tag.warn {
  background: #fbe8cf;
  color: #8f4e0c;
}

.card-meta {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-muted);
  line-height: 1.45;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.inline-input-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.inline-input-group input,
.inline-input-group select {
  padding: 0.45rem 0.6rem;
  border: 1px solid #767676;
  border-radius: 8px;
  background: #ffffff;
  min-height: 38px;
}

/* Tabel Responsif (Panduan responsive-table) */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(420px, 60vh);
  container-type: inline-size;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: #ffffff;
}

.data-table,
.scanner-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}

.data-table th,
.data-table td,
.scanner-table th,
.scanner-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}

.data-table thead,
.scanner-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  background: var(--surface-soft);
}

.data-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: #ffffff;
  font-weight: 700;
}

.player-row th,
.player-row td {
  background: #e8f5ef !important;
  font-weight: 700;
}

@container (width < 460px) {
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table th,
  .data-table td {
    display: block;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    margin-block-end: 0.75rem;
    border-bottom: 2px solid var(--border-soft);
  }

  .data-table tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: var(--surface-soft);
  }

  .data-table td:nth-child(2)::before {
    content: var(--label-2) ": ";
    font-weight: 700;
  }
  .data-table td:nth-child(3)::before {
    content: var(--label-3) ": ";
    font-weight: 700;
  }
  .data-table td:nth-child(4)::before {
    content: var(--label-4) ": ";
    font-weight: 700;
  }
}

/* Cheat Menu Popover Dialog (Rule 2: non-modal, top-layer tanpa menutupi rail HUD & baris tombol atas) */
#cheat-panel {
  position: fixed;
  inset: 7.4rem 6rem auto auto;
  margin: 0;
  width: min(460px, calc(100vw - 12rem));
  height: min(520px, calc(100dvh - 13.2rem));
  max-height: calc(100dvh - 13.2rem);
  background: #161d2b;
  color: #edf2f7;
  border: 1px solid rgba(248, 216, 107, 0.35);
  border-radius: 18px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.48);
  z-index: 30;
}

#cheat-panel[popover]:is(:popover-open, .\:popover-open) {
  display: flex;
  flex-direction: column;
}

@supports not selector(:popover-open) {
  [popover]:not(.\:popover-open) {
    display: none;
  }
}

.cheat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: #1d2638;
}

.cheat-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #f8d86b;
}

.cheat-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.76rem;
  color: #a9b6cc;
}

.dark-close {
  background: #2b364d;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.cheat-tabs-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.tablist {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: #1a2232;
  padding: 0 0.5rem;
  gap: 0.25rem;
}

.tablist [role="tab"] {
  position: relative;
  flex: none;
  border: 0;
  background: transparent;
  color: #b7c4db;
  padding: 0.7rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Indikator tab aktif memakai pseudo-element border (tidak hanya warna) */
.tablist [role="tab"][aria-selected="true"] {
  color: #f8d86b;
}

.tablist [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 3px solid #f8d86b;
}

.cheat-panels-stage {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.cheat-tabpanel {
  grid-area: 1 / 1;
  min-height: 0;
  overflow-y: auto;
}

.cheat-tabpanel[hidden] {
  z-index: 0;
  pointer-events: none;
}

.cheat-tabpanel:not([hidden]) {
  z-index: 1;
}

.cheat-panel-inner {
  padding: 0.95rem 1.05rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.cheat-sec-title {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9cb0d0;
}

.cheat-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 0.45rem;
}

.cheat-action-btn,
.cheat-primary-btn {
  border-radius: 10px;
  min-height: 38px;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #273249;
  color: #f1f5f9;
}

.cheat-action-btn:hover {
  background: #33415f;
}

.cheat-primary-btn {
  background: #f8d86b;
  color: #161d2b;
  border-color: #f8d86b;
}

.accent-cheat {
  background: #20694f;
  border-color: #36a37c;
}

.danger-btn {
  background: #6c2323;
  border-color: #c94e4e;
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: #202a3d;
  font-size: 0.83rem;
  font-weight: 600;
}

.toggle-row input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: #f8d86b;
}

.multiplier-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.6rem;
  padding: 0.55rem 0.65rem;
  background: #202a3d;
  border-radius: 10px;
  font-size: 0.82rem;
}

.multiplier-row input[type="number"] {
  width: 5.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #141b29;
  color: #ffffff;
}

.scanner-desc {
  margin: 0;
  font-size: 0.8rem;
  color: #b7c4db;
  line-height: 1.4;
}

.scanner-controls {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.scanner-input-row,
.scanner-btn-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.scanner-input-row input,
.scanner-input-row select {
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #111723;
  color: #ffffff;
  min-height: 38px;
}

.scanner-input-row input {
  flex: 1;
  min-width: 140px;
}

.scanner-status {
  font-size: 0.78rem;
  color: #f8d86b;
  font-weight: 600;
}

.dark-table-wrap {
  background: #121824;
  border-color: rgba(255, 255, 255, 0.12);
  max-block-size: 270px;
}

.scanner-table thead {
  background: #1d2638;
  color: #cbd5e1;
}

.scanner-table th,
.scanner-table td {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
}

.path-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #93c5fd;
  overflow-wrap: normal;
  word-break: normal;
}

.scanner-edit-cell {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.scanner-edit-input {
  width: 6.2rem;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0e131e;
  color: #ffffff;
  font-size: 0.78rem;
}

.mini-btn {
  padding: 0.24rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #29364f;
  color: #ffffff;
}

.mini-btn.frozen {
  background: #f8d86b;
  color: #161d2b;
  border-color: #f8d86b;
}

.save-slots-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: #202a3d;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8rem;
}

@media (max-width: 900px) {
  .bottom-btn {
    min-width: 4.35rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.72rem;
  }
}

@media (max-width: 720px) {
  .rail-btn {
    width: 3.55rem;
    min-height: 3.3rem;
  }
  .rail-label {
    font-size: 0.65rem;
  }
  .story-art {
    grid-template-columns: 1fr;
  }
  #cheat-panel {
    inset: 7.4rem 4.6rem 5.2rem 4.6rem;
    width: auto;
    height: auto;
    max-height: calc(100dvh - 12.6rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
