:root {
  --bg: #070b14;
  --surface: #0f172a;
  --surface-elevated: #111827;
  --border: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-genshin: #38bdf8;
  --accent-hsr: #a78bfa;
  --accent-zzz: #fb923c;
  --accent-wuwa: #2dd4bf;
  --gold: #facc15;
  --crimson: #ef4444;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', Consolas, monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, rgba(30, 41, 59, 0.28) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(30, 41, 59, 0.28) 1px, transparent 1px);
  background-size: 40px 40px;
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  scroll-behavior: smooth;
}

.is-hidden {
  display: none !important;
}

.sr-copy-area {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
  pointer-events: none;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding:
    calc(14px + env(safe-area-inset-top))
    calc(14px + env(safe-area-inset-right))
    calc(88px + env(safe-area-inset-bottom))
    calc(14px + env(safe-area-inset-left));
}

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.brand-group {
  min-width: 0;
}

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

.brand-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--crimson);
  animation: radarPulse 1.5s ease-in-out infinite;
}

@keyframes radarPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.82);
  }
}

.freshness-text {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.refresh-btn {
  flex-shrink: 0;
  appearance: none;
  border: 1px solid #334155;
  background: #1e293b;
  color: var(--text);
  font-weight: 700;
  font-size: 0.84rem;
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  min-height: 40px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.refresh-btn:hover:not(:disabled) {
  background: #334155;
  border-color: var(--accent-genshin);
}

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

.main-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.spotlight-card {
  background: linear-gradient(135deg, #1b1026 0%, #0f172a 100%);
  border: 2px solid var(--gold);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 24px rgba(250, 204, 21, 0.14);
}

.spotlight-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: #ca8a04;
  color: #070b14;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.spotlight-body {
  padding: 14px;
}

.spotlight-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.spotlight-code {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: #070b14;
  border: 1px solid rgba(250, 204, 21, 0.45);
  border-radius: 9px;
  padding: 10px 12px;
  word-break: break-all;
}

.spotlight-rewards {
  margin: 10px 0 12px;
  font-size: 0.92rem;
  color: #e2e8f0;
  line-height: 1.4;
}

.spotlight-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

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

.panel-kicker {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ratio-chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  background: #1e293b;
  color: #cbd5e1;
}

.pulls-headline {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pulls-total {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold);
}

.pulls-currency {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #cbd5e1;
}

.pulls-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pull-chip {
  background: #070b14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.pull-chip-genshin {
  border-color: rgba(56, 189, 248, 0.55);
}

.pull-chip-hsr {
  border-color: rgba(167, 139, 250, 0.55);
}

.pull-chip-zzz {
  border-color: rgba(251, 146, 60, 0.55);
}

.pull-chip-wuwa {
  border-color: rgba(45, 212, 191, 0.55);
}

.pull-chip-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.pull-chip-value {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.timers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.timer-card {
  background: #070b14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  min-width: 0;
}

.timer-title {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.timer-title-reset {
  color: var(--accent-genshin);
}

.timer-title-banner {
  color: var(--gold);
}

.timer-title-live {
  color: #f87171;
}

.timer-title-endgame {
  color: var(--accent-hsr);
}

.timer-value {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer-sub {
  margin-top: 3px;
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.section-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #cbd5e1;
}

.filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}

.filter-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
}

.filter-tab.is-active {
  background: #1e293b;
  color: var(--text);
  border-color: var(--accent-genshin);
}

.empty-banner {
  background: var(--surface);
  border: 1px dashed #334155;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

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

.code-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 11px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: opacity 0.15s ease;
}

.code-card-genshin {
  border-left-color: var(--accent-genshin);
}

.code-card-hsr {
  border-left-color: var(--accent-hsr);
}

.code-card-zzz {
  border-left-color: var(--accent-zzz);
}

.code-card-wuwa {
  border-left-color: var(--accent-wuwa);
}

.code-card.is-claimed {
  opacity: 0.56;
}

.code-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.code-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.game-badge {
  display: inline-block;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.game-badge-genshin {
  background: #0c4a6e;
  color: var(--accent-genshin);
}

.game-badge-hsr {
  background: #3b0764;
  color: var(--accent-hsr);
}

.game-badge-zzz {
  background: #7c2d12;
  color: var(--accent-zzz);
}

.game-badge-wuwa {
  background: #134e4a;
  color: var(--accent-wuwa);
}

.text-genshin {
  color: var(--accent-genshin);
}

.text-hsr {
  color: var(--accent-hsr);
}

.text-zzz {
  color: var(--accent-zzz);
}

.text-wuwa {
  color: var(--accent-wuwa);
}

.spotlight-chip {
  font-size: 0.66rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(250, 204, 21, 0.18);
  color: #fde047;
  border: 1px solid rgba(250, 204, 21, 0.4);
}

.time-ago {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.code-string {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.03em;
  word-break: break-all;
}

.code-rewards {
  margin: 0;
  font-size: 0.86rem;
  color: #cbd5e1;
  line-height: 1.38;
}

.ingame-path {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #99f6e4;
  background: rgba(19, 78, 74, 0.45);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 6px;
  padding: 5px 8px;
}

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

.redeem-btn {
  flex: 1;
  appearance: none;
  border: 1px solid #0284c7;
  background: #0369a1;
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 9px;
  cursor: pointer;
  min-height: 44px;
  transition: transform 0.08s ease, background-color 0.15s ease;
}

.redeem-btn:hover {
  background: #0284c7;
}

.redeem-btn:active {
  transform: scale(0.985);
}

.redeem-btn-ingame {
  background: #0f766e;
  border-color: var(--accent-wuwa);
}

.redeem-btn-ingame:hover {
  background: #0d9488;
}

.redeem-btn-primary {
  background: #ca8a04;
  border-color: var(--gold);
  color: #070b14;
}

.redeem-btn-primary:hover {
  background: #eab308;
}

.claimed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
  cursor: pointer;
  padding: 8px 6px;
  min-height: 44px;
  user-select: none;
}

.claimed-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-wuwa);
  cursor: pointer;
}

.mode-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #fde047;
}

.expired-details {
  margin-top: 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.expired-summary {
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
}

.expired-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.expired-card {
  background: rgba(7, 11, 20, 0.75);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 8px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.expired-code {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-dim);
  text-decoration: line-through;
}

.expired-rewards {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.expired-pill {
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--text-dim);
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.coop-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

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

.coop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.coop-main {
  min-width: 0;
}

.coop-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.server-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: #1e293b;
  color: #e2e8f0;
}

.coop-uid {
  font-family: var(--font-mono);
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text);
}

.coop-note {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: #cbd5e1;
  word-break: break-word;
}

.copy-uid-btn {
  flex-shrink: 0;
  appearance: none;
  border: 1px solid #0d9488;
  background: #134e4a;
  color: #5eead4;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
}

.copy-uid-btn:hover {
  background: #0f766e;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 16px);
  background: #0c4a6e;
  border: 1px solid var(--accent-genshin);
  color: #f8fafc;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: calc(100vw - 24px);
  text-align: center;
  z-index: 50;
}

.toast.toast-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 720px) {
  .summary-grid {
    grid-template-columns: 1fr 1.2fr;
  }

  .pulls-breakdown {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .codes-grid,
  .expired-grid,
  .coop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .codes-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.summary-grid,
.codes-section,
.coop-section {
  scroll-margin-top: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  appearance: none;
  border: 1px solid #334155;
  background: #1e293b;
  color: var(--text);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
  min-height: 40px;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  background: #334155;
  border-color: var(--accent-genshin);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sound-btn.is-on {
  background: rgba(45, 212, 191, 0.16);
  border-color: var(--accent-wuwa);
  color: #5eead4;
}

.install-header-btn {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-genshin);
  color: #7dd3fc;
}

.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #0f172a 0%, #0c2340 100%);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.install-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.install-banner-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
}

.install-banner-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
}

