:root {
  color-scheme: dark;
  --bg: #11141b;
  --surface: #1a1f29;
  --raised: #222936;
  --line: #323c4c;
  --ink: #edf3f6;
  --soft: #a4b1c4;
  --green: #a3f8c7;
  --greenink: #122b20;
  --alarm: #ffae9d;
  --blue: #aabfff;
  --display: "Bahnschrift", "Trebuchet MS", system-ui, sans-serif;
  --body: system-ui, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #edf0f2;
    --surface: #fafbfc;
    --raised: #e7eef0;
    --line: #c9d4d9;
    --ink: #172735;
    --soft: #495e70;
    --green: #17633e;
    --greenink: #f2fff6;
    --alarm: #9d392c;
    --blue: #35499a;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 var(--body); background: var(--bg); color: var(--ink); }
.shell { max-width: 800px; padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 99px max(14px, env(safe-area-inset-left)); margin: auto; }
header { display: grid; gap: 12px; padding: 10px 0 22px; }
.mast, .wallet, .toolrow, .modalHead, .line, .actions { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tools, .actions, .toolrow, .wallet { flex-wrap: wrap; }
.tools { display: flex; gap: 4px; }
.sector { margin: 0 0 5px; color: var(--soft); font: 700 .64rem/1.15 var(--body); letter-spacing: .18em; }
h1, h2, h3, p { margin: 0; }
h1 { font: 800 clamp(1.2rem, 6vw, 2.2rem)/.95 var(--display); letter-spacing: -.04em; white-space: nowrap; }
h1 span, strong.accent { color: var(--green); }
h2 { font: 750 1.38rem/1.16 var(--display); margin-bottom: 10px; }
h3 { font: 750 1.04rem/1.2 var(--display); }
p + p, h3 + p, label + label { margin-top: 6px; }
main { display: grid; gap: 13px; }
.panel, .card, .event, dialog { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.panel { min-width: 0; }
.section-heading { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.section-heading h2 { margin: 0; }
/* Section colours follow the activity. Storage sections have their own tint within the lab. */
#main[data-view] { --section-tint: #6dacf0; }
#main[data-view="synth"] { --section-tint: #aa89ea; }
#main[data-view="pvp"] { --section-tint: #f08080; }
#main[data-view="market"] { --section-tint: #e8b34d; }
#main[data-view="progress"] { --section-tint: #5cbcc5; }
#main[data-view="top"] { --section-tint: #dca368; }
.panel[data-zone="farm"] { --section-tint: #71c88e; }
.panel[data-zone="safe"] { --section-tint: #54b9ac; }
.panel[data-zone="elements"] { --section-tint: #d5a16c; }
.panel[data-zone="compounds"] { --section-tint: #ad7c71; }
#main[data-view] .panel {
  background: linear-gradient(115deg, color-mix(in srgb, var(--section-tint) 22%, var(--surface)),
    color-mix(in srgb, var(--section-tint) 10%, var(--surface)));
  border-color: color-mix(in srgb, var(--section-tint) 45%, var(--line));
}
#main[data-view] .result.won { border-color: var(--green); }
#main[data-view] .result.lost { border-color: var(--alarm); }
.panel[data-zone] > .section-heading { display: grid; grid-template-columns: auto minmax(26px, 1fr) auto; gap: 5px; }
.panel[data-zone] .help-tip { justify-self: start; }
.safety-badge {
  display: inline-flex; align-items: center; align-self: start; gap: 4px; white-space: nowrap;
  padding: 3px 7px; border-radius: 7px; font: 750 .68rem/1.45 var(--body); letter-spacing: .025em;
  color: #0b5131; background: #b6efc9; border: 1px solid #74bc94;
}
.safety-badge::before {
  content: ''; width: 10px; height: 12px; background: currentColor;
  clip-path: polygon(50% 0, 96% 16%, 90% 65%, 73% 84%, 50% 100%, 27% 84%, 10% 65%, 4% 16%);
}
.safety-badge[data-safety="not-safe"] { color: #7a2424; background: #ffd2c8; border-color: #dc9283; }
.safety-badge[data-safety="not-safe"]::before {
  clip-path: polygon(50% 0, 96% 16%, 90% 65%, 73% 84%, 50% 100%, 43% 96%, 60% 54%, 42% 55%, 55% 15%, 32% 64%, 46% 62%, 32% 89%, 10% 65%, 4% 16%);
}
.section-intro { color: var(--ink); margin-bottom: 11px; font-size: .91rem; }
.help-tip summary { display: grid; place-items: center; width: 26px; height: 26px; cursor: pointer;
  border-radius: 50%; border: 1px solid var(--line); color: var(--blue); background: var(--raised); font-weight: 800; }
.help-tip summary::-webkit-details-marker { display: none; }
.help-copy { display: none; position: absolute; inset-inline-start: 0; top: calc(100% + 5px); z-index: 4;
  width: min(300px, 100%); margin: 0; padding: 10px 12px; background: var(--raised); border: 1px solid var(--blue);
  border-radius: 9px; font-size: .82rem; box-shadow: 0 7px 18px #0005; }
.help-tip details:is([open], :focus-within) + .help-copy { display: block; }
@media (hover: hover) { .help-tip:hover .help-copy { display: block; } }
.card { border-radius: 11px; padding: 12px; overflow-wrap: anywhere; min-width: 0; display: grid; align-content: start; gap: 5px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: grid; gap: 8px; }
.muted, .caption, small { color: var(--soft); }
.caption, small { font-size: .79rem; }
.stat { font: 650 .8rem/1.35 var(--body); font-variant-numeric: tabular-nums; color: var(--blue); }
.stability, .error { color: var(--alarm); }
.known { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }
.masked { background: #080b0f; color: #aeb9ca; border-color: #28313c; }
.locked { opacity: .58; }
.ability { font-size: .83rem; }
.ability summary { cursor: pointer; color: var(--green); font-weight: 650; }
.ability[open] summary { margin-bottom: 5px; }
button, select, input { font: inherit; }
button { cursor: pointer; min-height: 40px; border: 1px solid transparent; padding: 7px 10px; border-radius: 8px; background: var(--green); color: var(--greenink); font-weight: 700; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button.secondary, .icon { color: var(--ink); background: var(--raised); border-color: var(--line); }
.icon { min-width: 32px; min-height: 36px; padding: 3px 5px; }
.card button { font-size: .85rem; }
input, select { color: var(--ink); background: var(--raised); width: 100%; padding: 8px; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--green); }
label { display: grid; gap: 4px; }
.proton-amount { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.proton-max { min-height: 42px; min-width: 64px; background: var(--blue); color: var(--bg); }
.leader-position { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.leader-award { flex: none; }
[data-pvp="on"], .pvp-on-key { color: var(--alarm); }
[data-pvp="off"], .pvp-off-key { color: var(--green); }
.roster-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.roster-list li { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; max-width: 100%; overflow-wrap: anywhere; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.option { display: flex; align-items: flex-start; gap: 9px; margin: 8px 0; }
.option span { flex: 1; }
.option input { flex: 0 0 18px; }
.action-row { margin-top: 9px; }
.wallet { justify-content: flex-start; font-variant-numeric: tabular-nums; }
.token { padding: 4px 9px; background: var(--raised); border-radius: 7px; font-size: .85rem; }
.event { width: 100%; color: var(--ink); display: grid; grid-template-columns: 26px 1fr; text-align: left; gap: 8px; }
.event.pvp { border-color: var(--alarm); }
.event.income { border-color: var(--green); }
.event p { font-size: .78rem; }
.event .symbol { color: var(--alarm); font-size: 1.15rem; }
.event.income .symbol { color: var(--green); }
progress { display: block; height: 6px; width: 100%; border: 0; border-radius: 99px; overflow: hidden; appearance: none; color: var(--green); background: var(--raised); }
progress::-webkit-progress-bar { background: var(--raised); }
progress::-webkit-progress-value { background: currentColor; }
progress::-moz-progress-bar { background: currentColor; }
.event.pvp progress { color: var(--alarm); }
.event[data-status="pending"], .event[data-status="pending"] :is(.symbol, progress) { color: #d8a84c; border-color: #d8a84c; }
.event[data-status="pending"] strong { color: var(--ink); }
.event[data-status="ended"], .event[data-status="ended"] :is(.symbol, progress) { color: var(--soft); border-color: var(--line); }
.fill { background: linear-gradient(90deg, #edf3f6, #49bf7a 65%, #ed7463); }
nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); padding: 6px 6px max(7px, env(safe-area-inset-bottom)); z-index: 2; width: min(100%, 800px); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; border-top: 1px solid var(--line); background: var(--bg); }
nav button { background: transparent; color: var(--soft); padding: 3px 0; font-size: clamp(.63rem, 2.7vw, .88rem); }
nav button[aria-current="page"] { color: var(--green); background: var(--raised); }
nav button span { display: block; font-size: 1rem; }
dialog { color: var(--ink); width: min(540px, calc(100% - 20px)); max-height: 85dvh; overscroll-behavior: contain; box-shadow: 0 20px 55px #0006; }
dialog::backdrop { background: #070a10bd; }
.modalHead { align-items: flex-start; margin-bottom: 10px; }
.modalHead h2 { margin: 3px 0; }
dialog .actions { justify-content: flex-end; margin-top: 14px; }
#toast { position: fixed; z-index: 3; left: 50%; bottom: 75px; transform: translateX(-50%); width: min(540px, calc(100% - 24px)); padding: 11px 14px; background: var(--raised); border: 1px solid var(--green); border-radius: 10px; }
.result.won { border-color: var(--green); }
.result.lost { border-color: var(--alarm); }
.farm-countdown { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
#wipe-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; text-align: center; background: radial-gradient(ellipse at center, var(--raised), var(--bg) 70%); }
.launch-screen { max-width: 540px; display: grid; gap: 18px; }
.launch-screen h1 { white-space: normal; }
.wipe-countdown { color: var(--green); font: 800 clamp(3rem, 16vw, 7rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.launch-dialog { color-scheme: dark; color: #edf3f6; width: 100%; height: 100dvh; max-width: none;
  max-height: none; margin: 0; border: 0; border-radius: 0; padding: max(16px, env(safe-area-inset-top)) 16px
  max(24px, env(safe-area-inset-bottom)); background: radial-gradient(ellipse at 50% 22%, #1a4339, #101821 58%, #0d1119); }
.launch-dialog form { min-height: 100%; max-width: 480px; margin: auto; display: grid;
  align-content: center; justify-items: center; gap: 12px; }
.launch-dialog .modalHead { margin: 0; }
.launch-dialog h2 { text-align: center; font-size: clamp(1.4rem, 6vw, 2.4rem); }
.launch-dialog .actions { width: 100%; justify-content: center; margin: 4px 0 0; }
.launch-dialog button[type="submit"] { width: min(100%, 270px); min-height: 46px; background: #a3f8c7; color: #122b20; }
.welcome-hero { text-align: center; display: grid; justify-items: center; gap: 11px; }
.launch-mark, .invite-mark { border-radius: 50%; object-fit: cover; }
.launch-mark { width: clamp(92px, 25dvh, 176px); height: auto; margin: 2px 0 5px;
  border: 1px solid #a3f8c78c; box-shadow: 0 0 40px #73f8b642; }
.launch-greeting { font-size: clamp(.94rem, 4vw, 1.15rem); }
.welcome-bonus { color: #a3f8c7; font: 800 clamp(1.8rem, 10vw, 3.25rem)/1 var(--display); }
.welcome-hero .muted { color: #d1dce7; }
.launch-event { color: #b2f2d1; font-size: .85rem; }
.launch-rules { color: #c2d4ff; text-underline-offset: 3px; padding: 6px; }
.rules-content, .game-glossary, .invite-content { display: grid; gap: 9px; }
.rules-dialog, .welcome-rules { width: min(700px, calc(100% - 20px)); height: min(92dvh, 850px); max-height: none; }
:is(.rules-dialog, .welcome-rules) form { display: flex; flex-direction: column; height: 100%; }
:is(.rules-dialog, .welcome-rules) #modalBody { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain;
  scrollbar-gutter: stable; padding-inline-end: 4px; }
.rules-content { gap: 10px; padding-bottom: 6px; }
.rules-content p { margin: 0; }
.guide-goal { display: grid; gap: 5px; background: var(--raised); border-inline-start: 3px solid var(--green);
  border-radius: 8px; padding: 11px 12px; }
.guide-goal h3 { color: var(--green); }
.guide-topics { display: flex; flex-wrap: wrap; gap: 6px; }
.guide-topic { min-height: 36px; font-size: .83rem; }
.guide-section { border: 1px solid var(--line); border-radius: 9px; scroll-margin-top: 4px; }
.guide-summary { display: flex; padding: 9px 11px; gap: 10px; min-height: 44px; align-items: center;
  justify-content: space-between; cursor: pointer; border-radius: 8px; }
.guide-summary::-webkit-details-marker { display: none; }
.guide-summary::after { content: '›'; color: var(--green); font-size: 1.25rem; line-height: 1; }
.guide-section[open] .guide-summary::after { transform: rotate(90deg); }
.guide-steps { margin: 0; display: grid; gap: 10px; padding: 4px 12px 12px; }
ul.guide-steps { list-style: none; }
ol.guide-steps { padding-inline-start: 32px; }
ol.guide-steps li::marker { color: var(--green); font-weight: 700; }
.guide-steps p { color: var(--soft); margin-top: 2px; }
.game-glossary { margin: 0; padding: 4px 11px 11px; }
.game-glossary div { padding: 8px 10px; border-radius: 6px; background: var(--raised); }
.game-glossary dt { font-weight: 750; color: var(--green); }
.game-glossary dd { margin: 3px 0 0; color: var(--soft); }
.invite-banner, .invite-reward { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--raised); }
.invite-banner { display: grid; grid-template-columns: 59px minmax(0, 1fr); align-items: center; gap: 11px; }
.invite-mark { width: 59px; height: 59px; }
.invite-reward strong { color: var(--green); }
.invite-reward progress { margin-top: 8px; background: var(--surface); }
.invite-reward progress::-webkit-progress-bar { background: var(--surface); }
.invite-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-link { display: inline-grid; place-items: center; min-height: 40px; padding: 7px 10px; border-radius: 8px;
  background: var(--green); color: var(--greenink); font-weight: 700; text-decoration: none; }
.share-link:focus-visible, .launch-rules:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
@media (max-width: 549px) {
  .rules-dialog, .welcome-rules { width: 100%; height: 100dvh; max-width: none; margin: 0; border: 0;
    border-radius: 0; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
}
@media (min-width: 550px) { .shell { padding-inline: 26px; } .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.hourly { color: var(--soft); font-size: .84em; font-weight: 450; white-space: nowrap; }
.farm-rate { color: var(--soft); font-style: italic; margin-block: 4px 12px; }
.zone-filters { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.zone-filters [aria-pressed="true"] { color: var(--greenink); background: var(--green); }
.shop-entry {
  display: flex; align-items: center; gap: 14px; width: calc(100% + 8px); margin-inline: -4px;
  min-height: 64px; padding: 10px 19px; border-radius: 14px; border: 1px solid #cd9b36;
  background: linear-gradient(105deg, #fff1b5, #ffe9a0 65%, #f7d77f); color: #49331b;
  font: 750 1.22rem/1.2 var(--display); text-align: start;
}
.shop-entry::after {
  content: ''; margin-inline-start: auto; width: 10px; height: 10px;
  border: solid #735420; border-width: 2px 2px 0 0; transform: rotate(45deg);
}
.shop-entry:active { background: #f8db89; }
.shopfront {
  display: block; flex: none; position: relative; width: 36px; height: 28px; margin: 4px 2px 0;
  border: 2px solid #715239; border-radius: 3px; background: #fffae4;
}
.shopfront::before {
  content: ''; position: absolute; z-index: 1; inset: -6px -4px auto; height: 11px;
  border: 2px solid #715239; border-radius: 5px 5px 3px 3px;
  background: repeating-linear-gradient(90deg, #e48b57 0 6px, #fff2cf 6px 12px);
}
.shopfront-window, .shopfront-door { position: absolute; border: 1px solid #715239; background: #a6cacc; }
.shopfront-window { inset: 9px auto 5px 3px; width: 14px; border-bottom-width: 2px; }
.shopfront-door { inset: 8px 3px -1px auto; width: 9px; }
.shop-shelf { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-product { display: grid; justify-items: center; align-content: end; gap: 5px; min-width: 0;
  padding: 12px 4px 18px; border: 1px solid #466b86; border-radius: 16px; color: #e9f7ff;
  background: radial-gradient(ellipse at 50% 35%, #254859, #152331 75%); }
.shop-product + .shop-product { background: radial-gradient(ellipse at 50% 35%, #51364e, #251f30 75%); border-color: #785372; }
.shop-product small { color: #bdd0dc; font-weight: 500; }
.art-stage { display: grid; place-items: center; width: 100%; height: 118px; }
.atom-art { position: relative; width: 100px; height: 100px; perspective: 500px; }
.orbit { position: absolute; inset: 3px; border: 2px solid #75e6f5; border-radius: 50%; transform: rotate(-35deg) scaleY(.4); }
.orbit.two { transform: rotate(31deg) scaleY(.4); border-color: #ffb279; }
.orbit.three { transform: rotate(95deg) scaleY(.4); border-color: #8eafff; }
.electron-track { position: absolute; inset: -2px; animation: orbit-run 4s linear infinite; }
.orbit.two .electron-track { animation-delay: -1.4s; }.orbit.three .electron-track { animation-delay: -2.8s; }
.electron { position: absolute; top: -4px; left: 45%; width: 10px; height: 16px; border-radius: 50%; background: #ffdb76; box-shadow: 0 0 9px #ffc962; }
.nucleus { position: absolute; inset: 35%; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 30% 26%, #a5ffff, #40abce 53%, #2b658e); color: #103647; font-size: 18px; box-shadow: 0 0 14px #5ac6ec66; }
@keyframes orbit-run { to { transform: rotate(360deg); } }
.machine-art { width: 74px; height: 100px; position: relative; transform-origin: center 95%; animation: machine-rock 5s ease-in-out infinite; }
.machine-glass { position: absolute; inset: 0 2px 39px; overflow: hidden; border: 3px solid #e2deed; border-radius: 13px 13px 8px 8px;
  background: linear-gradient(118deg, #f8fdff9c, #8bd9ea33 30%, #afcced69); }
.mini-ball { position: absolute; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(160deg, #fff6f4 44%, #504759 45% 51%, var(--ball, #ffa24d) 52%); }
.mini-ball:nth-child(1) { left: 1px; bottom: -3px; }.mini-ball:nth-child(2) { left: 21px; bottom: -3px; --ball: #fd6884; }
.mini-ball:nth-child(3) { left: 41px; bottom: -3px; --ball: #85dd93; }.mini-ball:nth-child(4) { left: 10px; bottom: 14px; --ball: #85c9ff; }
.mini-ball:nth-child(5) { left: 31px; bottom: 13px; --ball: #be8fec; }.mini-ball:nth-child(6) { left: 48px; bottom: 16px; }
.mini-ball:nth-child(7) { left: -4px; bottom: 30px; --ball: #e77991; }.mini-ball:nth-child(8) { left: 24px; bottom: 30px; --ball: #6bdbc6; }
.machine-base { position: absolute; inset: 58px 0 0; border: 2px solid #ffb39f; border-radius: 4px 4px 9px 9px; background: linear-gradient(130deg, #ff876f, #b94860); }
.dial,.chute { position: absolute; top: 8px; left: 10px; width: 20px; height: 20px; border: 3px solid #d9e4ee; border-radius: 50%; background: linear-gradient(45deg, #74849b 40%, white 41% 58%, #64788c 59%); }
.chute { left: 39px; top: 14px; width: 20px; height: 13px; border: 2px solid #a84c60; border-radius: 8px 8px 3px 3px; background: #302a38; }
@keyframes machine-rock { 0%, 60%, 79%, 100% { transform: rotate(0); } 66% { transform: rotate(-4deg); } 72% { transform: rotate(3deg); } }
.gacha-reward { display: grid; justify-items: center; gap: 7px; padding: 10px 0; }
.capsule-scene { position: relative; margin: 8px auto; width: 146px; height: 140px; display: grid; place-items: center; }
.capsule-top,.capsule-bottom { position: absolute; left: 31px; width: 84px; height: 42px; border: 3px solid #384860; }
.capsule-top { bottom: 50%; background: linear-gradient(145deg, #fff, #c2dfeb); border-radius: 54px 54px 5px 5px;
  transform: translate(-8px,-24px) rotate(-14deg); animation: capsule-open .65s ease-out; }
.capsule-bottom { top: 50%; background: linear-gradient(145deg, #53cddd, #357db9); border-radius: 4px 4px 54px 54px; transform: translateY(19px); animation: capsule-drop .65s ease-out; }
.capsule-symbol { color: var(--ink); font: 800 34px/1 var(--display); animation: reveal-symbol .65s ease-out; }
@keyframes capsule-open { from { transform: none; } }
@keyframes capsule-drop { from { transform: none; } }
@keyframes reveal-symbol { 0%, 35% { opacity: 0; transform: scale(.5); } }
@media (prefers-reduced-motion: reduce) {
  .machine-art,.electron-track,.capsule-top,.capsule-bottom,.capsule-symbol { animation: none; }
}


.server-heading { display: flex; align-items: center; justify-content: space-between; }
.server-rate { color: var(--soft); font-variant-numeric: tabular-nums; }
.server-enter { width: 100%; min-height: 44px; margin-top: 6px; color: var(--ink); border: 1px solid transparent; }
.enter-easy { background: rgb(120 221 151 / 23%); border-color: rgb(70 166 110 / 55%); }
.enter-hard:disabled { opacity: .8; background: rgb(243 146 154 / 22%); border-color: rgb(204 101 107 / 50%); }
.enter-chaos { background: rgb(170 140 249 / 26%); border-color: rgb(159 121 229 / 60%); }

.daily-claim:disabled { background: var(--raised); border-color: var(--line); color: var(--soft); opacity: .65; }
.wallet-currency { min-width: 0; display: grid; align-content: start; gap: 3px; }
.wallet-next { padding-inline: 4px; font-size: .71rem; font-variant-numeric: tabular-nums; }
.wallet-next output { color: var(--ink); }
dialog.element-dialog { width: min(580px, calc(100% - 12px)); max-width: calc(100vw - 12px); padding: 12px; }
.element-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; }
.element-tile, .reagent-tile {
  --tile-accent: var(--blue);
  display: grid; place-content: center; justify-items: center; position: relative; min-width: 0;
  min-height: 74px; padding: 12px 2px 5px; border-radius: 10px; color: var(--tile-accent);
  border: 1px solid color-mix(in srgb,var(--tile-accent) 48%,var(--line));
  background: linear-gradient(155deg,color-mix(in srgb,var(--tile-accent) 17%,var(--surface)),var(--surface) 90%);
}
.element-tile[data-family="nonmetal"] { --tile-accent: var(--green); }
.element-tile[data-family="halogen"] { --tile-accent: var(--alarm); }
.element-tile[data-family="active-metal"] { --tile-accent: color-mix(in srgb,var(--green) 50%,var(--blue)); }
.element-tile:is(:hover,:focus-visible), .reagent-tile:is(:hover,:focus-visible) { border-color: var(--tile-accent); }
.atomic-number { position: absolute; top: 3px; left: 6px; font: 600 .64rem/1.1 var(--body); color: var(--soft); }
.chemical-symbol, .reagent-tile strong { font: 750 clamp(1.5rem,6vw,2rem)/1.1 var(--display); }
.element-name, .reagent-tile span { color: var(--ink); font-size: .73rem; line-height: 1.3; }
.tile-stock { font-size: .68rem; }
.craft-summary, .reaction-summary { display: grid; grid-template-columns: minmax(76px, .8fr) minmax(0,1.4fr); align-items: stretch; gap: 12px; }
.craft-summary .element-tile { min-height: 100px; }
.craft-summary .chemical-symbol { font-size: 2.5rem; }
.craft-budget { align-self: center; display: grid; gap: 3px; min-width: 0; font-variant-numeric: tabular-nums; }
.budget-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 6px; font-size: .82rem; color: var(--soft); }
.budget-line strong { color: var(--blue); overflow-wrap: anywhere; }
.budget-line:nth-child(2) strong { color: var(--ink); }
.budget-line:last-child { padding-top: 4px; border-top: 1px solid var(--line); }
.budget-line:last-child strong { color: var(--green); }
.budget-line.shortfall strong { color: var(--alarm); }
.craft-quantity { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0; }
.quantity-dial { display: grid; grid-template-columns: minmax(0,1fr) 36px; max-width: 140px; border: 1px solid var(--line);
  background: var(--raised); border-radius: 9px; overflow: hidden; align-items: stretch; }
.quantity-dial input { appearance: textfield; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 0; border: 0; background: transparent; }
.quantity-dial input::-webkit-inner-spin-button { appearance: none; }
.quantity-arrows { display: grid; border-left: 1px solid var(--line); }
.quantity-arrow { min-height: 25px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--blue); line-height: 1; }
.quantity-arrow + .quantity-arrow { border-top: 1px solid var(--line); }
.reaction-grid { display: grid; grid-template-columns: minmax(0,1fr) 22px minmax(0,1fr); align-items: start; gap: 5px; }
.reagent { display: grid; gap: 7px; min-width: 0; }
.reagent .quantity-dial { width: 100%; max-width: none; }
.reagent-tile { width: 100%; min-height: 88px; padding: 6px; border-style: dashed; }
.reagent-tile.filled { border-style: solid; --tile-accent: var(--green); }
.reagent-tile small { font-size: .66rem; }
.reagent-source { color: var(--ink); font-size: .76rem; line-height: 1.4; text-align: center; }
.reagent-source:empty { display: none; }
.source-list { margin: 8px 0; padding-inline-start: 1.25em; line-height: 1.6; }
.farm-warning .source-list { color: var(--alarm); font-weight: 650; }
.reaction-plus { align-self: start; text-align: center; margin-top: 27px; font-size: 1.4rem; color: var(--soft); }
.reaction-summary { padding: 12px; margin: 14px 0 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
.result-cell { min-width: 0; align-self: center; }
.formula-result { display: block; overflow-wrap: anywhere; color: var(--soft); font-size: .83rem; }
.formula-result.complete { color: var(--green); font: 700 clamp(1.35rem,5vw,2rem)/1.3 var(--display); }
.formula-result sub { font-size: .58em; }
.synthesize-button { width: 100%; margin: 7px 0; }
@media (max-width: 400px) {
  .element-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; }
  .element-tile { min-height: 65px; }
  .element-name { font-size: .66rem; }
  .reaction-summary { gap: 8px; padding: 9px; }
}
