/* Look and feel taken from the original prototype: paper, brass and ink. */
:root {
  --paper: #EDE4CE;
  --panel: #FBF8EE;
  --ink: #1F2620;
  --ink-soft: #4C5348;
  --brass: #A9762B;
  --brass-light: #CE9B41;
  --line: #cabb95;
  --danger: #9d3626;
  --ok: #2E7D3A;
  --radius: 6px;
  --shadow: 0 2px 0 rgba(0, 0, 0, .14);
  --red: #C4342B;
  --green: #2E7D3A;
  --yellow: #D9A21B;
  --blue: #2A3C8F;
  --serif: 'Fraunces', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(ellipse at top left, rgba(255, 255, 255, .4), transparent 60%), var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { font-family: var(--serif); margin: 0; }
a { color: var(--brass); }
[hidden] { display: none !important; }

/* Buttons and inputs */
button, .button {
  font-family: inherit; font-size: 13px; cursor: pointer;
  background: var(--brass); color: #fff8ea;
  border: none; padding: 10px 14px; border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform .07s, background .15s;
  min-height: 40px; text-decoration: none; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px;
}
button:hover:not(:disabled) { background: var(--brass-light); }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
button.secondary, .button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
button.secondary:hover:not(:disabled), .button.secondary:hover { background: rgba(0, 0, 0, .05); }
button.danger { background: var(--danger); }
button.mini, .button.mini { font-size: 11px; padding: 5px 9px; min-height: 30px; box-shadow: none; }
button.block { width: 100%; }
button:disabled { opacity: .35; cursor: not-allowed; }
input, select, textarea {
  font-family: inherit; font-size: 16px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
input[type=text], select, textarea { width: 100%; }
label { font-size: 12px; color: var(--ink-soft); }

/* Layout */
.page { max-width: 1100px; margin: 0 auto; padding: 10px 10px 90px; }
.topbar {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 6px 2px 10px; flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 28px; font-weight: 800; letter-spacing: .06em; }
.brand span { font-size: 11.5px; color: var(--ink-soft); font-style: italic; }
.sub { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.card h3 {
  font-size: 12.5px; margin: 14px 0 6px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-soft);
}
.card h3:first-child { margin-top: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; }
.hint { font-size: 11px; color: var(--ink-soft); line-height: 1.5; }
.stat {
  display: flex; justify-content: space-between; gap: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px;
  font-size: 12px; margin-bottom: 9px;
}
.stat b { color: var(--brass); }
.banner {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: var(--radius);
  margin-bottom: 9px; color: #fff; font-size: 13px; font-weight: 600;
}
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; display: inline-block; }

/* Groups of pieces */
.grp { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 6px; overflow: hidden; }
.grp-h {
  display: flex; justify-content: space-between; align-items: center; padding: 6px 8px;
  background: #f2ecdc; font-size: 11px; font-weight: 600; letter-spacing: .03em;
}
.grp-h .loc { color: var(--ink-soft); font-weight: 400; }
.pc {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 12px;
  border-top: 1px solid #f0ebdd; min-height: 40px;
}
.pc.clickable { cursor: pointer; }
.pc.clickable:hover { background: #fff6e2; }
.pc.sel { background: #ffeec6; }
.pc.used { opacity: .5; }
.pc .nm { flex: 1; line-height: 1.3; }
.pc .st { font-size: 10.5px; color: var(--ink-soft); }
.actrow { display: flex; gap: 5px; padding: 6px 8px; border-top: 1px dashed var(--line); flex-wrap: wrap; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 8px; overflow-x: auto; }
.tabs button { flex: 1; white-space: nowrap; font-size: 12px; padding: 8px 6px; }
.tabs button.secondary.on { background: var(--ink); color: #fff8ea; border-color: var(--ink); }

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(18, 16, 10, .74); display: flex; align-items: center;
  justify-content: center; z-index: 60; padding: 14px;
}
.modal {
  background: var(--panel); border-radius: 12px; padding: 20px; width: min(580px, 96vw);
  max-height: 88vh; overflow: auto; border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
}
.modal h2 { font-size: 20px; margin-bottom: 8px; }

/* Combat log */
.log { list-style: none; padding: 0; margin: 8px 0; font-size: 12.5px; line-height: 1.55; }
.log li { padding: 6px 9px; background: #fff; border-radius: 6px; margin-bottom: 5px; border: 1px solid var(--line); }
.log li.big { background: #fff2e4; border-color: var(--brass); }
.empty { color: var(--ink-soft); font-style: italic; font-size: 12px; }

/* Sticky action bar at the bottom of the screen on mobile */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; align-items: center; box-shadow: 0 -4px 14px rgba(0, 0, 0, .12);
}
.actionbar .info { flex: 1; font-size: 12px; line-height: 1.35; }

.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 80;
  background: var(--ink); color: #fff8ea; padding: 10px 14px; border-radius: 8px;
  font-size: 12.5px; max-width: 92vw; box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}
.toast.error { background: var(--danger); }

/* Desktop: board and panel side by side */
.layout { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 900px) {
  .layout { flex-direction: row; align-items: flex-start; }
  .layout > .board-col { flex: 1 1 60%; position: sticky; top: 10px; }
  .layout > .side-col { flex: 1 1 40%; max-width: 420px; }
}

/* Piece chip in lists */
.chip {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 6px;
  color: #fff; flex: none;
}
