/* ==========================================================================
   KRILLION — Retro-Ocean Deep-Dive Daily Trivia
   Mobile-first (100dvh + visualViewport keyboard-aware) & Desktop polished
   ========================================================================== */

:root {
  --font-display: ui-rounded, 'SF Pro Display', -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-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;

  --bg-deep: #061325;
  --glass: rgba(7, 18, 38, 0.78);
  --glass-strong: rgba(5, 13, 29, 0.9);
  --glass-border: rgba(56, 189, 248, 0.24);
  --glass-border-bright: rgba(125, 211, 252, 0.45);

  --text-main: #F0F9FF;
  --text-dim: #94B4D1;
  --text-muted: #6482A3;

  --zone-accent: #22D3EE;
  --krill-pink: #FB7185;
  --krill-violet: #E879F9;
  --danger: #F87171;
  --success: #34D399;

  --vvh: 100dvh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.hidden {
  display: none !important;
}

/* Fullscreen 60fps Deep-Sea Canvas */
#ocean-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

/* Main App Shell — pinned to visualViewport so iOS Safari keyboard never scrolls UI off-screen */
.app-shell {
  position: fixed;
  top: var(--vv-top, 0px);
  left: 0;
  right: 0;
  z-index: 1;
  width: 100%;
  height: var(--vvh, 100dvh);
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
}

/* ==================== TOP HUD 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;
  background: rgba(7, 18, 38, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding-block: 7px;
  padding-inline: 9px 12px;
  color: var(--text-main);
  cursor: pointer;
  min-height: 40px;
  transition: transform 0.14s ease, border-color 0.2s ease, background 0.2s ease;
}
.brand-btn:hover {
  border-color: var(--glass-border-bright);
  background: rgba(12, 28, 56, 0.78);
}
.brand-btn:active {
  transform: scale(0.96);
}

.brand-icon {
  font-size: 1.05rem;
  line-height: 1;
}
.brand-wordmark {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #E0F2FE;
}

.hud-depth-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-shrink: 1;
  background: rgba(6, 15, 32, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 999px;
  padding: 5px 11px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--zone-accent);
  white-space: nowrap;
}

/* Prevent top HUD clipping on narrow mobile screens during active dives */
@media (max-width: 440px) {
  body.in-dive .top-bar {
    padding: 8px 10px 6px;
    gap: 6px;
  }
  body.in-dive .brand-wordmark {
    display: none;
  }
  body.in-dive .brand-btn {
    padding: 7px 10px;
  }
  body.in-dive #btn-buddies,
  body.in-dive #btn-stats {
    display: none;
  }
  body.in-dive .icon-btn {
    width: 38px;
    height: 38px;
  }
}
.hud-zone-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--zone-accent);
  box-shadow: 0 0 8px var(--zone-accent);
}

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

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: rgba(7, 18, 38, 0.58);
  color: #E0F2FE;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.14s ease, border-color 0.2s ease, background 0.2s ease;
}
.icon-btn:hover {
  border-color: var(--glass-border-bright);
  background: rgba(14, 34, 68, 0.82);
}
.icon-btn:active {
  transform: scale(0.93);
}

.notif-dot {
  position: absolute;
  top: 5px;
  inset-inline-end: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--krill-violet);
  box-shadow: 0 0 8px var(--krill-violet);
}

/* ==================== 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: fadeSlideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.view.active {
  display: flex;
}

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

/* ==================== HOME VIEW ==================== */
.view-home {
  justify-content: space-between;
  gap: 10px;
  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;
  padding-top: 6px;
  gap: 10px;
}

.buddy-showcase {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  transition: transform 0.18s ease;
}
.buddy-showcase:hover {
  transform: scale(1.04);
}

.buddy-halo {
  position: absolute;
  top: 6px;
  width: 102px;
  height: 102px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 113, 133, 0.32) 0%, rgba(56, 189, 248, 0.12) 55%, transparent 74%);
  filter: blur(4px);
  pointer-events: none;
}

