/* Two tones, like the world: ink panels with a paper outline. Inverted (paper) = selected. Same values as
   PAPER and DARK in client.js. */
:root {
  --paper: #cec9b6;
  --ink: #11131c;
  --muted: #8b8778;
  --gold: #e2ba52;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--paper);
  font: 13px/1.35 ui-monospace, "JetBrains Mono", "DejaVu Sans Mono", monospace; user-select: none; }
canvas { display: block; width: 100vw; height: 100vh; cursor: none; image-rendering: pixelated; }

.panel { position: fixed; background: var(--ink); color: var(--paper); border: 1px solid var(--paper);
  box-shadow: 0 0 0 2px var(--ink); padding: 10px 12px; pointer-events: none; }

#hud { top: 12px; left: 12px; min-width: 190px; }
.row { display: flex; justify-content: space-between; gap: 16px; }
.row.big b { font-size: 18px; }
.lbl { color: var(--muted); letter-spacing: 2px; font-size: 11px; align-self: center; }
.tools { margin-top: 8px; display: grid; gap: 3px; }
.tool { padding: 3px 6px; color: var(--muted); }
.tool.on { background: var(--paper); color: var(--ink); }
kbd { font: inherit; font-weight: 700; display: inline-block; min-width: 1.4em; text-align: center;
  border: 1px solid currentColor; margin-right: 4px; }
.swatches { display: grid; grid-template-columns: repeat(8, 18px); gap: 5px; margin-top: 10px; }
.sw { width: 18px; height: 18px; border: 1px solid var(--ink); }
.sw.locked { border: 1px dotted var(--muted); opacity: 0.6; }
.sw.on { outline: 2px solid var(--paper); outline-offset: 1px; }
.chip { display: inline-block; width: 10px; height: 10px; margin-right: 6px; }
.fx { display: grid; gap: 2px; margin-top: 8px; font-size: 12px; }
.fx:empty { display: none; }
.fx div { padding: 2px 6px; white-space: pre; }
.fx .good { background: var(--paper); color: var(--ink); }
.fx .bad { border: 1px dashed var(--paper); }
.cds { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 8px; font-size: 11px; }
.cds span { color: var(--paper); }
.cds span.cool { color: var(--muted); }

#boards { position: fixed; top: 12px; right: 12px; display: grid; gap: 12px; justify-items: end; pointer-events: none; }
#boards.hide { display: none; }
#boards .panel { position: static; }
#board { min-width: 200px; }
#board .title { color: var(--muted); letter-spacing: 2px; font-size: 11px; margin-bottom: 4px; }
#board ol { margin: 0; padding-left: 20px; }
#board li > span:first-child { font-weight: 600; }
#board li { display: flex; justify-content: space-between; gap: 12px; padding: 0 3px; }
#board li.off { opacity: 0.5; }
#board li.me { background: var(--paper); color: var(--ink); }

#help { bottom: 12px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 11px;
  text-align: center; width: max-content; max-width: min(980px, calc(100vw - 24px)); }
#help b { color: var(--paper); font-weight: 600; }

#chat { bottom: 92px; left: 12px; width: min(380px, calc(100vw - 24px)); font-size: 12px; transition: opacity 0.6s; }
#chat.faded { opacity: 0; }
#chatLog div { overflow-wrap: anywhere; }
#chatLog .who { font-weight: 600; cursor: pointer; }
#chat:not(.faded) .who { pointer-events: auto; } /* names toggle mute; nothing is clickable while faded */
#chatLog .muted { color: var(--muted); }
#chatIn { display: block; width: 100%; margin-top: 6px; padding: 3px 6px; background: var(--ink); color: var(--paper);
  border: 1px solid var(--paper); font: inherit; outline: none; pointer-events: auto; user-select: text; }
#chatIn.hide { display: none; }

#shop { top: 50%; right: 12px; transform: translateY(-50%); width: min(360px, calc(100vw - 24px));
  max-height: calc(100vh - 140px); overflow-y: auto; pointer-events: auto; }
#shop.hide { display: none; }
#shop .title, #shop .sec { color: var(--muted); letter-spacing: 2px; font-size: 11px; }
#shop .sec { margin: 10px 0 2px; }
#shop .title { display: flex; justify-content: space-between; align-items: center; }
#shop .item { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: center; padding: 5px 0;
  border-top: 1px dotted var(--muted); }
