:root {
  --bg: #0f1115;
  --panel: #16181d;
  --line: #262b33;
  --text: #e8e8e8;
  --dim: #9aa0a6;
  --accent: #3ec46d;
  --gold: #f0b429;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: radial-gradient(1200px 600px at 50% -10%, #1a1e26 0%, var(--bg) 60%);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

#wrap {
  width: min(940px, 96vw);
}

#topbar, #footbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 6px;
  color: var(--dim);
  font-size: 13px;
}

.brand {
  font-weight: bold;
  letter-spacing: 2px;
  color: var(--text);
  font-size: 15px;
}

.brand span { color: var(--gold); }

#muteBtn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  width: 38px;
  height: 30px;
  cursor: pointer;
  font-size: 15px;
}
#muteBtn:hover { border-color: var(--accent); }

#stage {
  position: relative;
  background: #f7f7f7;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 0 0 1px var(--line);
  user-select: none;
  -webkit-user-select: none;
}

#game {
  display: block;
  width: 100%;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  background: rgba(13, 15, 19, .78);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  transition: opacity .25s ease;
  z-index: 10;
}

.overlay.hidden { opacity: 0; pointer-events: none; }
.off { display: none !important; }

.title {
  margin: 0;
  font-size: 46px;
  letter-spacing: 8px;
  color: var(--text);
}
.title span { color: var(--gold); }

.go-title {
  margin: 0;
  font-size: 30px;
  letter-spacing: 6px;
}

.subtitle {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 2px;
}

.btn {
  font-family: inherit;
  cursor: pointer;
  border: none;
  letter-spacing: 1px;
}
.btn.big {
  background: var(--accent);
  color: #08110b;
  font-weight: bold;
  font-size: 16px;
  padding: 14px 28px;
  border-radius: 12px;
  transition: transform .08s ease, filter .12s ease;
}
.btn.big:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn.big:active { transform: scale(.97); }

.help {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--dim);
  font-size: 12.5px;
}

kbd {
  background: #22262e;
  border: 1px solid #333a45;
  border-bottom-width: 3px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text);
}

#skinPicker {
  display: flex;
  align-items: center;
  gap: 14px;
}

.arrow {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  font-size: 14px;
}
.arrow:hover { border-color: var(--accent); color: var(--accent); }

#skinCard {
  min-width: 170px;
  padding: 10px 18px 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .15s ease;
}
#skinCard:hover { border-color: var(--accent); }
#skinPreview { display: block; margin: 0 auto; }
#skinName { font-weight: bold; letter-spacing: 2px; margin-top: 4px; }
#skinStatus { color: var(--gold); font-size: 12px; margin-top: 4px; min-height: 15px; }

#menuStats {
  margin: 0;
  color: var(--dim);
  letter-spacing: 2px;
  font-size: 13px;
}

.stats-row {
  display: flex;
  gap: 40px;
}
.stats-row > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stats-row span {
  font-size: 38px;
  font-weight: bold;
}
.stats-row div:first-child span { color: var(--accent); }
.stats-row div:last-child span { color: var(--gold); }
.stats-row label {
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 3px;
}

#newBest {
  color: var(--gold);
  font-weight: bold;
  letter-spacing: 3px;
  animation: pulse 1s infinite alternate;
}
@keyframes pulse {
  from { transform: scale(1); opacity: .75; }
  to   { transform: scale(1.12); opacity: 1; }
}

#toasts {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 30;
}

.toast {
  background: rgba(20, 24, 30, .95);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  letter-spacing: .5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: toastIn 3.1s forwards;
}
@keyframes toastIn {
  0%   { transform: translateY(-14px); opacity: 0; }
  8%, 82% { transform: translateY(0); opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 640px) {
  .controls-hint { display: none; }
  .title { font-size: 32px; letter-spacing: 5px; }
  .stats-row { gap: 22px; }
  .stats-row span { font-size: 28px; }
  .help { font-size: 11px; }
}