.buddy-sprite {
  position: relative;
  width: 104px;
  height: 104px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
  animation: buddyFloat 3.4s ease-in-out infinite;
}

.buddy-fallback {
  font-size: 4rem;
  line-height: 104px;
  animation: buddyFloat 3.4s ease-in-out infinite;
}

@keyframes buddyFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}

.buddy-tag {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: #BAE6FD;
  background: rgba(7, 18, 38, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 999px;
  padding: 3px 10px;
}

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

.dive-number-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #67E8F9;
  background: rgba(8, 47, 73, 0.72);
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 999px;
  padding: 4px 12px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22D3EE;
  box-shadow: 0 0 8px #22D3EE;
  animation: pulseGlow 1.8s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 9vw, 2.75rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.05;
  background: linear-gradient(180deg, #FFFFFF 15%, #7DD3FC 65%, #38BDF8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 rgba(5, 16, 36, 0.85));
}

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

/* Home Buttons & Mode Grid */
.home-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.btn-primary {
  background: linear-gradient(180deg, #22D3EE 0%, #0284C7 100%);
  color: #031525;
  font-weight: 700;
  box-shadow: 0 5px 0 #075985, 0 10px 24px rgba(2, 132, 199, 0.42);
}
.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background: rgba(15, 36, 68, 0.85);
  color: #E0F2FE;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 0 rgba(4, 12, 26, 0.75);
}
.btn-secondary:hover {
  border-color: #7DD3FC;
  background: rgba(20, 48, 88, 0.9);
}

.btn-ghost {
  background: rgba(7, 18, 38, 0.55);
  color: var(--text-dim);
  border: 1px solid var(--glass-border);
}
.btn-ghost:hover {
  color: var(--text-main);
  border-color: var(--glass-border-bright);
}

.btn-dive-cta {
  flex-direction: column;
  gap: 3px;
  padding: 15px 20px;
  min-height: 64px;
  border-radius: var(--radius-lg);
}
.btn-dive-cta.completed {
  background: linear-gradient(180deg, #A78BFA 0%, #7C3AED 100%);
  color: #FAF5FF;
  box-shadow: 0 5px 0 #4C1D95, 0 10px 24px rgba(124, 58, 237, 0.4);
}
.btn-cta-main {
  font-size: 1.02rem;
}
.btn-cta-sub {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  opacity: 0.85;
}

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

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-main);
  cursor: pointer;
  text-align: start;
  min-height: 82px;
  transition: transform 0.14s ease, border-color 0.2s ease, background 0.2s ease;
}
.mode-card:hover {
  border-color: var(--glass-border-bright);
  background: rgba(12, 28, 56, 0.86);
}
.mode-card:active {
  transform: scale(0.97);
}
.mode-card-wide {
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 62px;
}
.mode-wide-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
}
.mode-emoji {
  font-size: 1.25rem;
  line-height: 1;
}
.mode-name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #E0F2FE;
}
.mode-desc {
  font-size: 0.76rem;
  color: var(--text-dim);
}
.mode-arrow {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--zone-accent);
}

.home-footer-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(6, 15, 32, 0.65);
  border: 1px solid rgba(56, 189, 248, 0.16);
  backdrop-filter: blur(8px);
}
.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;
  color: #F0F9FF;
}
.mini-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.mini-stat-divider {
  width: 1px;
  height: 26px;
  background: rgba(56, 189, 248, 0.18);
}

/* ==================== PLAYING VIEW ==================== */
.view-play {
  justify-content: space-between;
  gap: 8px;
}

.play-telemetry {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

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

.mode-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: #7DD3FC;
  background: rgba(8, 47, 73, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 999px;
  padding: 3px 10px;
}

.signal-counter {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #E0F2FE;
}

.lives-wrap {
  font-size: 0.85rem;
  letter-spacing: 2px;
}

.signal-pips {
  display: flex;
  gap: 6px;
  width: 100%;
}

.signal-pip {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.2);
  border: 1px solid rgba(148, 163, 184, 0.2);
  transition: background 0.3s ease, transform 0.25s ease, box-shadow 0.3s ease;
}
.signal-pip.current {
  background: rgba(34, 211, 238, 0.45);
  border-color: #22D3EE;
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.55);
}
.signal-pip.done {
  border-color: rgba(255, 255, 255, 0.35);
}

