/* Vaultbound — original dark-fantasy identity: deep navy, charcoal, gold. */

:root {
  --bg: #0a0e1a;
  --bg2: #0f1524;
  --panel: #121a2b;
  --panel2: #0d1420;
  --line: #243049;
  --gold: #d9a441;
  --gold2: #ffb02e;
  --text: #e8e4d8;
  --muted: #8b93a5;
  --hp: #c0392b;
  --xp: #4da3ff;
  --ok: #59c98a;
  --r-common: #9aa4b2;
  --r-rare: #4da3ff;
  --r-epic: #b26bff;
  --r-legendary: #ffb02e;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -100px, #16203a 0%, var(--bg) 60%);
  color: var(--text);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  min-height: 100vh;
}

a { color: var(--gold); }

h1, h2, h3 { font-weight: 700; letter-spacing: 0.02em; }
h1 { font-size: 1.9rem; margin: 0 0 8px; color: var(--gold); text-shadow: 0 2px 18px rgba(217, 164, 65, 0.25); }
h2 { font-size: 1.25rem; margin: 0 0 12px; color: var(--gold); }
h3 { font-size: 1rem; margin: 0 0 6px; }
code { color: var(--gold2); }

/* ---------- shell ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(10, 14, 26, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--gold); text-decoration: none; white-space: nowrap; }
.brand-gem { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--gold), #7a5a1e); box-shadow: 0 0 12px rgba(217, 164, 65, 0.4); }
.topnav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  color: var(--muted); text-decoration: none; padding: 6px 10px;
  border-radius: 8px; white-space: nowrap; font-size: 0.92rem;
}
.topnav a.is-active, .topnav a:hover { color: var(--text); background: var(--panel); }
.chip {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #1a2338, #101828);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 0.85rem; white-space: nowrap;
}
.chip-name { color: var(--gold); }
.chip-lv { color: var(--muted); }
.chip-coin { color: var(--gold2); font-weight: 700; }

main { max-width: 860px; margin: 0 auto; padding: 18px 14px 60px; display: grid; gap: 16px; }

.foot {
  border-top: 1px solid var(--line); color: var(--muted);
  text-align: center; padding: 18px 14px 26px; font-size: 0.85rem;
}

/* ---------- panels ---------- */

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.center { text-align: center; }
.muted { color: var(--muted); }
.mini { font-size: 0.85rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block; cursor: pointer; text-decoration: none; text-align: center;
  background: #1a2338; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; font-size: 0.95rem; font-weight: 600;
  transition: transform 0.06s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover:not(:disabled) { background: #223052; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #e8b34a, #b07f22);
  border-color: #8a6520; color: #1a1206;
  box-shadow: 0 4px 18px rgba(217, 164, 65, 0.25);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #f4c05d, #c08a28); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 0.85rem; }
.btn-big { padding: 14px 22px; font-size: 1.1rem; }
.btn-block { display: block; width: 100%; margin-top: 10px; }
.btn-skill { background: #2b2440; border-color: #4a3a6e; }
.btn-skill:hover:not(:disabled) { background: #372d54; }

/* ---------- landing ---------- */

.hero-sec { text-align: center; padding: 26px 10px 8px; }
.kicker { color: var(--muted); letter-spacing: 0.22em; text-transform: uppercase; font-size: 0.72rem; margin: 0 0 10px; }
.tagline { color: var(--muted); margin: 0 0 18px; }

.countdown { display: flex; gap: 10px; justify-content: center; margin: 18px 0 10px; flex-wrap: wrap; }
.cd-box {
  min-width: 74px; padding: 10px 8px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
}
.cd-num { font-size: 1.7rem; font-weight: 800; color: var(--gold2); font-variant-numeric: tabular-nums; }
.cd-lbl { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; }
.cd-zero { font-size: 1.4rem; font-weight: 800; color: var(--ok); letter-spacing: 0.2em; }

.hero-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 22px; text-align: left; }
.pick-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.pick-card.is-own { border-color: var(--gold); }
.sprite { width: 64px; height: 64px; display: block; margin: 0 auto 8px; }
.pick-card .sprite { margin: 0 0 8px; }

.chest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.chest-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.chest-card ul { list-style: none; margin: 8px 0 0; padding: 0; }
.chest-card li { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 3px 0; border-bottom: 1px dashed #1c2537; }

.tier-list { padding-left: 18px; }
.tier-list li { margin: 6px 0; }

.faq { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; background: var(--panel2); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--muted); margin: 8px 0 0; }

/* ---------- states ---------- */

.state { text-align: center; padding: 40px 10px; color: var(--muted); }
.state-icon { font-size: 1.6rem; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 12px;
  border: 3px solid var(--line); border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: #1a2338; color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 18px; max-width: min(92vw, 480px);
  opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 50;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--hp); }

/* ---------- hub ---------- */

.hub-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.hub-hero .sprite { width: 72px; height: 72px; margin: 0; }
.lvl-tag { color: var(--gold2); font-size: 0.85em; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 12px 0; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: center; }
.stat span { display: block; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.stat b { font-size: 1.05rem; color: var(--gold2); }
.hub-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-top: 10px; }

.bar { height: 10px; background: #0a0f1c; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--xp); transition: width 0.3s ease; }
.bar-hp .bar-fill { background: linear-gradient(90deg, #e05a4a, var(--hp)); }
.bar-enemy .bar-fill { background: linear-gradient(90deg, #8a3a4a, #a02030); }
.bar-xp .bar-fill { background: var(--xp); }
.bar-num { font-size: 0.8rem; color: var(--muted); margin-top: 3px; }

/* ---------- combat ---------- */

.room-intro .enemy-face .sprite { width: 110px; height: 110px; }
.boss-tag { color: var(--hp); font-size: 0.75em; border: 1px solid var(--hp); border-radius: 6px; padding: 1px 6px; vertical-align: middle; }
.combat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.arena { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; }
.fighter { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.fighter-top { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.fighter-top .sprite { width: 48px; height: 48px; margin: 0; }
.vs { align-self: center; color: var(--gold); font-weight: 800; padding: 0 2px; }
.log {
  height: 150px; overflow-y: auto; margin: 12px 0;
  background: #0a0f1c; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 0.88rem;
}
.log-hero { color: var(--gold2); }
.log-enemy { color: #e07a6a; }
.log-burn { color: #b26bff; }
.log-end { font-weight: 800; color: var(--text); margin-top: 4px; }
.log-grants { margin-top: 6px; }
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.grant { display: inline-block; background: #16203a; border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; margin: 2px; font-size: 0.82rem; }
.grant-hi { border-color: var(--gold); color: var(--gold2); }
.grant-wrap { margin: 10px 0; }
.summary .btn { margin-top: 8px; }

.tutorial-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(6, 9, 18, 0.8); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.tutorial-card { background: var(--panel); border: 1px solid var(--gold); border-radius: 14px; padding: 20px; max-width: 420px; }
.tutorial-step { color: var(--muted); font-size: 0.8rem; margin-left: 10px; }

/* ---------- character ---------- */

.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.slot-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 84px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.inv-card { background: var(--panel2); border: 1px solid var(--line); border-left-width: 3px; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.inv-btns { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.r-common { border-left-color: var(--r-common); }
.r-rare { border-left-color: var(--r-rare); }
.r-epic { border-left-color: var(--r-epic); }
.r-legendary { border-left-color: var(--r-legendary); }
.r-common b, .r-common { color: var(--r-common); }
.r-rare b { color: var(--r-rare); }
.r-epic b { color: var(--r-epic); }
.r-legendary b { color: var(--r-legendary); }
.craft-list { display: grid; gap: 10px; }
.craft-card { display: flex; justify-content: space-between; gap: 10px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }

/* ---------- quests / board ---------- */

.quest-list { display: grid; gap: 10px; }
.quest-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.quest-card.is-claimed { opacity: 0.6; }
.board-head { display: flex; justify-content: space-between; align-items: center; }
.board-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.board-row {
  display: grid; grid-template-columns: 52px 1fr auto auto; gap: 8px; align-items: center;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
.board-row.is-me { border-color: var(--gold); }
.board-row.is-zero { opacity: 0.55; }
.board-row .rank { color: var(--gold2); font-weight: 800; }
.board-row .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .score { color: var(--gold2); }
.board-row .mini { grid-column: 2 / 4; margin-top: -4px; }

/* ---------- forms ---------- */

.field { margin: 12px 0; }
.field > span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="datetime-local"], input[type="number"] {
  background: #0a0f1c; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 0.95rem; width: 100%; max-width: 420px;
}
input:focus { outline: 1px solid var(--gold); }
.depth-row { display: flex; gap: 8px; flex-wrap: wrap; }
.depth-btn.is-on { border-color: var(--gold); color: var(--gold2); }

/* ---------- admin ---------- */

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--muted); font-weight: 600; }
textarea {
  width: 100%; min-height: 130px; background: #0a0f1c; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: 0.85rem/1.5 monospace;
}

/* ---------- responsive ---------- */

@media (max-width: 620px) {
  h1 { font-size: 1.5rem; }
  .cd-box { min-width: 62px; }
  .cd-num { font-size: 1.35rem; }
  .arena { grid-template-columns: 1fr; }
  .vs { padding: 2px 0; text-align: center; }
  .actions { grid-template-columns: 1fr; }
  /* touch targets: the combat and navigation buttons are thumb-first */
  .actions .btn, .room-intro .btn, .center .btn, .hub-links .btn { min-height: 44px; }
  .topbar { flex-wrap: wrap; }
  .topnav { order: 3; width: 100%; }
  .board-row { grid-template-columns: 44px 1fr auto; }
  .board-row .mini { grid-column: 2 / 3; }
}
