/* ==========================================================================
   SIZE IT UP — Architectural Drafting Lab Scale Estimation Game
   Warm Drafting Paper (Default) + Dark Navy Blueprint Theme
   Mobile-first (100dvh, >= 44px touch targets) & Desktop wide studio layout
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Geeza Pro', 'Noto Sans Arabic', 'Kohinoor Devanagari', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  /* Warm Architectural Drafting Paper Theme */
  --bg: #EFECE3;
  --surface: #FAF8F3;
  --surface-alt: #F1EDE4;
  --canvas-bg: #F6F3EB;
  --border: rgba(15, 23, 42, 0.14);
  --border-strong: rgba(15, 23, 42, 0.26);

  --ink: #0F172A;
  --ink-dim: #475569;
  --ink-muted: #64748B;

  --accent: #F0522D;
  --accent-dark: #C23A1B;
  --accent-soft: rgba(240, 82, 45, 0.12);
  --actual: #059669;
  --actual-soft: rgba(5, 150, 105, 0.14);
  --ref-tint-filter: brightness(0) saturate(100%) invert(8%) sepia(24%) saturate(1650%) hue-rotate(188deg) brightness(95%) contrast(95%);
  --mystery-tint-filter: brightness(0) saturate(100%) invert(42%) sepia(93%) saturate(2250%) hue-rotate(348deg) brightness(96%) contrast(98%);

  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius-lg: 18px;
  --radius-md: 12px;
}

/* Dark Architectural Blueprint Mode */
body.theme-blueprint {
  --bg: #071221;
  --surface: #0E1F38;
  --surface-alt: #132949;
  --canvas-bg: #0B192C;
  --border: rgba(56, 189, 248, 0.22);
  --border-strong: rgba(125, 211, 252, 0.4);

  --ink: #F0F9FF;
  --ink-dim: #94B8D8;
  --ink-muted: #6A8FB3;

  --accent: #FF7849;
  --accent-dark: #C84D23;
  --accent-soft: rgba(255, 120, 73, 0.16);
  --actual: #34D399;
  --actual-soft: rgba(52, 211, 153, 0.16);
  --ref-tint-filter: brightness(0) saturate(100%) invert(93%) sepia(14%) saturate(850%) hue-rotate(184deg) brightness(102%) contrast(98%);
  --mystery-tint-filter: brightness(0) saturate(100%) invert(58%) sepia(83%) saturate(1850%) hue-rotate(338deg) brightness(102%) contrast(101%);

  --shadow-card: 0 12px 32px rgba(2, 6, 16, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  transition: background 0.22s ease, color 0.22s ease;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: 100%;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ==================== TOP STUDIO BAR ==================== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px 6px;
  flex-shrink: 0;
}

.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding-block: 6px;
  padding-inline: 9px 12px;
  color: var(--ink);
  cursor: pointer;
  min-height: 40px;
  transition: transform 0.14s ease, border-color 0.2s ease;
}
.brand-btn:hover {
  border-color: var(--border-strong);
}
.brand-btn:active {
  transform: scale(0.96);
}
.brand-mark {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.brand-wordmark {
  font-weight: 800;
  font-size: clamp(0.74rem, 3.1vw, 0.88rem);
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-score-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
}
.hud-sep {
  opacity: 0.4;
}

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

.icon-btn,
.unit-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.2s ease, background 0.2s ease;
}
.unit-btn {
  font-size: 0.78rem;
  color: var(--accent);
}
.icon-btn:hover,
.unit-btn:hover {
  border-color: var(--border-strong);
}
.icon-btn:active,
.unit-btn:active {
  transform: scale(0.94);
}

