:root {
  --ink: #152a4d;
  --paper: #f9fcff;
  --accent: #f3533d;
  --accent-2: #f6b321;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  font-family: "Nunito", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.35), transparent 40%),
    linear-gradient(180deg, #7bd0ff 0%, #8ee39d 58%, #4cb15f 100%);
  cursor: crosshair;
}

.game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0.65rem;
}

.hud {
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  top: 0.7rem;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  pointer-events: none;
}

.hud h1 {
  margin: 0;
  font-family: "Alfa Slab One", serif;
  font-size: clamp(1.1rem, 3.8vw, 2rem);
  color: var(--paper);
  letter-spacing: 0.02em;
  text-shadow: 0 4px 14px rgba(7, 25, 47, 0.35);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.game-logo {
  max-height: 8.5rem;
  max-width: 850px;
  height: auto;
  width: auto;
  vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  background: transparent;
}

.title-beta {
  position: relative;
  top: -0.85em;
  margin-left: 0.22em;
  font-size: 0.28em;
  font-family: "Nunito", sans-serif;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffeeb6;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.chip {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(16, 52, 105, 0.2);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-weight: 900;
  font-size: clamp(0.74rem, 1.6vw, 0.92rem);
  box-shadow: 0 6px 12px rgba(9, 34, 79, 0.16);
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 0 2px rgba(30, 82, 162, 0.15), 0 12px 28px rgba(4, 20, 45, 0.2);
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 0.9rem;
  background: rgba(7, 22, 44, 0.42);
  backdrop-filter: blur(2px);
}

.overlay.hidden {
  display: none;
}

.card {
  width: min(90vw, 520px);
  max-height: min(calc(100vh - 2.4rem), calc(100% - 0.2rem));
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.97), rgba(242, 249, 255, 0.96));
  border: 1px solid rgba(16, 57, 122, 0.2);
  box-shadow: 0 14px 32px rgba(6, 20, 48, 0.28);
  padding: 1.2rem 1.2rem 1.3rem;
  text-align: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.card h2 {
  margin: 0 0 0.6rem;
  font-family: "Alfa Slab One", serif;
  color: #123574;
  letter-spacing: 0.03em;
}

.card p {
  margin: 0 0 1rem;
  font-weight: 800;
  color: #1a3e7f;
}

.auth-box {
  margin: 0 auto 1rem;
  width: min(100%, 360px);
  text-align: left;
  background: rgba(234, 244, 255, 0.9);
  border: 1px solid rgba(16, 57, 122, 0.2);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
}

.auth-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.65rem;
}

.auth-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 900;
  color: #143a7a;
}

.auth-status {
  margin: 0;
  min-height: 2.1rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #355b99;
}

.auth-status[data-state="error"] {
  color: #b24025;
}

.auth-status[data-state="success"] {
  color: #1d7a4c;
}

.auth-fields {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.auth-input {
  width: 100%;
  border: 1px solid rgba(16, 57, 122, 0.28);
  border-radius: 11px;
  padding: 0.52rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  color: #123574;
  background: rgba(255, 255, 255, 0.98);
}

.auth-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.auth-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #2856b8, #4a8bff);
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(28, 70, 168, 0.2);
}

.auth-btn-secondary {
  background: rgba(16, 57, 122, 0.12);
  color: #143a7a;
}

.auth-btn:disabled,
.start-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.08);
  box-shadow: none;
}

.hidden {
  display: none !important;
}

.highscore-box {
  margin: 0 auto 1rem;
  width: min(100%, 320px);
  text-align: left;
  background: rgba(234, 244, 255, 0.86);
  border: 1px solid rgba(16, 57, 122, 0.2);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
}

.highscore-box h3 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 900;
  color: #143a7a;
}

.highscore-box ol {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.84rem;
  font-weight: 800;
  color: #1d3f7a;
  min-height: 6.1rem;
}

.highscore-box li {
  line-height: 1.4;
}