.install-banner-desc {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.install-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.install-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  appearance: none;
  border: 1px solid var(--accent-genshin);
  background: #0284c7;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 38px;
}

.install-btn-primary:hover {
  background: #0369a1;
}

.install-btn-dismiss {
  appearance: none;
  border: 1px solid #334155;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 38px;
}

.install-btn-dismiss:hover {
  color: var(--text);
  border-color: #475569;
}

.site-footer {
  margin-top: 28px;
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-link {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
}

.footer-link:hover,
.footer-link.is-active {
  color: var(--accent-genshin);
}

.footer-note {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 6px calc(8px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 700;
  min-height: 46px;
  border-radius: 8px;
}

.bottom-nav-item svg {
  width: 19px;
  height: 19px;
}

.bottom-nav-item:hover,
.bottom-nav-item:focus-visible {
  color: var(--accent-genshin);
  background: rgba(56, 189, 248, 0.08);
}

@media (max-width: 767px) {
  .toast {
    bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .btn-label-mobile-hide {
    display: none;
  }
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }

  .app-shell {
    padding-bottom: 36px;
  }
}

/* Static guide, legal, and 404 pages */
.brand-link {
  color: inherit;
  text-decoration: none;
}

.doc-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.doc-hero {
  background: linear-gradient(135deg, #0f172a 0%, #111c33 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px;
}

.doc-title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
}

.doc-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.doc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 720px) {
  .doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.doc-card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-genshin);
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-card h2 svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.doc-card p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.55;
}

.doc-card p:last-child {
  margin-bottom: 0;
}

.doc-list {
  margin: 6px 0 0;
  padding-left: 18px;
  color: #cbd5e1;
  font-size: 0.87rem;
  line-height: 1.6;
}

.doc-list code,
.doc-card code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: #070b14;
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 1px 6px;
  color: #7dd3fc;
}