@media (max-width: 440px) {
  .top-bar {
    padding: 8px 10px 6px;
    gap: 6px;
  }
  .top-actions {
    gap: 4px;
  }
  .brand-btn {
    padding-block: 5px;
    padding-inline: 7px 9px;
    gap: 5px;
    min-height: 36px;
  }
  .brand-wordmark {
    font-size: clamp(0.66rem, 2.9vw, 0.82rem);
    letter-spacing: 0.02em;
  }
  .icon-btn,
  .unit-btn {
    width: 36px;
    height: 36px;
  }
  body.in-round .brand-wordmark {
    display: none;
  }
  body.in-round .brand-btn {
    padding: 5px 9px;
  }
  body.in-round #btn-stats,
  body.in-round #btn-help {
    display: none;
  }
}

/* ==================== STAGE & VIEWS ==================== */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 14px 12px;
  overflow: hidden;
}

.view {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  animation: fadeUp 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.view.active {
  display: flex;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== HOME VIEW ==================== */
.view-home {
  justify-content: space-between;
  gap: 12px;
  overflow-y: auto;
  scrollbar-width: none;
}
.view-home::-webkit-scrollbar {
  display: none;
}

.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding-top: 4px;
}

.hero-blueprint-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 152px;
  border-radius: var(--radius-lg);
  background: var(--canvas-bg);
  border: 1.5px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px 20px 18px;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.45;
  pointer-events: none;
}

.hero-sil-pair {
  position: relative;
  z-index: 1;
  display: flex;
  direction: ltr;
  align-items: flex-end;
  justify-content: space-around;
  gap: 12px;
  height: 108px;
}

.hero-sil-ref,
.hero-sil-mystery {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.hero-sil-img {
  display: block;
  object-fit: contain;
}
.hero-sil-ref .hero-sil-img {
  height: 46px;
}
.hero-sil-mystery .hero-sil-img {
  height: 86px;
  animation: heroPulseScale 3.6s ease-in-out infinite;
  transform-origin: bottom center;
}
.ref-tint {
  filter: var(--ref-tint-filter);
}
.mystery-tint {
  filter: var(--mystery-tint-filter);
}

@keyframes heroPulseScale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

.hero-bbox {
  position: relative;
  padding: 4px 10px 0;
  border: 1.5px dashed var(--accent);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}
.bbox-dot {
  position: absolute;
  top: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}
.bbox-dot.tl { left: -4px; }
.bbox-dot.tr { right: -4px; }

.hero-scale-arrows {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 24px;
}

.hero-dim-chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}
.hero-dim-chip.mystery {
  color: var(--accent);
  border-color: var(--accent);
}

.hero-baseline {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 36px;
  height: 2px;
  background: var(--border-strong);
}

.home-title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.challenge-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(240, 82, 45, 0.35);
  border-radius: 999px;
  padding: 4px 12px;
}
.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-title {
  margin: 0;
  font-size: clamp(2rem, 8.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.04;
}

.hero-subtitle {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink-dim);
  max-width: 390px;
  text-wrap: balance;
}
.hero-subtitle strong {
  color: var(--ink);
}

/* Home Buttons & Modes */
.home-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  min-height: 48px;
  padding: 12px 18px;
  transition: transform 0.12s ease, filter 0.16s ease, box-shadow 0.16s ease;
}
.btn:active {
  transform: translateY(2px) scale(0.985);
}

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: 0 4px 0 var(--accent-dark), 0 8px 20px rgba(240, 82, 45, 0.28);
}
.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--border-strong);
  box-shadow: 0 3px 0 var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-dim);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-main-cta {
  flex-direction: column;
  gap: 2px;
  min-height: 62px;
  padding: 13px 18px;
  border-radius: var(--radius-lg);
}
.btn-main-cta.completed {
  background: var(--actual);
  box-shadow: 0 4px 0 #047857, 0 8px 20px rgba(5, 150, 105, 0.28);
}
.btn-cta-main {
  font-size: 1rem;
}
.btn-cta-sub {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0.9;
}

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

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 12px 13px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: start;
  min-height: 80px;
  overflow-wrap: break-word;
  box-shadow: var(--shadow-card);
  transition: transform 0.14s ease, border-color 0.2s ease;
}
.mode-card:hover {
  border-color: var(--accent);
}
.mode-card:active {
  transform: scale(0.97);
}
.mode-card-wide {
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 60px;
}
.mode-wide-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
}
.mode-emoji {
  font-size: 1.25rem;
  line-height: 1;
}
.mode-name {
  font-size: 0.88rem;
  font-weight: 800;
}
.mode-desc {
  font-size: 0.76rem;
  color: var(--ink-dim);
}
.mode-arrow {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
}

