/* TOPOS: a garden at war. Warm paper panels over the picture, round shapes, the two teams' colours. */
:root {
  --bg: #1b2a3a; --ink: #f6f0e2; --dim: #b9b7a6; --accent: #ffb23c; --accent2: #ff8a3c; --line: rgba(246, 240, 226, 0.18);
  --panel: rgba(24, 30, 34, 0.82); --t0: #ff8a3c; --t1: #3ec6ff; --ui: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--ui); overflow: hidden; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
.hidden { display: none !important; }
a { color: var(--ink); text-underline-offset: 3px; }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body.playing #cv { cursor: crosshair; }

/* ---------- panels over the picture */
#ui { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); pointer-events: none; }
#ui.bottom { align-items: flex-end; }
#ui:empty { display: none; }
.panel { pointer-events: auto; width: min(480px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 26px; padding: clamp(18px, 4.5vw, 30px); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; }
.panel.home { width: min(560px, 100%); }
.panel.sheet { width: min(440px, 100%); gap: 12px; padding: 16px 18px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 22px; font-weight: 800; letter-spacing: 0.02em; }
h3 { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.logo { font-size: clamp(56px, 16vw, 88px); font-weight: 900; letter-spacing: 0.06em; line-height: 1; text-align: center; color: var(--accent); text-shadow: 0 4px 0 #8a4a12, 0 10px 24px rgba(0, 0, 0, 0.4); }
/* the O of the name: a burrow with a nose coming out */
.logo i { display: inline-block; position: relative; width: 0.72em; height: 0.72em; margin: 0 0.02em; border-radius: 50%; background: #2a1a10; box-shadow: inset 0 0.08em 0 rgba(0, 0, 0, 0.5), 0 4px 0 #8a4a12; vertical-align: -0.04em; overflow: hidden; }
.logo i::before { content: ""; position: absolute; left: 14%; right: 14%; bottom: -34%; height: 86%; border-radius: 50% 50% 0 0; background: #4d4556; }
.logo i::after { content: ""; position: absolute; left: 38%; bottom: 24%; width: 24%; height: 20%; border-radius: 50%; background: #f7a6b8; }
.tag { text-align: center; color: var(--ink); font-size: 17px; margin-top: -2px; }
.sub { color: var(--dim); font-size: 14px; }
.how { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; color: #e2dccb; }
.keys { color: var(--dim); font-size: 13.5px; line-height: 1.7; }
kbd { display: inline-block; min-width: 1.7em; text-align: center; font: 700 12px var(--ui); color: var(--ink); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 7px; padding: 1px 6px; }
details summary { cursor: pointer; font-weight: 700; color: var(--accent); padding: 4px 0; }
.wlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 14px; margin: 8px 0; }
.wlist div { display: flex; gap: 10px; align-items: center; }
.wlist canvas { flex: none; width: 36px; height: 36px; background: rgba(246, 240, 226, 0.08); border-radius: 10px; }
.wlist p { font-size: 13px; line-height: 1.35; color: var(--dim); }
.wlist b { color: var(--ink); font-size: 14px; }
.wlist em { font-style: normal; color: var(--accent); font-weight: 700; }
.foot { color: var(--dim); font-size: 13px; text-align: center; line-height: 1.9; overflow-wrap: anywhere; }
.foot a { color: var(--dim); }
.back { color: var(--dim); font-size: 14px; text-decoration: none; align-self: flex-start; }
.msg { min-height: 1.3em; font-size: 14px; color: var(--dim); text-align: center; }
.msg.bad { color: #ff9a8a; }
.or { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- buttons, inputs */
.btns { display: flex; flex-direction: column; gap: 10px; }
.btns.row { flex-direction: row; }
.btns.row .btn { flex: 1; }
.btn { display: block; text-align: center; text-decoration: none; font: 700 16px var(--ui); color: var(--ink); background: rgba(246, 240, 226, 0.09); border: 1px solid var(--line); border-radius: 999px; padding: 12px 20px; cursor: pointer; transition: transform 0.08s, background 0.15s; }
.btn:hover { background: rgba(246, 240, 226, 0.17); }
.btn:active { transform: scale(0.97); }
.btn.big { font-size: 19px; font-weight: 800; padding: 14px 22px; color: #2a1505; background: var(--accent); border-color: var(--accent); box-shadow: 0 4px 0 #9a5a14, 0 10px 26px rgba(255, 160, 50, 0.25); }
.btn.big:hover { background: #ffc35c; }
.btn small { display: block; font-size: 12px; font-weight: 600; opacity: 0.75; }
.btn[disabled] { opacity: 0.45; cursor: default; box-shadow: none; }
.btn[disabled]:active { transform: none; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lv { font: 700 13px var(--ui); color: var(--dim); background: rgba(246, 240, 226, 0.05); border: 1px solid var(--line); border-radius: 14px; padding: 7px 2px; cursor: pointer; min-width: 0; }
.lv:hover { color: var(--ink); }
.lv.on { color: #2a1505; background: var(--ink); border-color: var(--ink); }
input { font: 500 16px var(--ui); color: var(--ink); background: rgba(0, 0, 0, 0.32); border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; width: 100%; min-width: 0; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--dim); }
label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; }
label.inline input { width: 9.5em; padding: 5px 10px; font-size: 14px; border-radius: 10px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row .btn { flex: none; padding: 11px 16px; font-size: 15px; }
#code { text-transform: uppercase; letter-spacing: 0.2em; font-weight: 700; }
.item { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; width: 100%; text-align: left; font: 500 15px var(--ui); color: var(--ink); background: rgba(246, 240, 226, 0.05); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; cursor: pointer; margin-top: 8px; }
.item span { color: var(--dim); font-size: 13px; white-space: nowrap; }

/* ---------- the room */
.invite { display: flex; flex-direction: column; gap: 7px; background: rgba(255, 178, 60, 0.1); border: 1px solid rgba(255, 178, 60, 0.4); border-radius: 18px; padding: 12px 14px; }
.invite small { color: #ffdca0; font-size: 13px; }
.invite input { font-size: 13px; padding: 9px 12px; }
.players { display: flex; flex-direction: column; gap: 6px; }
.pl, .result li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: rgba(246, 240, 226, 0.06); }
.pl i, .result li i { flex: none; width: 14px; height: 14px; border-radius: 50% 50% 4px 4px; }
.pl b, .result li b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl em { font-style: normal; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.pl em.off { color: #ff9a8a; border-color: rgba(255, 154, 138, 0.4); }
.pl .karma { margin-left: auto; font-size: 13px; font-weight: 700; color: #cfe9a0; white-space: nowrap; }
.pl > span:last-child, .result li > span:last-child { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.pl .karma + span:last-child { margin-left: 12px; }
.pl > span:last-child::before { content: "★ "; color: var(--accent); font-weight: 400; }
.result { display: flex; flex-direction: column; gap: 8px; }
.result h2 { text-align: center; font-size: 28px; color: var(--accent); }
.result .sub { text-align: center; }
.result ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.result li.win { background: rgba(255, 178, 60, 0.18); outline: 1px solid rgba(255, 178, 60, 0.5); }
.result li em { font-style: normal; font-size: 13px; font-weight: 800; white-space: nowrap; }
.result li em.up { color: #a8f08a; } .result li em.down { color: #ff9a8a; }
.result li > span:last-child::after { content: " ♥"; color: #ff7a8a; font-weight: 400; }
.score { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.score b { font-size: 30px; font-weight: 800; color: var(--accent); }
.score span { color: var(--dim); font-variant-numeric: tabular-nums; }

/* ---------- while playing */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud .top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
.tm { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 800; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.tm span { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34%; }
.tm b { font-size: 17px; font-variant-numeric: tabular-nums; min-width: 2em; }
.tm .bar { flex: 1; height: 14px; border-radius: 999px; background: rgba(10, 12, 20, 0.55); border: 1.5px solid rgba(255, 255, 255, 0.35); overflow: hidden; display: flex; }
.tm .bar i { display: block; height: 100%; width: 100%; border-radius: 999px; transition: width 0.3s; }
/* what each has left to throw: the number that ends the match at zero */
.tm em { flex: none; font-style: normal; font-size: 15px; font-variant-numeric: tabular-nums; color: #fff; background: rgba(10, 12, 20, 0.6); border: 1.5px solid currentColor; border-radius: 999px; padding: 1px 9px 1px 7px; white-space: nowrap; }
.tm em::before { content: "✦ "; font-size: 12px; }
.tm em.low { color: #ff5a4f; animation: pulse 0.6s infinite; }
.t0 { color: var(--t0); } .t0 .bar i { background: linear-gradient(#ffb070, var(--t0)); }
.t1 { color: var(--t1); } .t1 .bar { justify-content: flex-end; } .t1 .bar i { background: linear-gradient(#9ae2ff, var(--t1)); }
.t1 b { text-align: right; } .t0 b { text-align: left; }
.t1 span { text-align: right; }
#hud .mid { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 76px; }
#h-time { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }
#h-time.soon { color: #ffd23f; animation: pulse 0.9s infinite; }
#hud .tr { flex: none; display: flex; gap: 6px; pointer-events: auto; }
#hud .tr button { width: 38px; height: 38px; border-radius: 50%; font: 700 15px var(--ui); color: var(--ink); background: rgba(12, 16, 26, 0.6); border: 1px solid var(--line); cursor: pointer; }
#hud .tr button.off { color: var(--dim); text-decoration: line-through; }
#h-banner { position: absolute; left: 50%; top: 24%; transform: translate(-50%, -50%); font-size: clamp(24px, 5vw, 40px); font-weight: 900; letter-spacing: 0.03em; color: #fff; text-align: center; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.55), 0 0 26px rgba(0, 0, 0, 0.6); white-space: nowrap; animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1); }
#h-banner.big { font-size: clamp(40px, 10vw, 84px); color: var(--accent); }
#h-tip { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); max-width: min(700px, calc(100% - 24px)); text-align: center; font-size: 14px; color: var(--ink); background: rgba(12, 16, 26, 0.74); border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; }
#h-tip b { color: var(--accent); margin-right: 4px; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes pulse { 50% { opacity: 0.45; } }

/* what there is to throw (left) and to answer with (right) */
#bars { position: absolute; left: 50%; bottom: max(8px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 14px; pointer-events: none; max-width: calc(100% - 12px); }
#abar, #dbar { display: flex; gap: 5px; padding: 6px; background: rgba(12, 16, 26, 0.62); border: 1px solid var(--line); border-radius: 18px; pointer-events: auto; }
#dbar { border-color: rgba(160, 255, 150, 0.45); }
.wp { position: relative; flex: none; width: 48px; height: 48px; padding: 0; border-radius: 12px; background: rgba(246, 240, 226, 0.08); border: 1.5px solid transparent; cursor: pointer; touch-action: none; }
.wp canvas { width: 40px; height: 40px; display: block; margin: 2.5px auto; pointer-events: none; }
.wp:hover { background: rgba(246, 240, 226, 0.2); }
.wp.on { background: rgba(255, 178, 60, 0.32); border-color: var(--accent); }
.wp.off { opacity: 0.25; }
.wp i { position: absolute; right: 3px; bottom: 0; font: 800 13px var(--ui); font-style: normal; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.wp u { position: absolute; left: 3px; top: 0; font: 700 9px var(--ui); text-decoration: none; color: var(--dim); }
.wp.df u { color: #b8f0a0; }
#pad { display: none; position: absolute; left: max(8px, env(safe-area-inset-left)); bottom: max(8px, env(safe-area-inset-bottom)); gap: 6px; pointer-events: auto; }
body.touch #pad { display: flex; }
#pad button { width: min(58px, 7.4vw); height: min(58px, 7.4vw); padding: 0; border-radius: 50%; font: 700 21px var(--ui); color: var(--ink); background: rgba(12, 16, 26, 0.55); border: 1.5px solid rgba(255, 255, 255, 0.35); touch-action: none; user-select: none; -webkit-user-select: none; }
#pad button:active { background: rgba(255, 255, 255, 0.3); }
/* under the thumbs everything is one row along the bottom, below the ground the moles stand on */
body.touch #bars { left: auto; right: max(6px, env(safe-area-inset-right)); transform: none; align-items: flex-end; gap: 6px; max-width: calc(100% - min(58px, 7.4vw) * 3 - 34px); }
body.touch #abar, body.touch #dbar { gap: 3px; padding: 4px; border-radius: 14px; }
body.touch .wp { width: min(40px, 5.2vw); height: min(40px, 5.2vw); border-radius: 10px; } body.touch .wp canvas { width: 84%; height: 84%; margin: 8% auto; } body.touch .wp u { display: none; }
body.touch .wp.df { width: min(52px, 6.4vw); height: min(52px, 6.4vw); }
body.touch .wp i { font-size: 11px; right: 2px; }
body.touch #h-tip { bottom: 76px; font-size: 13px; }
#toast { position: fixed; left: 50%; top: max(100px, 16%); transform: translateX(-50%); max-width: calc(100% - 24px); text-align: center; font-size: 15px; font-weight: 600; background: rgba(12, 16, 26, 0.85); border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px; pointer-events: none; }
/* the list of attacks and their answers, on the title screen */
.pairs { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.pairs div { display: flex; gap: 10px; align-items: center; }
.pairs canvas { flex: none; width: 34px; height: 34px; background: rgba(246, 240, 226, 0.08); border-radius: 10px; }
.pairs p { font-size: 13px; line-height: 1.35; color: var(--dim); }
.pairs b { color: var(--ink); font-size: 14px; }
.pairs em { font-style: normal; color: var(--accent); font-weight: 700; }
.pairs .ans { color: #b8f0a0; }
.rule { background: rgba(255, 178, 60, 0.12); border: 1px solid rgba(255, 178, 60, 0.4); border-radius: 14px; padding: 9px 12px; color: var(--ink); }
.face { flex: none; display: inline-flex; width: 28px; height: 28px; border-radius: 8px; overflow: hidden; }
.face svg { width: 100%; height: 100%; display: block; }
@media (max-width: 900px) { .tm span { display: none; } body:not(.touch) #bars { flex-wrap: wrap; justify-content: center; } }
@media (max-height: 520px) { .tag { display: none; } .logo { font-size: 44px; } .panel { gap: 10px; padding: 14px 18px; } #h-banner { top: 30%; } }
