@font-face {
  font-family: Cinzel;
  src: url("../vendor/fonts/cinzel-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Cinzel;
  src: url("../vendor/fonts/cinzel-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("../vendor/fonts/crimson-pro-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("../vendor/fonts/crimson-pro-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("../vendor/fonts/crimson-pro-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #2c1c12;
  --ink-soft: #5c4533;
  --parchment: #f4e3c6;
  --parchment-deep: #e7d2a6;
  --paper: #fffaf0;
  --wood: #6d4128;
  --wood-dark: #3e2618;
  --wood-deep: #2c1a12;
  --gold: #b8882d;
  --gold-bright: #e8c56b;
  --crimson: #8d3140;
  --crimson-deep: #6e2432;
  --line: rgba(74, 42, 24, 0.16);
  --shadow: 0 14px 34px rgba(74, 42, 22, 0.12);
  --serif: "Crimson Pro", Palatino, "Palatino Linotype", serif;
  --display: Cinzel, "Times New Roman", serif;
  color: var(--ink);
  background: var(--parchment);
  font-family: var(--serif);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 0% -10%, rgba(255, 250, 236, 0.95), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(196, 122, 74, 0.16), transparent 46%),
    linear-gradient(180deg, #f7e7c9 0%, #ead4aa 100%);
}
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cpath d='M14 2l2 6h6l-5 4 2 6-5-4-5 4 2-6-5-4h6z' fill='none' stroke='%236b3f26' stroke-opacity='.08'/%3E%3C/svg%3E");
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--crimson); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: 0.04em; }
h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); margin: 0; }
h2 { font-size: 1.35rem; margin: 0 0 0.4rem; }
h3 { font-size: 1.05rem; margin: 0; }
p { margin: 0.35rem 0; }
.eyebrow {
  font-family: var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--crimson);
  margin: 0;
}
.lede, .muted { color: var(--ink-soft); }
.traits, .cost, .stats-line, .seat, .res-sub { color: var(--ink-soft); font-size: 0.95rem; }
.lock-note { color: var(--crimson-deep); }

.mast { text-align: center; padding: 12px 16px 6px; }
.mast-tools, .head-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.mast-tools { margin-bottom: 4px; }
.head-tools { flex-shrink: 0; }
.play-title { min-width: 0; }
.music {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 250, 240, 0.92);
  border: 1px solid rgba(120, 78, 36, 0.28);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
}
.music-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--wood);
  color: #fff6e8;
  display: grid;
  place-items: center;
  padding: 0;
}
.music-btn.off { background: #8d6a4e; }
.music-btn .ico svg { width: 22px; height: 22px; }
.music-vol {
  width: 88px;
  height: 28px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  accent-color: var(--crimson-deep);
}
.mast h1 {
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  color: var(--crimson-deep);
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.8);
}
.mast p:last-child { max-width: 38rem; margin: 0.4rem auto 0; font-size: 1.15rem; }

