:root {
  --bg-outer: #06080e;
  --bg-phone-top: #121829;
  --bg-phone-bot: #090d16;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.11);
  --text: #f8fafc;
  --muted: #94a3b8;
  --pink: #ff3366;
  --orange: #ff7b29;
  --teal: #00ebb5;
  --blue: #38bdf8;
  --gold: #ffd166;
  --danger: #ff4757;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 15%, #19223c 0%, var(--bg-outer) 72%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

#app {
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#phone-frame {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 450px;
  max-height: 900px;
  background: radial-gradient(circle at 50% 35%, var(--bg-phone-top) 0%, var(--bg-phone-bot) 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 500px) and (min-height: 680px) {
  #phone-frame {
    height: min(94vh, 860px);
    width: calc(min(94vh, 860px) * 9 / 16);
    border-radius: 34px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(255, 255, 255, 0.04);
  }
}

#fever-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  box-shadow: inset 0 0 80px rgba(255, 94, 58, 0.55), inset 0 0 24px rgba(255, 209, 102, 0.35);
  transition: opacity 0.35s ease;
}

#phone-frame.fever-active #fever-vignette {
  opacity: 1;
  animation: feverPulse 1.1s ease-in-out infinite;
}

@keyframes feverPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

/* HUD */
#hud {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px;
  pointer-events: none;
}

#hud button {
  pointer-events: auto;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-center {
  text-align: center;
}

#score-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 800;
}

#score-value {
  font-size: 28px;
  font-weight: 950;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.lives-box {
  display: flex;
  gap: 3px;
  font-size: 16px;
}

.heart {
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.heart.lost {
  opacity: 0.2;
  transform: scale(0.78);
  filter: grayscale(1);
}

.timer-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.timer-pill.low {
  background: rgba(255, 71, 87, 0.22);
  border-color: var(--danger);
  color: #ff6b81;
  animation: pulseFast 0.5s infinite;
}

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

.daily-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 800;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

.coin-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.32);
  font-weight: 850;
  font-size: 13px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.coin-dot {
  font-size: 11px;
}

/* Sub HUD */
#sub-hud {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 2px 16px;
  pointer-events: none;
}

.meta-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  text-transform: uppercase;
}

.meta-pill.muted {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.meta-pill.fever {
  background: linear-gradient(135deg, #ff5e3a, #ff2a6d);
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 51, 102, 0.5);
}

.meta-pill.boss {
  background: linear-gradient(135deg, #ffd166, #ff9f1c);
  color: #1c1300;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.45);
}

.duel-banner {
  font-size: 12px;
  font-weight: 850;
  color: #fde047;
  background: rgba(250, 204, 21, 0.14);
  border: 1px solid rgba(250, 204, 21, 0.38);
  padding: 4px 12px;
  border-radius: 999px;
}

.fever-bar-wrap {
  width: 140px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.fever-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--pink));
  transition: width 0.25s ease;
}

/* Verdict Banner — sits in open space below HUD/duel banner and above balance */
#verdict-banner {
  position: absolute;
  top: max(136px, 23%);
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  text-align: center;
  pointer-events: none;
  width: 92%;
  animation: popCenter 0.24s cubic-bezier(0.2, 1.45, 0.4, 1);
}

#verdict-title {
  font-size: 27px;
  font-weight: 950;
  letter-spacing: 0.8px;
  white-space: nowrap;
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.8);
}

#verdict-sub {
  font-size: 13px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2px;
}

@keyframes popCenter {
  0% { transform: translateX(-50%) scale(0.55); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

#bottom-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  font-size: 12px;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.72);
  background: rgba(6, 8, 14, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.09);
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

/* OVERLAYS */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(8, 11, 20, 0.93);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  padding: max(18px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
}

.top-bar-home {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 235, 181, 0.12);
  border: 1px solid rgba(0, 235, 181, 0.3);
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.5px;
}

.hero-block {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 0;
}

.hero-badge {
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 3.5px;
  color: var(--muted);
  margin-bottom: 10px;
}

.hero-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 76px;
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: -4px;
}

.h-left {
  color: var(--teal);
  transform: translateY(-4px) rotate(-3deg);
}

.h-slash {
  color: #fff;
  font-weight: 300;
  opacity: 0.9;
  transform: rotate(8deg);
}

.h-right {
  color: var(--pink);
  transform: translateY(4px) rotate(3deg);
}

.hero-sub {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.mini-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 11px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ms-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--muted);
}

