@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&display=swap');

:root { --green:#00ff00; --dim:#006600; --bg:#050505; --magenta:#ff00ff; --red:#ff0000; }

* { box-sizing: border-box; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
    background: var(--bg); color: var(--green); font-family: 'Fira Code', monospace;
    margin: 0; padding: 0; min-height: 100vh; text-align: center;
    display: flex; flex-direction: column; align-items: center;
    touch-action: manipulation; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}

.wrap { width: 100%; max-width: 500px; padding: 16px; z-index: 1; }

.title { font-size: 1.6rem; font-weight: bold; text-shadow: 0 0 10px var(--green); margin: 6px 0 2px; letter-spacing: 1px; }
.subtitle { color: var(--dim); font-size: .82rem; margin-bottom: 14px; }

.box { border: 1px solid var(--green); background: rgba(0,255,0,.05); box-shadow: 0 0 15px var(--dim); padding: 14px; margin-bottom: 16px; }

.btn, .arcade-btn {
    display: inline-block; background: transparent; border: 2px solid var(--green); color: var(--green);
    font-family: 'Fira Code', monospace; font-weight: bold; font-size: 1rem; padding: 12px 18px;
    text-decoration: none; cursor: pointer; touch-action: manipulation; border-radius: 4px; transition: .1s;
}
.btn:active, .arcade-btn:active { background: rgba(0,255,0,.25); }
.btn:disabled { color: #444; border-color: #333; cursor: not-allowed; }

.back { display: inline-block; color: var(--dim); text-decoration: none; font-size: .85rem; margin-top: 10px; }
.back:active { color: var(--green); }

/* HUB - siatka gier */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile {
    border: 1px solid var(--dim); background: rgba(0,0,0,.5); border-radius: 6px; padding: 16px 8px;
    text-decoration: none; color: var(--green); position: relative; transition: .15s; touch-action: manipulation;
}
.tile:active { background: rgba(0,255,0,.12); }
.tile .ico { font-size: 2rem; display: block; margin-bottom: 6px; }
.tile .nm { font-size: .85rem; font-weight: bold; letter-spacing: .5px; }
.tile.done { border-color: var(--green); box-shadow: 0 0 12px var(--dim); }
.tile.done::after { content: '✔'; position: absolute; top: 6px; right: 8px; color: var(--green); font-weight: bold; }
.tile.locked { opacity: .45; pointer-events: none; }
.tile.locked::after { content: 'WKRÓTCE'; position: absolute; top: 6px; right: 6px; font-size: .55rem; color: var(--dim); }

.progress-container { width: 100%; background: #222; border: 1px solid var(--dim); height: 12px; margin: 8px 0; }
.progress-bar { height: 100%; background: var(--green); box-shadow: 0 0 10px var(--green); width: 0%; transition: width .3s; }

.code-panel { font-size: 1.6rem; letter-spacing: 4px; font-weight: bold; color: var(--magenta); text-shadow: 0 0 12px var(--magenta); word-break: break-all; }

/* Kanwy / plansze gier */
canvas.game { display: block; margin: 6px auto; border: 1px solid var(--dim); background: #030503; touch-action: none; max-width: 100%; }

.hud { display: flex; justify-content: space-between; font-size: .95rem; margin: 8px 0; }
.hud b { color: var(--green); }

/* Ekran wygranej */
.arcade-win { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.arcade-win-box { border: 2px solid var(--green); box-shadow: 0 0 30px var(--green); background: #020502; padding: 24px; max-width: 340px; }
.arcade-win-box h2 { color: var(--green); text-shadow: 0 0 12px var(--green); margin-top: 0; }

/* Klawiatura / przyciski gier */
.keys { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-top: 10px; }
.key { width: 2rem; height: 2.4rem; border: 1px solid var(--dim); background: #071007; color: var(--green); font-family: 'Fira Code', monospace; font-weight: bold; border-radius: 4px; touch-action: manipulation; cursor: pointer; }
.key:active { background: var(--green); color: #000; }
.key:disabled { opacity: .3; }

/* D-pad (wąż) */
.dpad { display: grid; grid-template-columns: repeat(3, 3rem); grid-template-rows: repeat(3, 3rem); gap: 6px; justify-content: center; margin: 10px auto 0; }
.dbtn { border: 1px solid var(--green); background: #071007; color: var(--green); font-size: 1.2rem; border-radius: 6px; touch-action: manipulation; cursor: pointer; }
.dbtn:active { background: var(--green); color: #000; }
.up { grid-column: 2; grid-row: 1; } .left { grid-column: 1; grid-row: 2; } .right { grid-column: 3; grid-row: 2; } .down { grid-column: 2; grid-row: 3; }

.msg { min-height: 1.4rem; color: var(--magenta); font-weight: bold; margin: 6px 0; }