.difficulty {
  margin: 0 0 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.difficulty-label {
  font-weight: 900;
  color: #143a7a;
  font-size: 0.85rem;
}

.difficulty-options {
  display: inline-flex;
  gap: 0.3rem;
  background: rgba(234, 244, 255, 0.86);
  border: 1px solid rgba(16, 57, 122, 0.2);
  border-radius: 999px;
  padding: 0.22rem;
}

.diff-btn {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.82rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  color: #143a7a;
  cursor: pointer;
  transition: background 130ms ease, color 130ms ease;
}

.diff-btn.is-active {
  background: linear-gradient(135deg, #2856b8, #4a8bff);
  color: #fff;
  box-shadow: 0 5px 12px rgba(28, 70, 168, 0.35);
}

.name-box {
  margin: 0 0 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.name-box.hidden {
  display: none;
}

.name-box label {
  font-size: 0.82rem;
  font-weight: 900;
  color: #143a7a;
}

.name-box input {
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(16, 57, 122, 0.3);
  width: min(80%, 240px);
  text-align: center;
  color: #123574;
  background: #fff;
}

.name-box input[readonly] {
  background: rgba(230, 239, 251, 0.9);
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mute-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.85rem;
  background: rgba(16, 57, 122, 0.12);
  color: #143a7a;
  cursor: pointer;
}

.help-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.85rem;
  background: rgba(16, 57, 122, 0.12);
  color: #143a7a;
  cursor: pointer;
}

.help-btn[aria-expanded="true"] {
  background: rgba(40, 86, 184, 0.18);
  color: #123574;
}

.mute-btn[aria-pressed="true"] {
  background: rgba(243, 83, 61, 0.15);
  color: #b24025;
}

.start-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.62rem 1.25rem;
  font-family: "Alfa Slab One", serif;
  font-size: 0.95rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  cursor: pointer;
  box-shadow: 0 9px 18px rgba(184, 73, 34, 0.35);
  transition: transform 140ms ease, filter 140ms ease;
}

.start-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.floating-text {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
}

.float-item {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 8px rgba(8, 19, 39, 0.55);
  animation: riseFade 800ms ease-out forwards;
}

@keyframes riseFade {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.7);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -92%) scale(1.2);
  }
}

/* Combo bar */
.combo-bar-wrap {
  position: absolute;
  top: 4rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(60vw, 420px);
  height: 8px;
  background: rgba(7, 22, 44, 0.35);
  border-radius: 999px;
  overflow: hidden;
  z-index: 18;
  border: 1px solid rgba(255, 255, 255, 0.25);
  opacity: 0;
  transition: opacity 200ms ease;
}

.combo-bar-wrap.is-visible {
  opacity: 1;
}

.combo-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd84a, #ff7a3d, #ff3da6);
  transition: width 80ms linear;
  box-shadow: 0 0 12px rgba(255, 122, 61, 0.7);
}

