/* Machine Tower. One loud world: acid lime, ink line, paper white. Deliberately single theme. */
:root {
  --lime: #c8f800; --ink: #101010; --paper: #f8f8f0; --pink: #f810c8; --cobalt: #2010f8; --amber: #f8b810; --red: #f81018;
  --display: "Lilita One", "Arial Black", sans-serif; --body: "Nunito", system-ui, sans-serif;
  --line: 4px solid var(--ink); --drop: 6px 6px 0 var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--lime); color: var(--ink); font: 700 16px/1.4 var(--body); }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
kbd { font: 900 0.78em var(--body); background: var(--ink); color: var(--paper); border-radius: 5px; padding: 1px 6px; margin: 0 2px; }

.card, .panel, .note { background: var(--paper); border: var(--line); border-radius: 14px; box-shadow: var(--drop); }
.btn { font: 400 20px var(--display); letter-spacing: 0.02em; color: var(--ink); background: var(--paper); border: var(--line); border-radius: 12px; padding: 8px 18px; box-shadow: 4px 4px 0 var(--ink); cursor: pointer; transition: transform 0.06s, box-shadow 0.06s; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, .chips button:focus-visible { outline: 4px solid var(--cobalt); outline-offset: 2px; }
.btn.lime { background: var(--lime); }
.btn.pink { background: var(--pink); color: #fff; }
.btn.huge { font-size: 30px; padding: 10px 34px; }
.btn[disabled] { opacity: 0.55; cursor: wait; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud .btn { pointer-events: auto; }
.stats { position: absolute; left: 16px; top: 16px; padding: 8px 16px 10px; min-width: 190px; }
.stats .big { font: 400 40px/1 var(--display); }
.stats .small { font-size: 13px; font-variant-numeric: tabular-nums; }
.setbar { height: 12px; border: 3px solid var(--ink); border-radius: 7px; margin: 7px 0 3px; background: #fff; overflow: hidden; }
.setbar i { display: block; height: 100%; width: 0; background: var(--pink); }
.where { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); padding: 6px 18px; font: 400 22px var(--display); white-space: nowrap; display: flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; }
.where .sep { width: 4px; height: 20px; background: var(--ink); border-radius: 2px; }
.right { position: absolute; right: 16px; top: 16px; }
.meter { position: absolute; left: 22px; top: 168px; bottom: 70px; width: 80px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.tube { position: relative; flex: 1; width: 22px; background: var(--paper); border: var(--line); border-radius: 12px; box-shadow: 4px 4px 0 var(--ink); }
.fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--pink); border-radius: 0 0 7px 7px; }
.flag { position: absolute; left: -6px; right: -6px; height: 4px; background: var(--ink); }
.me { position: absolute; left: 22px; width: 0; height: 0; border: 9px solid transparent; border-right-color: var(--ink); transform: translateY(50%); }
.mlabel { font: 400 16px var(--display); background: var(--ink); color: var(--lime); padding: 1px 8px; border-radius: 8px; white-space: nowrap; }
#reticle { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border: 3px solid var(--ink); border-radius: 50%; background: var(--paper); opacity: 0.85; }
.keys { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 13px; background: color-mix(in srgb, var(--paper) 88%, transparent); border: 3px solid var(--ink); border-radius: 12px; padding: 5px 14px; max-width: calc(100vw - 32px); }

/* the message on a block */
.note { position: fixed; right: 24px; top: 50%; transform: translateY(-50%) rotate(1.5deg); width: min(340px, calc(100vw - 48px)); padding: 26px 24px 18px; text-align: center; pointer-events: none; z-index: 4; }
.note::before { content: ""; position: absolute; left: 50%; top: -14px; width: 84px; height: 26px; margin-left: -42px; background: var(--amber); border: 3px solid var(--ink); transform: rotate(-3deg); }
.note-msg { font: 400 27px/1.15 var(--display); overflow-wrap: anywhere; text-wrap: balance; min-height: 62px; display: grid; place-items: center; }
.note-msg.quiet { font: 700 17px var(--body); opacity: 0.7; }
.note-by { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 900; }
.note-by i { width: 18px; height: 18px; border: 3px solid var(--ink); border-radius: 5px; }
.note-meta { font-size: 12.5px; opacity: 0.75; margin-top: 4px; font-variant-numeric: tabular-nums; }

#toasts { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; z-index: 5; }
.toast { background: var(--ink); color: var(--lime); font: 400 19px var(--display); padding: 6px 16px; border-radius: 10px; animation: pop 0.25s; max-width: 90vw; text-align: center; }
.toast.out { opacity: 0; transition: opacity 0.4s; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }

/* overlays */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--lime) 45%, transparent); z-index: 10; overflow: auto; }
.overlay.soft { background: color-mix(in srgb, var(--ink) 30%, transparent); }
#menu { place-items: center start; padding-left: clamp(16px, 6vw, 90px); background: none; }
.panel { padding: 26px 30px; width: min(520px, 100%); position: relative; }
.panel.small { width: min(400px, 100%); text-align: center; }
.panel h1 { font: 400 clamp(52px, 11vw, 86px)/0.9 var(--display); margin: 0 0 12px; color: var(--pink); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 6px 6px 0 var(--ink); letter-spacing: 0.01em; }
.panel h2 { font: 400 34px/1 var(--display); margin: 0 0 8px; }
.tag { font-size: 18px; font-weight: 900; margin: 0 0 18px; max-width: 30em; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.panel.small .row { justify-content: center; margin-top: 12px; }
.who { margin: 0 0 12px; font-size: 15px; }
.who b { font: 400 22px var(--display); margin-right: 6px; }
.gate { list-style: none; margin: 14px 0 10px; padding: 0; display: grid; gap: 6px; font-weight: 900; }
.gate li { padding: 6px 10px 6px 34px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; position: relative; }
.gate li::before { content: "×"; position: absolute; left: 9px; top: 2px; font: 400 22px var(--display); color: var(--red); }
.gate li.ok::before { content: "✓"; color: #0a9a2a; }
.right { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.check { display: block; margin-top: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--pink); vertical-align: -3px; }
.rules { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 15px; }
.rules li { padding-left: 22px; position: relative; }
.rules li::before { content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 12px; background: var(--lime); border: 3px solid var(--ink); border-radius: 3px; }
.fine { font-size: 13px; opacity: 0.75; margin: 12px 0 0; }

.form label { display: flex; justify-content: space-between; font-weight: 900; margin: 14px 0 4px; }
.form input, .form textarea { width: 100%; font: 900 20px var(--body); padding: 8px 12px; border: var(--line); border-radius: 10px; background: #fff; color: var(--ink); resize: none; font-variant-numeric: tabular-nums; }
.form textarea { font-size: 17px; font-weight: 700; }
.sub { margin: 0; }
.count { font-weight: 700; opacity: 0.7; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.chips button { font: 900 14px var(--body); background: var(--lime); border: 3px solid var(--ink); border-radius: 999px; padding: 3px 12px; cursor: pointer; color: var(--ink); }
.preview { font: 400 20px var(--display); margin: 14px 0 12px; }
.err { background: var(--red); color: #fff; border: 3px solid var(--ink); border-radius: 8px; padding: 6px 10px; margin: 0 0 12px; }
.x { position: absolute; right: 12px; top: 10px; width: 40px; height: 40px; font: 400 26px/1 var(--display); background: var(--red); color: #fff; border: var(--line); border-radius: 10px; cursor: pointer; }

@media (max-width: 720px) { .keys { display: none; } .where { top: 120px; } .stats .big { font-size: 30px; } #menu { place-items: center; padding-left: 16px; } }
@media (prefers-reduced-motion: reduce) { .btn, .toast { transition: none; animation: none; } }

/* touch: a stick that appears under your left thumb, drag anywhere else to look, a jump button under your right */
html, body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
canvas#c { touch-action: none; }
#touch { position: fixed; inset: 0; z-index: 2; touch-action: none; }
#t-zone { position: absolute; inset: 0; }
#t-stick { position: absolute; width: 124px; height: 124px; margin: -62px 0 0 -62px; border: var(--line); border-radius: 50%; background: color-mix(in srgb, var(--paper) 45%, transparent); pointer-events: none; }
#t-stick i { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border: var(--line); border-radius: 50%; background: var(--pink); }
.tbtn { position: absolute; right: max(18px, env(safe-area-inset-right)); width: 54px; height: 54px; font: 400 26px/1 var(--display); color: var(--ink); background: var(--paper); border: var(--line); border-radius: 50%; box-shadow: 3px 3px 0 var(--ink); touch-action: none; padding: 0; }
.tbtn:active, .tbtn.down { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.tbtn.jump { bottom: max(26px, env(safe-area-inset-bottom)); width: 104px; height: 104px; font-size: 24px; background: var(--lime); }
#t-back { bottom: calc(max(26px, env(safe-area-inset-bottom)) + 118px); }
#t-sound { bottom: calc(max(26px, env(safe-area-inset-bottom)) + 184px); }
body.touch .keys, body.touch #reticle, body.touch kbd { display: none; }
body.touch #hud { z-index: 3; }
body.touch .meter { bottom: 150px; }
@media (max-width: 720px) {
  .stats { left: 8px; top: 8px; padding: 5px 10px 7px; min-width: 0; border-width: 3px; box-shadow: 3px 3px 0 var(--ink); }
  .stats .big { font-size: 24px; } .stats .small { font-size: 11px; } .setbar { height: 8px; margin: 4px 0 2px; }
  .where { top: auto; bottom: 8px; left: 8px; transform: none; font-size: 15px; padding: 3px 10px; gap: 8px; border-width: 3px; box-shadow: 3px 3px 0 var(--ink); max-width: calc(100vw - 150px); overflow: hidden; text-overflow: ellipsis; }
  .right { right: 8px; top: 8px; } .right .btn { font-size: 16px; padding: 6px 12px; }
  .meter { left: 10px; top: 128px; width: 60px; } .tube { width: 16px; } .me { left: 16px; } .mlabel { font-size: 13px; }
  .note { right: 50%; top: 22%; transform: translate(50%, 0) rotate(1.5deg); padding: 20px 16px 12px; } .note-msg { font-size: 21px; min-height: 44px; }
  #toasts { top: 58px; } .toast { font-size: 15px; }
  .panel { padding: 18px 18px; } .panel h1 { font-size: 46px; } .tag { font-size: 15px; margin-bottom: 12px; } .rules { font-size: 13px; margin-top: 12px; } .btn.huge { font-size: 24px; padding: 8px 26px; }
  #menu { align-items: start; }
}
@media (max-height: 480px) { .meter { display: none; } .tbtn.jump { width: 88px; height: 88px; } #t-back { bottom: calc(max(26px, env(safe-area-inset-bottom)) + 100px); } #t-sound { bottom: auto; top: 58px; } }

.here { font: 400 15px var(--display); background: var(--ink); color: var(--lime); padding: 2px 10px; border-radius: 8px; pointer-events: none; }
#b-voice.on { background: var(--lime); }
@media (max-width: 720px) { .here { font-size: 12px; } }

.warn { position: absolute; left: 50%; top: 22%; transform: translateX(-50%) rotate(-2deg); font: 400 34px var(--display); color: #fff; background: var(--red); border: var(--line); border-radius: 12px; padding: 2px 18px; box-shadow: var(--drop); }
@media (max-width: 720px) { .warn { font-size: 22px; } }
