:root {
  --bg: #0a0c1a; --panel: #151833; --panel2: #1d2145; --line: #2d3361; --text: #e6e8ff; --muted: #8a8fbf;
  --cyan: #4af0ff; --pink: #ff6ad5; --yellow: #ffe14a; --green: #59f06a; --red: #ff4a4a; --orange: #ff9a3c;
  --pix: 'Press Start 2P', monospace; --vt: 'VT323', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--vt); font-size: 20px; overflow: hidden; }
.hidden { display: none !important; }
button { font-family: var(--pix); font-size: 10px; background: var(--panel2); color: var(--text); border: 2px solid var(--line); padding: 8px 10px; cursor: pointer; box-shadow: 0 3px 0 #05060f; }
button:hover { border-color: var(--cyan); color: #fff; }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 #05060f; }
button.big, button.primary { background: #1f6b4a; border-color: #2fae73; }
button.big:hover, button.primary:hover { background: #26855c; }
input, textarea, select { font-family: var(--vt); font-size: 20px; background: #0b0d1f; color: var(--text); border: 2px solid var(--line); padding: 4px 8px; outline: none; }
input:focus, textarea:focus { border-color: var(--cyan); }
kbd { font-family: var(--pix); font-size: 8px; background: #23284f; border: 1px solid #3d4589; border-bottom-width: 3px; padding: 3px 5px; margin-right: 3px; color: #fff; }
.screen { position: fixed; inset: 0; }

/* ---------------- MENU ---------------- */
#menu { display: flex; align-items: center; justify-content: center; overflow: auto; }
.menu-bg { position: fixed; inset: 0; background:
  linear-gradient(transparent 95%, rgba(74,240,255,.06) 95%) 0 0/24px 24px,
  linear-gradient(90deg, transparent 95%, rgba(74,240,255,.06) 95%) 0 0/24px 24px,
  radial-gradient(ellipse at 50% 30%, #1a1f4a, #07081a 70%); animation: scroll 6s linear infinite; }
@keyframes scroll { to { background-position: 0 24px, 24px 0, 0 0; } }
.menu-box { position: relative; width: min(1100px, 96vw); margin: 20px auto; }
.logo { font-family: var(--pix); font-size: clamp(28px, 6vw, 58px); text-align: center; margin: 10px 0 24px; color: var(--green);
  text-shadow: 4px 4px 0 #14162b, 6px 6px 0 #ff6ad5; letter-spacing: 2px; }
.logo span { display: block; font-family: var(--vt); font-size: 26px; color: var(--cyan); text-shadow: none; letter-spacing: 1px; margin-top: 10px; }
.logo span::after { content: '█'; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.menu-cols { display: grid; grid-template-columns: 1fr 1.25fr; gap: 18px; }
@media (max-width: 860px) { .menu-cols { grid-template-columns: 1fr; } }
.panel { background: rgba(21,24,51,.92); border: 3px solid var(--line); padding: 14px 18px; box-shadow: 6px 6px 0 #05060f; }
.panel h3 { font-family: var(--pix); font-size: 11px; color: var(--yellow); margin: 14px 0 8px; }
.panel h3:first-child { margin-top: 0; }
.panel label { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.panel label input:not([type]) , .panel label input[maxlength] { flex: 1; }
.colors { display: flex; gap: 6px; margin: 8px 0; }
.colors i { width: 28px; height: 28px; border: 3px solid #05060f; cursor: pointer; }
.colors i.sel { outline: 3px solid #fff; }
.rooms { max-height: 170px; overflow: auto; border: 2px solid var(--line); background: #0b0d1f; padding: 4px; }
.room { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; cursor: pointer; border-bottom: 1px dashed var(--line); }
.room:hover { background: var(--panel2); }
.room b { color: var(--cyan); font-family: var(--pix); font-size: 10px; margin-right: 8px; }
.room .tag { color: var(--pink); font-size: 16px; margin-left: 6px; }
.muted { color: var(--muted); padding: 6px; }
.row { display: flex; gap: 8px; margin: 8px 0; align-items: center; }
.row input.code { width: 90px; text-transform: uppercase; font-family: var(--pix); font-size: 12px; }
.checks label { margin: 0 12px 0 0; }
.err { color: var(--red); min-height: 22px; margin-top: 6px; }
.how p, .how li { line-height: 1.15; }
.how ul { padding-left: 18px; margin: 6px 0; }
.how li { margin: 6px 0; }
.g { color: var(--green); } .y { color: var(--yellow); } .o { color: #ff7a4f; } .p { color: #ff6ad5; } .c { color: var(--cyan); } .gr { color: #59f06a; }
.keys { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; font-size: 18px; }

/* ---------------- GRA ---------------- */
#cv { position: absolute; left: 0; top: 0; image-rendering: pixelated; cursor: none; }
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55)); }
.lowhp { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px rgba(255,0,40,.7); opacity: 0; transition: opacity .3s; }
.hud { position: absolute; pointer-events: none; }
.hud.tl { left: 12px; top: 12px; width: 240px; }
.bar { position: relative; height: 18px; background: #0b0d1f; border: 3px solid #05060f; margin-bottom: 6px; box-shadow: 3px 3px 0 rgba(0,0,0,.5); }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; transition: width .1s; }
.bar.hp i { background: linear-gradient(#7dff8e, #38c450); }
.bar.hp i.sh { background: rgba(74,240,255,.6); height: 5px; }
.bar.en i { background: linear-gradient(#7ff6ff, #2aa8d8); }
.bar span { position: absolute; inset: 0; text-align: center; font-family: var(--pix); font-size: 8px; line-height: 12px; color: #fff; text-shadow: 1px 1px 0 #000; }
.bity { font-family: var(--pix); font-size: 10px; color: var(--yellow); text-shadow: 2px 2px 0 #000; }
.noen { margin-top: 6px; font-family: var(--pix); font-size: 9px; color: var(--red); text-shadow: 2px 2px 0 #000; animation: blink .25s steps(1) infinite; }
.hud.tc { left: 50%; top: 10px; transform: translateX(-50%); text-align: center; width: 520px; }
.wave { font-family: var(--pix); font-size: 16px; color: #fff; text-shadow: 3px 3px 0 #000; }
.phase { font-size: 22px; color: var(--cyan); text-shadow: 2px 2px 0 #000; margin-top: 4px; }
.phase b { color: var(--yellow); }
.boss { margin: 6px auto 0; width: 420px; }
.boss span { font-family: var(--pix); font-size: 10px; color: var(--red); text-shadow: 2px 2px 0 #000; }
.bb { height: 12px; border: 3px solid #05060f; background: #2a0b14; margin-top: 4px; }
.bb i { display: block; height: 100%; background: linear-gradient(#ff6a6a, #c41a3a); }
.toasts { margin-top: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.toast { background: rgba(10,12,26,.85); border: 2px solid var(--line); padding: 4px 10px; font-size: 20px; animation: tin .2s; }
.toast.ok { border-color: var(--green); color: #b8ffc2; } .toast.err { border-color: var(--red); color: #ffb8b8; }
.toast.warn { border-color: var(--orange); color: #ffd7a8; } .toast.boss { border-color: var(--red); color: #fff; background: rgba(120,10,30,.85); font-family: var(--pix); font-size: 11px; padding: 8px 12px; }
@keyframes tin { from { transform: translateY(-8px); opacity: 0; } }
.hud.tr { right: 12px; top: 12px; width: 200px; text-align: right; }
.roomcode { font-family: var(--pix); font-size: 9px; color: var(--muted); margin-bottom: 6px; text-shadow: 2px 2px 0 #000; }
.roomcode b { color: var(--cyan); }
#minimap { width: 174px; image-rendering: pixelated; border: 3px solid #05060f; background: #0d1022; opacity: .9; }
.team { margin-top: 6px; }
.tm { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 19px; text-shadow: 2px 2px 0 #000; margin-bottom: 3px; }
.tm .hb { width: 60px; height: 6px; background: #05060f; border: 1px solid #05060f; } .tm .hb i { display: block; height: 100%; background: var(--green); }
.tm .sw { width: 10px; height: 10px; border: 2px solid #05060f; }
.tm.down { opacity: .6; } .tm .rd { color: var(--green); font-family: var(--pix); font-size: 8px; }
.hud.bl { left: 12px; bottom: 44px; width: 420px; pointer-events: auto; }
.chatlog { font-size: 19px; text-shadow: 2px 2px 0 #000; max-height: 190px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.chatlog div { animation: tin .2s; }
#chatin { width: 100%; margin-top: 4px; }
.hud.bc { left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 18px; font-size: 18px; color: var(--muted); text-shadow: 2px 2px 0 #000; white-space: nowrap; }
.over { position: absolute; inset: 0; background: rgba(40,0,10,.75); display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.over h2 { font-family: var(--pix); color: var(--red); font-size: 30px; text-shadow: 4px 4px 0 #000; margin: 0 0 10px; }
.over table { border-collapse: collapse; margin: 16px auto; font-size: 22px; background: rgba(10,12,26,.8); border: 3px solid var(--line); }
.over td, .over th { padding: 6px 14px; border-bottom: 1px dashed var(--line); }
.over th { font-family: var(--pix); font-size: 9px; color: var(--yellow); }

/* ---------------- EDYTOR ---------------- */
#editor { position: absolute; inset: 0; background: rgba(8,9,22,.96); display: flex; flex-direction: column; z-index: 20; }
.ed-top { display: flex; align-items: center; gap: 16px; padding: 8px 12px; background: #11142c; border-bottom: 3px solid var(--line); flex-wrap: wrap; }
.ed-title { font-family: var(--pix); font-size: 13px; color: var(--green); }
.ed-stat { font-family: var(--pix); font-size: 9px; color: var(--muted); }
.ed-stat b { color: var(--cyan); font-size: 11px; }
#ed-bity b, .bity b { font-family: var(--vt); font-size: 22px; } .ed-stat b.bad { color: var(--red); }
.ed-warn { color: var(--orange); flex: 1; font-size: 18px; }
.ed-btns { display: flex; gap: 6px; margin-left: auto; }
.ed-main { flex: 1; display: flex; min-height: 0; }
.ed-cats { width: 150px; background: #0e1027; border-right: 2px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; overflow: auto; }
.ed-cats button { text-align: left; font-family: var(--vt); font-size: 19px; padding: 5px 6px; display: flex; align-items: center; gap: 6px; box-shadow: none; border-width: 1px; background: transparent; }
.ed-cats button i { width: 14px; height: 14px; background: var(--c); border: 2px solid #05060f; flex: none; }
.ed-cats button.active { background: var(--panel2); border-color: var(--c); }
.ed-palette { width: 340px; background: #111430; border-right: 3px solid var(--line); overflow: auto; padding: 8px 10px 30px; }
.pal-head { font-family: var(--pix); font-size: 11px; margin: 4px 0 10px; }
.pal-item { margin-bottom: 8px; display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; }
.pal-item .buy { font-size: 8px; padding: 5px 6px; background: #4a3a10; border-color: #a88a2a; }
.pal-item .buy.poor, .shop-item .buy.poor { opacity: .55; }
.pal-btn { margin-bottom: 6px; }
.pal-vars { color: var(--muted); margin-bottom: 10px; }
.shop-info { color: var(--muted); margin: 8px 0 14px; line-height: 1.1; }
.shop-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px; margin-bottom: 6px; border: 2px solid var(--line); background: var(--panel); }
.shop-item .lvl { color: var(--yellow); letter-spacing: -2px; font-size: 14px; }
.shop-item .sd, .sd { color: var(--muted); font-size: 18px; }
.buy small { font-size: 7px; margin-left: 2px; }
.buy.maxed { background: #203020; border-color: #2fae73; }
.ed-wrap { flex: 1; overflow: auto; position: relative; background:
  radial-gradient(circle, #262b55 1px, transparent 1.5px) 0 0/22px 22px, #151833; cursor: default; }
.ed-ws { position: relative; width: 3200px; height: 2400px; }
#editor.dragging .ed-wrap { cursor: grabbing; }
#editor.trash .ed-palette { background: #3a0f1a; }
.ed-help { padding: 6px 12px; background: #0e1027; border-top: 3px solid var(--line); min-height: 34px; font-size: 19px; color: #c8cbef; }
.ed-help .lockinfo { color: var(--yellow); }

.stack { position: absolute; }
.stack.orphan { opacity: .55; }
.stack.orphan::before { content: 'brak kapelusza — skrypt nie działa'; position: absolute; top: -18px; left: 0; font-size: 15px; color: var(--orange); white-space: nowrap; }
.stack-list { display: flex; flex-direction: column; align-items: flex-start; min-height: 6px; }
.blk-mouth > .stack-list { min-height: 22px; }

.blk { --c: #888; background: var(--c); color: #fff; border-radius: 4px; font-family: var(--vt); font-size: 20px; line-height: 1;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.18); position: relative; user-select: none; cursor: grab; width: max-content;
  border: 1px solid rgba(0,0,0,.45); text-shadow: 1px 1px 0 rgba(0,0,0,.35); }
.blk-line { display: flex; align-items: center; gap: 6px; padding: 5px 9px; min-height: 32px; white-space: nowrap; }
.k-stmt, .k-c, .k-c2 { margin-top: -1px; }
.k-stmt::before, .k-c::before, .k-c2::before { content: ''; position: absolute; left: 12px; top: -1px; width: 14px; height: 3px; background: rgba(0,0,0,.3); border-radius: 0 0 3px 3px; }
.k-hat { border-radius: 16px 16px 4px 4px; }
.k-hat .blk-line { padding-top: 9px; min-height: 38px; }
.hat-ico { font-size: 16px; }
.blk-mouth { margin-left: 16px; background: #151833; border-radius: 0 4px 4px 0; padding: 2px 0 2px 0; min-width: 70px; box-shadow: inset 2px 2px 0 rgba(0,0,0,.4); }
.blk-foot { height: 12px; }
.k-rep, .k-bool { display: inline-flex; border-radius: 14px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
.k-rep > .blk-line, .k-bool > .blk-line { padding: 2px 9px; min-height: 26px; gap: 4px; }
.k-bool { border-radius: 4px; clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); border: none; }
.k-bool > .blk-line { padding: 2px 14px; }
.slot input { background: #fff; color: #1a1d3a; border: none; border-radius: 12px; padding: 1px 6px; text-align: center; font-size: 20px; min-width: 2.2ch; height: 23px; }
.slot-text input { border-radius: 4px; }
.slot select { background: rgba(0,0,0,.28); color: #fff; border: 1px solid rgba(255,255,255,.35); font-size: 19px; padding: 0 2px; height: 24px; border-radius: 4px; }
.slot select option { background: #1d2145; }
.slot-bool:not(.filled) { display: inline-block; width: 38px; height: 22px; background: rgba(0,0,0,.3); clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 9px 100%, 0 50%); }
.slot.hover { outline: 3px solid #fff; border-radius: 12px; }
.slot.filled { display: inline-flex; }
.ed-palette .slot input, .ed-palette .slot select { pointer-events: none; }
.blk.locked { filter: saturate(.25) brightness(.8); }
.blk.locked::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: repeating-linear-gradient(45deg, rgba(255,60,60,.28) 0 6px, transparent 6px 12px); }
.ed-ghost-layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.ed-ghost { position: fixed; opacity: .88; filter: drop-shadow(6px 8px 0 rgba(0,0,0,.45)); }
.ed-indicator { position: fixed; width: 60px; height: 5px; background: #fff; box-shadow: 0 0 8px #fff; z-index: 99; pointer-events: none; border-radius: 3px; }
.ed-ctx { position: fixed; z-index: 120; background: var(--panel2); border: 2px solid var(--cyan); display: flex; flex-direction: column; max-width: 320px; box-shadow: 4px 4px 0 #000; }
.ed-ctx button { box-shadow: none; border: none; text-align: left; font-family: var(--vt); font-size: 20px; background: transparent; }
.ed-ctx button:hover { background: #2c3270; }
.ctx-help { padding: 6px 10px; color: var(--muted); font-size: 17px; border-top: 1px solid var(--line); }
.ed-modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 110; display: flex; align-items: center; justify-content: center; }
.m-box { width: min(1000px, 94vw); max-height: 88vh; overflow: auto; background: var(--panel); border: 3px solid var(--cyan); box-shadow: 8px 8px 0 #000; }
.m-head { font-family: var(--pix); font-size: 12px; padding: 10px 14px; background: #11142c; display: flex; justify-content: space-between; align-items: center; color: var(--green); }
.m-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; padding: 12px 16px; }
.m-cols h4 { font-family: var(--pix); font-size: 10px; color: var(--yellow); margin: 10px 0 6px; }
.f-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px dashed var(--line); }
.f-item button { font-size: 8px; padding: 6px 8px; }
.f-row { display: flex; gap: 6px; margin: 6px 0; } .f-row input { flex: 1; }
#f-code { width: 100%; height: 80px; font-size: 14px; }
