*{box-sizing:border-box;margin:0;padding:0;touch-action:none}
:root{
  color-scheme:dark;
  --font-ui:"Bahnschrift","Trebuchet MS","Segoe UI",sans-serif;
  --font-mono:"Consolas","Courier New",monospace;
  --bg-0:#06080c;
  --bg-1:#0c1118;
  --panel:#0e1218;
  --panel-2:rgba(11,15,21,0.84);
  --panel-3:rgba(17,22,29,0.78);
  --line:rgba(235,164,83,0.18);
  --line-strong:rgba(245,183,103,0.42);
  --amber:#f0af63;
  --amber-soft:#c98c4a;
  --amber-dim:#7f5528;
  --blue:#9dc8f1;
  --blue-dim:#49729c;
  --danger:#ef805d;
  --success:#86c077;
  --shadow:0 22px 48px rgba(0,0,0,0.45);
  --inset-shadow:inset 0 1px 0 rgba(255,255,255,0.05);
}
html,body{width:100%;height:100%;min-height:100%;overflow:hidden;overscroll-behavior:none}
html{
  background:
    radial-gradient(circle at top, rgba(77,114,160,0.26), transparent 42%),
    radial-gradient(circle at bottom, rgba(164,96,35,0.18), transparent 38%),
    linear-gradient(180deg, #080b10 0%, #06080c 100%);
}
body{
  display:flex;
  justify-content:center;
  align-items:stretch;
  font-family:var(--font-ui);
  color:#f3d5a6;
  background:
    radial-gradient(circle at 50% 0%, rgba(125,165,214,0.16), transparent 36%),
    linear-gradient(180deg, rgba(5,7,10,0.94), rgba(5,7,10,1));
}
#wrap{
  width:min(100vw,1024px);
  height:100vh;
  height:100dvh;
  max-width:1024px;
  margin:0 auto;
  border-radius:18px;
  overflow:hidden;
  user-select:none;
  background:
    linear-gradient(180deg, rgba(14,20,28,0.92), rgba(8,11,16,0.98));
  position:relative;
  display:flex;
  flex-direction:column;
  border:1px solid rgba(196,132,68,0.18);
  box-shadow:var(--shadow);
}
#wrap::before{
  content:'';
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(120deg, rgba(255,255,255,0.04), transparent 28%),
    repeating-linear-gradient(180deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 4px);
  opacity:0.2;
  mix-blend-mode:screen;
}
#wrap::after{
  content:'';
  position:absolute;
  inset:0;
  pointer-events:none;
  border:1px solid rgba(255,255,255,0.03);
  border-radius:18px;
}
#main{display:flex;flex:1 1 auto;min-height:260px;position:relative}
#peri{
  width:84px;
  background:
    linear-gradient(180deg, rgba(13,18,25,0.95), rgba(8,11,16,0.98));
  border-right:1px solid rgba(255,193,111,0.12);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  padding:10px 6px;
  gap:8px;
  flex-shrink:0;
  position:relative;
  box-shadow:inset -16px 0 32px rgba(0,0,0,0.2);
}
#peri::after{
  content:'';
  position:absolute;
  inset:10px 0 10px auto;
  width:1px;
  background:linear-gradient(180deg, transparent, rgba(255,181,96,0.26), transparent);
}
.plbl{
  font-size:9px;
  letter-spacing:0.28em;
  text-transform:uppercase;
  color:rgba(177,205,235,0.78);
  text-align:center;
}
#pcanvas{
  border:1px solid rgba(149,183,223,0.22);
  border-radius:10px;
  display:block;
  background:linear-gradient(180deg, rgba(24,35,49,0.88), rgba(9,14,20,0.95));
  box-shadow:0 12px 24px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.05);
}
.pdata{
  width:100%;
  padding:8px 6px 0;
  font-size:9px;
  color:rgba(230,187,121,0.86);
  text-align:center;
  line-height:1.7;
  font-family:var(--font-mono);
  letter-spacing:0.04em;
  text-shadow:0 0 12px rgba(238,173,95,0.15);
}
#cview{
  flex:1;
  min-width:0;
  min-height:0;
  overflow:hidden;
  position:relative;
  background:
    linear-gradient(180deg, rgba(18,28,41,0.95), rgba(6,9,13,1));
}
#cview::before{
  content:'';
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:1;
  background:
    radial-gradient(circle at center, transparent 42%, rgba(4,7,10,0.42) 100%),
    linear-gradient(180deg, rgba(121,156,203,0.06), transparent 28%),
    linear-gradient(0deg, rgba(219,136,64,0.08), transparent 26%);
}
#cview::after{
  content:'';
  position:absolute;
  inset:14px;
  pointer-events:none;
  z-index:1;
  background:
    linear-gradient(rgba(237,174,93,0.40), rgba(237,174,93,0.40)) left top/40px 1px no-repeat,
    linear-gradient(rgba(237,174,93,0.40), rgba(237,174,93,0.40)) left top/1px 40px no-repeat,
    linear-gradient(rgba(237,174,93,0.40), rgba(237,174,93,0.40)) right top/40px 1px no-repeat,
    linear-gradient(rgba(237,174,93,0.40), rgba(237,174,93,0.40)) right top/1px 40px no-repeat,
    linear-gradient(rgba(237,174,93,0.40), rgba(237,174,93,0.40)) left bottom/40px 1px no-repeat,
    linear-gradient(rgba(237,174,93,0.40), rgba(237,174,93,0.40)) left bottom/1px 40px no-repeat,
    linear-gradient(rgba(237,174,93,0.40), rgba(237,174,93,0.40)) right bottom/40px 1px no-repeat,
    linear-gradient(rgba(237,174,93,0.40), rgba(237,174,93,0.40)) right bottom/1px 40px no-repeat;
  opacity:0.75;
}
#ccanvas{display:block;width:100%;height:100%;cursor:crosshair;touch-action:none}
#g3dCanvas{
  position:absolute;
  inset:0;
  display:none;
  z-index:2;
  width:100%;
  height:100%;
  touch-action:none;
  cursor:grab;
  background:#000;
}
#scope-mask{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:3;
  --scope-cx:50%;
  --scope-cy:50%;
  display:none;
}
#scope-mask::before{
  content:'';
  position:absolute;
  left:var(--scope-cx);
  top:var(--scope-cy);
  width:min(86%,360px);
  height:min(86%,360px);
  transform:translate(-50%,-50%);
  border-radius:50%;
  background:
    radial-gradient(circle at center, rgba(237,180,96,0.07) 0%, rgba(0,0,0,0) 57%, rgba(0,0,0,0.24) 72%, rgba(0,0,0,0.72) 100%);
  box-shadow:
    0 0 0 1800px rgba(0,0,0,0.95),
    inset 0 0 0 1px rgba(145,98,34,0.52),
    inset 0 0 34px rgba(0,0,0,0.52),
    0 0 26px rgba(0,0,0,0.36);
}
#scope-mask::after{
  content:'';
  position:absolute;
  left:var(--scope-cx);
  top:var(--scope-cy);
  width:min(86%,360px);
  height:min(86%,360px);
  transform:translate(-50%,-50%);
  border-radius:50%;
  border:1px solid rgba(229,176,96,0.36);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.03),
    0 0 12px rgba(0,0,0,0.24);
}
#viewport-topbar{
  position:absolute;
  left:16px;
  right:16px;
  top:16px;
  z-index:4;
  pointer-events:none;
  display:flex;
  justify-content:space-between;
  gap:12px;
}
.vp-chip,
#viewport-status{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:10px 14px;
  min-width:0;
  border-radius:14px;
  border:1px solid rgba(245,183,103,0.22);
  background:
    linear-gradient(180deg, rgba(18,24,33,0.82), rgba(10,14,20,0.74));
  box-shadow:0 18px 32px rgba(0,0,0,0.26), var(--inset-shadow);
  backdrop-filter:blur(14px);
}
.vp-chip--brand{
  max-width:min(46%,240px);
}
.vp-chip--mode{
  margin-left:auto;
  align-items:flex-end;
  text-align:right;
  max-width:min(48%,280px);
}
.vp-kicker{
  font-size:9px;
  letter-spacing:0.24em;
  text-transform:uppercase;
  color:rgba(156,194,232,0.72);
}
.vp-value{
  font-size:15px;
  font-weight:600;
  line-height:1.1;
  color:#f2dcb6;
  text-shadow:0 0 18px rgba(238,183,108,0.12);
}
#viewport-status{
  position:absolute;
  right:16px;
  bottom:16px;
  z-index:4;
  pointer-events:none;
  width:min(42%,240px);
}
#camera-reset-btn{
  position:absolute;
  right:16px;
  top:78px;
  z-index:5;
  display:none;
  padding:6px 10px;
  font-size:9px;
  font-weight:600;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:#f0c48d;
  background:
    linear-gradient(180deg, rgba(18,24,33,0.86), rgba(10,14,20,0.78));
  border:1px solid rgba(245,183,103,0.22);
  border-radius:10px;
  cursor:pointer;
  user-select:none;
  touch-action:auto;
  pointer-events:auto;
  backdrop-filter:blur(10px);
  box-shadow:0 10px 20px rgba(0,0,0,0.20), inset 0 1px 0 rgba(255,255,255,0.04);
  transition:transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
