:root {
  --bg: #0f1115;
  --panel: #181b22;
  --border: #2a2f3a;
  --text: #e6e8ec;
  --dim: #9aa0aa;
  --accent: #7c5cff;
  --accent-2: #ff6bcb;
}

* { box-sizing: border-box; }

body.game-page {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.game-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.game-bar h1 { margin: 0; font-size: 1.25rem; font-weight: 700; }

.back {
  color: var(--dim);
  font-size: 0.9rem;
  text-decoration: none;
}
.back:hover { color: var(--accent); }

.score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
}

.score .best {
  margin-left: 0.85rem;
  color: var(--dim);
  font-weight: 500;
}

.game-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1.5rem;
}

#board {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 420px);
  max-height: calc(100vh - 8rem);
  touch-action: manipulation;
}

.overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(15, 17, 21, 0.88);
  backdrop-filter: blur(4px);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  width: min(100%, 420px);
  max-height: calc(100vh - 8rem);
}

.overlay h2 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.overlay p { color: var(--dim); margin: 0.25rem 0; }
.overlay .hint { font-size: 0.8rem; margin-top: 1rem; }

#start-btn {
  margin-top: 1rem;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
#start-btn:hover { background: #9479ff; }

.overlay.hidden { display: none; }

/* --- shop --------------------------------------------------------------- */

.shields {
  margin-left: 0.6rem;
  color: var(--accent-2);
  letter-spacing: 0.1em;
}

.overlay__actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1rem;
}

.overlay__actions #start-btn { margin-top: 0; }

.earned {
  margin: 0.4rem 0 0;
  color: var(--accent-2) !important;
  font-weight: 600;
}

.btn-ghost {
  padding: 0.75rem 1.4rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.shop {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  background: rgba(15, 17, 21, 0.96);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(100%, 420px);
  max-height: calc(100vh - 8rem);
  overflow: hidden;
}

.shop[hidden] { display: none; }

.shop__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.shop__title {
  margin: 0;
  font-size: 1.1rem;
  flex: 1;
}

.shop__wallet {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent-2);
  font-size: 0.9rem;
}

.shop__close {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}
.shop__close:hover { color: var(--text); }

.shop__body {
  overflow-y: auto;
  padding: 0.5rem 1rem 1rem;
}

.shop__section {
  margin: 0.9rem 0 0.5rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
}

.shop__list { display: flex; flex-direction: column; gap: 0.4rem; }

.item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.7rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.item--active { border-color: var(--accent); }

.item__swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: none;
}

.item__main { flex: 1; min-width: 0; }

.item__name {
  font-size: 0.9rem;
  font-weight: 600;
}

.item__desc {
  font-size: 0.75rem;
  color: var(--dim);
  margin-top: 0.1rem;
}

.item__buy {
  flex: none;
  padding: 0.4rem 0.7rem;
  min-width: 74px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.item__buy:hover:not(:disabled) { background: #9479ff; }
.item__buy:disabled { background: #2a2f3a; color: var(--dim); cursor: default; }

.item__buy--owned {
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--border);
}

.hint--block {
  display: block;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--dim);
  text-align: center;
}