.error-hero {
  text-align: center;
  padding: 40px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.error-code {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent-genshin);
}

.error-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Phase 7B: PWA, Sound Toggle, Icons, Mobile Bottom Nav & Doc Pages */
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

.app-shell {
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ui-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  appearance: none;
  border: 1px solid #334155;
  background: #0f172a;
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 11px;
  border-radius: 9px;
  cursor: pointer;
  min-height: 40px;
}

.icon-btn.is-sound-on {
  border-color: var(--accent-wuwa);
  color: var(--accent-wuwa);
  background: rgba(45, 212, 191, 0.1);
}

.pwa-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #0c4a6e 0%, #0f172a 100%);
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.pwa-banner-text {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pwa-banner-icon {
  width: 24px;
  height: 24px;
  color: var(--accent-genshin);
}

.pwa-banner-desc {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-install-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 14px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.doc-nav-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.doc-panel {
  padding: 20px;
  line-height: 1.6;
}

.doc-h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.doc-h2 {
  margin: 20px 0 8px;
  font-size: 1.05rem;
  color: var(--accent-genshin);
}

.doc-lead {
  color: var(--text-muted);
  margin: 0 0 14px;
}

.doc-list {
  padding-left: 20px;
  margin: 8px 0;
  color: #cbd5e1;
}

.doc-list li {
  margin-bottom: 6px;
}

.doc-cta {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 16px;
  border-radius: 9px;
  background: #0369a1;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
}

.site-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a[aria-current='page'] {
  color: var(--accent-genshin);
}

.footer-note {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-dim);
}

.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 700;
}

.mobile-nav-item:hover {
  color: var(--accent-genshin);
}

@media (min-width: 768px) {
  .mobile-bottom-nav {
    display: none;
  }
  .app-shell {
    padding-bottom: 32px;
  }
}

/* Mobile UX Polish (< 480px & Sticky Tabs) */
html,
body {
  overflow-x: hidden;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px 10px calc(80px + env(safe-area-inset-bottom, 0px));
  }

  /* Single-row compact header: title on left, icon-only actions on right */
  .top-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
  }

  .brand-group {
    flex: 1 1 auto;
    min-width: 0;
  }

  .brand-row {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .brand-title {
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .freshness-text {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-actions {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 6px;
  }

  .header-actions .icon-btn,
  .header-actions .refresh-btn {
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    justify-content: center;
  }

  .header-actions .btn-label {
    display: none;
  }

  /* Single-row 4-game pulls breakdown */
  .pulls-breakdown {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .pull-chip {
    padding: 6px 8px;
    text-align: center;
  }

  .filter-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(7, 11, 20, 0.94);
    backdrop-filter: blur(8px);
    padding: 8px 0;
    margin: 0 -2px;
  }

  .timers-grid {
    gap: 6px;
  }

  .timer-value {
    font-size: 0.95rem;
  }

  .code-card {
    padding: 12px;
    gap: 8px;
  }

  .redeem-btn {
    min-height: 46px;
    font-size: 0.9rem;
  }
}

/* iPhone / iOS Safari & Standalone PWA Polish */
@media (max-width: 640px) {
  .app-shell {
    padding-top: max(10px, env(safe-area-inset-top, 10px));
    padding-left: max(10px, env(safe-area-inset-left, 10px));
    padding-right: max(10px, env(safe-area-inset-right, 10px));
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  .filter-tabs {
    -webkit-backdrop-filter: blur(8px);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .mobile-bottom-nav {
    -webkit-backdrop-filter: blur(10px);
  }
}

/* Sort Selector */
.sort-select {
  appearance: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 32px;
}

.sort-select:focus {
  outline: none;
  border-color: var(--accent-genshin);
}

/* Stitch & Bento Grid 2026 Redesign Polish */
.panel,
.code-card,
.coop-card,
.spotlight-card {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.code-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateY(-1px);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.timer-card {
  background: rgba(7, 11, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pull-chip {
  background: rgba(7, 11, 20, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Phase C: Unclaimed Queue Stepper, Pity Calculator & Sound Active State */
.icon-btn.is-on {
  border-color: var(--accent-wuwa);
  color: var(--accent-wuwa);
  background: rgba(45, 212, 191, 0.12);
}

.unclaimed-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(12, 74, 110, 0.55) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 11px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.stepper-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.stepper-next-label {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: #e2e8f0;
}

.stepper-btn {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
}

.pity-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.pity-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
}

.pity-input {
  width: 100%;
  background: #070b14;
  color: var(--text);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 16px;
  min-height: 36px;
}

.pity-input:focus {
  outline: none;
  border-color: var(--accent-genshin);
}

.pity-result {
  background: rgba(7, 11, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 0.84rem;
  color: #cbd5e1;
  line-height: 1.45;
}

@media (max-width: 560px) {
  .pity-controls {
    grid-template-columns: 1fr 1fr;
  }
  .pity-controls .pity-field:first-child {
    grid-column: span 2;
  }
}