#shop .pv { display: flex; gap: 3px; align-items: center; justify-content: center; }
#shop .pv canvas { max-width: 44px; max-height: 44px; image-rendering: pixelated; }
#shop .pv i { width: 16px; height: 16px; border: 1px solid var(--paper); }
#shop .price, #shop .note, #shop .foot { color: var(--muted); font-size: 11px; }
#shop .foot { margin-top: 10px; }
#shop button { font: inherit; padding: 2px 8px; background: var(--ink); color: var(--paper); border: 1px solid var(--paper); cursor: pointer; }
#shop button:disabled { background: var(--paper); color: var(--ink); cursor: default; }

#toasts { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); border: 1px solid var(--paper); box-shadow: 0 0 0 2px var(--ink);
  padding: 6px 12px; transition: opacity 0.4s; }

#conn { top: 50%; left: 50%; transform: translate(-50%, -50%); }
#conn.hide { display: none; }

/* In a duel only the arena matters (the chat stays). */
.dueling #hud, .dueling #help, .dueling #boards { display: none; }
#chatLog .sys { color: var(--gold); }
#chatLog .dim { opacity: 0.6; } /* watchers */

#watch { bottom: 12px; left: 50%; transform: translateX(-50%); text-align: center; width: max-content;
  max-width: calc(100vw - 24px); }
#watch.hide, #watchDuels.hide, #call.hide, #report.hide { display: none; }
#watchLine { font-size: 16px; font-weight: 600; }
#watchWho, #watch .nm { color: var(--muted); font-size: 11px; margin-top: 3px; }
#watchDuels { margin-top: 6px; }
#watch button, #report button { font: inherit; padding: 2px 10px; background: var(--ink); color: var(--paper); border: 1px solid var(--paper);
  cursor: pointer; pointer-events: auto; }
#watch input { font: inherit; font-size: 11px; width: 160px; padding: 1px 5px; background: var(--ink); color: var(--paper);
  border: 1px solid var(--muted); outline: none; pointer-events: auto; user-select: text; }
#call { top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; padding: 22px 40px; z-index: 5; }
#call .t { font-size: 34px; color: var(--gold); }
.watching #hud, .watching #help { display: none; }
.watching canvas { cursor: default; }
#report { top: 96px; left: 50%; transform: translateX(-50%); text-align: center; }
#reportWho { margin-bottom: 8px; }

/* A name on the way in; the page in front of everything when you can't be in. */
#hello { top: 24%; left: 50%; transform: translateX(-50%); text-align: center; padding: 16px 24px; pointer-events: auto; z-index: 4; }
#hello.hide, #gate.hide, #gate .hide { display: none; }
#hello .title { color: var(--muted); letter-spacing: 2px; font-size: 11px; margin-bottom: 8px; }
#hello .sub, #gate .sub { color: var(--muted); font-size: 11px; margin-top: 8px; }
#hello input { font: inherit; width: 200px; padding: 4px 8px; background: var(--ink); color: var(--paper);
  border: 1px solid var(--paper); outline: none; user-select: text; }
#hello button, #gate button { font: inherit; padding: 4px 14px; background: var(--ink); color: var(--paper);
  border: 1px solid var(--paper); cursor: pointer; }
#gate { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background-color: var(--ink);
  background-image: radial-gradient(#cec9b630 1px, transparent 1.5px); background-size: 14px 14px; }
#gate .box { background: var(--ink); border: 1px solid var(--paper); padding: 28px 40px; text-align: center; max-width: calc(100vw - 24px); }
#gate h1 { margin: 0 0 16px; font-size: 22px; letter-spacing: 6px; font-weight: 600; }
#gate .big { font-size: 38px; color: var(--gold); margin: 10px 0; font-variant-numeric: tabular-nums; }
#gate button { margin-top: 14px; }

#disk { top: 12px; left: 50%; transform: translateX(-50%); padding: 4px 10px; font-size: 11px; display: flex; gap: 10px;
  align-items: center; white-space: nowrap; }
#disk.hide, #upgrade.hide { display: none; }
#diskBar { display: block; width: 110px; height: 8px; border: 1px solid var(--paper); }
#diskFill { display: block; height: 100%; width: 0; background: var(--paper); }
#upgrade { top: 96px; left: 50%; transform: translateX(-50%); text-align: center; padding: 14px 28px; z-index: 3; }
#upgrade .title { color: var(--muted); letter-spacing: 2px; font-size: 11px; margin-bottom: 8px; }
#upgrade .big { font-size: 22px; color: var(--gold); margin: 6px 0; }
#upgrade .sub { color: var(--muted); }
.dueling #disk, .dueling #upgrade { display: none; }