.combo-bar.tier-3 {
  background: linear-gradient(90deg, #62f0ff, #4aa9ff, #c64aff);
}

.combo-bar.tier-5 {
  background: linear-gradient(90deg, #fff, #ffd84a, #ff3da6, #62f0ff);
}

/* Active effects display */
.effect-bar {
  position: absolute;
  top: 5.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: none;
  max-width: 80vw;
}

.effect-pill {
  background: rgba(7, 22, 44, 0.7);
  color: #fff;
  font-weight: 900;
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  letter-spacing: 0.02em;
}

.effect-pill.buff {
  background: linear-gradient(135deg, #2c8a4a, #4ad06f);
}

.effect-pill.debuff {
  background: linear-gradient(135deg, #8a1f2c, #d04a4a);
}

/* Objective banner */
.objective {
  position: absolute;
  top: 0.7rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 19;
  background: rgba(7, 22, 44, 0.78);
  color: #fff;
  font-weight: 900;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  pointer-events: none;
  text-align: center;
}

.objective[hidden] {
  display: none;
}

.perk-panel {
  position: absolute;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  z-index: 24;
  width: min(92vw, 760px);
  padding: 0.95rem;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(8, 23, 46, 0.94), rgba(14, 47, 90, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 18px 34px rgba(4, 16, 36, 0.35);
}

.perk-panel[hidden] {
  display: none;
}

.perk-kicker {
  margin: 0 0 0.25rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 221, 126, 0.92);
}

.perk-panel h3 {
  margin: 0 0 0.8rem;
  text-align: center;
  color: #fff;
  font-family: "Alfa Slab One", serif;
  font-size: clamp(1rem, 2vw, 1.35rem);
  letter-spacing: 0.02em;
}

.perk-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.perk-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 0.85rem 0.8rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.perk-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 221, 126, 0.48);
  background: linear-gradient(180deg, rgba(255, 221, 126, 0.16), rgba(255, 255, 255, 0.08));
}

.perk-btn strong,
.perk-btn span {
  display: block;
}

.perk-btn strong {
  margin-bottom: 0.28rem;
  font-size: 0.92rem;
}

.perk-btn span {
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(239, 247, 255, 0.88);
}

/* Combo banner */
.combo-banner {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  z-index: 25;
  font-family: "Alfa Slab One", serif;
  font-size: clamp(2rem, 6vw, 4rem);
  color: #fff;
  text-shadow: 0 0 14px rgba(255, 122, 61, 0.9), 0 0 30px rgba(255, 61, 166, 0.7);
  pointer-events: none;
  opacity: 0;
}

.combo-banner.show {
  animation: bannerPop 1100ms ease-out forwards;
}

@keyframes bannerPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -85%) scale(0.95) rotate(0deg); }
}

/* Screen flash for golden / damage */
.screen-flash {
  position: absolute;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  background: transparent;
  transition: background 120ms ease;
}

.screen-flash.gold {
  background: rgba(255, 220, 100, 0.35);
}

.screen-flash.red {
  background: rgba(255, 60, 60, 0.35);
}

/* Blind overlay */
.blind-overlay {
  position: absolute;
  inset: 0;
  z-index: 23;
  pointer-events: none;
  background: radial-gradient(circle at var(--bx, 50%) var(--by, 50%), transparent 70px, rgba(0, 0, 0, 0.92) 220px);
  opacity: 0;
  transition: opacity 200ms ease;
}

.blind-overlay.active {
  opacity: 1;
}

/* Mode + skin selector */
.mode-box,
.skin-box {
  margin: 0 0 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.mode-label,
.skin-label {
  font-weight: 900;
  color: #143a7a;
  font-size: 0.85rem;
}

.mode-options,
.skin-options {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  background: rgba(234, 244, 255, 0.86);
  border: 1px solid rgba(16, 57, 122, 0.2);
  border-radius: 14px;
  padding: 0.25rem;
  justify-content: center;
}

.mode-btn,
.skin-btn {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.78rem;
  padding: 0.32rem 0.7rem;
  border-radius: 10px;
  color: #143a7a;
  cursor: pointer;
  transition: background 130ms ease, color 130ms ease;
}

.mode-btn:disabled,
.diff-btn:disabled,
.skin-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.7);
}