.gate { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }
.gate-grid, .throne-grid, .split {
  display: grid;
  gap: 14px;
}
.panel, .card, .stat, .resource, .land-card, .more-link {
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.96), rgba(244, 230, 204, 0.96));
  border: 1px solid rgba(120, 78, 36, 0.28);
  border-radius: 18px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 248, 230, 0.65);
}
.panel, .card { padding: 16px; }
.auth-card label, .found-card label, .narrow label { display: block; margin-top: 10px; font-family: var(--display); font-size: 0.82rem; letter-spacing: 0.06em; }
input {
  width: 100%;
  margin-top: 4px;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(90, 52, 28, 0.28);
  background: var(--paper);
}
input[type="radio"],
input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  min-width: 1.05rem;
  margin: 0.2rem 0 0;
  padding: 0;
  accent-color: var(--crimson-deep);
  flex: 0 0 auto;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn {
  font-family: var(--display);
  letter-spacing: 0.05em;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.7rem 1.05rem;
  min-height: 44px;
  background: transparent;
}
.btn.primary {
  background: linear-gradient(180deg, #a34454, #7c2c39);
  color: #fff8ec;
  box-shadow: inset 0 1px 0 rgba(255, 236, 214, 0.35);
}
.btn.wood {
  background: linear-gradient(180deg, #8d5a38, #6a3e24);
  color: #fff6e8;
}
.btn.ghost { border-color: rgba(90, 52, 28, 0.35); background: rgba(255, 250, 240, 0.5); }
.btn.danger {
  background: linear-gradient(180deg, #a32032, #6e1422);
  color: #fff8ec;
  box-shadow: inset 0 1px 0 rgba(255, 220, 220, 0.28);
}
.wipe-card label { display: block; margin-top: 12px; }
.season-card { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.season-card h3 { margin: 0 0 4px; font-size: 1rem; }
.board.compact { margin-top: 8px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.land-grid { display: grid; gap: 10px; margin-top: 12px; }
.land-card {
  display: flex;
  gap: 12px;
  text-align: left;
  padding: 12px;
  width: 100%;
}
.land-card.selected { box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.land-copy { display: flex; flex-direction: column; gap: 4px; }
.notice {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff4d8;
  border: 1px solid rgba(184, 136, 45, 0.45);
}
.notice.bad { background: #f8d9d4; border-color: #e2aaa4; color: var(--crimson-deep); }
.starve {
  background: #f8d9d4;
  border: 1px solid #e2aaa4;
  color: var(--crimson-deep);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.shell { min-height: 100vh; }
.sidebar {
  display: none;
  background:
    linear-gradient(180deg, rgba(232, 197, 107, 0.08), transparent 28%),
    linear-gradient(180deg, #4a2c1c, #3a2216 70%);
  color: #f6e7c8;
  padding: 18px 12px;
}
.brand {
  display: flex;
  gap: 8px;
  align-items: center;
  font-family: var(--display);
  letter-spacing: 0.06em;
  padding: 6px 8px 14px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  color: #f6e7c8;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--display);
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}
.sidebar button.on, .sidebar button:hover { background: rgba(232, 197, 107, 0.16); color: #ffe7a3; }
.side-foot { margin-top: auto; padding: 12px; color: #e6d3b0; font-size: 0.95rem; }
.stage { padding: 16px 16px 28px; }
.play-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.tickbox {
  background: var(--wood-dark);
  color: #f6e7c8;
  border-radius: 16px;
  padding: 8px 12px;
  min-width: 92px;
  text-align: center;
}
.tickbox strong {
  display: block;
  font-family: var(--display);
  font-size: 1.3rem;
}
.tick-label { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }

.resources {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.resource {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  min-width: 0;
}
.resource strong, .stat strong, .board b, .res-label {
  display: block;
  font-variant-numeric: tabular-nums;
}
.resource strong { font-family: var(--display); font-size: 1rem; }
.res-label { font-family: var(--display); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.resource.gold .ico { color: #a97818; }
.resource.food .ico { color: #2f6a45; }
.resource.peasants .ico { color: #7a4632; }
.resource.land .ico { color: #3f6b45; }
.resource.mana .ico { color: #2c6484; }
.resource.crown .ico { color: var(--crimson); }

.ico svg, .shield svg { display: block; }
.ico svg { width: 22px; height: 22px; }
.shield svg { width: 52px; height: 52px; }
.shield.lg svg { width: 74px; height: 74px; }
.shield.sm svg { width: 34px; height: 34px; }
.castle svg { width: 100%; height: auto; display: block; }

.identity { display: flex; gap: 14px; align-items: flex-start; }
.stat-grid, .card-grid, .track-list, .admin-list, .more-list { display: grid; gap: 10px; }
.stat { padding: 12px; }
.stat span, .stat em { display: block; color: var(--ink-soft); font-style: normal; font-size: 0.92rem; }
.stat strong { font-family: var(--display); font-size: 1.35rem; }
.page-intro { margin: 6px 0 12px; }
.card header, .admin-card header, .job-top, .track {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.card header b, .chip {
  font-family: var(--display);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--crimson-deep);
}
.chip {
  border: 1px solid rgba(141, 49, 64, 0.3);
  border-radius: 999px;
  padding: 4px 8px;
}
.stepper { display: flex; gap: 6px; align-items: center; margin: 8px 0; }
.stepper button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(90, 52, 28, 0.25);
  background: var(--paper);
}
.stepper span { min-width: 2ch; text-align: center; font-family: var(--display); }
.card.locked, .track.locked { opacity: 0.78; }
.job { margin: 10px 0; }
.job-kind, .job-inline { color: var(--ink-soft); font-size: 0.95rem; }
.job-inline { margin: 8px 0 0; font-family: var(--display); letter-spacing: 0.03em; }
.works { margin: 0 0 14px; }
.crew-line { margin: 0 0 8px; }
.crew-line p { margin: 0; }
.work-list .job:first-child { margin-top: 4px; }
.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(90, 52, 28, 0.12);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #a97818, #e8c56b);
}
.chronicle { list-style: none; margin: 0; padding: 0; }
.chronicle li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.chronicle time { color: var(--ink-soft); }
.track { align-items: flex-start; }
.pips { display: flex; gap: 4px; margin: 8px 0; }
.pips i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  display: block;
}
.pips i.on { background: var(--gold); }
.board { list-style: none; margin: 0; padding: 0; }
.board li {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.board li.you { background: rgba(232, 197, 107, 0.2); border-radius: 12px; padding: 8px; }
.board .who { display: flex; flex-direction: column; min-width: 0; }
.board .who em { color: var(--ink-soft); font-style: normal; font-size: 0.92rem; }
.rank {
  font-family: var(--display);
  width: 1.6rem;
  text-align: center;
}
.narrow { max-width: 640px; }
.grant {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}
.mini span { font-family: var(--display); font-size: 0.75rem; letter-spacing: 0.05em; }
.more-link {
  width: 100%;
  text-align: left;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-dock {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 24;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.chat-toggle { position: relative; }
.chat-badge {
  display: inline-block;
  margin-left: 6px;
  min-width: 1.1rem;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--crimson);
  color: #fff8ec;
  font-style: normal;
  font-family: var(--display);
  font-size: 0.68rem;
  line-height: 1.4;
}
.chat-panel {
  width: 100%;
  height: min(480px, 62vh);
  display: flex;
  flex-direction: column;
  padding: 10px;
  overflow: hidden;
}
.chat-tabs { display: flex; gap: 6px; }
.chat-tabs button {
  flex: 1;
  border: 1px solid rgba(90, 52, 28, 0.25);
  background: transparent;
  border-radius: 999px;
  min-height: 36px;
  font-family: var(--display);
  font-size: 0.78rem;
}
.chat-tabs button.on { background: #fff4d2; border-color: var(--gold); }
.chat-log { flex: 1; overflow: auto; margin-top: 8px; }
.chat-line { padding: 6px 0; border-top: 1px solid var(--line); }
.chat-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; color: var(--ink-soft); font-size: 0.92rem; }
.chat-meta strong { color: var(--ink); }
.chat-compose { display: flex; gap: 6px; margin-top: 8px; }
.chat-compose input { flex: 1; min-width: 0; }
.chat-admin .chat-line .btn { margin-top: 4px; }
@media (max-width: 720px) {
  .chat-dock {
    left: 0;
    right: 0;
    bottom: calc(62px + env(safe-area-inset-bottom));
    width: auto;
    align-items: stretch;
  }
  .chat-toggle { align-self: flex-end; margin-right: 12px; }
  .chat-panel { height: min(68vh, 520px); border-radius: 16px 16px 0 0; }
}
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: #fbf6ea;
  border-top: 1px solid rgba(90, 52, 28, 0.18);
  padding: 4px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav button {
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 54px;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
.bottom-nav button.on { color: var(--crimson-deep); }
.stage { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }

@media (min-width: 720px) {
  .land-grid, .card-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .resources { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
  .bottom-nav { display: none; }
  .stage { padding: 22px 28px 48px; }
  .throne-grid, .split { grid-template-columns: 1.2fr 0.8fr; }
  .gate-grid { grid-template-columns: 1.1fr 0.9fr; align-items: start; }
  .land-grid { grid-template-columns: 1fr 1fr 1fr; }
}
.target-list { display: grid; gap: 8px; }
.target { width: 100%; text-align: left; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.target.selected { box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.orders { scroll-margin-top: 12px; overflow: visible; }
.raid-types {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 10px 0 14px;
}
.raid {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  width: auto;
  margin: 0;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid rgba(120, 78, 36, 0.28);
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.72);
  cursor: pointer;
  min-width: 0;
}
.raid span { display: block; min-width: 0; }
.raid strong { display: block; font-family: var(--display); font-size: 0.95rem; letter-spacing: 0.04em; }
.raid em { display: block; color: var(--ink-soft); font-style: normal; font-size: 0.95rem; line-height: 1.3; }
.raid.on,
.raid:has(input:checked) {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
  background: #fff4d2;
}
.army-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 4px 0 12px;
  min-width: 0;
}
.unit-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 0 2px;
  overflow: visible;
  text-align: left;
}
.unit-field span {
  display: block;
  overflow: visible;
  white-space: normal;
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  line-height: 1.35;
}
.unit-field input { width: 100%; min-width: 0; max-width: 100%; }
@media (min-width: 800px) {
  .raid-types { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .army-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.reports h3 { margin: 0; }
.reports .btn { padding: 6px 12px; min-height: 36px; }
.report { padding: 10px 0; border-top: 1px solid var(--line); }
.report strong { font-family: var(--display); font-size: 0.95rem; }
.report p { margin: 2px 0 0; line-height: 1.35; }
.report .btn { margin-top: 8px; }
.outcome {
  display: inline-block;
  margin: 0 0 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.outcome.win { background: #e5efd4; color: #3d5a22; }
.outcome.loss { background: #f6d5d2; color: var(--crimson-deep); }
.casualty { margin: 8px 0 0; }
.casualty ul { margin: 4px 0 0; padding-left: 1.15rem; }
.casualty li { line-height: 1.35; }
.battle-sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(44, 26, 18, 0.48);
}
.battle-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
}
@media (max-width: 640px) {
  .music-vol { width: 72px; }
  .head-tools { width: 100%; }
}
@media (max-width: 560px) {
  .chronicle li { grid-template-columns: 1fr; gap: 0; }
  .grant, .army-grid { grid-template-columns: 1fr; }
  .identity { flex-direction: column; }
}
