@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Space+Grotesk:wght@500;600&display=swap');

:root {
  --bg: #0c1210;
  --panel: #141c18;
  --panel-2: #1b2621;
  --line: #2c3b34;
  --text: #e6ece4;
  --muted: #8b9c90;
  --lime: #c6db8c;
  --ink: #172117;
  --amber: #d7b56a;
  --danger: #d7b56a;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 'DM Sans', sans-serif;
}
h1, h2, h3, .brand { font-family: 'Space Grotesk', sans-serif; font-weight: 500; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
  padding: 0 20px;
  background: rgba(12, 18, 16, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  padding-right: 250px;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; letter-spacing: .08em; }
.brand-mark { color: var(--lime); font-size: 20px; }
.nav-caption, .sidebar-bottom p { display: none; }
nav { display: flex; gap: 4px; min-width: 0; }
.nav {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.nav > span { color: var(--lime); font-size: 14px; }
.nav.active { background: var(--panel-2); color: var(--text); }
.nav small {
  margin-left: 4px;
  min-width: 18px;
  text-align: center;
  font-size: 11px;
  color: var(--ink);
  background: var(--lime);
  border-radius: 99px;
  padding: 0 6px;
}
.sidebar-bottom { margin-left: auto; display: flex; align-items: center; }
.chain-label, .version {
  font-size: 12px;
  color: var(--muted);
}
.chain-label { display: flex; align-items: center; gap: 8px; }
.chain-label i, .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  display: inline-block;
}
.version { display: none; }

.app { margin: 0; }
header {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 40;
  height: auto;
  border: 0;
  padding: 0;
  display: flex;
}
.breadcrumb { display: none; }
.header-tools { display: flex; align-items: center; gap: 10px; }
.mode-label { font-size: 11px; letter-spacing: .08em; color: var(--amber); }
.wallet, .outline, .primary, .text-button {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
}
.wallet { background: var(--lime); color: var(--ink); border-color: var(--lime); font-weight: 600; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.primary { background: var(--lime); color: var(--ink); border-color: var(--lime); font-weight: 600; }
.outline { background: transparent; }
.text-button { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 0; }
.full { width: 100%; }

main { width: min(1180px, calc(100% - 32px)); margin: 24px auto 0; padding-bottom: 32px; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 16px; }
.heading p, .guide-grid p, .party-hero p, .item-card p { color: var(--muted); }
h1 { font-size: 28px; letter-spacing: 0; }
h2 { font-size: 20px; }
.eyebrow { display: block; margin-bottom: 6px; font-size: 11px; letter-spacing: .12em; color: var(--muted); }
.service-notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #6a5a32;
  background: #2a2416;
  color: var(--text);
  border-radius: 8px;
}

.explore-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 16px; align-items: start; }
.world-card, .panel, .stat-grid, .item-card, .info-banner {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.world-card { overflow: hidden; }
.world-top, .world-footer, .world-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
}
.world-top { background: #101815; }
#stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #10211c;
  overflow: hidden;
}
#stage canvas, #fallback-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#stage canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
#fallback-art { background: url('/assets/quarry-background.png') center/cover; }
.fallback-hero {
  position: absolute;
  height: 62%;
  width: auto;
  left: 22%;
  bottom: 8%;
  object-fit: contain;
  image-rendering: pixelated;
}
.world-copy { display: none !important; }
.combat-label {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 8px 10px;
  background: rgba(12, 18, 16, .8);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: 'Space Grotesk', sans-serif;
}
.wave-path { display: flex; gap: 4px; padding: 12px 14px 4px; }
.wave-node { flex: 1; height: 6px; border-radius: 99px; background: #2a3830; }
.wave-node.done { background: var(--lime); }
.wave-node.boss { background: #5c5140; }
.wave-node.boss.done { background: var(--amber); }
.wave-node.current { box-shadow: 0 0 0 2px var(--text); }
.checkpoint-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); display: inline-block; margin-right: 6px; }

