:root {
  --bg: #0a0c10;
  --bg2: #0f1319;
  --panel: #131820;
  --panel2: #18202a;
  --line: #242d39;
  --line2: #2f3a48;
  --text: #e8edf3;
  --muted: #8b97a8;
  --dim: #5d6878;
  --hash: #39ff7a;
  --hash-dim: #1f8f47;
  --hash-bg: rgba(57, 255, 122, 0.08);
  --gold: #f2c230;
  --pink: #ff6fa8;
  --sky: #6cc8ff;
  --red: #ff5a5a;
  --radius: 10px;
  --pixel: "Silkscreen", "JetBrains Mono", monospace;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image:
    linear-gradient(rgba(57, 255, 122, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 122, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--hash); text-decoration: none; }
a:hover { text-decoration: underline; }
img.px { image-rendering: pixelated; image-rendering: crisp-edges; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.hash { color: var(--hash); }
.hidden { display: none !important; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ------------------------------------------------ header */
header.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10, 12, 16, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
header.top .wrap { display: flex; align-items: center; gap: 22px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--pixel); font-size: 18px; letter-spacing: 1px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--line2); }
.brand b { color: var(--hash); font-weight: 400; }
nav.tabs { display: flex; gap: 4px; flex: 1; }
nav.tabs a {
  font-family: var(--pixel); font-size: 13px; color: var(--muted);
  padding: 8px 12px; border-radius: 8px; letter-spacing: 0.5px;
}
nav.tabs a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
nav.tabs a.active { color: var(--hash); background: var(--hash-bg); }
.wallet { display: flex; align-items: center; gap: 8px; }
.netbadge { font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 5px 9px; border-radius: 999px; white-space: nowrap; }
.netbadge.bad { color: var(--red); border-color: rgba(255, 90, 90, 0.5); cursor: pointer; }
.netbadge .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--hash); margin-right: 6px; vertical-align: 1px; }
.netbadge.bad .dot { background: var(--red); }

/* ------------------------------------------------ buttons / inputs */
.btn {
  appearance: none; border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  font-family: var(--pixel); font-size: 13px; letter-spacing: 0.5px;
  padding: 10px 16px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  transition: transform 0.06s ease, background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--dim); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--hash); color: #04130a; border-color: var(--hash); }
.btn.primary:hover { background: #5dff93; }
.btn.danger { background: transparent; color: var(--red); border-color: rgba(255, 90, 90, 0.5); }
.btn.ghost { background: transparent; }
.btn.big { font-size: 18px; padding: 16px 22px; width: 100%; }
input[type=text], input[type=number], select {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: 8px;
  padding: 9px 11px; font-family: var(--mono); font-size: 13px; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--hash-dim); }
