:root { --fg: #fff; --bg: #101014; --dim: #bbb1bd; --line: #51404c; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--fg);
  font-family: "Courier New", Courier, monospace; }

#app { display: flex; gap: 16px; padding: 0; max-width: none; margin: 0 auto; align-items: flex-start; }
.panel { border: 1px solid var(--line); padding: 12px; }
#left  { flex: 1.5; min-width: 0; }
#right { flex: 1; min-width: 300px; max-width: 560px; }

header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 12px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 22px; letter-spacing: 0.4em; }
h3 { margin: 16px 0 6px; font-size: 13px; letter-spacing: 0.3em; border-bottom: 1px solid #444; padding-bottom: 4px; }
.dim { color: var(--dim); }
.small { font-size: 12px; margin: 6px 0 12px; min-height: 2.4em; }
.tiny { font-size: 11px; letter-spacing: 0.1em; margin: 0 0 6px; }
.row em { font-style: normal; font-size: 12px; letter-spacing: 0.1em; }

/* pop-up messages over the game view */
#toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3;
  background: rgba(0,0,0,0.85); border: 1px solid #fff; padding: 7px 14px; font-size: 13px; letter-spacing: 0.15em;
  white-space: nowrap; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
#toast.show { opacity: 1; }

canvas { display: block; width: 100%; height: auto; background: #000; }
#viewWrap { position: relative; border: 1px solid #555; }
#viewWrap::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.03) 0 1px, transparent 1px 3px); }
#map { border: 1px solid #555; }
#hint { font-size: 12px; margin: 10px 0 0; }

/* overlay */
#overlay { position: absolute; inset: 0; display: none; z-index: 2; background: rgba(0,0,0,0.86);
  flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; gap: 10px; }
#overlay.show { display: flex; }
#overlay h1 { font-size: 34px; letter-spacing: 0.5em; margin: 0 0 6px 0.5em; }
#overlay p { margin: 4px 0; }
#overlay ul { list-style: none; padding: 0; margin: 8px 0; color: var(--dim); font-size: 13px; line-height: 1.7; }
#overlay .btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
#overlay label { font-size: 13px; letter-spacing: 0.15em; }
#overlay input { background: #000; color: #fff; border: 1px solid #fff; padding: 6px 8px; font: inherit; width: 170px; margin-left: 8px; }

/* hud */
.row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.row > span { width: 70px; font-size: 13px; letter-spacing: 0.15em; }
.row b { font-size: 22px; letter-spacing: 0.1em; }
.row.split { justify-content: space-between; }
.row.split label { font-size: 13px; letter-spacing: 0.15em; display: flex; flex-direction: column; gap: 4px; flex: 1; }
#prox { flex: 1; height: 12px; border: 1px solid #fff; position: relative; }
#prox i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #fff; }

button, select { font: inherit; color: #fff; background: #000; border: 1px solid #fff; padding: 7px 12px;
  cursor: pointer; letter-spacing: 0.12em; font-size: 12px; }
button:hover:not(:disabled), button.primary { background: #fff; color: #000; }
button:disabled { opacity: 0.4; cursor: default; }
button.primary:hover { background: #000; color: #fff; }
#hud .row.split button { flex: 1; padding: 8px 4px; }

ol#board { margin: 0; padding-left: 28px; font-size: 14px; line-height: 1.7; }
ol#board li { display: list-item; }
ol#board li span { float: right; }

@media (max-width: 900px) {
  #app { flex-direction: column; }
  #right { max-width: none; width: 100%; }
}

.panel{background:#1b1820;border-radius:10px}#left{overflow:hidden}#left>header h1{color:#fc9997}button,select{border-color:#795e6d;background:#30232b;border-radius:5px;min-height:40px}button.primary,button:hover:not(:disabled){background:#ad2842;color:#fff}button.primary:hover{background:#8b2035}#overlay{overflow:auto;justify-content:flex-start;padding:20px}#overlay h1{font-size:clamp(20px,4vw,34px);letter-spacing:.15em;margin:0}#overlay a{color:#fc9997}#overlay p{font-size:13px;line-height:1.5}#overlay ul{line-height:1.4;margin:2px}#overlay .btns{margin-top:4px}#overlay button{padding:7px 10px}#touchControls{display:none;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:12px;touch-action:none}#touchControls button{user-select:none;touch-action:none;font-size:20px}#btnPause{grid-column:1/-1}button:focus-visible,select:focus-visible,canvas:focus-visible{outline:3px solid #fc9997;outline-offset:2px}#board li{overflow-wrap:anywhere}#board li span{padding-left:10px}#app{padding:1px}#overlay .dim{color:#bfb4c3}
@media(pointer:coarse){#touchControls{display:grid}}
@media(max-width:900px){#left{width:100%}#right{min-width:0}#map{max-height:440px;object-fit:contain}#viewWrap{min-height:360px}#view{min-height:360px;object-fit:contain}.row.split{flex-wrap:wrap}.row.split label{min-width:80px}}

[hidden],#map[hidden]{display:none!important}.hardcore-option{display:flex;align-items:center;gap:10px;margin:16px 0 8px;font-size:13px;letter-spacing:.08em;color:#fc9997}.hardcore-option input{width:22px;height:22px;accent-color:#ad2842}#hardcoreNotice{padding:24px 16px;border:1px solid #795e6d;background:#30232b;color:#fc9997;line-height:1.6;text-align:center}#touchControls button.is-held{background:#ad2842;color:#fff;border-color:#fc9997}
@media(hover:none),(pointer:coarse){#touchControls{display:grid}}