/* ==================== PLATFORM ACCOUNT & MULTIPLAYER ==================== */
.platform-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
}
.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding-block: 4px;
  padding-inline: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink);
  cursor: pointer;
  max-width: 100%;
  transition: border-color 0.16s ease, transform 0.12s ease;
}
.profile-pill:hover {
  border-color: var(--accent);
}
.profile-pill:active {
  transform: scale(0.97);
}
.profile-avatar-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.profile-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.profile-name {
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.profile-guest-tag {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--border);
  color: var(--ink-dim);
  flex-shrink: 0;
}
.save-progress-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, background 0.16s ease, color 0.16s ease;
}
.save-progress-btn:hover {
  background: var(--accent);
  color: #FFFFFF;
}
.save-progress-btn:active {
  transform: scale(0.96);
}

.mode-card-mp {
  border-color: rgba(240, 82, 45, 0.35);
}
.mode-card-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.mode-card-mp.mode-card-wide .mode-card-top {
  width: auto;
  flex-shrink: 0;
}
.mode-live-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--actual-soft);
  color: var(--actual);
  border: 1px solid rgba(5, 150, 105, 0.28);
  white-space: nowrap;
}

.mp-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.mp-timer-pill,
.mp-locked-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}
.mp-timer-pill.urgent {
  color: #DC2626;
}
body.theme-blueprint .mp-timer-pill.urgent {
  color: #F87171;
}
.mp-leave-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 3px 9px;
  min-height: 28px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.mp-leave-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.mp-waiting-banner,
.mp-next-banner {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--ink-dim);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.btn-lock-in:disabled {
  opacity: 0.68;
  cursor: default;
  transform: none;
}

.mp-reveal-standings {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  max-height: 112px;
  overflow-y: auto;
}
.mp-standings-head {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 2px;
}
.mp-final-standings {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.mp-standing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
}
.mp-reveal-standings .mp-standing-row {
  padding: 4px 7px;
  font-size: 0.74rem;
}
.mp-standing-row.is-self {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.mp-standing-rank {
  font-family: var(--font-mono);
  font-weight: 800;
  min-width: 24px;
  color: var(--ink-dim);
}
.mp-standing-rank.rank-1 { color: #D97706; }
.mp-standing-rank.rank-2 { color: #64748B; }
.mp-standing-rank.rank-3 { color: #B45309; }
.mp-standing-avatar {
  display: inline-flex;
  flex-shrink: 0;
}
.mp-standing-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-you-badge {
  display: inline-block;
  margin-inline-start: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  vertical-align: middle;
}
.mp-standing-delta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--actual);
  white-space: nowrap;
}
.mp-standing-score {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}
.mp-rating-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  unicode-bidi: isolate;
}
.mp-rating-pill.pos {
  background: var(--actual-soft);
  color: var(--actual);
}
.mp-rating-pill.neg {
  background: rgba(220, 38, 38, 0.12);
  color: #DC2626;
}
body.theme-blueprint .mp-rating-pill.neg {
  color: #F87171;
}

.home-footer-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px solid var(--border);
}
.mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.mini-stat-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
}
.mini-stat-label {
  font-size: 0.72rem;
  color: var(--ink-muted);
}
.mini-stat-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

/* ==================== PLAY ARENA VIEW ==================== */
.view-play {
  gap: 8px;
}