.expedition-panel { padding: 16px; }
.panel-overline { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; letter-spacing: .08em; margin-bottom: 8px; }
.status { font-size: 11px; color: var(--text); background: var(--panel-2); border-radius: 99px; padding: 3px 8px; }
.expedition-panel h2 { margin-bottom: 4px; }
.explorer-summary { display: flex; align-items: center; gap: 10px; margin: 14px 0; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.avatar { width: 42px; height: 42px; border-radius: 6px; overflow: hidden; background: #101815; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.explorer-summary b { display: block; font-size: 13px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer-summary span { display: block; color: var(--muted); font-size: 12px; }
.human-tag { margin-left: auto; font-size: 11px; letter-spacing: .08em; color: var(--amber); }
.energy-heading { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 12px; }
.energy-heading b { color: var(--text); font-size: 22px; }
.energy-heading small { color: var(--muted); font-size: 13px; }
.energy-bars { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 8px; }
.energy-bars i { height: 8px; border-radius: 99px; background: #2a3830; }
.energy-bars i.filled { background: var(--lime); }
.energy-note, .simulation-note, .fee-note { color: var(--muted); font-size: 12px; margin: 8px 0 14px; }
.input-label, .market-form label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 12px; }
select, input[type=text] {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #101815;
  color: var(--text);
}
.check-label { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: var(--muted); font-size: 13px; }
.playback-controls { display: flex; justify-content: space-between; margin-top: 8px; }
#mint, #run { margin-top: 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 16px; overflow: hidden; }
.stat-grid article { padding: 16px; border-right: 1px solid var(--line); }
.stat-grid article:last-child { border-right: 0; }
.stat-grid article > span, .stat-grid article > small { display: block; color: var(--muted); font-size: 12px; }
.stat-grid b { display: block; margin: 6px 0; font-size: 26px; font-weight: 500; }
.stat-grid b small { font-size: 14px; color: var(--muted); }
.xp-track { height: 4px; background: #2a3830; border-radius: 99px; margin: 8px 0; }
.xp-track i { display: block; height: 100%; width: 0; background: var(--lime); border-radius: inherit; }

.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 22px 0 12px; }
.activity { min-height: 88px; }
.empty-state { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--text); margin-bottom: 4px; }
.activity-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.activity-row:last-child { border: 0; }
.activity-symbol { color: var(--lime); }
.activity-row p { color: var(--muted); font-size: 12px; }
.activity-gain { margin-left: auto; color: var(--lime); white-space: nowrap; }

.quiet-tag { font-size: 12px; color: var(--amber); border: 1px solid #5c5140; border-radius: 99px; padding: 6px 10px; }
.loadout { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px; }
.loadout-preview { display: grid; justify-items: center; gap: 8px; }
.loadout-avatar { width: 160px; height: 210px; border: 1px solid var(--line); border-radius: 8px; background: #101815; overflow: hidden; }
.loadout-avatar .human-paperdoll, .loadout-avatar svg { width: 100%; height: 100%; display: block; }
.loadout-caption { font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.loadout-description { color: var(--muted); margin-top: 6px; }
.loadout-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.loadout-slot { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #101815; }
.loadout-slot span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.loadout-slot b { display: block; margin-top: 6px; font-size: 13px; }
.combat-stats { display: grid; gap: 8px; min-width: 110px; font-size: 12px; }
.combat-stats span { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); }
.combat-stats b { color: var(--text); font-size: 16px; }

.item-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.item-card { padding: 14px; overflow: hidden; }
.item-overline { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.item-overline span:last-child { color: var(--tier, var(--lime)); }
.item-art {
  height: 160px;
  margin: 8px 0;
  display: grid;
  place-items: center;
  background: #101815;
  border-radius: 8px;
}
.item-art img { width: 128px; height: 128px; object-fit: contain; image-rendering: pixelated; }
.item-card h3 { font-size: 18px; }
.item-card p { min-height: 36px; font-size: 13px; margin-top: 6px; }
.item-meta { display: flex; gap: 6px; margin-top: 10px; }
.item-meta span { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }
.item-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.item-bottom b { color: var(--lime); }
.item-bottom small { display: block; color: var(--muted); font-size: 11px; }
.info-banner { display: flex; gap: 12px; padding: 14px; margin-top: 16px; }
.info-banner > span { color: var(--lime); }
.market-form { display: flex; align-items: end; gap: 12px; padding: 14px; margin-bottom: 12px; }
.market-form label { flex: 1; margin: 0; }
.market-form button { height: 40px; }
.party-hero { padding: 32px 20px; text-align: center; }
.party-symbol { font-size: 28px; color: var(--lime); }
.party-hero h2 { margin: 8px 0; }
.party-hero p { max-width: 560px; margin: 0 auto; }
.party-actions { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.party-actions input { width: 140px; }
.party-member { padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--lime); }
#party-state { margin-top: 16px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.guide-grid article { padding: 16px; }
.step { display: block; margin-bottom: 10px; color: var(--lime); font-family: 'Space Grotesk', sans-serif; }
.guide-grid h2 { font-size: 18px; margin-bottom: 8px; }
footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 50;
  display: none;
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--lime);
  color: var(--ink);
}
dialog {
  width: min(520px, calc(100% - 32px));
  margin: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
}
dialog::backdrop { background: rgba(6, 10, 8, .78); }
dialog h2 { font-size: 26px; margin: 8px 0 12px; }
dialog p { color: var(--muted); }
.dialog-close { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; color: var(--muted); font-size: 22px; }
.result-loot { display: grid; gap: 8px; margin: 12px 0 16px; }
.loot-row { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #101815; }
.loot-row span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
#wallet-dialog { width: min(560px, calc(100% - 32px)); }
#wallet-qr { display: grid; justify-items: center; gap: 8px; }
#wallet-qr-image { width: 220px; height: 220px; background: white; border-radius: 8px; }
.pairing-code { font: 28px/1 ui-monospace, monospace; letter-spacing: .2em; color: var(--lime); }
#wallet-link { display: block; text-align: center; margin: 12px 0; }
#wallet-preview { max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; margin: 12px 0; border-radius: 8px; background: #101815; border: 1px solid var(--line); font: 11px/1.5 ui-monospace, monospace; color: var(--text); }

@media (max-width: 980px) {
  .sidebar { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  header { position: static; padding: 0 16px 8px; background: var(--bg); }
  .header-tools { width: 100%; }
  .wallet { margin-left: auto; }
  main { width: min(100% - 24px, 1180px); }
  .explore-layout, .stat-grid, .guide-grid, .loadout { grid-template-columns: 1fr 1fr; }
  .explore-layout { grid-template-columns: 1fr; }
  .loadout { grid-template-columns: 140px 1fr; }
  .combat-stats { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); }
  .item-grid { grid-template-columns: 1fr 1fr; }
  .market-form, .party-actions { flex-wrap: wrap; }
}
@media (max-width: 680px) {
  .nav { font-size: 12px; padding: 8px; }
  .stat-grid, .guide-grid, .item-grid, .loadout, .loadout-slots { grid-template-columns: 1fr; }
  .stat-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  .heading { align-items: start; flex-direction: column; }
  .combat-stats { grid-template-columns: 1fr 1fr; }
  footer span:nth-child(2) { display: none; }
}
