/* ZCRATCH app shell. Palette measured from the brand banner: ink #0b0f10, gold #fab228, ember #241b1c, bone #fbf3f5. */
:root {
  --bg: #0b0f10; --panel: #101415; --panel2: #141819; --line: #1d2223; --line2: #2a2f30;
  --text: #fbf3f5; --dim: #a39fa1; --mute: #6c6a6c; --faint: #3c3f40;
  --gold: #fab228; --gold-h: #ffc243; --gold-d: #a8761a; --ember: #241b1c; --ember2: #2e2122;
  --good: #3ddc84; --warn: #fab228; --bad: #ff7b7b;
  --r1: 6px; --r2: 10px; --r3: 14px;
  --mono: 'Geist Mono', ui-monospace, monospace; --sans: 'Geist', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.dim { color: var(--dim); } .mute { color: var(--mute); }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Top bar */
.top { font: 400 14px/1.5 var(--sans); letter-spacing: 0; position: sticky; top: 0; z-index: 20; height: 56px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 16px; background: rgba(11,15,16,.92); backdrop-filter: blur(10px); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; letter-spacing: -.035em; }
.brand img { width: 26px; height: 26px; border-radius: 6px; }
.tabs { display: flex; gap: 4px; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--r1); color: var(--dim); font-weight: 500; transition: color .15s ease-out, background .15s ease-out; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--text); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); }
.tab[aria-current="page"] .ico { color: var(--gold); }
.top-r { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.ca { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-radius: var(--r1); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font-size: 13px; cursor: pointer; transition: box-shadow .15s ease-out; }
.xbtn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r1); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); transition: box-shadow .15s ease-out, color .15s ease-out; }
.xbtn:hover { box-shadow: inset 0 0 0 1px var(--gold-d); color: var(--gold); }
.ca:hover { box-shadow: inset 0 0 0 1px var(--gold-d); }
.ca .ico { color: var(--dim); }
.btn-gold { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 34px; padding: 0 14px; border: 0; border-radius: var(--r1); background: var(--gold); color: #120c02; font: 700 13px/1 var(--sans); letter-spacing: .02em; text-transform: uppercase; cursor: pointer; transition: background .15s ease-out, transform .1s ease-out; }
.btn-gold:hover:not(:disabled) { background: var(--gold-h); }
.btn-gold:active:not(:disabled) { transform: translateY(1px); }
.btn-gold:disabled { background: #5a4216; color: #c9a86a; cursor: not-allowed; }
.btn-gold.big { width: 100%; height: 42px; font-size: 13px; letter-spacing: .06em; }
.btn-gold.stop { background: var(--text); }

/* Layout */
.wrap { max-width: 1256px; margin: 0 auto; padding: 16px 16px 72px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r3); background: var(--panel); }
.card { display: flex; align-items: center; gap: 12px; padding: 16px; min-width: 0; }
.card + .card { border-left: 1px solid var(--line); }
.card .ic { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r2); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); color: var(--gold); flex: none; }
.card .ic .ico { width: 18px; height: 18px; }
.card .lbl { color: var(--dim); font-size: 13px; }
.card .val { font-size: 16px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.card .val small { color: var(--mute); font-size: 11px; font-weight: 500; }
.card .grow { flex: 1; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r1); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; font-size: 12px; white-space: nowrap; }
.sq { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--r1); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); flex: none; transition: background .15s ease-out; }
.sq:hover { background: var(--line); }
.bar { height: 4px; border-radius: 2px; background: var(--line2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--gold); border-radius: 2px; transition: width .25s ease-out; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 40px; margin-top: 16px; align-items: start; }
.strip { position: relative; height: 40px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #2b2410; border-radius: var(--r2); background: linear-gradient(90deg, #15130c, #1a160b 50%, #15130c); color: var(--gold); font: 600 11.5px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; overflow: hidden; }
.strip b { padding: 3px 6px; border-radius: 4px; box-shadow: inset 0 0 0 1px #5a4419; font-weight: 700; }

.board-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; margin-top: 16px; }
.blk { color: var(--dim); font-size: 14px; }
.state { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; height: 24px; padding: 0 8px; border-radius: 4px; background: #2a210c; color: var(--gold); font-size: 13px; font-weight: 500; }
.state::before { content: ''; width: 6px; height: 6px; background: currentColor; }
.state.live { background: #0f2419; color: var(--good); }
.state.live::before { border-radius: 50%; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.pot { text-align: center; }
.pot .big { display: inline-flex; align-items: center; gap: 10px; font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
.pot .big img { width: 28px; height: 28px; border-radius: 50%; }
.pot .sub { color: var(--dim); font-size: 13px; }
.pot .sub b { color: var(--text); font-weight: 600; }
.timer { justify-self: end; width: 56px; height: 62px; display: grid; place-items: center; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--line2); }
.timer > div { width: 54px; height: 60px; display: grid; place-items: center; align-content: center; clip-path: inherit; background: var(--panel2); color: var(--dim); font: 600 12px/1.1 var(--mono); text-align: center; }
.timer b { color: var(--text); font-size: 14px; }

/* Hex board */
.board { position: relative; margin: 12px auto 0; width: 100%; max-width: 860px; aspect-ratio: 860 / 330; }
.hex { position: absolute; width: calc(100% * 112 / 860); aspect-ratio: 112 / 128; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: #b07818; transition: background .2s ease-out, transform .2s ease-out; }
.hex > div { position: absolute; inset: 2px; clip-path: inherit; background: radial-gradient(120% 90% at 50% 40%, #2c1e15, #1d1512 70%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.hex .n { color: var(--dim); font: 500 11px/1 var(--mono); }
.hex .v { display: inline-flex; align-items: center; gap: 5px; font-size: 15px; font-weight: 600; }
.hex .v img { width: 15px; height: 15px; border-radius: 50%; }
.hex .w { color: var(--mute); font: 500 10.5px/1 var(--mono); }
.hex.empty { background: #4a3210; }
.hex.empty > div { background: radial-gradient(120% 90% at 50% 40%, #1d1612, #141011 70%); }
.hex.empty .v { color: var(--mute); }
.hex.mine { background: var(--gold); }
.hex.fresh { animation: hit .9s ease-out; }
@keyframes hit { 0% { transform: scale(1.06); background: #ffe2a0; } 100% { transform: scale(1); } }

.last { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.last .lab { margin-right: 6px; color: var(--mute); font: 600 10.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.lh { width: 24px; height: 26px; display: grid; place-items: center; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--line2); font: 600 10.5px/1 var(--mono); }
.lh:first-of-type { background: var(--gold); color: #120c02; }

.feeds { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.feed { border: 1px solid var(--line); border-radius: var(--r3); background: var(--panel); padding: 16px 18px 8px; }
.feed h3 { margin: 0 0 8px; color: var(--mute); font: 600 10.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.feed .row { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; height: 30px; color: var(--dim); font-size: 13px; }
.feed .row b { color: var(--text); font-weight: 600; }
.feed .row .r { color: var(--text); font-family: var(--mono); font-size: 12.5px; text-align: right; }
.feed .row .m { color: var(--mute); font-family: var(--mono); font-size: 12px; }
.feed .row a:hover { color: var(--gold); }
.feed .empty { height: 150px; display: grid; place-items: center; color: var(--mute); font-size: 13px; }

/* Side panel */
.side { position: sticky; top: 72px; border: 1px solid var(--line); border-radius: var(--r3); background: var(--panel); padding: 14px; }
.seg { display: inline-flex; gap: 4px; padding: 0; }
.seg button { height: 34px; padding: 0 14px; border: 0; border-radius: var(--r1); background: transparent; color: var(--dim); font-weight: 600; cursor: pointer; transition: color .15s ease-out, background .15s ease-out; }
.seg button[aria-selected="true"] { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.k { color: var(--mute); font: 600 10.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }
.field { display: flex; align-items: center; gap: 8px; height: 46px; margin-top: 8px; padding: 0 12px; border-radius: var(--r2); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); }
.field img { width: 18px; height: 18px; border-radius: 50%; }
.field .v { flex: 1; font-weight: 600; font-size: 15px; }
.field button { border: 0; background: none; color: var(--mute); font: 600 11px/1 var(--sans); letter-spacing: .06em; cursor: pointer; }
.field button:hover { color: var(--gold); }
.prow { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.prow + .prow { border-top: 0; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .num { width: 36px; text-align: center; font-weight: 600; font-size: 15px; }
.pill { height: 30px; padding: 0 10px; border: 0; border-radius: var(--r1); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); color: var(--dim); font: 700 11px/1 var(--sans); letter-spacing: .04em; cursor: pointer; transition: background .15s ease-out, color .15s ease-out; }
.pill:hover:not(:disabled) { color: var(--text); background: var(--line); }
.pill.on { color: var(--text); box-shadow: inset 0 0 0 1px var(--gold-d); }
.pill:disabled { opacity: .4; cursor: not-allowed; }
.tog { position: relative; width: 36px; height: 20px; border: 0; border-radius: 10px; background: var(--line2); cursor: pointer; transition: background .15s ease-out; }
.tog::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); transition: transform .15s ease-out; }
.tog[aria-checked="true"] { background: var(--gold); }
.tog[aria-checked="true"]::after { transform: translateX(16px); }
.sep { height: 1px; margin: 8px 0; background: var(--line); }
select.sel { width: 100%; height: 40px; margin-top: 8px; padding: 0 10px; border: 0; border-radius: var(--r2); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font: 500 12.5px var(--mono); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r2); }
.stats3 > div { padding: 10px 12px; }
.stats3 > div + div { border-left: 1px solid var(--line); }
.stats3 .k { text-decoration: none; }
.stats3 .x { margin-top: 6px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.status { margin-top: 10px; color: var(--dim); font-size: 12.5px; min-height: 18px; }
.status.good { color: var(--good); } .status.warn { color: var(--warn); } .status.bad { color: var(--bad); }
.log { list-style: none; margin: 6px 0 0; padding: 0; max-height: 168px; overflow-y: auto; }
.log li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); color: var(--dim); font: 12px var(--mono); }
.log li .gold { color: var(--gold); }
.log li a { color: var(--gold); }
.keyrow { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--dim); padding: 4px 0; }
.keyrow b { color: var(--text); font-family: var(--mono); font-weight: 500; }
.link { border: 0; background: none; padding: 0; color: var(--gold); font-size: 12.5px; cursor: pointer; }
.link:hover { color: var(--gold-h); }
.links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }

/* Bottom bar */
.foot { font-family: var(--sans); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: 40px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 12px; background: rgba(11,15,16,.95); border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
.foot .l, .foot .r { display: flex; align-items: center; gap: 14px; white-space: nowrap; overflow: hidden; }
.foot .r { justify-content: flex-end; }
.foot .tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--line); }
.foot .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mute); }
.foot .ok { color: var(--good); background: #0f2419; box-shadow: none; }
.foot .ok .dot { background: var(--good); }
.foot .bad { color: var(--bad); background: #2a1414; box-shadow: none; }
.foot .bad .dot { background: var(--bad); }
.foot a:hover { color: var(--text); }
.foot .cc { width: 14px; height: 14px; border-radius: 50%; }

.toast { position: fixed; left: 50%; bottom: 56px; transform: translateX(-50%); z-index: 50; max-width: min(520px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--r2); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line2), 0 16px 48px rgba(0,0,0,.5); font-size: 13.5px; }
.toast a { color: var(--gold); }
dialog.wallets { border: 0; border-radius: var(--r3); background: var(--panel); color: var(--text); padding: 20px; width: min(360px, calc(100vw - 32px)); box-shadow: inset 0 0 0 1px var(--line2); }
dialog.wallets::backdrop { background: rgba(5,7,8,.72); }
dialog.wallets button.w { display: flex; width: 100%; align-items: center; justify-content: space-between; height: 46px; margin-top: 8px; padding: 0 14px; border: 0; border-radius: var(--r2); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; font-size: 14px; }
dialog.wallets button.w:hover { box-shadow: inset 0 0 0 1px var(--gold-d); }
dialog.wallets .link-btn { border: 0; background: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (max-width: 1000px) {
  .top { grid-template-columns: auto 1fr auto; }
  .tabs { overflow-x: auto; justify-content: center; }
  .tab span { display: none; }
  .main { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 680px) {
  .cards { grid-template-columns: 1fr; }
  .card + .card { border-left: 0; border-top: 1px solid var(--line); }
  .feeds { grid-template-columns: 1fr; }
  .board-head { grid-template-columns: 1fr auto; }
  .board-head .timer { display: none; }
  .hex .w { display: none; } .hex .v { font-size: 11px; } .hex .v img { display: none; } .hex .n { font-size: 9px; }
  .foot .c, .foot .hide-s { display: none; }
  .foot { grid-template-columns: 1fr auto; }
  .brand span { display: none; }
  .ca .mute, .ca .ico { display: none; }
}

/* Removed per Noah: network chip, cluster tag, connection tag. */
#netState, #netStatus, .foot .l > .tag:first-child { display: none !important; }

/* Mobile: tabs get their own row so all four fit. */
@media (max-width: 680px) {
  .top { height: auto; grid-template-columns: auto 1fr; row-gap: 6px; padding: 8px 12px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }
  .tab { padding: 0 10px; }
  .tab span { display: inline; }
}