.mode-btn.is-active,
.skin-btn.is-active {
  background: linear-gradient(135deg, #2856b8, #4a8bff);
  color: #fff;
  box-shadow: 0 5px 12px rgba(28, 70, 168, 0.35);
}

.skin-btn.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.mode-details {
  margin: 0 auto 0.9rem;
  width: min(100%, 420px);
  text-align: left;
  background: linear-gradient(180deg, rgba(225, 239, 255, 0.9), rgba(240, 247, 255, 0.92));
  border: 1px solid rgba(16, 57, 122, 0.2);
  border-radius: 14px;
  padding: 0.75rem 0.8rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.help-panel {
  margin: 0 auto 0.9rem;
  width: min(100%, 420px);
  text-align: left;
  background: rgba(255, 250, 238, 0.9);
  border: 1px solid rgba(163, 123, 43, 0.25);
  border-radius: 14px;
  padding: 0.75rem 0.8rem;
}

.help-panel[hidden] {
  display: none;
}

.help-panel h3 {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  font-weight: 900;
  color: #5f3f12;
}

.help-panel h4 {
  margin: 0.5rem 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 900;
  color: #6c4a14;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.help-panel p {
  margin: 0 0 0.45rem;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.4;
  color: #6a4f1f;
}

.help-panel ul {
  margin: 0 0 0.5rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.2rem;
}

.help-panel li {
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.35;
  color: #5a4219;
}

.legend-grid {
  margin: 0 0 0.5rem;
  display: grid;
  gap: 0.3rem;
}

.legend-grid-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(144, 116, 56, 0.2);
  border-radius: 10px;
  padding: 0.3rem 0.45rem;
}

.legend-symbol {
  min-width: 2rem;
  height: 1.5rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.88rem;
  font-weight: 900;
  color: #10244d;
  border: 1px solid rgba(16, 57, 122, 0.24);
  background: #fff;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols2", "Nunito", sans-serif;
}

.legend-symbol.unicorn {
  min-width: 2.3rem;
}

.legend-text {
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.3;
  color: #5a4219;
}

.legend-symbol.u-normal { background: #ffffff; color: #20427d; }
.legend-symbol.u-golden { background: #ffd766; color: #5a3d10; }
.legend-symbol.u-evil { background: #2f323f; color: #ff4c67; }
.legend-symbol.u-shield { background: #c9d6f0; color: #1a3a78; }
.legend-symbol.u-sprint { background: #ffe2a8; color: #7a4a10; }
.legend-symbol.u-feint { background: #d8c0ff; color: #3a1a7a; }
.legend-symbol.u-healer { background: #c0ffd8; color: #10503a; }

.mode-details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.35rem;
}

.mode-details h3 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 900;
  color: #143a7a;
}

.mode-detail-tag {
  flex: none;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #2856b8, #4a8bff);
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
}

.mode-detail-summary,
.mode-detail-footer {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.4;
  color: #20427d;
}

.mode-detail-summary {
  margin-bottom: 0.45rem;
}

.mode-detail-footer {
  margin-top: 0.45rem;
  color: #45608e;
}

.mode-detail-list {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.2rem;
}

.mode-detail-list li {
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
  color: #173a74;
}

/* Achievements */
.achievements-box {
  margin: 0 auto 1rem;
  width: min(100%, 320px);
  text-align: left;
  background: rgba(234, 244, 255, 0.86);
  border: 1px solid rgba(16, 57, 122, 0.2);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
}

.achievements-box h3 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 900;
  color: #143a7a;
}

.achievements-box ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  max-height: 6.5rem;
  overflow: auto;
}

.achievements-box li {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(180, 195, 220, 0.4);
  color: #6a7a99;
}

.achievements-box li.unlocked {
  background: linear-gradient(135deg, #f6b321, #f3533d);
  color: #fff;
}

.meta-box {
  margin: 0 auto 1rem;
  width: min(100%, 320px);
  text-align: left;
  background: rgba(234, 244, 255, 0.86);
  border: 1px solid rgba(16, 57, 122, 0.2);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
}

.meta-box h3 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 900;
  color: #143a7a;
}

.meta-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-info-btn {
  width: 1.05rem;
  height: 1.05rem;
  border: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, #2856b8, #4a8bff);
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(28, 70, 168, 0.25);
}

.meta-info-popup {
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(16, 57, 122, 0.22);
  background: rgba(255, 255, 255, 0.85);
  color: #274882;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.35;
}

.meta-subtitle {
  margin: 0.55rem 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 900;
  color: #20427d;
}

.meta-currency {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: #1c3f79;
}

.meta-shop-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
  max-height: 8rem;
  overflow: auto;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  background: rgba(180, 195, 220, 0.22);
}

.meta-details {
  display: grid;
  gap: 0.15rem;
}

.meta-details strong {
  font-size: 0.74rem;
  color: #173a74;
}

.meta-details span {
  font-size: 0.68rem;
  color: #476193;
  font-weight: 800;
}

.meta-buy-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.62rem;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.7rem;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #2856b8, #4a8bff);
}

.meta-buy-btn:disabled {
  cursor: default;
  color: #6a7a99;
  background: rgba(180, 195, 220, 0.6);
}

.bg-shop-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
  max-height: 9rem;
  overflow: auto;
}

.bg-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 0.4rem;
  align-items: center;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  background: rgba(180, 195, 220, 0.2);
  border: 1px solid transparent;
}