/* Depth Banner */
.depth-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  background: rgba(6, 16, 35, 0.7);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.depth-readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.depth-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.depth-meters {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--zone-accent);
  text-shadow: 0 0 14px rgba(34, 211, 238, 0.45);
}

.zone-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.zone-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #E0F2FE;
}
.zone-sci {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Prompt Card */
.prompt-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px 16px 14px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--glass-border-bright);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 36px rgba(2, 8, 22, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  margin: auto 0;
}

.prompt-card.shake {
  animation: cardShake 0.36s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}

.prompt-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #BAE6FD;
  background: rgba(12, 74, 110, 0.52);
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 999px;
  padding: 4px 10px;
}

.timer-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #E0F2FE;
  background: rgba(7, 18, 38, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  padding: 4px 10px;
}
.timer-seconds {
  font-size: 1.08rem;
  min-width: 2ch;
  text-align: right;
}
.timer-unit {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.timer-badge.urgent {
  color: #FCA5A5;
  border-color: var(--danger);
  background: rgba(127, 29, 29, 0.55);
  animation: urgentPulse 0.65s ease-in-out infinite;
}
@keyframes urgentPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

.timer-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}
.timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22D3EE 0%, #38BDF8 100%);
  transform-origin: left center;
  transition: width 0.1s linear, background 0.3s ease;
}
.timer-fill.warn {
  background: linear-gradient(90deg, #FBBF24 0%, #FB923C 100%);
}
.timer-fill.urgent {
  background: linear-gradient(90deg, #F87171 0%, #EF4444 100%);
}

.prompt-question {
  margin: 2px 0 0;
  font-size: clamp(1.18rem, 4.8vw, 1.48rem);
  font-weight: 700;
  line-height: 1.28;
  color: #FFFFFF;
}

.prompt-constraint {
  margin: -4px 0 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #7DD3FC;
  background: rgba(14, 116, 144, 0.24);
  border-inline-start: 3px solid #22D3EE;
  padding: 5px 9px;
  border-radius: 6px;
}

.tries-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 22px;
}

.tries-pips {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.try-pip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.24);
  border: 1px solid rgba(148, 163, 184, 0.35);
  transition: all 0.2s ease;
}
.try-pip.active {
  background: #38BDF8;
  border-color: #BAE6FD;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.65);
}
.try-pip.spent {
  background: rgba(248, 113, 113, 0.3);
  border-color: rgba(248, 113, 113, 0.6);
}

.input-feedback {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #FCA5A5;
  text-align: end;
  flex: 1;
}

/* Mobile-Keyboard-Safe Input Dock */
.answer-dock {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 4px;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.answer-input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 12px 15px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(56, 189, 248, 0.42);
  background: rgba(4, 12, 27, 0.92);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 16px; /* Prevents iOS Safari auto-zoom */
  font-weight: 600;
  outline: none;
  user-select: text;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.answer-input::placeholder {
  color: #6482A3;
  font-size: 14px;
  font-weight: 400;
}
.answer-input:focus {
  border-color: #22D3EE;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.24);
}

.btn-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 88px;
  min-height: 52px;
  padding: 0 14px;
  flex-shrink: 0;
  white-space: nowrap;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #22D3EE 0%, #0284C7 100%);
  color: #031525;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #075985;
  transition: transform 0.12s ease, filter 0.15s ease;
}
.btn-send:active {
  transform: translateY(2px);
}
.btn-send:hover {
  filter: brightness(1.08);
}

.dock-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}
.dock-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.btn-text-subtle {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 6px 8px;
  min-height: 32px;
  cursor: pointer;
  border-radius: 6px;
}
.btn-text-subtle:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
}

