/* Eighty Columns, playable. Fond №1: bone stock, glaze ink, slip rules, ash recessive, ingress once per view, fond ground. */
:root {
  --bone: #E4E7E4; --slip: #C2C8C4; --ash: #5F6461; --glaze: #35595F; --ingress: #A03D22; --fond: #241A13;
  --fond-2: #2f241b; --fond-3: #3b2e23;
  --data: #35595F; --logic: #6b4f2e; --shift: #3f5a3a; --control: #5F6461;
  --mono: "Courier New", Courier, ui-monospace, monospace;
  --cut: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--bone); font-family: var(--mono); }
body { min-height: 100vh; }
button { font-family: inherit; }
a { color: var(--slip); }
.hidden { display: none !important; }

/* ---------- frame ---------- */
#app { max-width: 1120px; margin: 0 auto; padding: 14px 16px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--fond-3); margin-bottom: 14px; }
.brand { font-weight: bold; letter-spacing: .14em; font-size: 15px; cursor: pointer; background: none; border: 0;
  color: var(--bone); padding: 4px 0; }
.brand small { color: var(--ash); letter-spacing: .08em; font-weight: normal; margin-left: 8px; }
.tools { display: flex; gap: 8px; }
.btn { background: var(--bone); color: var(--fond); border: 0; padding: 10px 16px; font-weight: bold; letter-spacing: .06em;
  cursor: pointer; clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px); font-size: 14px; }
.btn:hover:not(:disabled) { background: #fff; }
.btn:disabled { opacity: .35; cursor: default; }
.btn.ghost { background: transparent; color: var(--bone); box-shadow: inset 0 0 0 1px var(--ash); clip-path: none; }
.btn.ghost:hover:not(:disabled) { background: var(--fond-3); }
.btn.loud { background: var(--ingress); color: var(--bone); }
.btn.small { padding: 6px 10px; font-size: 12px; }
:focus-visible { outline: 2px solid var(--slip); outline-offset: 2px; }

/* ---------- title ---------- */
.title { text-align: center; padding: 30px 0 10px; }
.title h1 { font-size: clamp(30px, 7vw, 64px); letter-spacing: .16em; margin: 0; }
.title .punchline { display: flex; justify-content: center; gap: 3px; margin: 14px auto 6px; max-width: 520px; flex-wrap: wrap; }
.title .punchline i { width: 5px; height: 12px; background: var(--bone); display: block; opacity: .12; }
.title .punchline i.on { opacity: 1; }
.title p { color: var(--slip); max-width: 60ch; margin: 10px auto; line-height: 1.5; font-size: 14px; }
.menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 26px; }
.menu-item { text-align: left; background: var(--fond-2); color: var(--bone); border: 1px solid var(--fond-3); padding: 18px;
  cursor: pointer; clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, 0 100%, 0 var(--cut)); min-height: 120px; }
.menu-item:hover { background: var(--fond-3); }
.menu-item b { display: block; font-size: 17px; letter-spacing: .08em; margin-bottom: 8px; }
.menu-item span { color: var(--slip); font-size: 13px; line-height: 1.45; }
.menu-item em { display: block; font-style: normal; color: var(--ash); font-size: 12px; margin-top: 10px; }

/* ---------- campaign ---------- */
.shift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.badge { background: var(--bone); color: var(--fond); border: 0; padding: 0 0 10px; cursor: pointer; text-align: left;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, 0 100%, 0 var(--cut)); font-family: var(--mono); }
.badge img { width: 100%; display: block; image-rendering: pixelated; }
.badge b { display: block; padding: 6px 10px 0; font-size: 13px; }
.badge span { display: block; padding: 2px 10px 0; font-size: 11px; color: var(--ash); }
.badge.locked { filter: grayscale(1) brightness(.45); cursor: default; }
.badge.beaten::after { content: "CLEARED"; position: absolute; }
.badge .stamp { display: inline-block; margin: 6px 10px 0; font-size: 10px; letter-spacing: .12em; padding: 2px 6px;
  border: 1px solid var(--glaze); color: var(--glaze); }