label.field { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
label.field span { display: block; margin-bottom: 5px; }

/* ------------------------------------------------ layout blocks */
main { padding: 28px 0 80px; }
section.page { display: none; }
section.page.active { display: block; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel h3 { margin: 0 0 14px; font-family: var(--pixel); font-weight: 400; font-size: 14px; letter-spacing: 1px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 18px; }
.banner { border: 1px solid rgba(242, 194, 48, 0.4); background: rgba(242, 194, 48, 0.08); color: #f7d774; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; }
.banner.err { border-color: rgba(255, 90, 90, 0.45); background: rgba(255, 90, 90, 0.08); color: #ff9a9a; }

/* ------------------------------------------------ hero */
.hero { display: flex; gap: 28px; align-items: center; margin-bottom: 24px; }
.hero h1 { font-family: var(--pixel); font-weight: 400; font-size: clamp(28px, 4.6vw, 48px); line-height: 1.05; margin: 0 0 10px; letter-spacing: 1px; }
.hero h1 em { font-style: normal; color: var(--hash); }
.hero p { margin: 0; color: var(--muted); max-width: 620px; }
.hero .strip { display: flex; gap: 6px; margin-left: auto; }
.hero .strip img { width: 72px; height: 72px; border-radius: 8px; border: 1px solid var(--line2); }

/* ------------------------------------------------ stats */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.stat .v { font-family: var(--mono); font-size: 20px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s { font-size: 12px; color: var(--dim); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 5px; background: var(--bg2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--hash); transition: width 0.6s; }

/* ------------------------------------------------ rig */
.rig .devices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.device { border: 1px solid var(--line2); border-radius: 9px; padding: 12px; background: var(--bg2); cursor: pointer; position: relative; }
.device.on { border-color: var(--hash-dim); background: var(--hash-bg); }
.device.off-na { opacity: 0.5; cursor: not-allowed; }
.device .t { font-family: var(--pixel); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.device .t .sw { margin-left: auto; width: 34px; height: 18px; border-radius: 9px; background: var(--line2); position: relative; transition: background 0.15s; }
.device .t .sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: left 0.15s, background 0.15s; }
.device.on .t .sw { background: var(--hash-dim); }
.device.on .t .sw::after { left: 18px; background: var(--hash); }
.device .d { font-size: 12px; color: var(--muted); margin-top: 6px; font-family: var(--mono); min-height: 18px; }
.device input[type=range] { width: 100%; accent-color: var(--hash); margin-top: 6px; }
.readouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.readout { background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.readout .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.readout .v { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.readout .v small { font-size: 12px; color: var(--muted); font-weight: 400; }
.kv { font-family: var(--mono); font-size: 12px; color: var(--muted); display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 4px 10px; margin-top: 12px; }
.kv b { color: var(--text); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-top: 12px; cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--hash); width: 16px; height: 16px; }
#mineBtn.running { background: transparent; color: var(--hash); border-color: var(--hash); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(57, 255, 122, 0.35); } 50% { box-shadow: 0 0 0 8px rgba(57, 255, 122, 0); } }

.found { margin-top: 14px; border: 1px solid var(--hash); background: var(--hash-bg); border-radius: 9px; padding: 14px; }
.found .title { font-family: var(--pixel); color: var(--hash); font-size: 16px; }
.found .mono { font-size: 12px; word-break: break-all; color: var(--muted); margin: 6px 0 10px; }

/* terminal */
.term { background: #06080b; border: 1px solid var(--line); border-radius: 9px; height: 300px; overflow-y: auto; padding: 10px 12px; font-family: var(--mono); font-size: 12px; line-height: 1.65; }
.term div { white-space: pre-wrap; word-break: break-word; }
.term .t { color: var(--dim); }
.term .ok { color: var(--hash); }
.term .warn { color: var(--gold); }
.term .err { color: var(--red); }
.term .info { color: var(--sky); }

.feed { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 330px; overflow-y: auto; }
.feed .row { display: flex; align-items: center; gap: 10px; font-size: 13px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.feed .row img { width: 40px; height: 40px; border-radius: 5px; }
.feed .row .m { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.feed .empty { color: var(--dim); font-size: 13px; padding: 10px 0; }

/* ------------------------------------------------ collection */
.filters { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.sidebar { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.sidebar .panel { padding: 14px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .count { font-family: var(--mono); color: var(--muted); font-size: 13px; margin-right: auto; }
.toolbar select, .toolbar input { width: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.card:hover { transform: translateY(-2px); border-color: var(--line2); }
.card img { width: 100%; aspect-ratio: 1; display: block; background: var(--bg2); }
.card .meta { padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 12px; }
.card .meta b { font-weight: 600; }
.card .st { font-size: 10px; padding: 2px 6px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); }
.card .st.minted { color: var(--hash); border-color: var(--hash-dim); }
.card .st.mine { color: #04130a; background: var(--hash); border-color: var(--hash); }
.sentinel { height: 40px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state img { width: 96px; height: 96px; border-radius: 10px; margin-bottom: 12px; opacity: 0.9; }

/* ------------------------------------------------ modal */
.modal { position: fixed; inset: 0; background: rgba(4, 6, 9, 0.8); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal .box { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; max-width: 880px; width: 100%; max-height: calc(100vh - 40px); overflow-y: auto; position: relative; }
.modal .close { position: absolute; right: 12px; top: 10px; background: none; border: 0; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; padding: 22px; }
.detail img { width: 100%; border-radius: 10px; border: 1px solid var(--line2); }
.detail h2 { font-family: var(--pixel); font-weight: 400; margin: 0 0 4px; font-size: 26px; }
.traits { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.trait { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.trait .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; }
.trait .v { font-size: 13px; font-weight: 600; }
.trait .p { font-size: 11px; color: var(--dim); font-family: var(--mono); }
.reveal { text-align: center; padding: 28px; }
.reveal img { width: 280px; max-width: 80%; border-radius: 12px; border: 2px solid var(--hash); box-shadow: 0 0 60px rgba(57, 255, 122, 0.25); }
.reveal h2 { font-family: var(--pixel); font-weight: 400; color: var(--hash); font-size: 28px; margin: 16px 0 4px; }
.picker { padding: 22px; }
.picker button { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 8px; font-family: var(--sans); font-size: 15px; text-align: left; }
.picker img { width: 28px; height: 28px; }

/* ------------------------------------------------ about */
.prose { max-width: 820px; }
.prose h2 { font-family: var(--pixel); font-weight: 400; font-size: 22px; margin: 28px 0 10px; }
.prose p, .prose li { color: #c7d0dc; }
table.epochs { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13px; margin: 10px 0 20px; }
table.epochs th, table.epochs td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
table.epochs th { color: var(--muted); font-weight: 400; font-size: 12px; }
table.epochs tr.cur td { color: var(--hash); }
code { font-family: var(--mono); font-size: 0.92em; background: var(--bg2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }

footer { border-top: 1px solid var(--line); color: var(--dim); font-size: 13px; padding: 22px 0; }
footer .wrap { display: flex; gap: 18px; flex-wrap: wrap; }

/* ------------------------------------------------ responsive */
@media (max-width: 1020px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .hero .strip { display: none; }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; }
  .sidebar .panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0 12px; }
}
@media (max-width: 720px) {
  header.top .wrap { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  nav.tabs { order: 3; flex: 1 1 100%; overflow-x: auto; align-items: center; }
  nav.tabs a { padding: 6px 10px; font-size: 12px; }
  .wallet { margin-left: auto; }
  .wrap { padding: 0 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .v { font-size: 17px; }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .cards { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .netbadge { display: none; }
}