/* Compact layout when mobile virtual keyboard is open (keeps entire game inside ~320-400px iOS viewport) */
body.keyboard-open .app-shell {
  padding-top: 4px;
  padding-bottom: 4px;
}
body.keyboard-open .top-bar {
  padding: 4px 10px 2px;
}
body.keyboard-open .brand-btn,
body.keyboard-open .icon-btn {
  min-height: 34px;
  height: 34px;
}
body.keyboard-open .icon-btn {
  width: 34px;
}
body.keyboard-open .stage {
  padding: 2px 10px 6px;
}
body.keyboard-open .view-play {
  gap: 5px;
}
body.keyboard-open .play-telemetry {
  gap: 4px;
}
body.keyboard-open .depth-banner,
body.keyboard-open .dock-subrow {
  display: none;
}
body.keyboard-open .prompt-card {
  padding: 10px 12px 8px;
  gap: 6px;
  margin: auto 0;
}
body.keyboard-open .prompt-question {
  font-size: 1.02rem;
  line-height: 1.22;
}
body.keyboard-open .prompt-constraint {
  font-size: 0.68rem;
  padding: 3px 7px;
}
body.keyboard-open .answer-input,
body.keyboard-open .btn-send {
  min-height: 44px;
}
body.keyboard-open .answer-input {
  padding: 8px 12px;
}

/* ==================== REVEAL OVERLAY VIEW ==================== */
.view-reveal {
  justify-content: center;
}

.reveal-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 18px 18px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  border: 1.5px solid var(--tier-color, #38BDF8);
  box-shadow: 0 16px 48px rgba(2, 8, 22, 0.7), 0 0 32px var(--tier-glow, rgba(56, 189, 248, 0.25));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: revealPop 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes revealPop {
  from { opacity: 0; transform: scale(0.94) translateY(14px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #031525;
  background: var(--tier-color, #38BDF8);
  box-shadow: 0 0 18px var(--tier-glow, rgba(56, 189, 248, 0.4));
}

.tier-shape {
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.reveal-answer-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.reveal-answer-text {
  font-size: clamp(1.35rem, 6vw, 1.8rem);
  font-weight: 700;
  color: #FFFFFF;
}
.reveal-fuzzy-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #7DD3FC;
}
.reveal-depth-gain {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 7vw, 2.2rem);
  font-weight: 900;
  color: var(--tier-color, #38BDF8);
  text-shadow: 0 0 22px var(--tier-glow, rgba(56, 189, 248, 0.55));
  margin-top: 2px;
}
.reveal-pct-line {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.reveal-fun-note {
  margin: 6px 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #E0F2FE;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 7px 11px;
  max-width: 100%;
}

.reveal-depth-bar {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(15, 29, 58, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.2);
}
.reveal-depth-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reveal-depth-stat.right {
  align-items: flex-end;
}
.stat-k {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.stat-v {
  font-family: var(--font-mono);
  font-size: 0.94rem;
  font-weight: 700;
  color: #F0F9FF;
}

.crowd-peek {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.peek-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(7, 16, 34, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.18);
}
.peek-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}
.peek-val {
  font-size: 0.84rem;
  font-weight: 600;
  color: #E0F2FE;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.btn-next-signal {
  width: 100%;
  min-height: 52px;
}

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

.summary-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-bottom: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.3) transparent;
}

.summary-hero-card,
.summary-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

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

.zone-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--zone-accent);
  background: rgba(14, 116, 144, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 999px;
  padding: 4px 11px;
}

.summary-depth-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.summary-buddy-wrap {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  background: rgba(14, 34, 68, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.summary-buddy-img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  image-rendering: pixelated;
}
.summary-depth-big {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 7vw, 2.3rem);
  font-weight: 900;
  line-height: 1.05;
  color: #FFFFFF;
}
.summary-score-sub {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.unlock-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(232, 121, 249, 0.22), rgba(56, 189, 248, 0.18));
  border: 1px solid rgba(232, 121, 249, 0.5);
  font-size: 0.82rem;
  font-weight: 600;
  color: #FAE8FF;
}

.summary-emoji-strip {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: rgba(6, 15, 32, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.16);
}
.strip-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #031525;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

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

.card-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.card-section-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #BAE6FD;
}
.section-hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dive-curve-container {
  width: 100%;
  min-height: 155px;
}
.dive-curve-container svg {
  width: 100%;
  height: auto;
  display: block;
  direction: ltr;
  unicode-bidi: isolate;
}
.dive-curve-container svg text {
  direction: ltr;
  unicode-bidi: isolate;
}

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

