@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700&family=Saira+Stencil+One&family=Share+Tech+Mono&display=swap');

:root {
  --steel-900: #12161b;
  --steel-800: #1b2128;
  --steel-700: #283039;
  --steel-600: #3a444f;
  --steel-400: #7a8794;
  --flood: #e9eef2;
  --hazard: #f5c400;
  --spark: #ff5a1f;
  --kill: #e0263f;
  --glass: #6fd0c8;
  --display: 'Saira Stencil One', 'Impact', sans-serif;
  --ui: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --mono: 'Share Tech Mono', ui-monospace, monospace;
  --stripes: repeating-linear-gradient(-45deg, var(--hazard) 0 14px, #16191d 14px 28px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #2c3742 0%, transparent 60%),
    var(--steel-900);
  color: var(--flood);
  font-family: var(--ui);
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: .01em;
}
a { color: var(--hazard); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--hazard); outline-offset: 2px; }

.brand { font-family: var(--display); letter-spacing: .04em; text-transform: uppercase; line-height: .9; }
.brand b { color: var(--hazard); font-weight: 400; }
.mono { font-family: var(--mono); }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--steel-400); }
.stripe { height: 10px; background: var(--stripes); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 0; padding: 9px 16px; background: var(--steel-600); color: var(--flood);
  font-weight: 600; font-size: 17px; text-transform: uppercase; letter-spacing: .08em;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: filter .12s, transform .06s;
}
.btn:hover { filter: brightness(1.2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .4; cursor: not-allowed; filter: none; }
.btn.go { background: var(--hazard); color: #15181c; }
.btn.danger { background: transparent; box-shadow: inset 0 0 0 1px var(--kill); color: #ff8b9a; clip-path: none; }
.btn.small { padding: 4px 10px; font-size: 14px; }
.field {
  background: var(--steel-900); border: 1px solid var(--steel-600); padding: 9px 12px; width: 100%;
  font-family: var(--mono); font-size: 15px;
}
.panel { background: var(--steel-800); border: 1px solid var(--steel-700); }
.panel > header { padding: 10px 16px; border-bottom: 1px solid var(--steel-700); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--steel-600); display: inline-block; flex: none; }
.lamp.on { background: #58e07a; box-shadow: 0 0 8px #58e07a; }
.lamp.warn { background: var(--hazard); box-shadow: 0 0 8px var(--hazard); }
.lamp.dead { background: var(--kill); }

/* ---------- landing ---------- */
.landing { min-height: 100%; display: grid; place-items: center; padding: 24px; text-align: center; }
.landing h1 { font-size: clamp(64px, 16vw, 200px); margin: 0; }
.landing p { max-width: 46ch; margin: 18px auto 28px; color: #b9c3cc; font-size: 22px; }

/* ---------- admin ---------- */
.admin { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
.admin .top { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.admin .top h1 { font-size: 44px; margin: 0; }
.admin .grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.fightlist button {
  display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--steel-700);
  padding: 12px 16px; cursor: pointer;
}
.fightlist button:hover { background: var(--steel-700); }
.fightlist button.sel { background: var(--steel-700); box-shadow: inset 4px 0 0 var(--hazard); }
.fightlist .n { font-weight: 600; font-size: 20px; }
.newfight { padding: 14px 16px; display: grid; gap: 10px; }
.newfight label { display: grid; gap: 4px; }
.detail .body { padding: 16px; display: grid; gap: 18px; }
.linkrow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.linkrow .field { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readybar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.readybar .count { font-family: var(--display); font-size: 54px; line-height: 1; }
.readybar .count small { font-family: var(--ui); font-size: 18px; color: var(--steel-400); letter-spacing: .08em; text-transform: uppercase; margin-left: 8px; }
table.bots { width: 100%; border-collapse: collapse; }
table.bots th { text-align: left; font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--steel-400); font-weight: 400; padding: 6px 10px; }
table.bots td { padding: 9px 10px; border-top: 1px solid var(--steel-700); vertical-align: middle; }
table.bots td.name { font-weight: 600; font-size: 20px; }
.tag { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border: 1px solid var(--steel-600); color: #b9c3cc; text-transform: uppercase; letter-spacing: .08em; }
.tag.ready { border-color: #58e07a; color: #58e07a; }
.tag.wait { border-color: var(--hazard); color: var(--hazard); }
.tag.dead { border-color: var(--kill); color: #ff8b9a; }
.empty { padding: 26px 16px; color: var(--steel-400); }
.login { max-width: 380px; margin: 14vh auto 0; padding: 0 20px; }
.login .panel { padding: 22px; display: grid; gap: 12px; }
.err { color: #ff8b9a; min-height: 1.3em; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--hazard); color: #15181c; padding: 8px 16px; font-weight: 600; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
@media (max-width: 820px) { .admin .grid { grid-template-columns: 1fr; } .linkrow { grid-template-columns: 1fr auto; } }

/* ---------- watch ---------- */
.watch { height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 8px 18px; background: #0d1014; border-bottom: 1px solid var(--steel-700); }
.bar .brand { font-size: 26px; }
.bar .title { font-size: 15px; color: var(--steel-400); font-family: var(--mono); text-transform: uppercase; letter-spacing: .1em; margin-left: 12px; }
.bar .left { display: flex; align-items: baseline; min-width: 0; }
.bar .left .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .clock { display: flex; align-items: center; gap: 18px; font-family: var(--display); font-size: 30px; }
.bar .clock .t { font-family: var(--mono); font-size: 26px; color: var(--hazard); min-width: 4ch; text-align: center; }
.bar .right { justify-self: end; display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--steel-400); }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.arena-wrap { position: relative; min-height: 0; display: grid; place-items: center; padding: 14px; overflow: hidden; }
.arena-wrap svg { width: 100%; height: 100%; max-height: calc(100vh - 80px); display: block; }
.caption {
  position: absolute; left: 4%; right: 4%; bottom: 26px; display: grid; grid-template-columns: auto 1fr; align-items: stretch;
  background: rgba(10, 12, 15, .92); border-top: 3px solid var(--hazard); min-height: 62px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.caption .k { background: var(--hazard); color: #15181c; font-family: var(--display); font-size: 20px; padding: 0 16px; display: grid; place-items: center; min-width: 120px; text-transform: uppercase; }
.caption.kill .k, .caption.betray .k { background: var(--kill); color: #fff; }
.caption.kill { border-top-color: var(--kill); } .caption.betray { border-top-color: var(--kill); }
.caption.comms .k { background: var(--glass); }
.caption.comms { border-top-color: var(--glass); }
.caption .x { padding: 10px 18px; font-size: 24px; font-weight: 500; line-height: 1.2; align-self: center; }
.caption.pop { animation: pop .25s ease-out; }
@keyframes pop { from { transform: translateY(10px); opacity: .3; } }
.side { display: grid; grid-template-rows: auto minmax(0, 1fr); border-left: 1px solid var(--steel-700); background: var(--steel-800); min-height: 0; }
.roster { padding: 10px 14px; display: grid; gap: 7px; max-height: 52vh; overflow: auto; }
.rb { display: grid; grid-template-columns: 30px 1fr auto; gap: 9px; align-items: center; }
.rb .sw { width: 30px; height: 30px; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; color: #15181c; font-weight: 700; clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); }
.rb .nm { font-weight: 600; font-size: 19px; line-height: 1; display: flex; gap: 7px; align-items: center; white-space: nowrap; overflow: hidden; }
.rb .nm small { font-family: var(--mono); font-size: 11px; color: var(--steel-400); letter-spacing: .08em; text-transform: uppercase; font-weight: 400; }
.rb .hp { height: 8px; background: #0d1014; margin-top: 4px; position: relative; }
.rb .hp i { position: absolute; inset: 0 auto 0 0; background: #58e07a; transition: width .4s, background .4s; }
.rb .num { font-family: var(--mono); font-size: 15px; text-align: right; line-height: 1.15; }
.rb .num .en { color: var(--glass); font-size: 12px; }
.rb.dead { opacity: .38; } .rb.dead .nm { text-decoration: line-through; }
.rb .st { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; padding: 1px 4px; border: 1px solid currentColor; }
.log { border-top: 1px solid var(--steel-700); overflow: auto; padding: 8px 14px 20px; font-size: 16px; min-height: 0; }
.log .l { padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.05); color: #b9c3cc; }
.log .l.round { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--hazard); border: 0; padding-top: 12px; }
.log .l.msg { color: var(--flood); }
.log .l.msg.private { color: var(--glass); }
.log .l.death, .log .l.betray { color: #ff8b9a; font-weight: 600; }
.log .l.pact { color: var(--glass); font-style: italic; }
.log .l.win { color: var(--hazard); font-weight: 700; font-size: 19px; }
.winner { position: absolute; inset: 0; display: none; place-items: center; background: radial-gradient(closest-side, rgba(10,12,15,.9), rgba(10,12,15,.55)); text-align: center; }
.winner.show { display: grid; animation: pop .5s ease-out; }
.winner .w1 { font-family: var(--mono); letter-spacing: .3em; color: var(--hazard); text-transform: uppercase; }
.winner .w2 { font-family: var(--display); font-size: clamp(54px, 10vw, 150px); line-height: .95; margin: 6px 0 10px; }
.winner .w3 { font-family: var(--mono); color: #b9c3cc; font-size: 15px; }

/* svg bits */
.bot { transition: opacity .5s; }
.bot .body-wrap { transition: transform .5s; }
.bot.dead .body-wrap { filter: grayscale(1) brightness(.35); }
.bot.unready { opacity: .45; }
.bot text { font-family: var(--ui); font-weight: 700; fill: var(--flood); paint-order: stroke; stroke: #0d1014; stroke-width: 5px; }
.float { font-family: var(--display); paint-order: stroke; stroke: #0d1014; stroke-width: 6px; animation: floatup 1.3s ease-out forwards; }
@keyframes floatup { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-70px); opacity: 0; } }
.ring { fill: none; animation: ring .9s ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes ring { from { transform: scale(.1); opacity: 1; } to { transform: scale(1); opacity: 0; } }
.spin { animation: spin 1.2s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.flick { animation: flick .25s steps(2) infinite; }
@keyframes flick { 50% { opacity: .35; } }
.sweep { animation: sweep 9s ease-in-out infinite alternate; transform-origin: 500px 500px; }
@keyframes sweep { from { transform: rotate(-25deg); } to { transform: rotate(25deg); } }
.bubble { animation: pop .2s ease-out; }
@media (prefers-reduced-motion: reduce) { .sweep, .spin, .flick { animation: none; } }
@media (max-width: 900px) {
  .watch { height: auto; min-height: 100vh; }
  .stage { grid-template-columns: 1fr; }
  .side { border-left: 0; border-top: 1px solid var(--steel-700); }
  .arena-wrap svg { max-height: none; }
  .caption { position: static; margin-top: 8px; width: 100%; }
  .caption .x { font-size: 19px; } .caption .k { min-width: 84px; font-size: 15px; }
  .bar { grid-template-columns: 1fr auto; } .bar .right { display: none; }
  .log { max-height: 50vh; }
}
table.bots td { white-space: nowrap; }
