/* Beam: editor and game shell. Quiet dark chrome so the neon on the wall stays the brightest thing on screen. */

:root {
  --bg: #07080b;
  --chrome: #0b0d12;
  --card: #10131a;
  --card2: #171b26;
  --line: rgba(255, 255, 255, 0.07);
  --line2: rgba(255, 255, 255, 0.13);
  --text: #e8ecf4;
  --soft: #c3cad8;
  --dim: #8d95a8;
  --faint: #5f6779;
  --acc: #19f0ff;
  --acc-ink: #031317;
  --warn: #ffd23d;
  --err: #ff4d5e;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: grid;
  grid-template-rows: 50px minmax(0, 1fr) 28px;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: 0.35; pointer-events: none; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid rgba(25, 240, 255, 0.55); outline-offset: 2px; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }

#top {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0 12px;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; letter-spacing: 0.01em; flex: none; }
.brand svg { filter: drop-shadow(0 0 6px rgba(25, 240, 255, 0.45)); }

#steps { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
#steps::-webkit-scrollbar { display: none; }
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 13px 0 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--dim);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.step b {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 650;
}
.step:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.step.on { color: var(--text); background: rgba(25, 240, 255, 0.07); border-color: rgba(25, 240, 255, 0.32); }
.step.on b { background: var(--acc); color: var(--acc-ink); }
.step.done:not(.on) b { color: var(--acc); box-shadow: inset 0 0 0 1px rgba(25, 240, 255, 0.5); }

#topRight { display: flex; align-items: center; gap: 8px; flex: none; }
.mini { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 12px; }
.sep { width: 1px; height: 22px; margin: 0 2px; background: var(--line2); }

.sel {
  height: 30px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238d95a8' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.seg button {
  height: 26px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--card2); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 3px rgba(0, 0, 0, 0.45); }
.card .seg { display: flex; }
.card .seg button { flex: 1; padding: 0 6px; }

.btn {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line2);
  border-radius: 9px;
  background: var(--card2);
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.btn:hover { background: #1d2231; border-color: rgba(255, 255, 255, 0.2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--acc); border-color: transparent; color: var(--acc-ink); font-weight: 650; }
.btn.primary:hover { background: #6af6ff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.05); }
.btn.small { height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn.big { height: 42px; font-size: 14px; }
.icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
}
.icon:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

#main { display: grid; grid-template-columns: auto minmax(0, 1fr) 316px; grid-template-rows: minmax(0, 1fr); min-height: 0; }

#toolbar {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 54px;
  padding: 8px 6px;
  overflow-y: auto;
  background: var(--chrome);
  border-right: 1px solid var(--line);
}
#toolbar.off { display: none; }
.tool {
  display: grid;
  place-items: center;
  width: 42px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--dim);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.tool:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tool.on { color: var(--acc); background: rgba(25, 240, 255, 0.09); border-color: rgba(25, 240, 255, 0.3); }
.tsep { height: 1px; margin: 4px 6px; background: var(--line); flex: none; }

#stage { grid-column: 2; grid-row: 1; position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); touch-action: none; user-select: none; -webkit-user-select: none; }
#stage canvas { position: absolute; left: 0; top: 0; display: block; }

#stagebar {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(11, 13, 18, 0.88);
}
#stagebar .icon { width: 30px; height: 30px; }

#hud {
  position: absolute;
  top: 12px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 16px;
  border: 1px solid var(--line2);
  border-radius: 999px;
  background: rgba(7, 8, 11, 0.8);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity 0.2s, transform 0.2s;
}
#hud.on { opacity: 1; transform: translate(-50%, 0); }
#hud .coin { color: var(--warn); }
#hud .pw { padding: 2px 8px; border: 1px solid var(--line2); border-radius: 999px; font-size: 11px; font-style: normal; }
#hud .pw.big { color: #ff8cf6; }
#hud .pw.feather { color: #c8f7ff; }
#hud .pw.star { color: var(--warn); }

#toast {
  position: absolute;
  left: 50%;
  bottom: 22px;
  max-width: min(560px, calc(100% - 32px));
  padding: 10px 16px;
  border: 1px solid var(--line2);
  border-radius: 12px;
  background: rgba(16, 19, 26, 0.95);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  color: var(--soft);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast > div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#toast b { color: var(--text); font-size: 20px; }
#toast button { margin-top: 6px; pointer-events: auto; }
#toast:not(.on) button { pointer-events: none; }

#panel {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  overflow-y: auto;
  background: var(--chrome);
  border-left: 1px solid var(--line);
}
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  flex: none;
}
.card h3 { margin: 0; color: var(--dim); font-size: 11.5px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.card p { margin: 0; color: var(--soft); }
.card p.fine { color: var(--faint); font-size: 12px; }
.card p.fine a { color: var(--dim); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.2); }

.row { display: flex; align-items: flex-end; gap: 8px; }
.row.wrap { flex-wrap: wrap; align-items: center; gap: 6px; }
.row > .field, .row > .btn { flex: 1; }

.field { display: flex; flex-direction: column; gap: 5px; color: var(--dim); font-size: 12px; }
.field input[type=text], .field input[type=number] {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.field input:focus { border-color: rgba(25, 240, 255, 0.5); }
.field .sel { width: 100%; }
.field.num { position: relative; }
.field.num input { padding-right: 34px; font-variant-numeric: tabular-nums; }
.field.num i { position: absolute; right: 10px; bottom: 8px; color: var(--faint); font-style: normal; pointer-events: none; }

ol.steps { display: flex; flex-direction: column; gap: 5px; margin: 0; padding-left: 18px; color: var(--soft); }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.toggle input { position: absolute; width: 0; height: 0; opacity: 0; }
.toggle .knob { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, 0.13); transition: background 0.18s; }
.toggle .knob::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.4, 1);
}
.toggle input:checked + .knob { background: var(--acc); }
.toggle input:checked + .knob::after { transform: translateX(14px); }
.toggle input:focus-visible + .knob { outline: 2px solid rgba(25, 240, 255, 0.55); outline-offset: 2px; }
.toggle .tl { color: var(--soft); }

