:root {
  color-scheme: light;
  --ink:#17104d; --muted:#787394; --purple:#6037f3; --gold:#edba41;
  --cream:#fffaf0; --line:#e9e5f1; --red:#ef4343;
  font-family: ui-rounded, 'Trebuchet MS', system-ui, -apple-system, sans-serif;
  color:var(--ink); background:#faf8ef;
  font-synthesis:none;
}
* { box-sizing:border-box; }
body { margin:0; }
button, input { font:inherit; color:inherit; }
button { cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
button:disabled { cursor:default; opacity:.42; }
button:not(:disabled):hover { filter:brightness(.97); }
button, a, input, summary { outline-offset:3px; }
:focus-visible { outline:3px solid #6633ed; }
input[type=number] { appearance:textfield; -moz-appearance:textfield; }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
input { min-width:0; }
button svg { width:18px; height:18px; display:block; pointer-events:none; }
.sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
[hidden] { display:none!important; }
.app { height:100vh; height:100dvh; padding:12px; display:grid; grid-template-rows:116px minmax(0,1fr); gap:12px; background:linear-gradient(170deg,#eaf4fb 0%,#fffbed 85%); }
.topbar { display:grid; grid-template-columns:minmax(300px,1.45fr) minmax(175px,.72fr) minmax(190px,.82fr) minmax(320px,1.28fr); gap:10px; min-width:0; }
.top-card { background:#fffefa; border:1px solid #eee9e1; border-radius:18px; box-shadow:0 3px 8px #39326a0e; min-width:0; }
.brand { display:flex; align-items:center; gap:13px; padding:12px 14px; position:relative; }
.brand>img { flex:none; width:64px; height:64px; }
.brand-copy { min-width:0; }
.brand h1 { font-size:clamp(20px,2.2vw,34px); line-height:1.08; letter-spacing:-1.05px; margin:0 0 6px; font-weight:900; white-space:nowrap; }
.brand p { font-size:clamp(10px,.9vw,14px); margin:0; color:var(--muted); white-space:nowrap; }
.help-button { position:absolute; right:6px; top:5px; width:22px!important; height:22px!important; min-height:0!important; border-radius:50%!important; font-size:12px!important; background:#f4f1fc!important; color:#746691!important; }
.top-card h2 { margin:0; font-size:clamp(13px,1.2vw,18px); line-height:1.15; font-weight:800; }
.terrain-count { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; text-align:center; padding:8px; }
.count-control { display:grid; grid-template-columns:42px minmax(42px,74px) 42px; gap:5px; align-items:center; justify-content:center; }
.count-control button { width:42px; height:40px; border:1px solid #b59339; border-radius:11px; background:linear-gradient(#fff69e,#ffdd6b); color:var(--ink); font-size:26px; font-weight:800; box-shadow:0 2px 3px #5c33ed17; padding:0; }
.count-control input { width:100%; height:40px; border:1px solid var(--line); border-radius:9px; background:white; font-weight:900; font-size:28px; text-align:center; padding:0 2px; }
.energy-total { display:flex; align-items:center; justify-content:center; gap:12px; padding:10px; text-align:center; }
.energy-symbol { width:39px; height:55px; flex:none; }
.energy-total output { display:block; font-size:clamp(28px,2.6vw,40px); font-weight:900; margin-top:4px; line-height:1; font-variant-numeric:tabular-nums; }
.baby-total { position:relative; background:#fff9e7 url('assets/baby-bees-bandeau.webp') center center/72% auto no-repeat; border:1px solid #edcf77; border-radius:18px; overflow:hidden; box-shadow:0 4px 10px #8f690d12; }
.baby-total output { position:absolute; left:50%; top:60%; transform:translate(-50%,-50%); min-width:22%; width:auto; min-height:34%; padding:0 1em; display:flex; align-items:center; justify-content:center; text-align:center; color:#532600; background:linear-gradient(180deg,#fff6bf 0%,#fff0aa 100%); border:3px solid #e0a11d; border-radius:999px; box-shadow:inset 0 1px 0 #fffdf2, 0 3px 6px #8f690d20; font-size:clamp(28px,2.7vw,42px); font-weight:900; line-height:1; font-variant-numeric:tabular-nums; text-shadow:0 1px 0 #fff7d3; }
.mobile-bee, .mobile-bee-title { display:none; }
.lands { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-auto-rows:calc((100% - 10px)/2); gap:10px; min-height:0; min-width:0; overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; align-content:start; }
.lands[data-layout=solo] { grid-template-columns:minmax(0,1fr); grid-auto-rows:100%; }
.terrain { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(215px,.9fr); gap:6px; padding:6px; background:#fffefa; border:1px solid #f3dfac; border-radius:18px; box-shadow:0 2px 5px #55482008; min-width:0; min-height:0; }
.stage { min-width:0; min-height:0; display:grid; place-items:center; border-radius:13px; background:#f0f1df; overflow:hidden; position:relative; }
.board { width:var(--board-width,100%); height:var(--board-height,100%); position:relative; flex:none; background:url('assets/terrain-vide.webp') center/100% 100% no-repeat; isolation:isolate; }
.hive-picture { position:absolute; object-fit:contain; display:block; pointer-events:none; user-select:none; height:auto; transform:translateX(-50%); }
/* Locked original assets: no CSS filter, recolouring, stretching or redraw. */
.hive-picture.imperial { left:50%; top:19.5%; width:26%; }
.hive-picture.sat-0 { left:20%; top:10.8%; width:15%; }
.hive-picture.sat-1 { left:80%; top:10.8%; width:15%; }
.hive-picture.sat-2 { left:50%; top:66%; width:15%; }
.hive-name { position:absolute; transform:translateX(-50%); font-weight:800; border:1px solid #ebbf51; color:#201352; background:#fffce1; border-radius:8px; text-align:center; padding:3px 8px; white-space:nowrap; z-index:2; font-size:clamp(8px,calc(var(--board-width) * .027),18px); line-height:1.1; box-shadow:0 2px 3px #673a0e14; }
.hive-name.imperial { left:50%; top:15.9%; }
.hive-name.sat-0 { left:20%; top:9.1%; }
.hive-name.sat-1 { left:80%; top:9.1%; }
.hive-name.sat-2 { left:50%; top:64.2%; }
.board-crown { position:absolute; width:7.5%; height:auto; top:6.6%; left:50%; transform:translateX(-50%); border-radius:35%; z-index:3; }
.energy-control { position:absolute; display:grid; grid-template-columns:24% minmax(0,1fr) 24%; gap:2px; width:28%; height:clamp(27px,calc(var(--board-width) * .074),60px); transform:translate(-50%,-50%); z-index:4; filter:drop-shadow(0 2px 2px #40250630); }
.energy-control.imperial { left:50%; top:55.8%; }
.energy-control.sat-0 { left:20%; top:37.8%; }
.energy-control.sat-1 { left:80%; top:37.8%; }
.energy-control.sat-2 { left:50%; top:90.5%; }
.energy-control button { min-width:0; padding:0; border:1px solid #b59339; border-radius:8px; background:linear-gradient(#fff69e,#ffdd6b); font-weight:900; font-size:clamp(16px,calc(var(--board-width) * .05),32px); display:grid; place-items:center; }
.energy-control label { display:flex; align-items:center; justify-content:center; gap:0; min-width:0; overflow:hidden; border:1px solid #cec5ba; border-radius:7px; background:white; padding:0 2px; }
.energy-control .bolt { flex:0 0 auto; margin-right:2px; font-size:clamp(10px,calc(var(--board-width) * .035),25px); line-height:1; color:#ed9610; }
.energy-control input { flex:1 1 0; min-width:0; width:0; background:transparent; border:0; text-align:center; padding:1px 0; font-size:clamp(15px,calc(var(--board-width) * .04),31px); font-weight:900; font-variant-numeric:tabular-nums; outline-offset:-2px; }
.slot-delete { position:absolute; z-index:5; display:grid; place-items:center; width:clamp(23px,calc(var(--board-width) * .055),38px); height:clamp(23px,calc(var(--board-width) * .055),38px); border:1px solid #f0d8d4; border-radius:7px; padding:0; background:#fffaf6; color:var(--red); }
.slot-delete svg { width:65%; height:65%; }
.slot-delete.sat-0 { left:31%; top:15.8%; }
.slot-delete.sat-1 { left:90%; top:15.8%; }
.slot-delete.sat-2 { left:62%; top:71.5%; }
.empty-slot { position:absolute; width:23%; height:24%; transform:translate(-50%,-50%); border:2px dashed #ccaa56; border-radius:18px; background:#fff9dbd9; color:#8a4b08; font-weight:800; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px; font-size:clamp(10px,calc(var(--board-width) * .027),18px); line-height:1.1; padding:2px; }
.empty-slot>span { font-size:clamp(22px,calc(var(--board-width) * .08),50px); line-height:1; }
.empty-slot.sat-0 { left:20%; top:24.3%; }
.empty-slot.sat-1 { left:80%; top:24.3%; }
.empty-slot.sat-2 { left:50%; top:79%; }
.panel { display:flex; flex-direction:column; gap:6px; min-width:0; min-height:0; padding:4px; }
.panel-head { display:flex; align-items:center; gap:6px; min-width:0; min-height:28px; }
.panel-head h2 { font-size:clamp(15px,1.2vw,22px); margin:0; flex:1; min-width:0; overflow-wrap:anywhere; line-height:1.1; }
.icon-button { width:28px; height:28px; flex:none; display:grid; place-items:center; border:1px solid #ecdab6; border-radius:8px; background:#fffdf8; color:#8a4b08; font-size:19px; padding:0; }
.icon-button.danger { background:#fff4f1; border-color:#fae5e1; color:#ef4141; }
.hive-list { display:grid; grid-template-rows:repeat(4,minmax(28px,1fr)); flex:1; min-height:112px; }
.hive-row { display:grid; grid-template-columns:25px minmax(0,1fr) 12px 47px 22px; align-items:center; gap:4px; border-bottom:1px solid #efecf1; min-width:0; }
.hive-row:last-child { border-bottom:0; }
.hive-row .row-name { font-weight:700; font-size:clamp(10px,.8vw,13px); line-height:1.1; }
.row-crown { width:25px; height:25px; border-radius:35%; object-fit:contain; }
.row-satellite-icon { width:25px; height:25px; object-fit:contain; }
.number-badge { display:grid; place-items:center; background:#ff8c18; color:white; border-radius:50%; width:24px; height:24px; font-size:15px; font-weight:800; }
.number-badge.slot-1 { background:#15b786; }
.number-badge.slot-2 { background:#9529ed; }
.row-bolt { color:#ee9e00; font-size:15px; }
.row-input { width:47px; height:28px; background:white; border:1px solid var(--line); border-radius:8px; text-align:center; font-size:16px; font-weight:800; padding:0 2px; }
.row-remove { border:0; color:var(--red); background:transparent; width:22px; height:25px; display:grid; place-items:center; padding:0; }
.row-remove svg { width:15px; height:15px; }
.hive-row .empty-text { grid-column:3/5; font-size:10px; color:var(--muted); text-align:right; }
.row-add { color:#8a4b08; font-weight:900; }
.add-satellite { border:1px dashed #d6bb76; background:#fffdf7; color:#8a4b08; border-radius:10px; padding:5px; min-height:32px; display:flex; align-items:center; justify-content:center; gap:7px; }
.add-satellite .plus-disc { display:grid; place-items:center; border-radius:50%; background:linear-gradient(#f3b443,#d98014); color:white; width:27px; height:27px; font-size:23px; line-height:1; flex:none; }
.add-satellite .add-label { text-align:left; font-size:clamp(10px,.82vw,13px); font-weight:700; }
.add-satellite small { display:block; color:#8f7656; font-size:10px; font-weight:400; margin-top:1px; }
.panel-actions { display:grid; grid-template-columns:1fr 1fr; gap:5px; }
.panel-action { min-width:0; display:flex; align-items:center; justify-content:center; gap:5px; border:1px solid #e9d09b; border-radius:8px; background:linear-gradient(#fff9ef,#f9eed6); color:#8a4b08; font-size:clamp(10px,.8vw,12px); font-weight:700; min-height:29px; padding:4px; }
.panel-action svg { width:15px; height:15px; flex:none; }
.local-result { display:flex; justify-content:space-between; align-items:center; color:#77685a; background:#fff8e5; border-radius:7px; padding:4px 7px; font-size:11px; min-height:23px; gap:3px; }
.local-result strong { color:#633917; font-size:14px; font-variant-numeric:tabular-nums; }
.local-energy { color:#807b92; font-size:10px; }
.compact-summary { display:none; }
/* A single terrain gets a full-size scene and larger sidebar controls. */
.lands[data-layout=solo] .terrain { grid-template-columns:minmax(0,1fr) minmax(300px,370px); padding:9px; gap:12px; }
.lands[data-layout=solo] .panel { gap:13px; padding:10px; justify-content:center; }
.lands[data-layout=solo] .panel-head h2 { font-size:26px; }
.lands[data-layout=solo] .hive-list { flex:none; grid-auto-rows:58px; grid-template-rows:repeat(4,58px); }
.lands[data-layout=solo] .hive-row { grid-template-columns:36px minmax(0,1fr) 18px 66px 26px; gap:8px; }
.lands[data-layout=solo] .row-input { width:66px; height:42px; font-size:22px; }
.lands[data-layout=solo] .row-name { font-size:14px; }
.lands[data-layout=solo] .row-crown, .lands[data-layout=solo] .row-satellite-icon, .lands[data-layout=solo] .number-badge { width:34px; height:34px; }
.lands[data-layout=solo] .add-satellite { min-height:60px; }
.lands[data-layout=solo] .panel-action { min-height:43px; font-size:13px; }
.lands[data-layout=solo] .local-result { min-height:42px; font-size:14px; }
.lands[data-layout=solo] .local-result strong { font-size:23px; }
/* Dialogs are the detailed mobile editor, not additional terrain copies. */
dialog { border:1px solid #eee5d3; border-radius:20px; padding:18px; background:#fffdfa; color:var(--ink); box-shadow:0 20px 70px #1b16474d; max-height:calc(100dvh - 28px); }
dialog::backdrop { background:#17112d80; backdrop-filter:blur(3px); }
.dialog-top { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.dialog-top h2 { font-size:21px; margin:0; }
.dialog-top .icon-button { width:40px; height:40px; font-size:25px; }
.message-dialog { width:min(430px,calc(100vw - 30px)); }
.message-dialog h2 { margin:0 0 14px; font-size:23px; }
.message-dialog p { font-size:15px; color:#7c6544; line-height:1.5; }
#name-label { display:grid; gap:8px; }
#terrain-name { width:100%; border:1px solid #d6cce8; border-radius:9px; height:44px; padding:8px; font-size:17px; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:22px; }
.primary-button, .neutral-button, .danger-button { -webkit-appearance:none; appearance:none; border:1px solid #e6d3aa; border-radius:10px; padding:10px 14px; min-height:42px; background:#fffaf0; font-weight:700; font-size:14px; }
.neutral-button { background:linear-gradient(180deg,#fffaf0 0%,#f7ead0 100%); color:#8a4b08; border-color:#d79d33; box-shadow:0 2px 6px #8f690d1c; }
.primary-button { background:linear-gradient(180deg,#efad34 0%,#da8613 100%); color:#fffdf9; border-color:#c8740e; box-shadow:0 2px 6px #8f690d22; }
.danger-button { color:#b43131; background:#fff4f0; border-color:#efd3cd; }
.primary-button:focus-visible, .neutral-button:focus-visible, .danger-button:focus-visible, .icon-button:focus-visible, button:focus-visible { outline:2px solid #d88b18; outline-offset:2px; box-shadow:0 0 0 3px #f3d08b80; }
.primary-button:focus, .neutral-button:focus, .danger-button:focus, .icon-button:focus, button:focus { outline-color:#d88b18; }
.help-dialog { width:min(660px,calc(100vw - 24px)); }
.help-content p { line-height:1.55; font-size:14px; }
.help-content details { background:#fff6df; border:1px solid #ecdcb7; border-radius:12px; padding:12px; margin:15px 0; }
.help-content summary { font-weight:800; cursor:pointer; }
.help-content h3 { margin-top:24px; }
.help-content .source-note,.small-note { color:var(--muted); font-size:12px; }
.table-scroll { overflow:auto; }
table { border-collapse:collapse; width:100%; font-size:13px; text-align:center; }
caption { font-weight:700; padding:8px; }
th,td { border-bottom:1px solid #e6d8b9; padding:7px 4px; }
.tool-actions { display:flex; gap:8px; flex-wrap:wrap; margin:10px 0; }
.editor-dialog { width:min(1060px,calc(100vw - 20px)); padding:12px; }
.editor-dialog .terrain { border:0; box-shadow:none; grid-template-columns:minmax(0,1fr) 305px; min-height:500px; }
.editor-dialog .stage { min-height:400px; }
.editor-dialog .panel { gap:10px; justify-content:center; }
.editor-dialog .hive-list { flex:none; grid-template-rows:repeat(4,49px); }
.editor-dialog .hive-row { grid-template-columns:30px minmax(0,1fr) 14px 56px 24px; }
.editor-dialog .row-input { width:56px; height:42px; font-size:20px; }
.editor-dialog .row-satellite-icon { width:30px; height:30px; }
.editor-dialog .row-name { font-size:13px; }
.editor-dialog .panel-actions { margin-top:3px; }
.editor-dialog .panel-action { min-height:42px; }
.editor-dialog .add-satellite { min-height:52px; }
.editor-dialog .compact-summary { display:none; }
.toast { position:fixed; z-index:100; left:50%; bottom:20px; transform:translateX(-50%); padding:12px 20px; background:#282043; color:white; border-radius:12px; box-shadow:0 5px 20px #29203630; max-width:calc(100vw - 24px); font-size:14px; text-align:center; }
.noscript { position:fixed; inset:20px; background:white; padding:25px; z-index:999; }
@media (min-width:1450px) and (min-height:820px) {
  .panel { padding:8px; gap:9px; }
  .hive-list { grid-template-rows:repeat(4,minmax(36px,1fr)); }
  .row-input { height:35px; }
  .panel-actions { grid-template-columns:1fr; }
  .panel-action { min-height:35px; }
  .add-satellite { min-height:45px; }
}
@media (min-width:901px) and (max-height:660px) {
  .app { padding:8px; grid-template-rows:80px minmax(0,1fr); gap:8px; }
  .topbar { gap:7px; }
  .brand { gap:8px; padding:8px; }
  .brand>img { width:48px; height:48px; }
  .brand h1 { font-size:23px; letter-spacing:-.6px; }
  .brand p { font-size:10px; }
  .lands { gap:8px; grid-auto-rows:calc((100% - 8px)/2); }
  .lands[data-layout=solo],   .terrain { padding:4px; gap:4px; border-radius:13px; }
  .panel { gap:4px; padding:3px; }
  .hive-list { grid-template-rows:repeat(4,minmax(25px,1fr)); min-height:100px; }
  .hive-row { gap:3px; }
  .row-input { height:25px; }
  .panel-head { min-height:25px; }
  .add-satellite { padding:3px; min-height:29px; }
  .add-satellite .plus-disc { width:24px; height:24px; }
  .panel-actions .panel-action { min-height:26px; }
  .local-result { padding:3px 6px; min-height:20px; }
  .lands[data-layout=solo] .hive-list { grid-template-rows:repeat(4,48px); }
}
@media (min-width:901px) and (max-width:1160px) {
  .topbar { grid-template-columns:minmax(260px,1.5fr) 158px 155px minmax(210px,1fr); gap:7px; }
  .brand { gap:8px; padding:8px; }
  .brand>img { width:45px; height:45px; }
  .brand h1 { font-size:21px; letter-spacing:-.7px; }
  .brand p { font-size:9px; }
  .energy-symbol { width:26px; height:42px; }
  .energy-total { gap:4px; }
  .top-card h2 { font-size:13px; }
  .terrain { grid-template-columns:minmax(0,1fr) 203px; }
  .hive-row { grid-template-columns:22px minmax(0,1fr) 9px 42px 18px; gap:3px; }
  .row-input { width:42px; }
}
@media (max-width:900px) {
  .app { padding:max(6px,env(safe-area-inset-top)) max(7px,env(safe-area-inset-right)) max(7px,env(safe-area-inset-bottom)) max(7px,env(safe-area-inset-left)); grid-template-rows:124px minmax(0,1fr); gap:8px; }
  .topbar { grid-template-columns:1fr 1fr 1.4fr; grid-template-rows:39px 79px; gap:6px; }
  .top-card { border-radius:13px; }
  .brand { grid-column:1/-1; justify-content:center; padding:4px 25px 4px 8px; gap:8px; }
  .brand>img { width:30px; height:30px; }
  .brand h1 { font-size:21px; letter-spacing:-.6px; margin:0; }
  .brand p { display:none; }
  .brand .help-button { top:8px; right:8px; }
  .top-card h2 { font-size:12px; }
  .terrain-count { gap:6px; padding:6px 3px; }
  .count-control { grid-template-columns:30px minmax(26px,40px) 30px; gap:1px; }
  .count-control button { width:30px; height:34px; font-size:23px; border-radius:8px; }
  .count-control input { height:34px; font-size:23px; border-radius:7px; }
  .energy-total { padding:6px 2px; gap:1px; }
  .energy-symbol { width:20px; height:34px; }
  .energy-total h2 { font-size:11px; }
  .energy-total output { font-size:26px; margin-top:8px; }
  .baby-total { background-color:#fff8dc; background-image:none !important; background-size:auto; border:1px solid #edcf77; }
  .baby-total output { left:50%; top:66%; font-size:24px; width:auto; min-width:42%; min-height:31%; padding:0 .9em; }
  .mobile-bee-title { display:block; position:absolute; top:7px; left:17%; right:17%; font-size:12px; line-height:1.05; font-weight:800; text-align:center; color:#22154e; text-shadow:none; }
  .mobile-bee { display:block; position:absolute; width:32%; height:46px; object-fit:contain; bottom:2px; }
  .mobile-bee.solar { left:-2px; }
  .mobile-bee.blood { right:-1px; }
  .lands { grid-template-columns:1fr; grid-auto-rows:calc((100% - 16px)/3); gap:8px; }
  .lands[data-layout=solo] { grid-auto-rows:100%; }
  .lands[data-layout=duo] { grid-auto-rows:calc((100% - 8px)/2); }
  .terrain, .lands[data-layout=solo] .terrain { grid-template-columns:minmax(0,1.12fr) minmax(145px,1fr); gap:5px; padding:5px; border-radius:14px; }
  .terrain .panel { display:none; }
  .stage { border-radius:10px; }
  .board .hive-name { font-size:clamp(6px,calc(var(--board-width) * .028),13px); padding:2px 3px; border-radius:5px; }
  .board .slot-delete { display:none; }
  .board .energy-control { display:grid; width:38%; grid-template-columns:21% minmax(0,1fr) 21%; gap:1px; height:clamp(28px,calc(var(--board-width) * .082),44px); }
  .board .energy-control button { font-size:clamp(15px,calc(var(--board-width) * .043),24px); }
  .board .energy-control label { padding:0 4px; }
  .board .energy-control input { min-width:0; width:0; flex:1 1 0; font-size:clamp(15px,calc(var(--board-width) * .039),20px); }
  .board .energy-control .bolt { margin-right:1px; font-size:clamp(8px,calc(var(--board-width) * .025),14px); }
  .board .empty-slot { border-width:1px; border-radius:9px; font-size:clamp(9px,calc(var(--board-width) * .028),13px); line-height:1.1; gap:3px; padding:2px; }
  .board .empty-slot>span { font-size:20px; }
  .compact-summary { display:flex; flex-direction:column; justify-content:space-evenly; min-width:0; gap:3px; padding:3px; }
  .compact-head { display:flex; justify-content:space-between; align-items:center; gap:3px; }
  .compact-head h2 { font-size:15px; margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .compact-values { display:grid; grid-template-columns:1fr 1fr; gap:3px; }
  .compact-value { border:1px solid #ede8ed; border-radius:6px; background:white; display:flex; align-items:center; justify-content:space-between; gap:2px; padding:3px 4px; font-size:10px; }
  .compact-value strong { font-size:14px; }
  .compact-value img { width:16px; height:16px; object-fit:contain; }
  .compact-result { display:flex; align-items:center; justify-content:space-between; font-size:10px; gap:4px; padding:3px 0; }
  .compact-result strong { font-size:16px; color:#613719; }
  .compact-edit { min-height:30px; border:1px solid #e6d09f; border-radius:8px; background:#fff5dc; color:#8a4b08; font-size:12px; font-weight:800; }
  .compact-actions { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
  .compact-reset { min-height:30px; border:1px solid #ead7cf; border-radius:8px; background:#fff7f2; color:#a94a34; font-size:12px; font-weight:800; }
  .compact-head .icon-button { width:26px; height:26px; }
  .lands[data-layout=solo] .terrain { grid-template-columns:1fr; grid-template-rows:minmax(0,1fr) 180px; }
  .lands[data-layout=solo] .compact-values { grid-template-columns:repeat(4,1fr); }
  .lands[data-layout=solo] .compact-value { flex-direction:column; }
  .lands[data-layout=solo] .compact-summary { padding:4px 10px; }
  .lands[data-layout=solo] .compact-head h2 { font-size:20px; }
  .lands[data-layout=solo] .compact-edit, .lands[data-layout=solo] .compact-reset { min-height:40px; font-size:14px; }
  .editor-dialog { padding:9px; max-height:calc(100dvh - 14px); width:calc(100vw - 14px); }
  .editor-dialog .dialog-top { margin:0 0 8px; padding:3px; position:sticky; top:0; background:#fffdfa; z-index:15; }
  .editor-dialog .terrain { display:grid; grid-template-columns:1fr; grid-template-rows:auto auto; gap:9px; min-height:0; padding:0; }
  .editor-dialog .stage { min-height:0; height:auto; aspect-ratio:520/391; }
  .editor-dialog .board .energy-control { display:grid; height:44px; width:29%; }
  .editor-dialog .board .energy-control button { font-size:22px; }
  .editor-dialog .board .energy-control input { font-size:19px; }
  .editor-dialog .board .energy-control .bolt { font-size:12px; }
  .editor-dialog .board .hive-name { font-size:10px; }
  .editor-dialog .board .slot-delete { display:none; }
  .editor-dialog .panel { display:flex; gap:8px; padding:6px; }
  .editor-dialog .panel-head { display:none; }
  .editor-dialog .hive-list { grid-template-rows:repeat(4,48px); }
  .editor-dialog .hive-row { grid-template-columns:29px minmax(0,1fr) 20px 70px 36px; gap:7px; }
  .editor-dialog .row-input { width:70px; height:42px; }
  .editor-dialog .row-name { font-size:14px; }
  .editor-dialog .row-remove { width:36px; height:42px; }
  .editor-dialog .row-remove svg { width:20px; height:20px; }
  .editor-dialog .add-label { font-size:14px; }
  .editor-dialog .add-satellite { min-height:45px; }
  .editor-dialog .panel-action { font-size:14px; min-height:44px; }
  .editor-dialog .local-result { min-height:33px; font-size:14px; }
  .editor-dialog .local-result strong { font-size:22px; }
  .editor-dialog .compact-summary { display:none; }
}
@media (max-width:360px) {
  .app { padding:5px; grid-template-rows:116px minmax(0,1fr); gap:6px; }
  .topbar { grid-template-rows:35px 75px; }
  .brand h1 { font-size:19px; }
  .count-control { grid-template-columns:27px 28px 27px; }
  .count-control button { width:27px; }
  .energy-symbol { display:none; }
  .terrain { grid-template-columns:minmax(0,1fr) 144px; }
  .compact-head h2 { font-size:13px; }
}
@media (max-height:550px) {
  .lands:not([data-layout=solo]):not([data-layout=duo]) { grid-auto-rows:minmax(145px,calc((100% - 16px)/3)); }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; animation:none!important; transition:none!important; } }
@media print {
  .app { height:auto; display:block; padding:0; background:white; }
  .topbar { height:90px; margin-bottom:12px; }
  .lands { overflow:visible; grid-auto-rows:320px!important; display:grid; grid-template-columns:1fr 1fr!important; }
  .terrain { break-inside:avoid; }
  .help-button,.slot-delete { display:none; }
}
