/* dennery games clubhouse table v1. Paper, felt, brass. No gradients-as-brand. */
:root {
  color-scheme: light dark;
  --paper: #FAF6EC;
  --raised: #FFFFFF;
  --felt: #2E6B4F;
  --felt-lt: #3A7D5C;
  --felt-ink: #123B2A;
  --ink: #1D1B16;
  --muted: #6B645A;
  --brass: #B07C1F;
  --brass-soft: #F3E6C8;
  --line: #E3DCCB;
  --focus: #1A5FD7;
  --danger: #B3261E;
  --success: #1F7A3D;
  --shadow: 0 1px 2px rgba(29, 27, 22, .08);
  --radius: 12px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101511;
  --raised: #1F2621;
  --felt: #35795A;
  --felt-lt: #41876A;
  --felt-ink: #0E2F22;
  --ink: #F2EDE0;
  --muted: #B7AE9D;
  --brass: #D9A441;
  --brass-soft: #3A2F17;
  --line: #2C342D;
  --focus: #8FB6FF;
  --danger: #F2A49E;
  --success: #7BD89A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--raised);
  position: sticky;
  top: 0;
  z-index: 10;
}
.wordmark { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); }
.wordmark .word {
  font-family: "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
  font-stretch: condensed;
  font-weight: 700;
  letter-spacing: .02em;
  font-size: 1.2rem;
}
.mark { position: relative; width: 22px; height: 22px; flex: none; }
.mark .sq { position: absolute; width: 12px; height: 12px; border-radius: 2px; }
.mark .sq-a { left: 0; top: 0; background: var(--felt); }
.mark .sq-b { right: 0; bottom: 0; background: var(--ink); }
.topnav { display: flex; gap: .25rem; }
.topnav a {
  color: var(--ink);
  text-decoration: none;
  padding: .4rem .7rem;
  border-radius: 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.topnav a[aria-current="page"] { background: var(--brass-soft); box-shadow: inset 0 0 0 1px var(--brass); }
.topctl { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.topctl select {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .35rem .5rem;
  min-height: 44px;
}
.move-badge {
  background: var(--brass);
  color: #fff;
  border-radius: 999px;
  padding: .1rem .55rem;
  font-weight: 700;
  font-size: .85rem;
}
#who { font-size: .9rem; color: var(--muted); max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#who a { color: var(--ink); }
main { flex: 1; width: 100%; max-width: 68rem; margin: 0 auto; padding: 1rem; }
.foot {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
  padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom));
  text-align: center;
}
.sr-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.offline-bar {
  margin: 0;
  padding: .5rem 1rem;
  background: var(--brass-soft);
  border-bottom: 1px solid var(--brass);
  font-size: .9rem;
}
section.block { margin-bottom: 1.5rem; }
section.block > h2 {
  font-family: "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
  font-size: 1.3rem;
  margin: 0 0 .6rem;
  letter-spacing: .01em;
}
/* Lobby rows: thumbnail + text + one action. */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.row {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .6rem .8rem;
  min-height: 76px;
}
.row.your-move { box-shadow: inset 3px 0 0 var(--brass), var(--shadow); }
.row .thumb {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 2px solid var(--line);
  overflow: hidden;
  background: var(--paper);
  display: grid;
  place-items: center;
}
.row .thumb.your-move { border-color: var(--brass); }
.row .meta { min-width: 0; flex: 1; }
.row .meta .t1 { font-weight: 700; overflow-wrap: anywhere; }
.row .meta .t2 { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.row .act { flex: none; display: flex; gap: .5rem; align-items: center; }
button, .btn {
  font: inherit;
  padding: .45rem .9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
  min-height: 44px;
}
button.primary { background: var(--brass); border-color: transparent; color: #fff; border-radius: 999px; font-weight: 700; }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; }
input[type="text"], input:not([type]) {
  font: inherit;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .45rem .7rem;
  min-height: 44px;
  max-width: 100%;
}
.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--raised);
}
.empty p { margin: 0 0 .8rem; }
.empty .ops { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.skel { display: grid; gap: .6rem; }
.skel span {
  display: block;
  height: 76px;
  border-radius: var(--radius);
  background: var(--line);
  opacity: .55;
}
.errbar {
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  gap: .8rem;
  align-items: center;
  justify-content: space-between;
  overflow-wrap: anywhere;
}
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.chips button[aria-pressed="true"] { background: var(--brass-soft); box-shadow: inset 0 0 0 1px var(--brass); }
.sticky-new {
  position: sticky;
  bottom: calc(.8rem + env(safe-area-inset-bottom));
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .6rem;
  margin-top: 1rem;
}
/* Game view: board first, rail second. */
.game-layout { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 60rem) {
  .game-layout { grid-template-columns: minmax(320px, 560px) minmax(16rem, 1fr); align-items: start; }
}
.turn-banner {
  border-radius: var(--radius);
  padding: .7rem 1rem;
  margin-bottom: .8rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--raised);
  overflow-wrap: anywhere;
}
.turn-banner.yours { box-shadow: inset 3px 0 0 var(--brass); }
.turn-banner .sub { display: block; font-weight: 400; color: var(--muted); font-size: .9rem; }
.board-frame {
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow);
  max-width: 560px;
}
.board-frame.lastmove { border-color: var(--brass); }
table.board { border-collapse: collapse; width: 100%; table-layout: fixed; border-spacing: 0; }
table.board td {
  padding: 0;
  text-align: center;
  vertical-align: middle;
  font-size: clamp(1rem, 4.5vw, 2rem);
  line-height: 1;
  position: relative;
}
table.board td .cellbox {
  display: block;
  position: relative;
  width: 100%;
  padding-top: 100%;
  height: 0;
  overflow: hidden;
}
table.board td .cellbox > * {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
table.board td .cellbox > button {
  all: unset;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-sizing: border-box;
}
table.board td .cellbox > button:disabled { cursor: default; }
table.board td button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
td.sq-lt { background: #EDE6D3; color: #1D1B16; }
td.sq-dk { background: var(--felt); color: #fff; }
[data-theme="dark"] td.sq-lt { background: #D8CFB8; }
td.sq-last { box-shadow: inset 0 0 0 3px var(--brass); }
td.sq-sel { box-shadow: inset 0 0 0 3px var(--focus); }
td.sq-star { box-shadow: inset 0 0 0 2px var(--brass); }
.wgrid { font-size: clamp(.55rem, 2.4vw, 1rem); font-weight: 700; }
.wgrid td button { font-size: inherit; }
.rail { display: grid; gap: .8rem; align-content: start; }
.panel {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .8rem 1rem;
}
.panel h3 { margin: 0 0 .5rem; font-size: 1rem; }
.panel .fine { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
ol.moves { margin: 0; padding-left: 1.4rem; max-height: 12rem; overflow: auto; }
ol.moves li.cur { font-weight: 700; }
.actionrow { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actionrow input { flex: 1 1 12rem; }
.fielderr { color: var(--danger); font-size: .9rem; margin: .4rem 0 0; overflow-wrap: anywhere; }
.stepper { display: flex; gap: .4rem; align-items: center; }
.stepper button { min-width: 44px; }
.plaque {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: var(--raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .6rem .8rem;
}
.plaque .rank { font-weight: 700; min-width: 2rem; text-align: center; }
.plaque .meta { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.plaque .badges { color: var(--muted); font-size: .85rem; }
.shelf { display: flex; gap: .5rem; flex-wrap: wrap; }
.shelf .plate {
  border: 1px solid var(--brass);
  border-radius: 8px;
  padding: .4rem .7rem;
  background: var(--brass-soft);
  font-size: .9rem;
}
.shelf .plate small { display: block; color: var(--muted); }
.shelf .ghost-plate { border-style: dashed; background: transparent; color: var(--muted); }
.signform { display: grid; gap: .6rem; max-width: 28rem; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
/* Card entry (?match= from a post): game first, minimal chrome. */
body[data-entry="card"] .topnav,
body[data-entry="card"] .foot,
body[data-entry="card"] .sticky-new,
body[data-entry="card"] #locale-sel,
body[data-entry="card"] #theme-sel { display: none; }
body[data-entry="card"] main { max-width: 44rem; }
body[data-entry="card"] .card-cta { margin-top: 1rem; }
