/* bare first pass. all colours are variables so a later theming pass can restyle from here. */
:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #666666;
  --line: #999999;
  --panel: #f3f3f3;
  --accent: #1a4fa0;
  --accent-fg: #ffffff;
  --warn: #b00020;
  --ok: #1a7f37;
  --tap: 48px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0.6em 0 0.3em; }
h1 { font-size: 1.4em; } h2 { font-size: 1.2em; } h3 { font-size: 1.05em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.muted { color: var(--muted); }
.warn { color: var(--warn); font-weight: bold; }
.ok { color: var(--ok); }
.right { text-align: right; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1; }
.hidden { display: none !important; }

button, select, input[type=text], input[type=number], input[type=file] {
  font: inherit; min-height: var(--tap); padding: 4px 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); border-radius: 4px;
}
button { cursor: pointer; min-width: var(--tap); }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.danger { color: var(--warn); border-color: var(--warn); }
button:disabled { opacity: 0.4; cursor: default; }
input[type=checkbox] { width: 24px; height: 24px; vertical-align: middle; }
label { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); }

nav { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); padding: 6px 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
nav button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
nav .sw { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--line); margin-right: 6px; vertical-align: -2px; }
nav .info { margin-left: auto; font-size: 0.9em; }
main { padding: 8px 12px 60px; max-width: 1200px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 8px 12px; margin: 8px 0; border-radius: 4px; }
.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }

table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: middle; }
th { font-weight: 600; font-size: 0.9em; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.undone td { text-decoration: line-through; color: var(--muted); }
tr.drop-over, .drop-over { outline: 3px dashed var(--accent); }

.swatch { display: inline-block; width: 16px; height: 16px; border: 1px solid var(--line); border-radius: 3px; vertical-align: -3px; }
.big { font-size: 1.8em; font-weight: 700; }
.pend button { min-width: 60px; }

/* nobles */
.nobles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 700px) { .nobles { grid-template-columns: 1fr; } }
.noble { border: 1px solid var(--line); padding: 8px; border-radius: 4px; }
.noble.dead { opacity: 0.55; }
.circle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--fg); color: #fff; font-weight: 700; text-shadow: 0 0 2px #000; flex: none; }
.sumbar { border: 2px solid var(--warn); padding: 4px 8px; margin: 6px 0; display: flex; gap: 14px; flex-wrap: wrap; font-weight: 600; }
.handle { cursor: grab; touch-action: none; user-select: none; font-size: 1.3em; padding: 0 8px; }
.ghost { position: fixed; z-index: 50; pointer-events: none; background: var(--panel); border: 1px solid var(--fg); padding: 4px 10px; opacity: 0.9; }

/* map */
.mapwrap { position: relative; width: 100%; max-width: 1200px; user-select: none; touch-action: manipulation; }
.mapwrap img { display: block; width: 100%; height: auto; }
.city { position: absolute; width: 3.4%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid #666; border-radius: 50%; background: #ddd; display: flex; align-items: center; justify-content: center; font-size: clamp(8px, 1vw, 14px); font-weight: 700; color: #fff; text-shadow: 0 0 2px #000; cursor: pointer; padding: 0; min-height: 0; min-width: 0; }
.city.razed { background: #333 !important; border-color: #000; color: #fff; }
.city.improved { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #111; }
.city .gar { position: absolute; right: -35%; bottom: -35%; background: #fff; color: #000; border: 1px solid #000; border-radius: 3px; font-size: 0.8em; padding: 0 2px; text-shadow: none; }
.token { position: absolute; width: 2.8%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid #fff; outline: 1px solid #000; display: flex; align-items: center; justify-content: center; font-size: clamp(7px, 0.9vw, 13px); font-weight: 700; color: #fff; text-shadow: 0 0 2px #000; touch-action: none; cursor: grab; }
.tray { display: flex; flex-wrap: wrap; gap: 8px; min-height: 60px; padding: 8px; border: 1px dashed var(--line); }
.tray .token { position: static; transform: none; width: 44px; height: 44px; font-size: 14px; }

dialog { border: 2px solid var(--fg); border-radius: 6px; max-width: min(520px, 94vw); width: 100%; padding: 12px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog .field { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 6px; z-index: 100; max-width: 90vw; }
.start { max-width: 640px; margin: 0 auto; padding: 16px; }
.start button.big { width: 100%; margin: 6px 0; min-height: 72px; font-size: 1.2em; }
.code { font-family: ui-monospace, monospace; font-size: 2em; letter-spacing: 0.2em; }
code { background: var(--panel); padding: 1px 4px; word-break: break-all; }