.log-item {
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: rgba(10, 22, 46, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.16);
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}
.log-item.selected {
  border-color: var(--zone-accent);
  background: rgba(14, 34, 68, 0.92);
}
.log-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.log-prompt {
  font-size: 0.82rem;
  color: var(--text-dim);
  flex: 1;
}
.log-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  color: #031525;
  flex-shrink: 0;
}
.log-item-mid {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 4px;
  gap: 8px;
}
.log-answer {
  font-size: 0.95rem;
  font-weight: 700;
  color: #FFFFFF;
}
.log-meters {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: #7DD3FC;
}
.log-detail {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.2);
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(2, 8, 20, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  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: #08172E;
  border: 1px solid rgba(56, 189, 248, 0.34);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  animation: modalUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.16);
}
.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #E0F2FE;
}

.modal-close {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 29, 58, 0.7);
  color: #E0F2FE;
  font-size: 1rem;
  cursor: pointer;
}
.modal-close:hover {
  background: rgba(30, 58, 108, 0.85);
}

.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(--text-dim);
  line-height: 1.45;
}

.modal-subhead {
  margin: 6px 0 -4px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #7DD3FC;
}

.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;
  color: #E0F2FE;
}
.help-step p {
  margin: 0;
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(34, 211, 238, 0.2);
  border: 1px solid #22D3EE;
  color: #67E8F9;
  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-tiers-list,
.help-zones-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.help-tier-row,
.help-zone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(14, 29, 56, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.14);
  font-size: 0.82rem;
}
.help-tier-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.help-tier-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: #031525;
  font-weight: 800;
  font-size: 0.75rem;
}
.help-tier-pts {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: #BAE6FD;
}

/* Buddies Grid */
.buddies-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.buddy-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 12px 10px;
  border-radius: 14px;
  border: 1.5px solid rgba(56, 189, 248, 0.2);
  background: rgba(12, 26, 52, 0.82);
  color: #E0F2FE;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.2s ease;
}
.buddy-card:hover:not(.locked) {
  border-color: #7DD3FC;
  transform: translateY(-2px);
}
.buddy-card.equipped {
  border-color: #22D3EE;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.35);
  background: rgba(14, 42, 78, 0.92);
}
.buddy-card.locked {
  opacity: 0.62;
  cursor: not-allowed;
}
.buddy-card img {
  width: 66px;
  height: 66px;
  object-fit: contain;
  image-rendering: pixelated;
}
.buddy-card.locked img {
  filter: brightness(0.28) saturate(0.25);
}
.buddy-card-name {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
}
.buddy-card-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.25;
}
.buddy-equipped-pill {
  position: absolute;
  top: 7px;
  inset-inline-end: 7px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  color: #031525;
  background: #22D3EE;
  border-radius: 999px;
  padding: 2px 6px;
}

