/* Blockhaven — one stylesheet, one set of tokens, every page. */

:root {
  --bg:        #0e1118;
  --bg-2:      #141926;
  --panel:     #1a2130;
  --panel-2:   #202839;
  --line:      #2b3447;
  --ink:       #e9edf5;
  --ink-dim:   #9aa6b8;
  --ink-faint: #68748a;
  --accent:    #ffb23d;
  --accent-2:  #ff8a3d;
  --coin:      #e0a24f;
  --gem:       #58c8ff;
  --good:      #4fc47a;
  --bad:       #e85c5c;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 6px 22px rgba(0, 0, 0, 0.35);
  --font:      'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-head: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(1100px 500px at 15% -10%, rgba(255, 178, 61, 0.09), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(88, 200, 255, 0.07), transparent 60%);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-head); margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 30px; letter-spacing: -0.01em; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }

/* ----------------------------------------------------------------- nav */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; height: 58px;
  background: rgba(14, 17, 24, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-head); font-size: 19px; font-weight: 700;
  color: var(--ink); text-decoration: none; letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 24px; height: 24px; border-radius: 5px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
  position: relative;
}
.brand .mark::after {
  content: ''; position: absolute; inset: 6px 6px auto 6px; height: 4px;
  border-radius: 2px; background: rgba(255, 255, 255, 0.7);
}

.navlinks { display: flex; gap: 4px; flex: 1; }
.navlinks a {
  color: var(--ink-dim); padding: 7px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
}
.navlinks a:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.navlinks a.on { color: var(--accent); background: rgba(255, 178, 61, 0.1); }

.wallet { display: flex; gap: 8px; align-items: center; }
.coin {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 99px;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.coin .dot { width: 10px; height: 10px; border-radius: 3px; }
.coin.coins .dot { background: var(--coin); }
.coin.gems .dot { background: var(--gem); border-radius: 50%; }

.whoami { display: flex; align-items: center; gap: 10px; }
.whoami .name { font-weight: 700; font-size: 14px; }

/* --------------------------------------------------------------- layout */
.page { max-width: 1180px; margin: 0 auto; padding: 26px 20px 70px; }
.row { display: flex; gap: 20px; flex-wrap: wrap; }
.spacer { flex: 1; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.panel.tight { padding: 12px; }

.section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 26px 0 12px;
}
.section-head h2 { margin: 0; }
.section-head .hint { color: var(--ink-faint); font-size: 13px; }

/* --------------------------------------------------------------- buttons */
.btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 700;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  padding: 9px 16px; border-radius: var(--radius-sm);
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: #28324a; border-color: #3a4761; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(170deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #241703;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { border-color: #5c2a2a; color: #ffb3b3; }

/* ---------------------------------------------------------------- forms */
label.field { display: block; margin-bottom: 13px; }
label.field span { display: block; font-size: 13px; color: var(--ink-dim); margin-bottom: 5px; font-weight: 600; }
input[type=text], input[type=password], input[type=email], textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 11px;
}
input:focus, textarea:focus { outline: 2px solid rgba(255, 178, 61, 0.45); outline-offset: -1px; }

.notice {
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px;
  margin-bottom: 12px; display: none;
}
.notice.show { display: block; }
.notice.err { background: rgba(232, 92, 92, 0.12); border: 1px solid #6b2b2b; color: #ffbcbc; }
.notice.ok  { background: rgba(79, 196, 122, 0.12); border: 1px solid #2b6b45; color: #bdf0d0; }

/* ------------------------------------------------------------- 3d stages */
.stage {
  background:
    radial-gradient(60% 60% at 50% 12%, rgba(255, 255, 255, 0.07), transparent 70%),
    linear-gradient(180deg, #1b2434, #121723);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.stage::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 36%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.3));
  pointer-events: none;
}
.stage .hint {
  position: absolute; left: 12px; bottom: 10px; z-index: 2;
  font-size: 12px; color: var(--ink-faint);
}

/* ------------------------------------------------------------ item cards */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .09s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: #3d4a64; }
.card .thumb {
  aspect-ratio: 1; background: linear-gradient(180deg, #1e2737, #151b27);
  display: grid; place-items: center; position: relative;
}
.card .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card .meta { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card .name { font-weight: 700; font-size: 14px; line-height: 1.25; }
.card .tags { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.card .price { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.card .price .dot { width: 9px; height: 9px; border-radius: 2px; background: var(--coin); }
.card .price.gems .dot { background: var(--gem); border-radius: 50%; }
.card .actions { margin-top: auto; display: flex; gap: 6px; }
.card .actions .btn { flex: 1; }

.pill {
  display: inline-block; padding: 2px 7px; border-radius: 99px;
  font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  border: 1px solid currentColor;
}
.rarity-strip { height: 3px; width: 100%; }

.owned-flag {
  position: absolute; top: 8px; right: 8px;
  background: rgba(79, 196, 122, 0.9); color: #06220f;
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 99px; text-transform: uppercase;
}

/* ------------------------------------------------------------ editor bits */
.slot-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.slot-tabs button {
  appearance: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700;
  background: var(--panel-2); color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 99px; padding: 6px 13px;
}
.slot-tabs button.on { background: rgba(255, 178, 61, 0.14); color: var(--accent); border-color: rgba(255, 178, 61, 0.4); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 2px solid transparent; cursor: pointer; padding: 0;
}
.swatch.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 178, 61, 0.25); }

.wear-list { display: grid; gap: 8px; }
.wear-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.wear-row .slot { color: var(--ink-faint); font-size: 12px; font-weight: 700; text-transform: uppercase; width: 72px; flex: none; }
.wear-row .val { font-weight: 600; font-size: 14px; }

/* ------------------------------------------------------------ home page */
.hero {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px;
  align-items: center; margin-bottom: 10px;
}
.hero .blurb { font-size: 16px; color: var(--ink-dim); max-width: 46ch; }
.hero .cta { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero .stage { height: 420px; }

.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tile h3 { margin-bottom: 4px; }
.tile p { margin: 0; color: var(--ink-dim); font-size: 14px; }

.player-strip { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.player-chip {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; text-align: center;
}
.player-chip img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.player-chip .n { font-weight: 700; font-size: 13px; margin-top: 4px; word-break: break-all; }

.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); font-size: 13px; }
.center { text-align: center; }

/* ------------------------------------------------------------ responsive */
/* Below this width the brand, wallet and account name fill the bar and push the
   nav off-screen, so the links move to a second row of their own. */
@media (max-width: 640px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px 0; row-gap: 4px; }
  .brand { font-size: 17px; }
  .navlinks {
    order: 3; width: 100%; flex: 1 0 100%;
    overflow-x: auto; padding-bottom: 6px;
  }
  .navlinks a { padding: 6px 10px; }
  .coin { padding: 4px 9px; font-size: 12px; }
  .whoami .name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero .stage { height: 320px; }
  .navlinks { overflow-x: auto; }
  .topbar { gap: 10px; padding: 0 12px; }
  .page { padding: 18px 14px 60px; }
}