.bg-item.is-selected {
  border-color: rgba(40, 86, 184, 0.45);
  background: rgba(120, 170, 255, 0.16);
}

.bg-swatch {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(16, 57, 122, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.bg-details {
  display: grid;
  gap: 0.12rem;
}

.bg-details strong {
  font-size: 0.73rem;
  color: #173a74;
}

.bg-details span {
  font-size: 0.66rem;
  font-weight: 800;
  color: #476193;
}

.bg-action-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.34rem 0.58rem;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.68rem;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #2856b8, #4a8bff);
}

.bg-action-btn:disabled {
  cursor: default;
  color: #6a7a99;
  background: rgba(180, 195, 220, 0.6);
}

/* Quest box */
.quest-box {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.65rem 0.6rem;
  border-radius: 14px;
  background: rgba(230, 240, 255, 0.55);
  border: 1px solid rgba(40, 86, 184, 0.18);
}

.quest-title {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 900;
  color: #20427d;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.quest-date {
  font-size: 0.68rem;
  font-weight: 700;
  color: #5878a8;
}

.quest-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}

.quest-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.05rem 0.4rem;
  padding: 0.3rem 0.4rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(40, 86, 184, 0.12);
}

.quest-item.quest-done {
  background: rgba(120, 200, 140, 0.25);
  border-color: rgba(60, 160, 80, 0.35);
}

.quest-item.quest-locked {
  opacity: 0.5;
}

.quest-label {
  grid-row: 1;
  grid-column: 1;
  font-size: 0.74rem;
  font-weight: 900;
  color: #173a74;
}

.quest-desc {
  grid-row: 2;
  grid-column: 1;
  font-size: 0.66rem;
  font-weight: 800;
  color: #476193;
}

.quest-reward {
  grid-row: 1 / 3;
  grid-column: 2;
  display: flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 900;
  color: #2856b8;
  white-space: nowrap;
}

.quest-done .quest-reward {
  color: #3c9a50;
}

.hs-scope {
  font-size: 0.72rem;
  font-weight: 700;
  color: #4a6aa0;
}

/* Achievement toast */
.ach-toast {
  position: absolute;
  right: 0.8rem;
  top: 4.5rem;
  z-index: 30;
  background: linear-gradient(135deg, #f6b321, #f3533d);
  color: #fff;
  font-weight: 900;
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(184, 73, 34, 0.4);
  pointer-events: none;
  animation: toastSlide 2400ms ease forwards;
}

@keyframes toastSlide {
  0%   { opacity: 0; transform: translateX(120%); }
  10%  { opacity: 1; transform: translateX(0); }
  85%  { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(120%); }
}

/* Body shake */
body.shake {
  animation: shake 220ms ease;
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-3px, 3px); }
  80% { transform: translate(4px, -2px); }
}

body.shake-strong {
  animation: shake 350ms ease;
}

@keyframes shakeStrong {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-9px, 5px); }
  30% { transform: translate(8px, -7px); }
  45% { transform: translate(-7px, 4px); }
  60% { transform: translate(6px, -5px); }
  75% { transform: translate(-5px, 3px); }
}

body.cursor-hidden {
  cursor: none;
}

@media (max-width: 760px) {
  .perk-choices {
    grid-template-columns: 1fr;
  }

  .game-shell {
    padding: 0.35rem;
  }

  .hud {
    left: 0.45rem;
    right: 0.45rem;
    top: 0.45rem;
    gap: 0.4rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    justify-content: flex-start;
  }

  .overlay {
    padding: 0.45rem;
  }

  .card {
    width: min(96vw, 520px);
    max-height: calc(100vh - 1rem);
    padding: 1rem 0.9rem 1.05rem;
  }

  .mode-details {
    width: 100%;
  }

  .mode-details-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
