/* =========================================================================
   VOLCANO — styles
   ========================================================================= */

:root {
  --bg: #0b0710;
  --panel: rgba(20, 13, 24, 0.72);
  --panel-solid: #140d18;
  --border: rgba(255, 255, 255, 0.12);
  --text: #f7efe8;
  --muted: rgba(247, 239, 232, 0.66);
  --accent: #ff6b3d;
  --accent-2: #ffd166;
  --danger: #ff5c7a;
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#stage { position: fixed; inset: 0; }

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

/* -------------------------------------------------------------- HUD ---- */
#hud {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right))
           12px calc(14px + env(safe-area-inset-left));
  pointer-events: none;
  z-index: 3;
}

.hud-group { display: flex; align-items: center; gap: 10px; }

.stat { display: flex; flex-direction: column; line-height: 1; }
.stat span {
  font-size: clamp(26px, 4.4vw, 40px);
  font-weight: 800;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
}
.stat small {
  font-size: 10px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.stat.tiny span { font-size: clamp(15px, 2.4vw, 20px); font-weight: 700; }
.stat.tiny small { font-size: 9px; }

.lives { display: flex; gap: 4px; font-size: clamp(18px, 2.6vw, 24px); }
.heart { color: var(--danger); text-shadow: 0 0 14px rgba(255, 92, 122, 0.7); transition: opacity .2s; }
.heart.lost { opacity: 0.22; text-shadow: none; }

.icon-btn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  font-size: 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
.icon-btn:active { transform: scale(0.94); }

/* --------------------------------------------------------- overlays ---- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background:
    radial-gradient(120% 80% at 50% 8%, rgba(10, 6, 14, 0.25), rgba(8, 5, 11, 0.78) 70%);
}

.panel {
  position: relative;
  width: min(430px, 100%);
  padding: 24px 26px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.panel.slim { width: min(360px, 100%); padding: 18px 20px; }
.panel.narrow { width: min(340px, 100%); text-align: center; }

h1 {
  margin: 0 0 10px;
  font-size: clamp(40px, 8.6vw, 68px);
  line-height: 0.98;
  letter-spacing: -2px;
  font-weight: 800;
  background: linear-gradient(180deg, #ffe9a8 0%, var(--accent-2) 38%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 24px rgba(255, 107, 61, 0.35));
}

h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -0.5px; }

.tag { margin: 0 0 18px; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.hint { margin: 16px 0 0; font-size: 12.5px; line-height: 1.8; color: rgba(247, 239, 232, 0.58); }
.hint strong { color: rgba(247, 239, 232, 0.9); font-weight: 600; }
.best-line { margin: 10px 0 0; font-size: 13px; color: var(--muted); letter-spacing: 0.4px; }
.best-line strong { color: var(--accent-2); font-size: 16px; }

.badge {
  display: inline-block;
  margin: 0 0 14px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #2b1607;
  background: linear-gradient(180deg, #ffe9a8, var(--accent-2));
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(255, 209, 102, 0.35);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row.column { flex-direction: column; }
.btn {
  flex: 1 1 auto;
  min-width: 140px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #ff8a4c, #e8482a);
  box-shadow: 0 10px 26px rgba(232, 72, 42, 0.4);
}
.btn.primary:hover { box-shadow: 0 12px 30px rgba(232, 72, 42, 0.55); }
.btn.ghost {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border);
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.13); }

.final-stats {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin: 12px 0 20px;
}
.final-stats .stat { align-items: center; }

/* ------------------------------------------------------- customizer ---- */
#preview {
  display: block;
  width: 110px;
  height: 140px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background:
    radial-gradient(90% 60% at 50% 92%, rgba(255, 130, 60, 0.28), rgba(255, 130, 60, 0) 70%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#customizer { display: flex; flex-direction: column; gap: 10px; }

.crow { display: flex; flex-direction: column; gap: 5px; }
.clabel {
  font-size: 9.5px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: rgba(247, 239, 232, 0.5);
}
.copts { display: flex; flex-wrap: wrap; gap: 6px; }

.opt {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.opt:hover { background: rgba(255, 255, 255, 0.14); }
.opt.on {
  color: #2b1607;
  background: linear-gradient(180deg, #ffe9a8, var(--accent-2));
  border-color: transparent;
}

.sw {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.sw:hover { transform: scale(1.08); }
.sw.on {
  border-color: #fff;
  transform: scale(1.12);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18), 0 4px 14px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------- start.ng ---- */
.pchip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 8px 12px 8px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.pchip img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  object-fit: cover;
  flex: 0 0 auto;
}
.pchip .pinfo { min-width: 0; flex: 1 1 auto; }
.pchip b {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pchip span { font-size: 11.5px; color: var(--muted); }
.pnote {
  margin: -8px 0 14px;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  color: rgba(247, 239, 232, 0.5);
}

.btn.mini { padding: 8px 12px; font-size: 12.5px; min-width: 0; border-radius: 999px; }
.btn.wide { width: 100%; margin-top: 12px; }

.msg {
  margin: 0 0 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--accent-2);
}

.slim-title {
  margin: 0 0 10px;
  font-size: 10px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: rgba(247, 239, 232, 0.5);
  font-weight: 600;
}

.board { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); text-align: left; }
.board h3 {
  margin: 0 0 10px;
  font-size: 10px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: rgba(247, 239, 232, 0.5);
  font-weight: 600;
}
.board h3 small { letter-spacing: 1px; opacity: 0.7; text-transform: none; }
.board ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.brow {
  display: grid;
  grid-template-columns: 10px 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
}
.brow.me { background: rgba(255, 209, 102, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.35); }
.bdot { width: 10px; height: 10px; border-radius: 50%; display: block; }
.brank { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.bname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.bval { font-variant-numeric: tabular-nums; color: var(--accent-2); }
.bsub { grid-column: 3 / 5; font-size: 10.5px; color: rgba(247, 239, 232, 0.45); }

.linky {
  margin-top: 10px;
  padding: 0;
  font: inherit;
  font-size: 11px;
  color: rgba(247, 239, 232, 0.5);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}
.linky:hover { color: var(--text); }

/* ------------------------------------------------------------ utils ---- */
.hidden { display: none !important; }

@media (max-width: 820px) {
  .overlay { align-items: flex-start; justify-content: center; padding-top: 4vh; }
  .panel { padding: 18px 18px; }
  h1 { margin-bottom: 6px; }
  .tag { margin-bottom: 14px; font-size: 13.5px; }
  .hint { font-size: 11.5px; }
  #preview { width: 92px; height: 116px; }
}

@media (max-height: 520px) {
  .hint { display: none; }
  #preview { display: none; }
}