/* 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;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  background: rgba(12, 27, 54, 0.85);
  color: #E0F2FE;
  cursor: pointer;
  text-align: start;
  transition: transform 0.14s ease, border-color 0.2s ease;
}
.pack-card:hover {
  border-color: #7DD3FC;
  transform: translateY(-2px);
}
.pack-emoji {
  font-size: 1.4rem;
}
.pack-name {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
}
.pack-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-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;
  padding: 10px 6px;
  border-radius: 12px;
  background: rgba(13, 28, 56, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.18);
}
.kpi-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: #FFFFFF;
}
.kpi-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
}

.endless-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(14, 29, 56, 0.72);
  border: 1px solid rgba(167, 139, 250, 0.26);
  font-size: 0.84rem;
}
.endless-stat-row strong {
  font-family: var(--font-mono);
  color: #C4B5FD;
  white-space: nowrap;
}

.stats-tier-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(112px, 136px) 1fr 36px;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
}
.bar-label {
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  height: 11px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
  transition: width 0.35s ease;
}
.bar-count {
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: end;
  color: #E0F2FE;
}

/* Settings Toggles & Language Dropdown */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
}
.setting-row:last-child {
  border-bottom: none;
}
.setting-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #F0F9FF;
}
.setting-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.lang-select {
  min-height: 40px;
  max-width: 172px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(56, 189, 248, 0.42);
  background: rgba(12, 27, 54, 0.92);
  color: #F0F9FF;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.lang-select option {
  background: #08172E;
  color: #F0F9FF;
}
.lang-select:focus {
  outline: 2px solid #22D3EE;
  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: rgba(148, 163, 184, 0.28);
  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: #0EA5E9;
}
.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) .dive-number-pill,
html:lang(ar) .buddy-tag,
html:lang(ar) .btn,
html:lang(ar) .mode-name,
html:lang(ar) .mode-tag,
html:lang(ar) .signal-counter,
html:lang(ar) .depth-label,
html:lang(ar) .tier-badge,
html:lang(ar) .stat-k,
html:lang(ar) .card-section-head h3,
html:lang(ar) .modal-head h2,
html:lang(ar) .modal-subhead,
html:lang(hi) .dive-number-pill,
html:lang(hi) .buddy-tag,
html:lang(hi) .btn,
html:lang(hi) .mode-name,
html:lang(hi) .mode-tag,
html:lang(hi) .signal-counter,
html:lang(hi) .depth-label,
html:lang(hi) .tier-badge,
html:lang(hi) .stat-k,
html:lang(hi) .card-section-head h3,
html:lang(hi) .modal-head h2,
html:lang(hi) .modal-subhead {
  letter-spacing: 0;
}

html:lang(ar) .dive-number-pill,
html:lang(ar) .buddy-tag,
html:lang(ar) .mode-tag,
html:lang(ar) .signal-counter,
html:lang(ar) .depth-label,
html:lang(ar) .zone-sci,
html:lang(ar) .prompt-constraint,
html:lang(ar) .btn-text-subtle,
html:lang(ar) .reveal-fuzzy-note,
html:lang(ar) .stat-k,
html:lang(ar) .stat-v,
html:lang(ar) .zone-badge,
html:lang(ar) .section-hint,
html:lang(ar) .log-pill,
html:lang(ar) .log-meters,
html:lang(ar) .help-tier-pts,
html:lang(ar) .buddy-equipped-pill,
html:lang(ar) .pack-count,
html:lang(hi) .dive-number-pill,
html:lang(hi) .buddy-tag,
html:lang(hi) .mode-tag,
html:lang(hi) .signal-counter,
html:lang(hi) .depth-label,
html:lang(hi) .zone-sci,
html:lang(hi) .prompt-constraint,
html:lang(hi) .btn-text-subtle,
html:lang(hi) .reveal-fuzzy-note,
html:lang(hi) .stat-k,
html:lang(hi) .stat-v,
html:lang(hi) .zone-badge,
html:lang(hi) .section-hint,
html:lang(hi) .log-pill,
html:lang(hi) .log-meters,
html:lang(hi) .help-tier-pts,
html:lang(hi) .buddy-equipped-pill,
html:lang(hi) .pack-count {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}

html[dir='rtl'] .mode-arrow {
  display: inline-block;
  transform: scaleX(-1);
}
html[dir='rtl'] .timer-fill {
  transform-origin: right center;
}
html[dir='rtl'] .timer-badge {
  direction: rtl;
}
html[dir='rtl'] .timer-seconds {
  text-align: center;
}
html[dir='rtl'] .reveal-depth-gain,
html[dir='rtl'] .log-meters {
  direction: ltr;
  unicode-bidi: isolate;
}

