/* ==========================================================================
 * dwik.web.id — Shared K3 Arcade UI & UX System (Cross-Game Module)
 * Supports Light/Dark Theme Variables, Tactile HUD, Checklist Drawer,
 * Difficulty Mode Selector, Career Passport, and PNG Certificate Generator.
 * ========================================================================== */

/* ── Hub Career Passport (/game/) ────────────────────────────────────────── */
.sp-hub-passport {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 16px;
  padding: clamp(1rem, 2.2vw, 1.45rem);
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 24px rgba(15, 107, 84, 0.06);
}

.sp-passport-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.95rem;
}

.sp-passport-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.sp-passport-emblem {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--sp-brand-soft);
  border: 1px solid var(--sp-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.sp-passport-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sp-brand);
}

.sp-passport-rank {
  font-size: clamp(1.05rem, 0.9rem + 0.6vw, 1.32rem);
  font-weight: 800;
  color: var(--sp-heading);
  line-height: 1.25;
}

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

.sp-passport-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sp-passport-progress-wrap {
  margin-bottom: 0.95rem;
}

.sp-passport-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sp-muted);
  margin-bottom: 0.35rem;
}

.sp-passport-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--sp-subtle);
  border: 1px solid var(--sp-border);
  overflow: hidden;
}

.sp-passport-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f6b54, #10b981, #fbbf24);
  transition: width 0.35s ease;
}

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

.sp-passport-profile-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.55rem;
  align-items: end;
  padding-top: 0.85rem;
  border-top: 1px solid var(--sp-border);
}

.sp-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
  min-width: 0;
}

.sp-field-group label {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--sp-muted);
}

.sp-field-input {
  width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.72rem;
  border-radius: 9px;
  border: 1px solid var(--sp-border);
  background: var(--sp-subtle);
  color: var(--sp-heading);
  font-family: inherit;
  font-size: 0.86rem;
}

.sp-field-input:focus {
  outline: 2px solid var(--sp-brand);
  outline-offset: 1px;
}

/* ── Category Filter Bar & Card Record Chips (/game/) ───────────────────── */
.sp-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.15rem;
}

.sp-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 38px;
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: var(--sp-card);
  color: var(--sp-text);
  font-family: inherit;
  font-size: 0.81rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

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

.sp-filter-pill.is-active {
  background: var(--sp-brand);
  border-color: var(--sp-brand);
  color: #ffffff;
}

.sp-game-card[hidden] {
  display: none;
}

.sp-card-record-chip {
  position: absolute;
  bottom: 0.65rem;
  right: 0.65rem;
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  background: rgba(6, 18, 14, 0.88);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
  font-size: 0.72rem;
  font-weight: 800;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.sp-card-record-chip.is-empty {
  border-color: rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

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

.sp-hub-feature-card {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 13px;
  padding: 1rem;
}

.sp-hub-feature-card strong {
  display: block;
  font-size: 0.93rem;
  color: var(--sp-heading);
  margin-bottom: 0.25rem;
}

.sp-hub-feature-card p {
  font-size: 0.82rem;
  color: var(--sp-muted);
}

/* ── Quick Game Switcher Bar Above Cabinet ──────────────────────────────── */
.sp-chapter-bar {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  overflow-x: auto;
  padding: 0.2rem 0 0.65rem;
  scrollbar-width: thin;
}

.sp-chapter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.36rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: var(--sp-card);
  color: var(--sp-text);
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

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

.sp-chapter-chip.is-current {
  background: var(--sp-brand-soft);
  border-color: var(--sp-brand);
  color: var(--sp-brand);
}

:root[data-theme="dark"] .sp-chapter-chip {
  background: #131e1b;
  color: #e2e8f0;
  border-color: #253832;
}
:root[data-theme="dark"] .sp-chapter-chip.is-current {
  background: #113a2e;
  color: #34d399;
  border-color: #10b981;
}

.sp-chapter-stars {
  font-size: 0.68rem;
  opacity: 0.9;
}

/* ── HUD Progress Bar & Checklist Drawer Inside Cabinet ─────────────────── */
.sp-hud-progress {
  width: 100%;
  height: 4px;
  background: #091310;
  position: relative;
  overflow: hidden;
}

.sp-hud-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #34d399, #fbbf24);
  transition: width 0.28s ease;
}

.sp-checklist-drawer {
  background: #0d1b17;
  border-bottom: 1px solid #233c34;
  padding: 0.65rem 0.8rem;
  color: #e2ece8;
}

.sp-checklist-drawer[hidden] {
  display: none;
}

.sp-checklist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #6ee7b7;
}

.sp-checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.42rem;
}

.sp-checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.38rem 0.55rem;
  border-radius: 8px;
  background: #142520;
  border: 1px solid #264239;
  font-size: 0.74rem;
}

.sp-checklist-item.is-done {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}

.sp-checklist-item.is-tracked {
  border-color: #fbbf24;
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.45);
}

.sp-checklist-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.sp-checklist-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-checklist-reg {
  font-size: 0.66rem;
  color: #94a3b8;
}