.slider { display: flex; flex-direction: column; gap: 4px; }
.slider .sl { display: flex; justify-content: space-between; gap: 8px; color: var(--soft); }
.slider .val { color: var(--dim); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; height: 22px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.13); }
input[type=range]::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); -webkit-appearance: none; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.13); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }

.walls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wall {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line2);
  border-radius: 10px;
  background: var(--bg);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wall img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; opacity: 0.72; transition: opacity 0.15s; }
.wall span { padding: 6px 9px 7px; overflow: hidden; color: var(--soft); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.wall:hover img, .wall.on img { opacity: 1; }
.wall.on { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.wall .x {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(7, 8, 11, 0.85);
  color: var(--text);
  font-size: 15px;
  font-style: normal;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.wall:hover .x { opacity: 1; }

.lwalls { display: flex; flex-direction: column; gap: 4px; }
.lw {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--line2);
  border-radius: 10px;
  background: var(--bg);
  color: var(--soft);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.lw:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }
.lw.on { color: var(--text); border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.lw span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pico { display: grid; place-items: center; color: var(--acc); filter: drop-shadow(0 0 5px rgba(25, 240, 255, 0.45)); }
.lw .x {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--dim);
  font-size: 15px;
  font-style: normal;
  line-height: 1;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.15s, background 0.15s;
}
.lw:hover .x { opacity: 1; }
.lw .x:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.ibtn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.ibtn i { display: grid; place-items: center; color: var(--acc); }
.col { display: flex; flex-direction: column; gap: 6px; }

.pbtn { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 11px; }
.pdot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: background 0.2s, box-shadow 0.2s; }
.pbtn.on .pdot, .pstat.on .pdot { background: var(--acc); box-shadow: 0 0 8px var(--acc); }
.pstat { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--soft); }
.pstat.on { border-color: rgba(25, 240, 255, 0.3); }
.card p.warn { color: var(--warn); font-size: 12px; }

.types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.type {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--dim);
  font-size: 11.5px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.type:hover { color: var(--text); border-color: var(--line2); }
.type.on { color: var(--text); border-color: rgba(255, 255, 255, 0.4); background: var(--card2); }
.sw {
  width: 28px;
  height: 14px;
  border: 1.5px solid var(--c);
  border-radius: 4px;
  box-shadow: 0 0 9px color-mix(in srgb, var(--c) 55%, transparent), inset 0 0 6px color-mix(in srgb, var(--c) 45%, transparent);
}
.sw.mask { border-color: rgba(255, 255, 255, 0.4); background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0 1.5px, transparent 1.5px 5px); box-shadow: none; }

.ops { display: flex; flex-wrap: wrap; gap: 6px; }

.list { display: flex; flex-direction: column; gap: 2px; max-height: 280px; margin: 0 -4px; overflow-y: auto; }
.li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--soft);
  text-align: left;
}
.li:hover { background: rgba(255, 255, 255, 0.04); }
.li.on { background: rgba(25, 240, 255, 0.08); color: var(--text); }
.li .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px color-mix(in srgb, var(--c) 70%, transparent); }
.li .dot.mask { background: transparent; border: 1.5px solid rgba(255, 255, 255, 0.4); box-shadow: none; }
.li span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.li em { color: var(--faint); font-size: 11px; font-style: normal; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stats div { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.stats b { font-size: 19px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--faint); font-size: 11px; }

table.keys { width: 100%; border-collapse: collapse; font-size: 12px; }
.keys th { padding: 0 4px 5px; color: var(--faint); font-weight: 500; text-align: left; }
.keys td { padding: 6px 4px; border-top: 1px solid var(--line); color: var(--soft); }
.keys td:first-child { color: var(--dim); font-weight: 650; }

#status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 12px;
  overflow: hidden;
  background: var(--chrome);
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
}
#hint { overflow: hidden; text-overflow: ellipsis; }
#coords { color: var(--faint); font-variant-numeric: tabular-nums; }

#loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: var(--bg);
  transition: opacity 0.4s;
}
#loading.off { opacity: 0; pointer-events: none; }
#loading p { margin: 0; color: var(--dim); }
#loading.err p { max-width: 440px; color: var(--err); text-align: center; }
#loading.err .spin { display: none; }
.spin {
  width: 46px;
  height: 46px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--acc);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(25, 240, 255, 0.18);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.nojs { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; background: var(--bg); color: var(--dim); z-index: 60; }

@media (max-width: 1080px) {
  #main { grid-template-columns: auto minmax(0, 1fr) 280px; }
  .mini { display: none; }
  .step { padding: 0 10px 0 6px; }
}

@media (max-width: 760px) {
  body { grid-template-rows: auto minmax(0, 1fr) 28px; }
  #top { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  #steps { order: 3; flex-basis: 100%; }
  #topRight { margin-left: auto; }
  #main { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 40%; }
  #panel { grid-column: 1 / -1; grid-row: 2; border-left: 0; border-top: 1px solid var(--line); }
  .step:not(.on) { padding: 0 7px; }
  .step:not(.on) span { display: none; }
  #hud { top: 56px; }
}