.intro { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.intro img { width: 100%; image-rendering: pixelated; display: block; }
.intro h2 { margin: 0 0 4px; letter-spacing: .06em; }
.intro .role { color: var(--slip); margin-bottom: 14px; }
.intro blockquote { margin: 0 0 16px; padding: 12px 14px; background: var(--fond-2); border-left: 3px solid var(--slip);
  font-size: 15px; line-height: 1.5; }
.intro .style { color: var(--slip); font-size: 13px; margin-bottom: 18px; }
@media (max-width: 640px) { .intro { grid-template-columns: 1fr; } .intro img { max-width: 220px; } }

/* ---------- cards ---------- */
.card { position: relative; width: 136px; height: 198px; flex: 0 0 auto; background: var(--bone); color: var(--fond);
  border: 0; padding: 0; cursor: pointer; text-align: left; font-family: var(--mono);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, 0 100%, 0 var(--cut));
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s; }
.card .band { position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--suit, var(--glaze)); }
.card.s-data { --suit: var(--data); } .card.s-logic { --suit: var(--logic); }
.card.s-shift { --suit: var(--shift); } .card.s-control { --suit: var(--control); }
.card .punch { position: absolute; left: 6px; right: 6px; bottom: 5px; height: 22px; width: calc(100% - 12px); }
.card .c-top { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 8px 0 16px; font-size: 11px; }
.card .c-sym { font-size: 15px; color: var(--suit); font-weight: bold; }
.card .c-name { padding: 4px 8px 0; font-weight: bold; font-size: 12px; line-height: 1.15; min-height: 30px; letter-spacing: .02em; }
.card .c-big { display: flex; align-items: baseline; gap: 6px; padding: 2px 8px 0; }
.card .c-big b { font-size: 30px; line-height: 1; }
.card .c-big small { font-size: 10px; color: var(--ash); letter-spacing: .08em; }
.card .c-cost { display: flex; gap: 3px; padding: 4px 8px 0; align-items: center; font-size: 10px; color: var(--ash); }
.card .c-cost i { width: 7px; height: 7px; border-radius: 50%; background: var(--glaze); display: block; }
.card .c-line { padding: 5px 8px 0; font-size: 10px; line-height: 1.25; color: var(--glaze); max-height: 44px; overflow: hidden; }
.card .c-op { padding: 4px 8px 0; font-size: 17px; font-weight: bold; line-height: 1.15; }
.card .c-w { color: var(--ash); font-size: 11px; }
.card .c-op.long { font-size: 13px; }
.card .c-op.long + .c-line { max-height: 26px; }
.card:hover:not(.dim):not(:disabled) { transform: translateY(-4px); }
.card.selected { transform: translateY(-10px); box-shadow: 0 0 0 3px var(--bone), 0 0 0 5px var(--ingress); }
.card.dim { opacity: .38; cursor: not-allowed; }
.card.used { opacity: .25; cursor: default; }
.card.small { width: 116px; height: 172px; }
.card.small .c-big b { font-size: 24px; }
.card.small .punch { height: 18px; }
.card.small .c-op { font-size: 15px; }
.card.small .c-line { max-height: 26px; }
.card.back { background: var(--glaze); cursor: default; }
.card.back::before { content: "EC1"; position: absolute; left: 0; right: 0; top: 42%; text-align: center; color: var(--bone);
  letter-spacing: .3em; font-weight: bold; opacity: .8; }
.card.back .punch rect { fill: var(--bone); opacity: .5; }
.card.blank-card { background: var(--slip); }

/* ---------- battle ---------- */
.side { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 10px 12px;
  background: var(--fond-2); }