.arena-header {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

.arena-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mode-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(240, 82, 45, 0.3);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

.round-pips {
  display: flex;
  gap: 5px;
  flex: 1;
  max-width: 160px;
}
.round-pip {
  flex: 1;
  height: 7px;
  border-radius: 4px;
  background: var(--border);
  transition: background 0.25s ease;
}
.round-pip.current {
  background: var(--accent);
}

.round-counter {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-dim);
  white-space: nowrap;
}

.matchup-bar {
  display: grid;
  direction: ltr;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-card);
}

.matchup-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.matchup-item.mystery {
  align-items: flex-end;
  text-align: right;
}
.matchup-k {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}
.matchup-item.mystery .matchup-k {
  color: var(--accent);
}
.matchup-v {
  font-size: clamp(0.78rem, 3.5vw, 0.92rem);
  font-weight: 800;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}
.matchup-dim {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-dim);
}
.matchup-item.mystery .matchup-dim {
  color: var(--accent);
}

.matchup-vs {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ink-muted);
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--surface-alt);
}

/* Interactive Canvas Frame */
.canvas-frame {
  position: relative;
  flex: 1;
  min-height: 220px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-strong);
  background: var(--canvas-bg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

#scale-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scale-canvas:active {
  cursor: grabbing;
}

.gesture-hint {
  position: absolute;
  top: 10px;
  left: calc(50% + 22px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 62px);
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  color: var(--ink-dim);
  white-space: normal;
  pointer-events: none;
  opacity: 0.92;
  transition: opacity 0.35s ease;
}
.gesture-hint.faded {
  opacity: 0;
}

.realign-btn {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
}

/* Precision Control Dock */
.control-dock {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 13px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-card);
  flex-shrink: 0;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.1s ease, border-color 0.16s ease, background 0.16s ease;
}
.step-btn:hover {
  border-color: var(--accent);
}
.step-btn:active {
  transform: scale(0.92);
  background: var(--accent-soft);
}

.slider-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  min-width: 0;
}

.scale-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  margin: 4px 0 6px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  outline: none;
  cursor: pointer;
}

.scale-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--accent);
  box-shadow: 0 3px 10px rgba(240, 82, 45, 0.35);
  cursor: grab;
  transition: transform 0.12s ease;
}
.scale-slider::-webkit-slider-thumb:active {
  transform: scale(1.12);
  cursor: grabbing;
}
.scale-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--accent);
  box-shadow: 0 3px 10px rgba(240, 82, 45, 0.35);
  cursor: grab;
}

.slider-ticks {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  font-weight: 700;
  color: var(--ink-muted);
  padding: 0 2px;
}
.slider-ticks > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#slider-live-ratio {
  color: var(--ink-dim);
  flex-shrink: 0;
}

.btn-lock-in,
.btn-next-round {
  width: 100%;
  min-height: 50px;
}

/* Reveal Dock */
.reveal-dock {
  gap: 8px;
  border-color: var(--actual);
}

.reveal-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reveal-score-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  color: #FFFFFF;
  background: var(--actual);
}

.reveal-delta {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
}

.reveal-points-box {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.reveal-points-num {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  color: var(--actual);
}
.reveal-points-max {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-muted);
}

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

.dim-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  color: var(--ink-dim);
  overflow-wrap: break-word;
}
.dim-pill strong {
  font-family: var(--font-mono);
  color: var(--ink);
}
.dim-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dim-pill.guess .dim-dot {
  background: var(--accent);
}
.dim-pill.actual .dim-dot {
  background: var(--actual);
}

.reveal-fact {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.38;
  color: var(--ink-dim);
  background: var(--actual-soft);
  border-inline-start: 3px solid var(--actual);
  padding: 6px 10px;
  border-start-end-radius: 8px;
  border-end-end-radius: 8px;
}

/* ==================== SUMMARY VIEW ==================== */
.view-summary {
  overflow: hidden;
}

.summary-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-bottom: 14px;
}

.summary-hero-card,
.summary-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-card);
}