/* 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: rgba(6, 18, 38, 0.95);
  border: 1px solid #22D3EE;
  color: #E0F2FE;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  white-space: normal;
  text-align: center;
}

/* Reduced Motion */
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;
}

/* Colorblind High-Contrast Enhancements */
body.colorblind .tier-badge,
body.colorblind .log-pill,
body.colorblind .strip-chip {
  border: 2px solid #FFFFFF;
}

/* ==================== PLATFORM ACCOUNT & MULTIPLAYER UI ==================== */
.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 5px 11px 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(7, 18, 38, 0.72);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.account-pill:hover {
  border-color: var(--glass-border-bright);
  background: rgba(12, 28, 56, 0.88);
}
.profile-avatar-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.profile-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.profile-status-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.18);
  color: #7DD3FC;
  border: 1px solid rgba(56, 189, 248, 0.3);
  flex-shrink: 0;
}

.btn-save-progress {
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.55);
  background: rgba(250, 204, 21, 0.16);
  color: #FEF08A;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, transform 0.12s ease;
}
.btn-save-progress:hover {
  background: rgba(250, 204, 21, 0.28);
}
.btn-save-progress:active {
  transform: scale(0.97);
}

.mp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.mode-card-mp {
  border-color: rgba(34, 211, 238, 0.42);
  background: linear-gradient(155deg, rgba(14, 52, 92, 0.82), rgba(7, 18, 38, 0.85));
}
.mode-card-duel {
  border-color: rgba(232, 121, 249, 0.42);
  background: linear-gradient(155deg, rgba(58, 18, 78, 0.78), rgba(7, 18, 38, 0.85));
}
.mp-card-full {
  grid-column: span 2;
}
.mp-card-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.live-count-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.18);
  color: #6EE7B7;
  border: 1px solid rgba(52, 211, 153, 0.4);
  white-space: nowrap;
}

.mp-status-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.16);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: #A5F3FC;
  white-space: nowrap;
}

.input-feedback.locked {
  color: #6EE7B7;
}

.mp-reveal-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(7, 16, 34, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.24);
}
.mp-reveal-head {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #7DD3FC;
}
.mp-standings-list,
.mp-rankings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mp-standing-row,
.mp-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(12, 27, 54, 0.78);
  border: 1px solid rgba(56, 189, 248, 0.16);
  font-size: 0.82rem;
}
.mp-standing-row.is-me,
.mp-rank-row.is-me {
  border-color: #22D3EE;
  background: rgba(14, 48, 86, 0.88);
}
.mp-standing-left,
.mp-rank-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.mp-rank-num {
  font-family: var(--font-mono);
  font-weight: 800;
  color: #7DD3FC;
  min-width: 24px;
}
.mp-player-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mp-player-name {
  font-weight: 700;
  color: #F0F9FF;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-player-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 5px;
  margin-inline-start: 4px;
  vertical-align: middle;
}
.mp-badge-you {
  background: rgba(34, 211, 238, 0.24);
  color: #67E8F9;
}
.mp-badge-bot {
  background: rgba(148, 163, 184, 0.22);
  color: #CBD5E1;
}
.mp-standing-right,
.mp-rank-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-weight: 700;
}
.mp-pts-val {
  color: #F0F9FF;
  font-size: 0.84rem;
}
.mp-delta-pos {
  color: #34D399;
  font-size: 0.72rem;
}
.mp-delta-neg {
  color: #F87171;
  font-size: 0.72rem;
}
.mp-gems-row {
  font-size: 0.76rem;
  color: #E0F2FE;
  padding-top: 6px;
  border-top: 1px dashed rgba(148, 163, 184, 0.22);
}