.side img.face { width: 64px; height: 85px; image-rendering: pixelated; display: block; }
.side .who b { display: block; letter-spacing: .05em; }
.side .who span { color: var(--slip); font-size: 12px; }
.meter { display: flex; gap: 2px; margin-top: 6px; flex-wrap: wrap; max-width: 360px; }
.meter i { width: 12px; height: 12px; display: block; background: var(--bone); }
.meter i.gone { background: var(--fond-3); }
.meter i.extra { background: var(--slip); }
.meter-label { font-size: 12px; color: var(--slip); margin-top: 4px; }
.lamps { display: flex; gap: 4px; align-items: center; }
.lamps i { width: 11px; height: 11px; border-radius: 50%; background: var(--fond-3); display: block; }
.lamps i.on { background: var(--slip); box-shadow: 0 0 6px rgba(194, 200, 196, .5); }
.counts { font-size: 12px; color: var(--slip); text-align: right; line-height: 1.6; }
.table { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; min-height: 230px; padding: 10px 0; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.slot .empty { width: 136px; height: 198px; border: 1px dashed var(--ash); clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, 0 100%, 0 var(--cut)); }
.slot .calc { font-size: 14px; min-height: 20px; color: var(--slip); text-align: center; }
.slot .calc b { color: var(--bone); font-size: 18px; }
.mid { text-align: center; min-width: 170px; }
.mid .round { color: var(--ash); font-size: 12px; letter-spacing: .1em; }
.mid .verdict { font-size: 16px; margin: 8px 0; min-height: 44px; line-height: 1.35; }
.mid .jam { color: var(--slip); font-size: 12px; }
.hand { display: flex; gap: 10px; overflow-x: auto; padding: 14px 4px 10px; min-height: 228px; }
.opp-hand { display: flex; gap: 4px; }
.opp-hand .card { width: 30px; height: 42px; --cut: 6px; }
.opp-hand .card::before { display: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.hint { color: var(--slip); font-size: 12px; }
.log { margin-top: 18px; font-size: 12px; color: var(--slip); max-height: 200px; overflow-y: auto; background: var(--fond-2);
  padding: 8px 12px; line-height: 1.6; }
.log summary { cursor: pointer; color: var(--bone); }
.shake { animation: shake .35s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.pop { animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (max-width: 720px) {
  .table { grid-template-columns: 1fr 1fr; }
  .mid { grid-column: 1 / -1; order: -1; }
  .side { grid-template-columns: auto 1fr; }
  .side .counts { grid-column: 1 / -1; text-align: left; }
}

/* ---------- puzzle ---------- */
.readout { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 8px; }
.readout .lbl { font-size: 11px; color: var(--ash); letter-spacing: .12em; }
.nixie { display: flex; gap: 4px; margin-top: 4px; }
.nixie i { width: 30px; height: 44px; background: #1a120c; color: #e9a15a; font-style: normal; font-size: 30px; display: flex;
  align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px #4a3a2c; text-shadow: 0 0 8px rgba(233, 161, 90, .6); }
.nixie.target i { color: var(--bone); text-shadow: none; }
.nixie.bad i { color: var(--ingress); text-shadow: none; }
.program { display: flex; gap: 10px; flex-wrap: wrap; min-height: 200px; padding: 10px; background: var(--fond-2); align-items: flex-start; }
.program .step { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.program .step .acc { font-size: 13px; color: var(--slip); }
.program .step .acc.bad { color: var(--ingress); }
.program .placeholder { color: var(--ash); font-size: 13px; padding: 70px 10px; }
.listing { background: #1a120c; color: #d9cfbf; font-size: 11px; padding: 10px 12px; overflow-x: auto; white-space: pre; line-height: 1.5;
  margin-top: 12px; }
.listing .hl { color: #e9a15a; }
.mem-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.mem-item { background: var(--fond-2); border: 1px solid var(--fond-3); color: var(--bone); text-align: left; padding: 12px; cursor: pointer; }
.mem-item:hover { background: var(--fond-3); }
.mem-item b { display: block; font-size: 13px; margin-bottom: 4px; }
.mem-item span { font-size: 12px; color: var(--slip); }
.stars { letter-spacing: .2em; color: var(--slip); }
.stars .on { color: var(--bone); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(20, 14, 10, .82); display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 10; }
.modal .box { background: var(--bone); color: var(--fond); max-width: 460px; width: 100%; padding: 22px;
  clip-path: polygon(18px 0, 100% 0, 100% 100%, 0 100%, 0 18px); }
.modal h2 { margin: 0 0 8px; letter-spacing: .08em; }
.modal p { line-height: 1.5; margin: 6px 0 14px; font-size: 14px; }
.modal .btn { background: var(--fond); color: var(--bone); }
.modal .btn.ghost { color: var(--fond); box-shadow: inset 0 0 0 1px var(--ash); background: transparent; }
.modal .row { display: flex; gap: 10px; flex-wrap: wrap; }
.modal img { width: 96px; image-rendering: pixelated; float: right; margin: 0 0 8px 12px; }

/* ---------- rules ---------- */
.rules { max-width: 760px; line-height: 1.6; font-size: 14px; }
.rules h2 { letter-spacing: .08em; margin-top: 28px; }
.rules table { border-collapse: collapse; width: 100%; font-size: 13px; }
.rules td, .rules th { border-bottom: 1px solid var(--fond-3); padding: 6px 8px; text-align: left; vertical-align: top; }
.rules code { background: var(--fond-2); padding: 1px 4px; }
.foot { margin-top: 34px; color: var(--ash); font-size: 11px; text-align: center; }

/* ---------- polish after the first play-through ---------- */
.card .c-top { white-space: nowrap; font-size: 10px; gap: 6px; }
.card.small .c-op.long + .c-line { display: none; }
.modal .stars { color: var(--glaze); font-size: 22px; letter-spacing: .3em; }
@media (max-width: 720px) {
  #app { padding: 10px 12px 30px; }
  .side { gap: 8px 10px; padding: 8px 10px; }
  .side img.face { width: 44px; height: 59px; }
  .side .counts { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; line-height: 1.2; }
  .side .counts br { display: none; }
  .meter i { width: 9px; height: 9px; }
  .opp-hand .card { width: 18px; height: 25px; --cut: 4px; }
  .table { min-height: 0; padding: 6px 0; gap: 8px; }
  .mid .verdict { min-height: 0; font-size: 14px; }
  .slot .card, .slot .empty { width: 112px; height: 164px; }
  .slot .card .c-big b { font-size: 22px; }
  .slot .card .c-line { display: none; }
  .hand { min-height: 0; padding-top: 10px; }
  .actions .hint { display: none; }
}
