/*
 * Mobile-first parlor layout.
 * Felt, lake, and brass colors, plus the square treatment, are adapted from
 * Oliver Forral's MIT-licensed Veil of the Salt Crown stylesheet
 * (Copyright (c) 2026 Oliver Forral). See third_party/salt-crown/LICENSE.
 */

:root {
  color-scheme: dark;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  color: #e9e9d9;
  background: #10272c;
  --brass: #e2b86c;
  --ink: #9cc7d0;
  --muted: #b1c0bd;
  --line: #385052;
  --felt: #42605b;
  --felt-2: #385550;
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 80% 0, #294345 0, transparent 55%),
    #10272c;
}

button, input, select { font: inherit; color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button {
  cursor: pointer;
  background: #244046;
  border: 1px solid #567071;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 16px;
}

button:disabled { opacity: 0.45; cursor: default; }

button.primary {
  background: var(--brass);
  color: #1b2420;
  border-color: var(--brass);
  font-weight: 700;
}

button.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  text-decoration: underline;
  min-height: 44px;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #f9dfa5;
  outline-offset: 2px;
}

.wrap {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 16px 14px calc(20px + var(--safe-bottom));
}

header.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #e7d2a5;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.brand span {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  font-weight: 500;
  font-size: clamp(34px, 10vw, 48px);
  line-height: 1.05;
  margin: 18px 0 8px;
}

.lede, p { font-family: system-ui, sans-serif; font-size: 15px; line-height: 1.5; color: #c7d3cf; }

.stack { display: grid; gap: 10px; margin-top: 16px; }

label {
  display: grid;
  gap: 6px;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  color: var(--brass);
  letter-spacing: 0.04em;
}

input, select {
  width: 100%;
  min-height: 44px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #567071;
  background: #173238;
  padding: 8px 12px;
}

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.choice button[aria-pressed="true"] {
  border-color: var(--brass);
  color: var(--brass);
}

.banner {
  font-family: system-ui, sans-serif;
  background: #3a2c22;
  border: 1px solid #a68455;
  color: #f3e2c4;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
}

.table { display: grid; gap: 14px; }

.names {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: system-ui, sans-serif;
  font-size: 13px;
}

.names b { font-weight: 650; }
.gold { color: var(--brass); }
.ink { color: var(--ink); }

.badge {
  display: inline-block;
  margin-left: 6px;
  border: 1px solid currentColor;
  border-radius: 99px;
  padding: 0 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  vertical-align: 1px;
}

.board-wrap {
  background: #193439;
  border: 1px solid #52645f;
  padding: 8px;
  box-shadow: 0 12px 40px #0003;
}

.board {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  aspect-ratio: 1;
  touch-action: none;
  background: #10292b;
}

.square {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 2px;
  border: 1px solid #ffffff10;
  background: var(--felt);
  color: #efe6d2;
}

.square:nth-child(2n) { background: var(--felt-2); }

.square.gold { color: #ffe0a2; background: linear-gradient(145deg, #5e634c, #354940); }
.square.ink { color: #d5e7ea; background: linear-gradient(145deg, #42606a, #29474f); }
.square.lake {
  background: radial-gradient(ellipse, #102d37, #173b44);
  color: #6ea8ad;
  border-color: #2f5356;
}
.square.selected { outline: 2px solid #ffe4a1; outline-offset: -2px; }
.square.legal { box-shadow: inset 0 0 0 2px #efc675; }
.square.last { box-shadow: inset 0 0 0 2px #9fb7ad; }

.mark {
  font-family: Georgia, serif;
  font-size: clamp(9px, 2.6vw, 13px);
  line-height: 1;
}

.lake-mark { font-size: clamp(10px, 2.8vw, 14px); opacity: 0.8; }

.tray {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.tray button {
  flex: 0 0 auto;
  min-width: 64px;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px;
}

.tray button[aria-pressed="true"] { border-color: var(--brass); }

.tray small { font-family: system-ui, sans-serif; font-size: 11px; color: var(--muted); }

.emblem { width: 28px; height: 32px; }

.actions { display: grid; gap: 8px; }

.share input { font-family: ui-monospace, monospace; font-size: 13px; }

.captured, .log, .guide-list {
  font-family: system-ui, sans-serif;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 8px;
  font-size: 12px;
}

.log { list-style: none; margin: 0; padding: 0; max-height: 160px; overflow: auto; }
.log li {
  border-left: 2px solid #526d68;
  padding: 4px 0 4px 10px;
  margin: 0 0 8px;
  color: #c5d4ce;
  font-size: 13px;
}
.log li:first-child { border-color: var(--brass); color: #f0e4c7; }

.reveal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #07171bf5;
  display: grid;
  place-items: center;
  padding: 18px;
}

.reveal article {
  width: min(420px, 100%);
  background: #1b363b;
  border: 1px solid #e2b86c;
  border-radius: 12px;
  padding: 22px 16px 18px;
  text-align: center;
  box-shadow: 0 18px 60px #000a;
  animation: rise 0.35s ease;
}

.versus { display: flex; justify-content: center; gap: 18px; align-items: center; }
.versus .emblem { width: 72px; height: 82px; }
.versus p { margin: 6px 0 0; font-size: 14px; }

h2 { font-weight: 500; margin: 0 0 8px; }

.guide {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.guide-list { display: grid; gap: 8px; }
.guide-list article {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  align-items: center;
}
.guide-list p { margin: 2px 0 0; font-size: 13px; }

#ghost {
  position: fixed;
  z-index: 30;
  width: 46px;
  pointer-events: none;
  transform: translate(-50%, -70%);
  filter: drop-shadow(0 6px 8px #0008);
}

@media (min-width: 900px) {
  .layout {
    width: min(920px, calc(100% - 32px));
    display: grid;
    grid-template-columns: minmax(320px, 520px) minmax(240px, 1fr);
    gap: 28px;
    align-items: start;
    margin: 0 auto;
    padding: 20px 16px 40px;
  }
  .layout .board-column { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal article { animation: none; }
}

@keyframes rise {
  from { transform: translateY(8px); }
  to { transform: none; }
}