.mp-summary-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 4px 0;
}
.mp-summary-title {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #7DD3FC;
}
.mp-rating-banner {
  margin-top: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #E0F2FE;
}
.mp-rating-banner.pos {
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.45);
  color: #6EE7B7;
}
.mp-rating-banner.neg {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
  color: #FCA5A5;
}

.btn:disabled,
.btn-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

html:lang(ar) .mp-reveal-head,
html:lang(ar) .mp-summary-title,
html:lang(hi) .mp-reveal-head,
html:lang(hi) .mp-summary-title {
  letter-spacing: 0;
}
html:lang(ar) .live-count-pill,
html:lang(ar) .mp-status-pill,
html:lang(ar) .profile-status-badge,
html:lang(ar) .mp-rating-banner,
html:lang(hi) .live-count-pill,
html:lang(hi) .mp-status-pill,
html:lang(hi) .profile-status-badge,
html:lang(hi) .mp-rating-banner {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}
html[dir='rtl'] .account-pill {
  padding: 5px 6px 5px 11px;
}


/* ==========================================================================
   Daily Rematch "light arcade" pass (fonts, buttons, home cards; the ocean stays dark)
   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;
  --dr-ink: #1d1b3a;
  --dr-muted: #5d5a7e;
}
/* 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 {
  letter-spacing: 0.02em;
}

/* Buttons: ink border + hard offset shadow, press-down motion */
.btn-primary,
.btn-send {
  background: #ffd23f;
  color: var(--dr-ink);
  border: 3px solid var(--dr-ink);
  box-shadow: 5px 5px 0 var(--dr-ink);
}
.btn-secondary {
  background: #ffffff;
  color: var(--dr-ink);
  border: 3px solid var(--dr-ink);
  box-shadow: 4px 4px 0 var(--dr-ink);
}
.btn-primary:hover,
.btn-send:hover,
.btn-secondary:hover {
  filter: none;
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--dr-ink);
}
.btn-primary:hover,
.btn-send:hover {
  background: #ffd23f;
}
.btn-secondary:hover {
  background: #ffffff;
}
.btn-primary:active,
.btn-send:active,
.btn-secondary:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--dr-ink);
}

/* Top bar + account strip */
.icon-btn,
.brand-btn,
.account-pill {
  background: #ffffff;
  color: var(--dr-ink);
  border: 2px solid var(--dr-ink);
  box-shadow: 3px 3px 0 var(--dr-ink);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.icon-btn:hover,
.brand-btn:hover,
.account-pill:hover {
  background: #ffffff;
  border-color: var(--dr-ink);
}
.btn-save-progress {
  background: #7b5cff;
  color: #ffffff;
  border: 2px solid var(--dr-ink);
  box-shadow: 3px 3px 0 var(--dr-ink);
}
.btn-save-progress:hover {
  background: #7b5cff;
}
.dive-number-pill {
  background: #ffffff;
  color: var(--dr-ink);
  border: 2px solid var(--dr-ink);
}

/* Home mode cards + theme packs: white cards on the ocean */
.mode-card,
.pack-card {
  background: #ffffff;
  color: var(--dr-ink);
  border: 3px solid var(--dr-ink);
  box-shadow: 5px 5px 0 var(--dr-ink);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.mode-card:hover,
.pack-card:hover {
  background: #ffffff;
  border-color: var(--dr-ink);
}
.mode-card .mode-name,
.pack-card .pack-name {
  color: var(--dr-ink);
}
.mode-card .mode-desc,
.mode-card .mode-arrow,
.pack-card .pack-desc {
  color: var(--dr-muted);
}
.mode-card .live-count-pill {
  background: #6fe0b5;
  color: var(--dr-ink);
  border: 2px solid var(--dr-ink);
}
.brand-btn .brand-wordmark {
  background: none;
  -webkit-text-fill-color: var(--dr-ink);
  color: var(--dr-ink);
  filter: none;
}
.account-pill .profile-status-badge {
  background: #efeaff;
  color: #7b5cff;
  border-color: #c9b8ff;
}