.summary-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.summary-rank-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--actual);
  background: var(--actual-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

.summary-score-block {
  text-align: center;
  margin: 4px 0 12px;
}
.summary-score-main {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.summary-score-big {
  font-family: var(--font-mono);
  font-size: clamp(2.4rem, 10vw, 3.2rem);
  font-weight: 800;
  line-height: 1;
}
.summary-score-denom {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink-muted);
}
.summary-score-sub {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: var(--ink-dim);
}

.summary-blocks-strip {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.score-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 46px;
  border-radius: 10px;
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.86rem;
}
.score-tile span {
  font-size: 0.58rem;
  opacity: 0.9;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.share-actions .btn {
  white-space: normal;
  line-height: 1.2;
  text-align: center;
  font-size: 0.8rem;
  padding: 10px 8px;
}

.card-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.card-section-head h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}
.section-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.summary-rounds-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sum-round-row {
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sum-round-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sum-round-title {
  font-size: 0.86rem;
  font-weight: 700;
  min-width: 0;
}
.sum-obj-name {
  display: inline-block;
  max-width: 100%;
}
.sum-round-score {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  color: #FFFFFF;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.sum-round-dims {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--ink-dim);
}
.sum-bar-track {
  height: 7px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.sum-bar-fill {
  height: 100%;
  border-radius: 999px;
}
.sum-round-fact {
  font-size: 0.76rem;
  color: var(--ink-dim);
  line-height: 1.35;
}

.summary-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 18, 32, 0.62);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

@media (min-width: 560px) {
  .modal-backdrop {
    align-items: center;
  }
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: modalUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.modal-close {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
}

.modal-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-intro {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-dim);
}
.modal-subhead {
  margin: 4px 0 -4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}
.modal-cta {
  width: 100%;
  margin-top: 4px;
}

/* Help Modal */
.help-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.help-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  line-height: 1.45;
}
.help-step p {
  margin: 0;
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.help-ranks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.help-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}
.help-rank-pts {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--ink-dim);
}

/* Packs Grid */
.packs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pack-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  padding: 13px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink);
  cursor: pointer;
  text-align: start;
  overflow-wrap: break-word;
  transition: transform 0.14s ease, border-color 0.2s ease;
}
.pack-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.pack-emoji {
  font-size: 1.4rem;
}
.pack-name {
  font-size: 0.86rem;
  font-weight: 800;
}
.pack-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-dim);
}

/* Stats Modal */
.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.kpi-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 10px 5px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.kpi-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
}
.kpi-lbl {
  font-size: 0.65rem;
  color: var(--ink-muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.streak-record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(240, 82, 45, 0.28);
  font-size: 0.82rem;
}
.streak-record-row strong {
  font-family: var(--font-mono);
  color: var(--accent);
  white-space: nowrap;
}

.stats-rank-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(105px, 44%) 1fr 34px;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
}
.bar-label {
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  height: 11px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
}
.bar-count {
  font-family: var(--font-mono);
  font-weight: 800;
  text-align: end;
}

