/* ParlorNet Play: one stylesheet for the shell and every game's panels. */
:root {
  --bg: #14171b; --bg2: #1a1e23; --card: #1f242a; --card2: #262c33; --line: #343c46; --ink: #eef0f2;
  --muted: #a3adb8; --accent: #e3a83c; --accent2: #f3c56b; --accent-ink: #1d1505; --ok: #6cc497;
  --danger: #ea6d62; --focus: #ffd27a; --radius: 12px;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 70% -10%, #23303a 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 110%, #2a2418 0%, transparent 55%), var(--bg);
  color: var(--ink); font: 100%/1.45 var(--sans); display: flex; flex-direction: column; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); }
a:hover { color: #fff; }
h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: 0.01em; margin: 0 0 0.6em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.15rem; color: #f6e7c8; }
p { margin: 0.4em 0 0.8em; }
.small { font-size: 0.86rem; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

button, select, input { font: inherit; color: inherit; }
button {
  background: var(--card2); border: 1px solid var(--line); border-radius: 9px; padding: 0.5em 0.95em;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.05s; min-height: 40px;
}
button:hover { background: #2f363e; border-color: #4a5461; }
button:active { transform: translateY(1px); }
button.primary { background: linear-gradient(#efb54b, #d7982a); color: var(--accent-ink); border-color: #b98220; font-weight: 600; }
button.primary:hover { background: linear-gradient(#f6c260, #e0a333); }
button.danger { color: #ffd8d3; border-color: #6d3530; background: #3a2321; }
button.danger:hover { background: #4b2a27; }
button:disabled { opacity: 0.45; cursor: default; }
button.icon { width: 40px; height: 40px; padding: 8px; display: inline-grid; place-items: center; }
button.icon svg { width: 22px; height: 22px; fill: currentColor; }
button.text { background: none; border-color: transparent; }
input, select {
  background: #12161a; border: 1px solid var(--line); border-radius: 9px; padding: 0.5em 0.7em; min-height: 40px;
}
input:focus, select:focus { border-color: var(--accent); }
label { display: block; color: var(--muted); font-size: 0.9rem; margin: 0.2em 0; }
label.check { display: flex; align-items: center; gap: 0.5em; color: var(--ink); }
.row { display: flex; gap: 0.5em; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row input { flex: 1; min-width: 0; }

.bar {
  display: flex; align-items: center; gap: 1rem; padding: 6px 14px; min-height: 54px;
  background: rgba(16, 19, 23, 0.82); border-bottom: 1px solid #262c33; backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 0.55em; text-decoration: none; color: var(--ink);
  font-family: var(--display); font-size: 1.2rem; font-weight: 600; }
.brand em { color: var(--accent); font-style: normal; }
.crumbs { flex: 1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.tools { display: flex; align-items: center; gap: 0.4rem; }
.who { color: var(--muted); margin-right: 0.3rem; }
.who b { color: var(--ink); }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
main:focus { outline: none; }
.view { flex: 1; min-height: 0; }
.view.center { display: grid; place-items: center; padding: 24px 16px; }
.card { background: linear-gradient(180deg, rgba(38, 44, 51, 0.92), rgba(30, 35, 41, 0.92)); border: 1px solid #2f3740;
  border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.card + .card { margin-top: 14px; }
.card.narrow { width: min(440px, 100%); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; }
.msg { color: var(--danger); min-height: 1.2em; margin: 0.6em 0 0; }
.msg.ok { color: var(--ok); }
.hint { font-size: 0.82rem; color: var(--muted); margin: 0.25em 0 0.9em; }

.signin input { width: 100%; }
.signin form button[type=submit] { width: 100%; margin-top: 0.2em; }
.signin .row button { flex: 1; }
.tabs { display: flex; gap: 4px; background: #14181c; border-radius: 10px; padding: 4px; margin: 0.6em 0 1em; }
.tabs button { flex: 1; border: 0; background: none; min-height: 36px; }
.tabs button[aria-selected=true] { background: var(--card2); box-shadow: inset 0 0 0 1px var(--line); }
.info { color: var(--ink); font-size: 0.92rem; white-space: pre-wrap; }
.info:empty { display: none; }
.yn { display: flex; gap: 0.5em; margin: 0.4em 0; }
.yn button { flex: 1; }

/* the lobby */
.lobby { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 16px; padding: 18px;
  max-width: 1480px; width: 100%; margin: 0 auto; align-items: start; }
.tables { display: grid; gap: 8px; }
.trow { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px;
  border-radius: 10px; background: #1a1f24; border: 1px solid #2b333c; }
.trow.mine { border-color: #6b5426; background: #241f17; }
.trow .gname { font-weight: 600; }
.trow .meta { color: var(--muted); font-size: 0.86rem; }
.trow .num { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.badge { display: inline-block; font-size: 0.72rem; padding: 1px 7px; border-radius: 99px; background: #30373f; color: #d9dee4; margin-left: 6px; vertical-align: 1px; }
.badge.turn { background: var(--accent); color: var(--accent-ink); }
.badge.bot { background: #2d4a3d; color: #c6f1d9; }
.badge.unfinished { background: #3b3324; color: #f0d9a8; margin-left: 0; }
.empty { color: var(--muted); padding: 12px 2px; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.games button { text-align: left; padding: 10px 12px; min-height: 58px; }
.games button small { display: block; color: var(--muted); font-size: 0.78rem; }
.games button[aria-checked=true] { border-color: var(--accent); background: #2b2518; box-shadow: inset 0 0 0 1px var(--accent); }
.opts { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: end; margin-bottom: 12px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid #2a3139; }
.list li:last-child { border-bottom: 0; }
.people li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 8px; flex: none; }
.people li { justify-content: flex-start; }
.people .idle::before { background: #6a737e; }

/* a player's name, which opens their profile */
button.plink { background: none; border: 0; border-radius: 3px; padding: 0; min-height: 0; font: inherit; color: inherit;
  cursor: pointer; text-decoration: underline; text-decoration-color: rgba(243, 197, 107, 0.45); text-underline-offset: 3px; }
button.plink:hover { background: none; color: #fff; text-decoration-color: var(--accent2); }
button.plink:active { transform: none; }

/* activity: turns as sentences */
.page { max-width: 920px; width: 100%; margin: 0 auto; padding: 18px; }
.page h1 { font-size: 1.6rem; }
.page .row a { margin-left: auto; }
.feed { list-style: none; margin: 0 0 8px; padding: 0; }
.feed li { padding: 10px 2px; border-bottom: 1px solid #2a3139; }
.feed li:last-child { border-bottom: 0; }
.feed p { margin: 0; }
.feed .what { line-height: 1.4; }
.feed .when { margin-top: 2px; }
.feed .when a { color: var(--muted); }
.feed .when a:hover { color: var(--ink); }
.feed.compact li { padding: 7px 0; font-size: 0.9rem; }
.feed.compact .when { font-size: 0.78rem; }

/* the profile */
#d-profile { width: min(680px, calc(100vw - 24px)); }
.profile .kicker { margin: 0; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; }
.profile h2 { font-size: 1.6rem; margin-bottom: 0.2em; }
.profile h3 { font-size: 0.9rem; font-weight: 600; color: var(--muted); margin: 0 0 4px; }
.profile .pref { font-size: 1.02rem; margin: 0 0 0.8em; }
.profile .pref b { color: var(--accent2); }
.profile form { margin: 0 0 0.4em; }
.profile form .hint { margin-bottom: 0; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 18px; margin: 6px 0 4px; }
.counts li { font-size: 0.92rem; padding: 5px 0; }
.counts .n { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.84rem; }
.counts li.empty { padding: 5px 0; }
#pf-recent-box { margin-top: 10px; }

/* a table */
.table-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 25vw, 440px); height: calc(100dvh - 54px); }
.stage { position: relative; min-width: 0; min-height: 0; }
#board { width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
#board:focus { outline: none; }
#board:focus-visible { outline: 2px solid rgba(255, 210, 122, 0.55); outline-offset: -2px; }
.stage-status { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); padding: 6px 14px;
  border-radius: 99px; background: rgba(12, 14, 17, 0.72); color: #f2f2f2; font-size: 0.95rem; pointer-events: none;
  white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.stage-status:empty { display: none; }
.stage-status.mine { background: rgba(227, 168, 60, 0.92); color: var(--accent-ink); font-weight: 600; }
.toast { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); background: #3a2321; border: 1px solid #6d3530;
  color: #ffe1dc; padding: 8px 14px; border-radius: 10px; max-width: 90%; }
.toast.ok { background: #1f3a2d; border-color: #2f6b4f; color: #d7f7e6; }
.side { overflow-y: auto; padding: 12px; border-left: 1px solid #262c33; background: rgba(18, 21, 25, 0.6); }
.players .p { display: grid; grid-template-columns: 18px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 4px; border-radius: 8px; }
.players .p.turn { background: rgba(227, 168, 60, 0.12); }
.players .chip { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.15); }
.players .pts { font-variant-numeric: tabular-nums; font-weight: 600; }
.players .clk { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.85rem; min-width: 4.5em; text-align: right; }
.players .clk.low { color: var(--danger); }
.turnline { margin: 8px 4px 0; color: var(--muted); }
.turnline.mine { color: var(--accent2); font-weight: 600; }
.panel-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-buttons button { flex: 1 1 auto; }
.moves { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.moves button { min-height: 34px; padding: 0.25em 0.6em; font-variant-numeric: tabular-nums; }
details summary { cursor: pointer; color: var(--muted); }
.log { list-style: none; margin: 0 0 8px; padding: 0; max-height: 240px; overflow-y: auto; font-size: 0.9rem; }
.log li { padding: 3px 0; color: #cfd5dc; }
.log li.say { color: #fff; }
.log li.say b { color: var(--accent2); }
.log li.mine { color: #fff; }
.log li .via { display: block; font-size: 0.8rem; color: var(--muted); padding-left: 0.9em; }
.table-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 4px; }
.table-actions a { margin-left: auto; color: var(--muted); }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 8px 0 0; font-size: 0.85rem; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { display: inline-grid; place-items: center; width: 30px; height: 24px; border-radius: 4px; font-style: normal; font-weight: 700; font-size: 0.75rem; }
.legend i.word { box-shadow: inset 0 0 0 2px currentColor; }
.score-preview { margin: 8px 0 0; min-height: 1.4em; }
.score-preview.bad { color: var(--danger); }
.score-preview.good { color: var(--ok); }
pre.view-lines { white-space: pre-wrap; font-size: 0.82rem; background: #12161a; padding: 8px; border-radius: 8px; max-height: 320px; overflow: auto; }

/* the notifications page */
body.helppage { height: auto; background-attachment: fixed; }
.help { padding: 18px; }
.help .card { max-width: 760px; margin: 0 auto; }
.help h2 { margin-top: 1.4em; scroll-margin-top: 70px; }
.help h3 { font-size: 1rem; margin: 1em 0 0.3em; color: var(--ink); }
.help ol, .help ul { padding-left: 1.4em; }
.help li { margin: 0.3em 0; }

/* dialogs */
dialog { background: #1f242a; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px;
  width: min(560px, calc(100vw - 24px)); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
dialog::backdrop { background: rgba(6, 8, 10, 0.6); backdrop-filter: blur(3px); }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 14px; padding: 10px 14px; }
legend { color: #f6e7c8; padding: 0 6px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.presets button[aria-checked=true] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.custom { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; margin-bottom: 10px; }
.custom label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); }
.custom input[type=color] { width: 46px; height: 32px; padding: 2px; min-height: 0; }
#s-preview { width: 100%; height: auto; border-radius: 8px; background: #111; }
#s-bg .presets { gap: 6px 20px; }
#s-notify p button + button { margin-left: 8px; }
#d-motd { width: min(680px, calc(100vw - 24px)); }
.motd pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 0.92rem/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: #12161a; border: 1px solid #2b333c; border-radius: 10px; padding: 12px 14px; margin: 0 0 14px;
  max-height: min(60dvh, 520px); overflow: auto; }
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin: 10px 0; }
.letters button { padding: 0; min-height: 44px; font-weight: 700; }

/* full screen: the board and its panels take the whole screen */
.is-full .bar { position: fixed; top: 8px; right: 8px; left: auto; padding: 4px; min-height: 0; border: 1px solid #2a3139;
  border-radius: 12px; background: rgba(16, 19, 23, 0.7); }
.is-full .bar .brand, .is-full .bar .crumbs, .is-full .bar .who, .is-full #b-out { display: none; }
.is-full .table-layout { height: 100dvh; }
.is-full .side { padding-top: 60px; }

/* narrow screens and phones held upright: the board on top, the panels under it */
@media (max-width: 900px), (max-aspect-ratio: 4/5) {
  .lobby { grid-template-columns: 1fr; padding: 12px; }
  .table-layout { display: block; height: auto; }
  .stage { height: calc(min(calc(100vw / var(--board-aspect, 1)), 72dvh) + 46px); padding-top: 46px; }
  .stage-status { top: 8px; }
  .who, .brand span em { display: none; }
  .brand { font-size: 1.05rem; white-space: nowrap; }
  button.text { white-space: nowrap; padding: 0.5em 0.4em; }
  .side { border-left: 0; overflow: visible; }
  .bar { gap: 0.5rem; }
  .crumbs { display: none; }
  .is-full .side { padding-top: 12px; }
}
/* big and wide screens: the panels in two columns beside the board, and text that does not run too wide */
@media (min-width: 1800px) and (min-aspect-ratio: 16/9) {
  body { font-size: 106%; }
  .table-layout { grid-template-columns: minmax(0, 1fr) clamp(640px, 34vw, 860px); }
  .side { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto auto 1fr; gap: 14px; align-content: start; }
  .side .card + .card { margin-top: 0; }
  .side .chat { grid-column: 2; grid-row: 1 / -1; align-self: start; }
  .side .players, .side #game-panel, .side .invite, .side .table-actions { grid-column: 1; }
  .side .chat .log { max-height: calc(100dvh - 260px); }
  .side .table-actions { grid-column: 1; }
}
@media (min-width: 3000px) { body { font-size: 137%; } button, input, select { min-height: 52px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