.sp-checklist-track {
  flex-shrink: 0;
  min-height: 28px;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #355a4e;
  background: #1b332c;
  color: #fde68a;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
}

.sp-checklist-track:hover {
  border-color: #fbbf24;
  background: #27473d;
}

.sp-checklist-track.is-active {
  background: #f59e0b;
  border-color: #fde68a;
  color: #0b1411;
}

/* ── Start Card: Inspector Name & 3-Mode Selector ───────────────────────── */
.sp-inspector-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.48rem;
  margin-bottom: 0.75rem;
  text-align: left;
}

.sp-inspector-fields label {
  display: block;
  font-size: 0.69rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}

.sp-inspector-input {
  width: 100%;
  min-height: 36px;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #2f4f45;
  background: #0d1a16;
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.8rem;
}

.sp-inspector-input:focus {
  outline: 2px solid #34d399;
  outline-offset: 1px;
}

.sp-mode-selector {
  margin-bottom: 0.85rem;
  text-align: left;
}

.sp-mode-label {
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.38rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sp-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.42rem;
}

.sp-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  padding: 0.45rem 0.55rem;
  border-radius: 9px;
  border: 1px solid #2b473e;
  background: #13241f;
  color: #cbd5e1;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

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

.sp-mode-btn.is-active {
  background: #143d31;
  border-color: #10b981;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px #10b981;
}

.sp-mode-btn strong {
  font-size: 0.76rem;
  color: inherit;
}

.sp-mode-btn span {
  font-size: 0.65rem;
  line-height: 1.25;
  color: #94a3b8;
}

.sp-mode-btn.is-active span {
  color: #a7f3d0;
}

/* ── Desktop Action Button Ready State ──────────────────────────────────── */
#sp-btn-action-desktop.is-ready,
.sp-btn.is-ready {
  background: linear-gradient(160deg, #f59e0b, #d97706);
  border-color: #fde68a;
  color: #0c1412;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.35);
}

/* ── Summary Next Mission & Certificate Buttons ─────────────────────────── */
.sp-btn--cert {
  background: #0f766e;
  border-color: #14b8a6;
  color: #ffffff;
}

.sp-btn--cert:hover {
  background: #115e59;
  color: #ffffff;
}

.sp-mode-chip-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #6ee7b7;
}

@media (prefers-reduced-motion: reduce) {
  .sp-passport-bar-fill,
  .sp-hud-progress-fill {
    transition: none;
  }
}

/* ── Responsive Adjustments ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sp-passport-grid,
  .sp-hub-features-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sp-passport-profile-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .sp-inspector-fields,
  .sp-mode-grid,
  .sp-hub-features-grid {
    grid-template-columns: 1fr;
  }

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

/* ── Post-Shift Debrief Box (Summary Modal) ─────────────────────────────── */
.sp-debrief-box {
  margin: 0.75rem 0 0.9rem;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--sp-border);
  background: var(--sp-subtle);
  text-align: left;
}

.sp-debrief-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.sp-debrief-head strong {
  font-size: 0.85rem;
  color: var(--sp-heading);
}

.sp-debrief-copy-btn {
  padding: 0.25rem 0.6rem;
  border-radius: 7px;
  border: 1px solid var(--sp-border);
  background: var(--sp-card);
  color: var(--sp-heading);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

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

.sp-debrief-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  font-size: 0.78rem;
  color: var(--sp-text);
}

.sp-debrief-list li strong {
  color: var(--sp-heading);
}

.sp-debrief-reg {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
  background: var(--sp-amber-soft);
  color: var(--sp-amber);
  margin-left: 0.35rem;
}

.sp-debrief-clean {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sp-brand);
}

/* ── Global Score Submit Bar & Leaderboard Tabs ─────────────────────────── */
.sp-global-sync-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--sp-border);
  background: var(--sp-subtle);
  margin-bottom: 0.85rem;
  font-size: 0.79rem;
  color: var(--sp-heading);
}

.sp-lb-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.sp-lb-tab-btn {
  min-height: 36px;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: var(--sp-subtle);
  color: var(--sp-text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.sp-lb-tab-btn.is-active {
  background: var(--sp-brand);
  border-color: var(--sp-brand);
  color: #ffffff;
}

.sp-lb-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

/* ── Daily Drill Banner & Hub Leaderboard ───────────────────────────────── */
.sp-daily-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.9rem 1.15rem;
  border-radius: 14px;
  border: 1.5px solid var(--sp-brand);
  background: var(--sp-brand-soft);
  margin-bottom: 1.35rem;
}

.sp-daily-banner strong {
  display: block;
  font-size: 0.96rem;
  color: var(--sp-heading);
}

.sp-daily-banner span {
  font-size: 0.81rem;
  color: var(--sp-text);
}

.sp-session-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.42);
  color: #fde68a;
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 0.55rem;
}

.sp-lead-kit-box {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--sp-border);
  border-left: 4px solid var(--sp-brand);
  background: var(--sp-surface);
  color: var(--sp-text);
  font-size: 0.82rem;
}
.sp-lead-kit-box summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--sp-heading);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.sp-lead-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  margin-top: 0.65rem;
}
.sp-lead-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