/* Settings */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child {
  border-bottom: none;
}
.setting-title {
  font-size: 0.9rem;
  font-weight: 700;
}
.setting-desc {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.seg-control {
  display: inline-flex;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 2px;
  flex-shrink: 0;
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.seg-btn.active {
  background: var(--accent);
  color: #FFFFFF;
}

.lang-select {
  min-height: 40px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.setting-row:has(.lang-select) {
  flex-wrap: wrap;
}
.lang-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.switch {
  position: relative;
  display: inline-block;
  direction: ltr;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.2s ease;
}
.slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform 0.2s ease;
}
.switch input:checked + .slider {
  background: var(--accent);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* RTL (Arabic), Indic (Hindi) & CJK Script Typography Adjustments */
html:lang(ja) {
  line-break: strict;
}

html:lang(ar) .brand-wordmark,
html:lang(ar) .challenge-pill,
html:lang(ar) .btn,
html:lang(ar) .mode-tag,
html:lang(ar) .matchup-k,
html:lang(ar) .rank-badge,
html:lang(ar) .card-section-head h3,
html:lang(ar) .modal-head h2,
html:lang(ar) .modal-subhead,
html:lang(hi) .brand-wordmark,
html:lang(hi) .challenge-pill,
html:lang(hi) .btn,
html:lang(hi) .mode-tag,
html:lang(hi) .matchup-k,
html:lang(hi) .rank-badge,
html:lang(hi) .card-section-head h3,
html:lang(hi) .modal-head h2,
html:lang(hi) .modal-subhead {
  letter-spacing: 0;
}

html:lang(ar) .hud-score-pill,
html:lang(ar) .challenge-pill,
html:lang(ar) .mode-tag,
html:lang(ar) .round-counter,
html:lang(ar) .matchup-k,
html:lang(ar) .matchup-dim,
html:lang(ar) .gesture-hint,
html:lang(ar) .realign-btn,
html:lang(ar) .slider-ticks,
html:lang(ar) .rank-badge,
html:lang(ar) .summary-rank-pill,
html:lang(ar) .card-section-head h3,
html:lang(ar) .section-hint,
html:lang(ar) .sum-round-dims,
html:lang(ar) .modal-head h2,
html:lang(ar) .modal-subhead,
html:lang(ar) .pack-count,
html:lang(ar) .seg-btn,
html:lang(hi) .hud-score-pill,
html:lang(hi) .challenge-pill,
html:lang(hi) .mode-tag,
html:lang(hi) .round-counter,
html:lang(hi) .matchup-k,
html:lang(hi) .matchup-dim,
html:lang(hi) .gesture-hint,
html:lang(hi) .realign-btn,
html:lang(hi) .slider-ticks,
html:lang(hi) .rank-badge,
html:lang(hi) .summary-rank-pill,
html:lang(hi) .card-section-head h3,
html:lang(hi) .section-hint,
html:lang(hi) .sum-round-dims,
html:lang(hi) .modal-head h2,
html:lang(hi) .modal-subhead,
html:lang(hi) .pack-count,
html:lang(ar) .mode-live-badge,
html:lang(ar) .mp-timer-pill,
html:lang(ar) .mp-locked-pill,
html:lang(ar) .mp-leave-btn,
html:lang(ar) .mp-waiting-banner,
html:lang(ar) .mp-next-banner,
html:lang(ar) .mp-standing-score,
html:lang(ar) .mp-rating-pill,
html:lang(hi) .mode-live-badge,
html:lang(hi) .mp-timer-pill,
html:lang(hi) .mp-locked-pill,
html:lang(hi) .mp-leave-btn,
html:lang(hi) .mp-waiting-banner,
html:lang(hi) .mp-next-banner,
html:lang(hi) .mp-standing-score,
html:lang(hi) .mp-rating-pill,
html:lang(hi) .seg-btn {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}

html[dir='rtl'] .mode-arrow,
html[dir='rtl'] .btn-arrow {
  display: inline-block;
  transform: scaleX(-1);
}
html[dir='rtl'] .hero-dim-chip {
  direction: rtl;
  unicode-bidi: isolate;
}
html[dir='rtl'] .reveal-points-box,
html[dir='rtl'] .summary-score-main {
  direction: ltr;
  unicode-bidi: isolate;
}
html[dir='rtl'] .matchup-item {
  direction: rtl;
}
html[dir='rtl'] .matchup-item.ref {
  align-items: flex-end;
  text-align: left;
}
html[dir='rtl'] .matchup-item.mystery {
  align-items: flex-start;
  text-align: right;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100vw - 24px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #0F172A;
  color: #F8FAFC;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  white-space: normal;
  text-align: center;
}

body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}


/* ==========================================================================
   Daily Rematch "light arcade" pass (palette, buttons, cards, heading font)
   Site tokens copied from portal/app/globals.css: ink #1d1b3a, paper #f6f4ff,
   violet #7b5cff, yellow #ffd23f; 3px ink borders + hard offset shadows;
   Bungee headings + Rubik body, self-hosted (offline-safe, system fallback).
   ========================================================================== */
@font-face {
  font-family: 'Bungee';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/bungee-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bungee';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/bungee-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/rubik-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/rubik-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/rubik-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/rubik-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font-sans: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Geeza Pro', 'Noto Sans Arabic', 'Kohinoor Devanagari', sans-serif;
  --font-display: 'Bungee', 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Geeza Pro', 'Noto Sans Arabic', 'Kohinoor Devanagari', sans-serif;
  --bg: #f6f4ff;
  --surface: #ffffff;
  --surface-alt: #efeaff;
  --canvas-bg: #ffffff;
  --border: rgba(29, 27, 58, 0.16);
  --border-strong: #1d1b3a;
  --ink: #1d1b3a;
  --ink-dim: #5d5a7e;
  --ink-muted: #7a77a0;
  --shadow-card: 5px 5px 0 #1d1b3a;
  --dr-line: #1d1b3a;
  --dr-shadow: #1d1b3a;
}
body.theme-blueprint {
  --dr-line: var(--border-strong);
  --dr-shadow: rgba(0, 0, 0, 0.55);
}
/* Bungee has no CJK / Devanagari / Arabic glyphs: use bold Rubik/system there (same as the portal) */
html:lang(ja),
html:lang(ko),
html:lang(zh),
html:lang(hi),
html:lang(ar) {
  --font-display: var(--font-sans);
}
html {
  font-synthesis-weight: none;
}

.hero-title,
.btn-cta-main,
.mode-name,
.modal-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
}
html:lang(ja) .hero-title, html:lang(ko) .hero-title, html:lang(zh) .hero-title, html:lang(hi) .hero-title, html:lang(ar) .hero-title,
html:lang(ja) .btn-cta-main, html:lang(ko) .btn-cta-main, html:lang(zh) .btn-cta-main, html:lang(hi) .btn-cta-main, html:lang(ar) .btn-cta-main,
html:lang(ja) .mode-name, html:lang(ko) .mode-name, html:lang(zh) .mode-name, html:lang(hi) .mode-name, html:lang(ar) .mode-name,
html:lang(ja) .modal-head h2, html:lang(ko) .modal-head h2, html:lang(zh) .modal-head h2, html:lang(hi) .modal-head h2, html:lang(ar) .modal-head h2 {
  font-weight: 800;
  letter-spacing: 0;
}

/* Buttons: ink border + hard offset shadow, press-down motion */
.btn-primary {
  background: #ffd23f;
  color: #1d1b3a;
  border: 3px solid var(--dr-line);
  box-shadow: 5px 5px 0 var(--dr-shadow);
}
.btn-secondary {
  border: 3px solid var(--dr-line);
  box-shadow: 4px 4px 0 var(--dr-shadow);
}
.btn-primary:hover,
.btn-secondary:hover {
  filter: none;
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--dr-shadow);
}
.btn-primary:active,
.btn-secondary:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--dr-shadow);
}
.save-progress-btn {
  background: #7b5cff;
  color: #ffffff;
  border: 2px solid var(--dr-line);
  box-shadow: 3px 3px 0 var(--dr-shadow);
}
.icon-btn,
.unit-btn,
.brand-btn,
.profile-pill {
  border: 2px solid var(--dr-line);
  box-shadow: 3px 3px 0 var(--dr-shadow);
}
.challenge-pill {
  border: 2px solid var(--dr-line);
}

/* Cards */
.mode-card,
.pack-card,
.summary-card,
.summary-hero-card,
.hero-blueprint-card {
  border: 3px solid var(--dr-line);
  box-shadow: 5px 5px 0 var(--dr-shadow);
}
.mode-card:hover,
.pack-card:hover {
  border-color: var(--dr-line);
}