.ms-val {
  font-size: 19px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.mode-btn {
  width: 100%;
  border: none;
  border-radius: 18px;
  padding: 13px 13px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  transition: transform 0.12s ease;
}

.mode-btn:active {
  transform: scale(0.96);
}

.mode-top-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-btn.primary {
  background: linear-gradient(135deg, #ff3366, #ff7b29);
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 51, 102, 0.28);
}

.mode-btn.accent {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  box-shadow: 0 10px 22px rgba(99, 102, 241, 0.25);
}

.mode-btn.teal {
  background: linear-gradient(135deg, #00ebb5, #00a8e8);
  color: #06141b;
  box-shadow: 0 10px 22px rgba(0, 235, 181, 0.2);
}

.mode-btn.hardcore {
  background: linear-gradient(135deg, #27272a, #991b1b);
  border: 1px solid rgba(255, 71, 87, 0.45);
  color: #fff;
  box-shadow: 0 10px 22px rgba(153, 27, 27, 0.32);
}

.mode-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.mode-title {
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0.3px;
}

.mode-desc {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.88;
  line-height: 1.25;
}

.streak-tag {
  font-size: 11px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(6, 20, 27, 0.2);
}

.streak-tag.dark {
  background: rgba(0, 0, 0, 0.35);
  color: #fca5a5;
}

.btn-install {
  width: 100%;
  margin-bottom: 10px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0, 235, 181, 0.4);
  background: rgba(0, 235, 181, 0.12);
  color: var(--teal);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.btn-install:active {
  transform: scale(0.97);
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.nav-pill {
  position: relative;
  padding: 12px 6px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.quest-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

/* Quests Panel */
.quests-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quest-card.ready {
  border-color: var(--gold);
  background: rgba(255, 209, 102, 0.08);
}

.quest-card.claimed {
  opacity: 0.55;
}

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

.quest-title {
  font-size: 14px;
  font-weight: 800;
}

.quest-reward {
  font-size: 12px;
  font-weight: 900;
  color: var(--gold);
  white-space: nowrap;
}

.quest-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.quest-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 0.25s ease;
}

.quest-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.quest-claim-btn {
  padding: 6px 12px;
  border-radius: 10px;
  border: none;
  background: var(--gold);
  color: #1c1300;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.btn-duel {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #fff;
  box-shadow: 0 8px 22px rgba(139, 92, 246, 0.32);
  transition: transform 0.12s ease;
}

.btn-duel:active {
  transform: scale(0.97);
}

.quest-toast {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  background: linear-gradient(135deg, #ffd166, #ff9f1c);
  color: #1c1300;
  font-weight: 900;
  font-size: 12.5px;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}

.nav-pill:active {
  transform: scale(0.97);
}

/* Panels (Shop / Stats) */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 2px;
}

.shop-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.shop-tab {
  padding: 10px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.shop-tab.active {
  background: rgba(0, 235, 181, 0.14);
  border-color: var(--teal);
  color: var(--teal);
}

.blade-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 16px;
}

.arena-swatch {
  width: 46px;
  height: 30px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.arena-swatch::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  height: 3px;
  border-radius: 999px;
  background: var(--swatch-bar, #fff);
}

.blade-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.blade-card.equipped {
  border-color: var(--teal);
  background: rgba(0, 235, 181, 0.08);
}

.blade-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.blade-preview {
  width: 46px;
  height: 9px;
  border-radius: 999px;
  transform: rotate(-20deg);
}

.blade-name {
  font-weight: 850;
  font-size: 14px;
}

.blade-sub {
  font-size: 12px;
  color: var(--muted);
}

.blade-btn {
  padding: 8px 13px;
  border-radius: 11px;
  border: none;
  font-weight: 850;
  font-size: 12px;
  cursor: pointer;
}

.blade-btn.active {
  background: var(--teal);
  color: #06141b;
}

.blade-btn.equip {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.blade-btn.buy {
  background: var(--gold);
  color: #1c1300;
}

.blade-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Career Stats */
.career-rank-card {
  background: linear-gradient(135deg, rgba(0, 235, 181, 0.12), rgba(56, 189, 248, 0.12));
  border: 1px solid rgba(0, 235, 181, 0.28);
  border-radius: 20px;
  padding: 18px;
  text-align: center;
  margin-bottom: 14px;
}

.career-rank-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--teal);
}

.career-rank-name {
  font-size: 28px;
  font-weight: 950;
  margin: 4px 0;
}

.career-rank-next {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-tile-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.stat-tile-val {
  font-size: 22px;
  font-weight: 900;
}

/* Modals (Revive / Game Over) */
#screen-revive, #screen-gameover {
  justify-content: center;
  align-items: center;
}

.modal-card {
  width: 100%;
  max-height: 92%;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 20px 18px;
  text-align: center;
}

.modal-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 235, 181, 0.16);
  color: var(--teal);
  margin-bottom: 8px;
}

.modal-eyebrow.danger {
  background: rgba(255, 71, 87, 0.18);
  color: #ff6b81;
}

.go-score, .revive-score {
  font-size: 48px;
  font-weight: 950;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.go-sub, .revive-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 4px;
}

.daily-breakdown {
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.daily-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 11px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
  font-weight: 700;
}

.go-reward-pill {
  display: inline-block;
  margin: 10px 0 14px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.14);
  color: var(--gold);
  font-size: 13px;
  font-weight: 850;
}

.go-actions, .revive-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.btn-primary-solid, .btn-gold, .btn-ghost {
  width: 100%;
  border: none;
  border-radius: 15px;
  padding: 13px 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.12s ease;
}

.btn-primary-solid:active, .btn-gold:active, .btn-ghost:active {
  transform: scale(0.97);
}

.btn-primary-solid {
  background: linear-gradient(135deg, #ff3366, #ff7b29);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 51, 102, 0.32);
}

.btn-gold {
  background: linear-gradient(135deg, #ffd166, #ff9f1c);
  color: #1c1300;
  box-shadow: 0 8px 22px rgba(255, 196, 61, 0.28);
}

.btn-gold small {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.8;
}

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
}

.copy-toast {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: var(--teal);
  color: #06141b;
  font-weight: 850;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}