#camera-reset-btn:active{transform:translateY(1px)}
#wrap[data-screen="combat-3d"] #camera-reset-btn{display:block}
#wrap[data-screen="intro"] .vp-chip,
#wrap[data-screen="intro"] #viewport-status{
  border-color:rgba(133,174,219,0.28);
  background:linear-gradient(180deg, rgba(15,26,40,0.76), rgba(8,14,22,0.68));
}
#wrap[data-screen="barracks"] .vp-chip,
#wrap[data-screen="barracks"] #viewport-status{
  border-color:rgba(238,183,101,0.30);
  background:linear-gradient(180deg, rgba(30,22,14,0.78), rgba(13,10,8,0.70));
}
#wrap[data-screen="menu"] .vp-chip--mode,
#wrap[data-screen="settings"] .vp-chip--mode,
#wrap[data-screen="confirm"] .vp-chip--mode{
  border-color:rgba(157,200,241,0.34);
}
#trial-type-panel,
#trial-difficulty-panel,
#menu-panel,
#settings-panel{
  background:
    linear-gradient(180deg, rgba(18,24,33,0.94), rgba(9,13,19,0.96));
  border:1px solid rgba(239,183,104,0.24);
  border-radius:16px;
  box-shadow:0 26px 48px rgba(0,0,0,0.40), var(--inset-shadow);
  backdrop-filter:blur(18px);
}
#trial-type-panel,
#trial-difficulty-panel{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:min(84%,380px);
  padding:16px;
  display:none;
  z-index:8;
  touch-action:auto;
  pointer-events:auto;
}
#trial-difficulty-panel{
  z-index:9;
}
#trial-type-panel .btitle,
#trial-difficulty-panel .btitle{
  font-size:11px;
  letter-spacing:0.28em;
  text-transform:uppercase;
  color:#f0ba50;
  text-align:center;
  margin-bottom:12px;
}
.bitem,
.mitem{
  background:
    linear-gradient(180deg, rgba(33,24,15,0.82), rgba(18,14,10,0.72));
  border:1px solid rgba(255,188,101,0.14);
  border-radius:12px;
  color:#e8bf87;
  font-size:12px;
  padding:11px 12px;
  margin-bottom:8px;
  touch-action:auto;
  cursor:pointer;
  user-select:none;
  transition:transform 120ms ease, border-color 120ms ease, background 120ms ease, color 120ms ease, box-shadow 120ms ease;
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.03);
}
.bitem:last-child,
.mitem:last-child{margin-bottom:0}
.bitem:active,
.mitem:active{transform:translateY(1px) scale(0.995)}
.bitem.locked,
.mitem.locked{
  opacity:0.45;
  color:#8a6a3a;
  border-color:rgba(123,89,48,0.18);
}
.bitem.active,
.mitem.active{
  background:linear-gradient(180deg, rgba(57,37,18,0.92), rgba(24,18,12,0.84));
  border-color:rgba(255,187,103,0.36);
  color:#f7d7ab;
  box-shadow:0 10px 22px rgba(0,0,0,0.24), inset 0 0 0 1px rgba(255,255,255,0.03);
}
#hud{
  display:flex;
  justify-content:space-between;
  align-items:stretch;
  gap:8px;
  padding:12px 14px 10px;
  background:
    linear-gradient(180deg, rgba(13,18,24,0.94), rgba(8,11,16,0.98));
  border-top:1px solid rgba(255,184,98,0.12);
  touch-action:auto;
}
.hs{
  flex:1 1 0;
  min-width:0;
  min-height:58px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:4px;
  padding:8px 6px;
  border-radius:14px;
  border:1px solid rgba(245,183,103,0.12);
  background:
    linear-gradient(180deg, rgba(19,25,34,0.84), rgba(11,16,22,0.78));
  box-shadow:0 14px 24px rgba(0,0,0,0.18), var(--inset-shadow);
}
.hv{
  font-size:16px;
  font-weight:700;
  color:#f2bd72;
  font-family:var(--font-mono);
  text-shadow:0 0 18px rgba(244,182,101,0.16);
}
.hl{
  font-size:9px;
  letter-spacing:0.18em;
  text-transform:uppercase;
  color:rgba(152,185,220,0.62);
}
#msg{
  position:relative;
  text-align:center;
  padding:12px 16px 12px 82px;
  font-size:12px;
  color:#efc48f;
  background:
    linear-gradient(180deg, rgba(12,17,23,0.94), rgba(9,12,18,0.98));
  min-height:46px;
  border-top:1px solid rgba(255,184,98,0.10);
  touch-action:auto;
  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1.3;
}
#msg::before{
  content:'RADIO';
  position:absolute;
  left:18px;
  top:50%;
  transform:translateY(-50%);
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(145,187,231,0.18);
  background:rgba(18,29,41,0.55);
  color:rgba(160,199,236,0.76);
  font-size:9px;
  letter-spacing:0.20em;
  text-transform:uppercase;
}
#btns{
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:8px;
  padding:12px 14px 14px;
  background:
    linear-gradient(180deg, rgba(10,14,19,0.98), rgba(7,10,14,1));
  touch-action:auto;
}
.btn{
  position:relative;
  overflow:hidden;
  background:
    linear-gradient(180deg, rgba(26,32,40,0.92), rgba(12,16,22,0.92));
  border:1px solid rgba(150,192,235,0.13);
  border-radius:14px;
  color:#c8d8eb;
  font-size:12px;
  letter-spacing:0.12em;
  text-transform:uppercase;
  padding:12px 10px;
  min-height:52px;
  text-align:center;
  cursor:pointer;
  user-select:none;
  touch-action:auto;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 16px 28px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.06);
  transition:transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease, background 120ms ease;
}
.btn::before{
  content:'';
  position:absolute;
  inset:1px;
  border-radius:12px;
  background:linear-gradient(180deg, rgba(255,255,255,0.07), transparent 42%);
  opacity:0.7;
  pointer-events:none;
}
.btn:active{transform:translateY(1px) scale(0.99)}
#bfire{
  background:linear-gradient(180deg, rgba(84,31,26,0.94), rgba(35,14,12,0.94));
  border-color:rgba(235,128,93,0.34);
  color:#ffd4c2;
  font-size:13px;
  font-weight:700;
}
#bfire.is-ready{
  box-shadow:0 0 0 1px rgba(239,128,93,0.22), 0 16px 30px rgba(118,40,30,0.34), inset 0 1px 0 rgba(255,255,255,0.06);
}
#bfire.is-disabled{
  border-color:rgba(129,93,88,0.20);
  color:rgba(222,182,171,0.72);
}
#breset{
  background:linear-gradient(180deg, rgba(28,44,27,0.92), rgba(11,18,12,0.92));
  border-color:rgba(132,192,119,0.22);
  color:#bfe6bb;
}
#bkas{
  background:linear-gradient(180deg, rgba(52,38,19,0.92), rgba(19,14,11,0.92));
  border-color:rgba(231,184,104,0.18);
  color:#efce9b;
}
#bmenu{
  background:linear-gradient(180deg, rgba(21,35,49,0.92), rgba(11,16,23,0.92));
  border-color:rgba(148,193,235,0.20);
  color:#cee0f1;
  font-size:13px;
  font-weight:600;
}
#menu-panel{
  padding:12px;
  display:none;
  touch-action:auto;
}
#menu-panel::before{
  content:'Vyber modul';
  display:block;
  margin-bottom:10px;
  color:rgba(160,199,236,0.74);
  font-size:10px;
  letter-spacing:0.22em;
  text-transform:uppercase;
}
#menu-panel .mitem[data-challenge]{display:none}
#settings-panel{
  padding:14px;
  display:none;
  touch-action:auto;
}
#settings-panel::before{
  content:'Nastavenia';
  display:block;
  margin-bottom:12px;
  color:rgba(160,199,236,0.74);
  font-size:10px;
  letter-spacing:0.22em;
  text-transform:uppercase;
}
.settings-section{
  margin:12px 0 8px;
  padding-top:10px;
  border-top:1px solid rgba(148,193,235,0.12);
  color:rgba(160,199,236,0.72);
  font-size:9px;
  letter-spacing:0.18em;
  text-transform:uppercase;
}
.settings-section:first-of-type{
  margin-top:0;
  padding-top:0;
  border-top:0;
}
.srow{display:flex;align-items:center;gap:8px;margin-bottom:10px;touch-action:auto}
.slbl{
  font-size:10px;
  color:rgba(221,194,148,0.84);
  width:112px;
  flex-shrink:0;
  letter-spacing:0.04em;
}
.sval{
  font-size:11px;
  color:#f2bd72;
  width:38px;
  text-align:right;
  font-weight:700;
  font-family:var(--font-mono);
}
input[type=range]{
  flex:1;
  height:4px;
  accent-color:#e07020;
  cursor:pointer;
  touch-action:auto;
}
#confirm-reset{
  display:none;
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at center, rgba(17,23,31,0.32), rgba(0,0,0,0.84));
  z-index:10;
  align-items:center;
  justify-content:center;
  touch-action:auto;
}
#confirm-reset.show{display:flex}
.cr-box{
  background:linear-gradient(180deg, rgba(20,26,35,0.96), rgba(11,14,20,0.98));
  border:1px solid rgba(240,177,95,0.24);
  border-radius:18px;
  padding:22px 24px;
  text-align:center;
  box-shadow:0 28px 50px rgba(0,0,0,0.42), var(--inset-shadow);
}
.cr-title{
  color:#f0c48d;
  font-size:16px;
  margin-bottom:16px;
  letter-spacing:0.04em;
}
.cr-btns{display:flex;gap:12px;justify-content:center}
.cr-btn{
  padding:10px 20px;
  border-radius:10px;
  cursor:pointer;
  font-size:12px;
  font-family:var(--font-ui);
  font-weight:700;
  letter-spacing:0.08em;
  text-transform:uppercase;
  border:none;
  touch-action:auto;
}
#cr-yes{background:#5b2922;color:#ffd4c2}
#cr-no{background:#243321;color:#c7ebb9}
.vp-chip,
#viewport-status,
#hud,
#msg,
#btns{
  animation:chrome-enter 540ms cubic-bezier(.2,.8,.2,1);
}
@keyframes chrome-enter{
  from{opacity:0;transform:translateY(10px)}
  to{opacity:1;transform:translateY(0)}
}
@keyframes fire-pulse{
  0%,100%{box-shadow:0 0 0 1px rgba(239,128,93,0.20), 0 16px 30px rgba(118,40,30,0.28), inset 0 1px 0 rgba(255,255,255,0.06)}
  50%{box-shadow:0 0 0 1px rgba(255,169,118,0.30), 0 20px 34px rgba(160,52,38,0.40), inset 0 1px 0 rgba(255,255,255,0.08)}
}
#bfire.is-ready{animation:fire-pulse 1.9s ease-in-out infinite}
@media (prefers-reduced-motion: reduce){
  .vp-chip,
  #viewport-status,
  #hud,
  #msg,
  #btns,
  #bfire.is-ready{animation:none}
  .btn,
  .bitem,
  .mitem{transition:none}
}
@media (hover:hover){
  .btn:hover,
  .bitem:hover,
  .mitem:hover{
    transform:translateY(-1px);
    border-color:rgba(241,188,111,0.30);
  }
  .btn:hover{box-shadow:0 18px 32px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.06)}
}
@media (max-width: 560px){
  #wrap{width:100vw;max-width:none;border-radius:0}
  #wrap::after{border-radius:0}
  #main{height:300px}
  #peri{width:64px;padding:8px 4px;gap:6px}
  #pcanvas{width:54px;height:172px}
  .pdata{font-size:8px;line-height:1.54}
  #viewport-topbar{top:10px;left:10px;right:10px;gap:8px}
  .vp-chip{padding:8px 10px;border-radius:12px}
  .vp-chip--brand{max-width:140px}
  .vp-chip--mode{max-width:160px}
  .vp-kicker{font-size:8px}
  .vp-value{font-size:12px}
  #viewport-status{
    right:10px;
    bottom:10px;
    width:min(52%,180px);
    padding:8px 10px;
    border-radius:12px;
  }
  #camera-reset-btn{
    right:10px;
    top:62px;
    padding:5px 8px;
    font-size:8px;
    border-radius:8px;
  }
  #scope-mask::before,#scope-mask::after{width:min(88%,320px);height:min(88%,320px)}
  #hud{padding:8px 10px 6px;gap:6px}
  .hs{min-height:52px;padding:6px 4px}
  .hv{font-size:13px}
  .hl{font-size:8px}
  #msg{font-size:10px;padding:10px 10px 10px 66px;min-height:40px}
  #msg::before{left:12px;padding:3px 7px}
  #btns{gap:6px;padding:10px}
  .btn{font-size:10px;padding:10px 6px;min-height:48px}
  #trial-type-panel,#trial-difficulty-panel{width:min(92%,340px);padding:12px}
  .bitem,.mitem{font-size:12px;padding:10px}
}
@media (orientation: landscape) and (max-height: 560px){
  #wrap{
    width:100vw;
    max-width:none;
    border-radius:0;
    display:grid;
    grid-template-columns:minmax(0,1fr) clamp(204px,24vw,240px);
    grid-template-rows:auto auto minmax(0,1fr);
    grid-template-areas:
      "main hud"
      "main msg"
      "main btns";
    padding:
      max(4px, env(safe-area-inset-top))
      max(6px, env(safe-area-inset-right))
      max(4px, env(safe-area-inset-bottom))
      max(6px, env(safe-area-inset-left));
  }
  #wrap::after{border-radius:0}
  #main{grid-area:main;height:100%;min-height:0;min-width:0}
  #peri{width:58px;padding:6px 4px;gap:4px}
  #pcanvas{width:48px;height:144px}
  .plbl{font-size:7px}
  .pdata{font-size:7px;line-height:1.34}
  #viewport-topbar{left:10px;right:10px;top:10px}
  .vp-chip{padding:8px 10px}
  .vp-value{font-size:12px}
  #viewport-status{right:10px;bottom:10px;width:min(45%,180px);padding:8px 10px}
  #camera-reset-btn{right:10px;top:58px;padding:5px 8px;font-size:8px}
  #scope-mask::before,#scope-mask::after{width:min(92%,300px);height:min(92%,300px)}
  #hud{
    grid-area:hud;
    display:grid;
    grid-template-columns:1fr 1fr;
    align-content:start;
    gap:6px;
    padding:8px;
    border-top:none;
    border-left:1px solid rgba(255,184,98,0.10);
  }
  #hud .hs:last-child{grid-column:1 / -1}
  .hs{min-width:0;min-height:36px;padding:6px 4px}
  .hv{font-size:11px}
  .hl{font-size:7px}
  #msg{
    grid-area:msg;
    font-size:10px;
    padding:8px 8px 8px 58px;
    min-height:46px;
    border-left:1px solid rgba(255,184,98,0.10);
  }
  #msg::before{left:10px}
  #btns{
    grid-area:btns;
    grid-template-columns:1fr 1fr;
    gap:6px;
    padding:8px;
    border-left:1px solid rgba(255,184,98,0.10);
    align-content:end;
  }
  .btn{font-size:10px;padding:8px 6px;min-height:52px}
  #bfire,#bmenu{font-size:11px}
  #menu-panel,#settings-panel{
    position:absolute;
    top:max(6px, env(safe-area-inset-top));
    right:max(6px, env(safe-area-inset-right));
    width:clamp(204px,24vw,240px);
    max-height:calc(100% - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
    overflow:auto;
    z-index:11;
  }
  #trial-type-panel,#trial-difficulty-panel{width:min(72vw,420px);max-height:calc(100% - 20px);overflow:auto}
}
@media (orientation: landscape) and (min-width: 880px) and (max-height: 460px){
  #wrap{grid-template-columns:minmax(0,1fr) 220px}
  #peri{width:60px}
  #pcanvas{width:48px;height:150px}
  #scope-mask::before,#scope-mask::after{width:min(88%,324px);height:min(88%,324px)}
  .hv{font-size:12px}
  .btn{min-height:54px}
  #menu-panel,#settings-panel{width:220px}
}
