:root {
  color-scheme: light;
  --ink: #202822;
  --muted: #526057;
  --paper: #fffefa;
  --line: #dce2d8;
  --accent: #194e3d;
  --accent-soft: #e9f0e9;
  --canvas: #edf0e8;
  --green: #164e3c;
  --plum: #653e69;
  --radius: 8px;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p, ul, ol { margin: 0; }
:focus-visible { outline: 2px solid #29705b; outline-offset: 3px; }
::selection { background: #cde2d2; color: #16392d; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px;
  padding: 7px 13px; border: 1px solid #cbd5ca; border-radius: var(--radius);
  background: var(--paper); color: var(--ink); font-size: .875rem; font-weight: 680;
  text-decoration: none; text-align: center; cursor: pointer;
}
button:hover:not(:disabled), .button:hover { background: var(--accent-soft); border-color: #b2c3b4; }
button:disabled { opacity: .46; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover:not(:disabled), .button.primary:hover { background: #113e30; border-color: #113e30; }
.top { background: var(--paper); border-bottom: 1px solid var(--line); }
.top-inner, main { width: min(100% - 44px, 1152px); margin-inline: auto; }
.top-inner { min-height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 9px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.22rem; font-weight: 790; letter-spacing: -.025em; color: var(--ink); }
.brand img { flex: none; }
nav { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 5px 13px; font-size: .88rem; }
nav button { min-height: 36px; }
#account { color: var(--muted); font-weight: 650; overflow-wrap: anywhere; }
main { padding-block: 29px 42px; }
h1 { font-size: 2.45rem; line-height: 1.12; font-weight: 790; letter-spacing: -.034em; }
h2 { font-size: 1.33rem; line-height: 1.25; letter-spacing: -.024em; }
h3 { font-size: .9rem; line-height: 1.35; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-bottom: 11px; font-size: .875rem; font-weight: 650; text-decoration: none; }
.back span { font-size: 1.4rem; line-height: 1; }
.back:hover { text-decoration: underline; }
.game-meta, .hint, .banner p, .catalog-copy p, #lesson-text, #match-help { color: var(--muted); }
.hint { font-size: .84rem; }
.catalog-entry { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 21px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.catalog-art, .board-stage {
  background-color: var(--canvas);
  background-image: radial-gradient(circle, #c4cec1 .85px, transparent 1px);
  background-size: 17px 17px;
  display: grid; place-items: center; min-width: 0;
}
.catalog-art { padding: 24px; background-color: #dce9dc; border-right: 1px solid var(--line); }
.catalog-art svg { width: min(100%, 290px); height: 276px; }
.catalog-copy { align-self: center; padding: 30px clamp(23px, 5vw, 55px); }
.catalog-copy h2 { font-size: 2.2rem; margin-block: 4px 10px; }
.catalog-copy p { max-width: 48ch; }
.catalog-copy .button { margin-top: 19px; }
.game-meta { font-size: .85rem; }
.banner, .tutorial-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
.banner p { margin-top: 6px; }
.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, .62fr); border: 1px solid var(--line); border-radius: 14px; background: var(--paper); overflow: hidden; }
.board-stage { min-height: 450px; padding: 19px; border-right: 1px solid var(--line); }
.board-stage svg { width: min(100%, 510px); max-height: 66dvh; overflow: visible; }
.play-panel { background: var(--paper); min-width: 0; padding: clamp(17px, 3vw, 29px); }
.lesson { align-self: center; }
.progress-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .85rem; font-weight: 650; }
progress { display: block; width: 100%; height: 6px; margin-block: 9px 23px; appearance: none; border: 0; border-radius: 4px; background: var(--line); color: var(--accent); }
progress::-webkit-progress-bar { background: var(--line); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 4px; }
#lesson-text, #match-help { margin-top: 8px; }
#replay { margin-top: 15px; }
.lesson-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.lobby-layout { display: grid; grid-template-columns: minmax(280px, .78fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.lobby-forms { display: grid; gap: 16px; }
.lobby-forms form, .parties { border: 1px solid var(--line); border-radius: 14px; }
form { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: .88rem; font-weight: 650; }
input, select { min-width: 0; width: 100%; min-height: 42px; padding: 7px 10px; border: 1px solid #cbd5ca; border-radius: var(--radius); background: #fff; caret-color: var(--accent); }
input[name=code] { text-transform: uppercase; letter-spacing: .08em; }
form button { justify-self: start; }
.parties h2 { margin-bottom: 11px; }
#party-list { list-style: none; padding: 0; }
#party-list li + li { border-top: 1px solid var(--line); }
#party-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 11px; text-decoration: none; }
#party-list a:hover strong { text-decoration: underline; }
#party-list small { display: block; color: var(--muted); }
.round-status { flex: none; font-size: .83rem; color: var(--muted); }
.round-status.turn { color: var(--accent); font-weight: 750; }
.players { list-style: none; padding: 0 0 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.players li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; padding-block: 4px; }
.players strong { overflow-wrap: anywhere; }
.players small { color: var(--muted); }
.token, .swatch { display: inline-block; flex: none; width: 15px; height: 15px; border-radius: 50%; border: 1px solid #273c3238; }
.token.green, .piece.green { background: var(--green); fill: var(--green); }
.token.plum, .piece.plum { background: var(--plum); fill: var(--plum); }
.piece { stroke: #fffefa; stroke-width: 2; }
.piece-holes { fill: #fffefa; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 13px 0 0; margin-top: 17px; border-top: 1px solid var(--line); font-size: .76rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 5px; }
.swatch.white { background: #fffefa; }
.swatch.orange { background: #f4b634; }
.swatch.red { background: #ea545c; }
.invitation-code { margin-top: 12px; color: var(--accent); font-weight: 810; font-size: 1.6rem; letter-spacing: .12em; overflow-wrap: anywhere; }
#invitation .lesson-actions { justify-content: flex-start; }
#skip, #recent-actions { margin-top: 16px; }
#actions { padding-inline-start: 1.1em; margin-top: 5px; font-size: .79rem; color: var(--muted); }
.message { margin-bottom: 12px; padding: 8px 11px; border-radius: var(--radius); background: #dce9dc; color: var(--accent); font-size: .9rem; }
.message.error { background: #faeae4; color: #802b23; }
.board-field { stroke-width: 1.7; }
.field-label { font-size: 11px; font-weight: 780; fill: #17362b; pointer-events: none; paint-order: stroke; stroke: #fffefa; stroke-width: 2; }
.markers { fill: #3c332c; pointer-events: none; }
.area-text { fill: #344a40; font-size: 14px; font-weight: 740; }
.cell-hit { fill: transparent; stroke: transparent; stroke-width: 3; }
.cell-hit.actionable { cursor: pointer; }
.cell-hit.actionable:hover, .cell-hit:focus-visible { outline: none; stroke: #153f30; stroke-width: 4; }
.cell-hit.selected { stroke: #173c2f; stroke-width: 4; }
.source-mark { fill: none; stroke: #194e3d; stroke-width: 2; stroke-dasharray: 4 3; }
.target { fill: #194e3d21; stroke: #194e3d; stroke-width: 3; stroke-dasharray: 6 4; }
.example-trace { fill: none; stroke: #194e3d; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 7 6; }
@media (max-width: 760px) {
  .top-inner, main { width: calc(100% - 26px); }
  .play-layout { grid-template-columns: minmax(0, 1fr); }
  .board-stage { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 9px; }
  .board-stage svg { width: min(100%, 380px); max-height: 55dvh; }
  .lobby-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 510px) {
  h1 { font-size: 2.1rem; }
  main { padding-top: 18px; }
  .catalog-entry { grid-template-columns: minmax(0, 1fr); }
  .catalog-art { padding: 11px; border-right: 0; border-bottom: 1px solid var(--line); }
  .catalog-art svg { height: 211px; }
  .banner { flex-wrap: wrap; align-items: flex-start; }
  #account { display: none; }
  .brand { gap: 5px; font-size: 1.06rem; }
  .brand img { width: 32px; height: 32px; }
  nav { gap: 5px 7px; }
  nav button { padding-inline: 8px; }
}
