/* Random Philosophers. Old paper, ink, terracotta and laurel. Word cards with knobs like puzzle pieces. */

@font-face {
  font-family: "Fraunces";
  src: url(/fonts/fraunces-latin-ext-full-normal.woff2) format("woff2-variations");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  src: url(/fonts/fraunces-latin-full-normal.woff2) format("woff2-variations");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  src: url(/fonts/fraunces-latin-full-italic.woff2) format("woff2-variations");
  font-weight: 100 900; font-style: italic; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  src: url(/fonts/figtree-latin-ext-wght-normal.woff2) format("woff2-variations");
  font-weight: 300 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Figtree";
  src: url(/fonts/figtree-latin-wght-normal.woff2) format("woff2-variations");
  font-weight: 300 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #f3ecdf;
  --paper2: #ebe1cf;
  --card: #fffaf1;
  --ink: #2a2118;
  --mute: #756350;
  --line: #d9cab0;
  --wash: #e8dcc6;
  --clay: #c4572f;
  --clay-d: #9f4120;
  --gold: #e3ad24;
  --olive: #5e7a32;
  --r: 14px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --laurel: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 72'><path d='M30 70Q4 46 20 4' fill='none' stroke='%235e7a32' stroke-width='2.2' stroke-linecap='round'/><g fill='%235e7a32'><ellipse cx='21.5' cy='66.0' rx='2.6' ry='5.6' transform='rotate(-90 21.5 66.0)'/><ellipse cx='23.0' cy='56.0' rx='2.5' ry='5.4' transform='rotate(14 23.0 56.0)'/><ellipse cx='14.0' cy='53.2' rx='2.4' ry='5.3' transform='rotate(-73 14.0 53.2)'/><ellipse cx='18.4' cy='44.3' rx='2.4' ry='5.1' transform='rotate(31 18.4 44.3)'/><ellipse cx='10.7' cy='39.0' rx='2.3' ry='4.9' transform='rotate(-57 10.7 39.0)'/><ellipse cx='17.3' cy='31.2' rx='2.2' ry='4.8' transform='rotate(47 17.3 31.2)'/><ellipse cx='11.2' cy='23.4' rx='2.1' ry='4.6' transform='rotate(-42 11.2 23.4)'/><ellipse cx='19.5' cy='16.6' rx='2.1' ry='4.4' transform='rotate(60 19.5 16.6)'/><ellipse cx='15.4' cy='6.6' rx='2.0' ry='4.3' transform='rotate(-31 15.4 6.6)'/><ellipse cx='20.0' cy='1.0' rx='2.4' ry='5.2'/></g></svg>");
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 250, 238, 0.9), rgba(255, 250, 238, 0) 60%),
    radial-gradient(rgba(42, 33, 24, 0.05) 1px, transparent 1.3px);
  background-size: auto, 16px 16px;
  -webkit-tap-highlight-color: transparent;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--serif); font-weight: 750; line-height: 1.1; margin: 0 0 0.5em; letter-spacing: -0.01em; font-variation-settings: "SOFT" 50, "WONK" 0; }
h1 { font-size: clamp(28px, 5vw, 42px); }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 0.7em; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- wordmark ---------- */

.wordmark {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  text-decoration: none; color: var(--ink); font-family: var(--serif); line-height: 0.86;
  font-size: 22px;
}
.wm-random {
  font-style: italic; font-weight: 600; font-size: 0.5em; color: var(--clay); letter-spacing: 0.01em;
  font-variation-settings: "SOFT" 100, "WONK" 1; margin-left: 0.08em;
}
.wm-phil { font-weight: 850; letter-spacing: -0.025em; font-variation-settings: "SOFT" 40, "WONK" 1; }
.wordmark.small { font-size: 19px; }
.wordmark.big { font-size: 44px; }
.wordmark.huge { font-size: clamp(54px, 12.5vw, 128px); align-items: center; }
.wordmark.huge .wm-random { font-size: 0.42em; margin-left: 0; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  min-height: 48px; padding: 0.55em 1.15em;
  font-family: var(--sans); font-weight: 750; font-size: 16px; text-decoration: none;
  color: var(--ink); background: var(--card);
  border: 2.5px solid var(--ink); border-radius: var(--r);
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer; touch-action: manipulation;
  transition: transform 0.06s, box-shadow 0.06s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { color: #fffaf1; background: var(--clay); }
.btn.ghost { box-shadow: none; background: transparent; }
.btn.ghost:active:not(:disabled) { transform: translateY(1px); }
.btn.big { min-height: 56px; font-size: 18px; padding: 0.55em 1.5em; }
.btn.small { min-height: 40px; font-size: 14px; padding: 0.35em 0.9em; box-shadow: 0 3px 0 var(--ink); }
.btn.tiny { min-height: 30px; font-size: 13px; padding: 0.1em 0.7em; border-width: 2px; border-radius: 9px; box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.claimbtn { background: var(--gold); color: var(--ink); }
.iconbtn, .linkbtn, .tinybtn {
  background: none; border: 2px solid transparent; border-radius: 10px; cursor: pointer;
  font-size: 14px; font-weight: 650; padding: 6px 10px; color: var(--ink); text-decoration: none;
}
.iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; position: relative; }
.iconbtn svg { width: 24px; height: 24px; }
.iconbtn[aria-pressed="true"].cover { color: var(--clay); }
.iconbtn:hover, .tinybtn:hover { border-color: var(--line); }
.linkbtn { text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.tinybtn { font-size: 12px; padding: 2px 8px; color: var(--mute); }
.tinybtn.x { font-size: 18px; line-height: 1; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.bookn { position: absolute; right: -2px; top: -2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--clay); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; padding: 0 4px; }
.bookn:empty { display: none; }

/* ---------- top bar, dock ---------- */

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; border-bottom: 2px solid var(--line); background: rgba(243, 236, 223, 0.94);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(4px);
}
.grow { flex: 1; }
.roomcode { font-size: 14px; color: var(--mute); }
.roomcode strong { color: var(--ink); letter-spacing: 0.08em; }
.count { font-family: var(--serif); font-weight: 650; font-size: 15px; white-space: nowrap; }
.timer { min-width: 50px; text-align: center; font-family: var(--serif); font-weight: 800; font-size: 21px; background: var(--wash); border-radius: 999px; padding: 1px 12px; font-variant-numeric: tabular-nums; }
.timer:empty { visibility: hidden; }
.timer.low { background: var(--clay); color: #fff; }
.onstream-badge { font-size: 12px; font-weight: 700; color: #fff; background: var(--clay); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.hostmenu { position: relative; }
.hostmenu summary { list-style: none; cursor: pointer; }
.hostmenu summary::-webkit-details-marker { display: none; }
.hostmenu .dots { font-size: 26px; font-weight: 900; line-height: 1; margin-top: -8px; }
.hostmenu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; display: flex; flex-direction: column;
  background: var(--card); border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); padding: 6px;
}
.menuhead { font-size: 12px; font-weight: 700; color: var(--mute); margin: 4px 10px 6px; }
.menuitem { text-align: left; font-weight: 700; padding: 10px 12px; border: none; background: none; border-radius: 10px; cursor: pointer; }
.menuitem:hover { background: var(--wash); }
.myscore { font-family: var(--serif); font-weight: 800; white-space: nowrap; }
.dock {
  position: sticky; bottom: 0; z-index: 4;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.dock:empty { padding: 0; }
.hint { color: var(--mute); font-size: 14px; margin: 0; }
.lead { font-size: 18px; max-width: 34em; }
.err { color: #b3261e; font-weight: 650; min-height: 1.4em; }

/* ---------- the cards ---------- */

.card {
  --kc: #2a2118;
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  column-gap: 0.4em;
  min-width: 6.2em; min-height: 4.5em;
  padding: 0.38em 0.45em 0.34em 0.95em;
  color: var(--ink);
  background: color-mix(in srgb, var(--kc) 7%, var(--card));
  border: 2px solid var(--ink);
  border-radius: 0.65em;
  box-shadow: 0 0.18em 0 var(--ink);
  text-align: left;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.1;
}
.card .knob { position: absolute; left: -0.66em; top: 50%; width: 1.22em; height: 1.22em; transform: translateY(-50%); z-index: 1; }
.card .knob svg { display: block; width: 100%; height: 100%; overflow: visible; }
.card .knob path { stroke: var(--card); stroke-width: 3.2px; paint-order: stroke; stroke-linejoin: round; }
.card .word {
  grid-column: 1; grid-row: 2; align-self: center;
  font-family: var(--serif); font-weight: 650; font-size: 1.32em; letter-spacing: -0.005em;
  font-variation-settings: "SOFT" 30, "WONK" 0;
  overflow-wrap: anywhere;
}
.card .word.long { font-size: 1.12em; }
.card .word.xlong { font-size: 1em; }
.card .pts {
  grid-column: 2; grid-row: 1; justify-self: end; align-self: start;
  font-weight: 800; font-size: 0.72em; line-height: 1.5; padding: 0 0.5em; border-radius: 999px;
  background: var(--card); border: 1.5px solid var(--ink); white-space: nowrap;
}
.card.mult .pts { background: var(--gold); }
.card .kind { grid-column: 1; grid-row: 3; font-weight: 800; font-size: 0.56em; letter-spacing: 0.09em; text-transform: uppercase; color: color-mix(in srgb, var(--kc) 80%, var(--ink)); align-self: end; }
.card .socks { grid-column: 2; grid-row: 2 / 4; justify-self: end; align-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 0.15em; }
.card .sock-grid { display: grid; grid-template-columns: repeat(2, 0.62em); gap: 0.14em; }
.card .sock-grid svg { width: 0.62em; height: 0.62em; display: block; }
.card .sock-after { display: flex; flex-direction: column; align-items: flex-end; gap: 0.08em; }
.card .sock-label { font-size: 0.45em; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mute); }
.card .sock-pass svg { width: 1.2em; height: 1.2em; color: var(--kc); display: block; }
.card .sock-end { font-size: 0.5em; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mute); }
.card .note { display: none; }
.card.k-link .word { font-weight: 800; }
.card.punct { min-width: 4.2em; }
.card.punct .word { font-family: var(--serif); font-size: 2.3em; font-weight: 800; line-height: 0.7; padding-bottom: 0.12em; }
.card.punct[data-w="."] .word, .card.punct[data-w=","] .word { font-size: 3.2em; line-height: 0.5; }
.tcard.punct { min-width: 0; }
.tcard.punct .word { font-size: 1.6em; line-height: 0.8; }
.tcard.punct[data-w="."] .word, .tcard.punct[data-w=","] .word { font-size: 2.2em; line-height: 0.6; }

/* cards on the table: just the word, the points and who played it */
.tcard {
  min-width: 0; min-height: 0;
  grid-template-rows: auto;
  padding: 0.3em 0.55em 0.42em 0.85em;
  font-size: 17px;
  box-shadow: 0 0.16em 0 var(--ink), inset 0 -0.3em 0 var(--pc, transparent);
}
.tcard .word { grid-row: 1; font-size: 1.3em; }
.tcard .pts { grid-row: 1; align-self: center; font-size: 0.62em; }
.tcard.k-link { min-width: 0; }
.tcard.fresh { animation: land 0.42s cubic-bezier(0.2, 1.4, 0.4, 1); }
.tcard.ghost { opacity: 0.6; border-style: dashed; box-shadow: none; animation: breathe 1.4s ease-in-out infinite; }
@keyframes land { from { transform: translateY(-24px) rotate(-4deg) scale(1.12); opacity: 0; } }
@keyframes breathe { 50% { opacity: 0.35; } }

/* ---------- home ---------- */

.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px 20px; text-align: center; }
.home { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 34px 18px 18px; gap: 26px; text-align: center; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(760px, 100%); }
.tag { font-family: var(--serif); font-style: italic; font-size: clamp(19px, 3vw, 26px); font-weight: 500; margin: 0; color: var(--mute); font-variation-settings: "SOFT" 100, "WONK" 1; }
.sub { max-width: 32em; color: var(--ink); margin: 4px 0 0; }
.demo { min-height: 128px; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
.demo .sentence { justify-content: center; }
.homeactions { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(380px, 100%); }
.homeactions .btn.primary { width: 100%; }
.join { display: flex; gap: 10px; width: 100%; }
.join input, .namebox input, .field input {
  flex: 1; min-width: 0; min-height: 50px; padding: 0 14px; font-size: 18px; font-weight: 650;
  border: 2.5px solid var(--ink); border-radius: var(--r); background: var(--card);
}
.join input { text-transform: uppercase; letter-spacing: 0.08em; }
.join input::placeholder { text-transform: none; letter-spacing: 0; }
.homefoot { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; align-items: center; color: var(--mute); font-size: 13px; }
dialog.how { max-width: 600px; width: calc(100vw - 24px); max-height: calc(100dvh - 32px); overflow: auto; border: 2.5px solid var(--ink); border-radius: 18px; padding: 22px; box-shadow: 0 6px 0 var(--ink); color: var(--ink); background: var(--card); }
dialog.how h2:focus { outline: none; }
dialog.how::backdrop { background: rgba(42, 33, 24, 0.4); }
.howlist { padding-left: 1.2em; margin: 0 0 1em; display: grid; gap: 6px; }
.legend { list-style: none; padding: 0; margin: 0 0 1em; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.legend li { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 10px; font-size: 14px; line-height: 1.2; }
.legend .shape { width: 20px; height: 20px; }
.legend li div { display: flex; flex-direction: column; }
.legend span { color: var(--mute); font-size: 0.92em; }
.rules { padding-left: 1.3em; display: grid; gap: 6px; margin: 0 0 1em; }
.namebox { display: flex; flex-direction: column; gap: 14px; align-items: stretch; width: min(400px, 100%); }
.namebox h1 { margin: 8px 0 0; }
.namebox .wordmark { align-self: center; }

/* ---------- lobby ---------- */

.lobby { flex: 1; display: grid; gap: 16px; padding: 16px 16px 40px; width: 100%; max-width: 1080px; margin: 0 auto; }
@media (min-width: 860px) { .lobby { grid-template-columns: 1fr 1fr; align-items: start; } }
.lobbycol { display: grid; gap: 16px; }
.panel { background: var(--card); border: 2.5px solid var(--ink); border-radius: 18px; padding: 18px; box-shadow: 0 4px 0 var(--ink); }
.panel h2 { margin-bottom: 12px; }
.invite .qr { width: 180px; margin: 14px 0 6px; }
.code { letter-spacing: 0.06em; }
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pl { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--paper); }
.pl.off { opacity: 0.5; }
.pname { font-weight: 700; }
.inkdot { width: 14px; height: 14px; border-radius: 50%; background: var(--pc, var(--ink)); flex: none; box-shadow: 0 0 0 2px var(--card); }
.badge { font-size: 12px; font-weight: 700; border: 2px solid currentColor; border-radius: 999px; padding: 0 8px; }
.badge.you { color: var(--clay); }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 650; }
.fieldlabel { font-weight: 700; margin: 14px 0 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--card); background: var(--pc); box-shadow: 0 0 0 2px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--ink), 0 4px 0 2px var(--ink); }
.swatch:disabled { opacity: 0.2; cursor: default; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; }
.slabel { font-weight: 700; }
.sctl { display: flex; align-items: center; gap: 8px; }
.sctl output { min-width: 76px; text-align: center; font-weight: 800; font-family: var(--serif); font-size: 18px; }
.stepbtn { width: 42px; height: 42px; border-radius: 12px; border: 2.5px solid var(--ink); background: var(--card); font-size: 22px; font-weight: 800; cursor: pointer; line-height: 1; }
.stepbtn:disabled { opacity: 0.35; cursor: default; }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-top: 16px; cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--clay); }
.lobbydock { border-top: 2px solid var(--line); background: var(--paper); flex-direction: column; }
.onstream { font-size: 14px; font-weight: 650; color: var(--clay); margin: 0; }
.howpanel .legend { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

/* ---------- the game ---------- */

.game { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 1120px; margin: 0 auto; min-height: 0; }
.pstrip { list-style: none; margin: 0; padding: 8px 12px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.pstrip::-webkit-scrollbar { display: none; }
.pchip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 8px;
  border-radius: 999px; background: var(--card); border: 2px solid var(--line); font-weight: 700; font-size: 14px;
  transition: border-color 0.2s, transform 0.2s;
}
.pchip .pscore { font-family: var(--serif); font-weight: 800; color: var(--mute); font-variant-numeric: tabular-nums; }
.pchip.turn { border-color: var(--ink); background: #fff; transform: translateY(-1px); box-shadow: 0 3px 0 var(--ink); }
.pchip.turn::before { content: ""; width: 0; height: 0; border-left: 7px solid var(--clay); border-top: 5px solid transparent; border-bottom: 5px solid transparent; margin-right: -2px; }
.pchip.mine .pname { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--pc, var(--ink)); }
.pchip.off { opacity: 0.45; }
.pchip.waiting { border-style: dashed; color: var(--mute); }
.ppick { font-size: 12px; color: var(--mute); }

.table {
  position: relative; flex: 1; min-height: 190px;
  margin: 4px 12px; padding: 18px 16px 14px 22px;
  background: color-mix(in srgb, var(--card) 70%, var(--paper));
  border: 2px solid var(--line); border-radius: 22px;
  display: flex; flex-direction: column; overflow-y: auto;
}
.tableinner { display: flex; flex-direction: column; gap: 14px; margin: auto 0; }
.sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55em 0.62em; padding-left: 0.5em; }
.newthought { font-family: var(--serif); font-style: italic; color: var(--mute); font-size: 18px; }
.socket {
  display: inline-flex; align-items: center; gap: 0.5em; padding: 0.3em 0.55em;
  border: 2px dashed var(--line); border-radius: 0.65em; min-height: 2.6em; font-size: 17px;
  background: rgba(255, 250, 241, 0.6);
}
.socket.withghost { border: none; padding: 0; background: none; gap: 0.62em; }
.socket.withghost .socklist { border: 2px dashed var(--line); border-radius: 0.65em; padding: 0.3em 0.5em; }
.socklist { display: inline-flex; flex-wrap: wrap; gap: 0.28em; align-items: center; }
.sock { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; }
.sock svg { width: 1.05em; height: 1.05em; }
.sock.blocked { opacity: 0.22; }
.sock.endsock:not(.blocked) { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }
.canend { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--clay); white-space: nowrap; }
.socket.withghost .canend { display: none; }
.value {
  align-self: flex-end; display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 14px;
  border-radius: 999px; background: var(--ink); color: var(--card); position: relative;
}
.vlabel { font-size: 12px; font-weight: 700; opacity: 0.75; }
.vtotal { font-family: var(--serif); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.vcalc { font-size: 12px; font-weight: 700; opacity: 0.75; }
.demo .value { align-self: center; }
.log { text-align: center; color: var(--mute); font-size: 14px; font-weight: 600; margin: 4px 12px 0; min-height: 1.45em; }

.handzone {
  position: sticky; bottom: 0; z-index: 3;
  background: linear-gradient(to bottom, rgba(243, 236, 223, 0), var(--paper) 18px);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}
.status { text-align: center; font-weight: 700; margin: 0 12px 8px; min-height: 1.45em; }
.game.myturn .status { color: var(--clay-d); }
.hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 14px; padding: 2px 12px 4px 20px; }
.hcard { cursor: pointer; font-size: 14.5px; transition: transform 0.15s, opacity 0.2s, box-shadow 0.15s, filter 0.2s; touch-action: manipulation; }
.hcard:hover { transform: translateY(-2px); }
.game.myturn .hcard:not(.fits) { opacity: 0.45; filter: saturate(0.4); }
.game.myturn .hcard.fits { box-shadow: 0 0 0 3px var(--kc), 0 0.26em 0 var(--ink); transform: translateY(-3px); }
.game:not(.myturn) .hcard.fits::after { content: ""; position: absolute; right: 6px; bottom: -8px; width: 8px; height: 8px; border-radius: 50%; background: var(--kc); }
.hcard.sel { transform: translateY(-7px) scale(1.05) !important; box-shadow: 0 0 0 4px var(--ink), 0 0.4em 0 var(--ink) !important; z-index: 2; }
.game.myturn .hand.swapping .hcard, .hcard.swappable { opacity: 1 !important; filter: none !important; box-shadow: 0 0 0 3px var(--clay), 0 0.2em 0 var(--ink) !important; }
.hcard.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.hand.covered .hcard .word, .hand.covered .hcard .pts, .hand.covered .hcard .socks, .hand.covered .hcard .kind { filter: blur(8px); }
.hand.covered.peek .hcard .word, .hand.covered.peek .hcard .pts, .hand.covered.peek .hcard .socks, .hand.covered.peek .hcard .kind { filter: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 10px 12px 0; }
.actions:empty { display: none; }
.picks { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pickbtn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; border: 2.5px solid var(--ink); background: var(--card); font-weight: 750; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.pickbtn.picked { background: var(--ink); color: var(--card); }
.pickbtn:disabled { opacity: 0.55; cursor: default; }
.peekhand { width: 100%; }
.peekhand .fieldlabel { text-align: center; margin: 4px 0 8px; }
.peekrow { display: flex; flex-wrap: wrap; gap: 10px 12px; justify-content: center; padding-left: 12px; }
.hcard.mini { font-size: 12px; cursor: default; }

/* the moment a sentence is taken */
.overlay {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(250, 245, 235, 0.97); border-radius: 20px; text-align: center;
}
.quote { margin: 0; max-width: 34em; animation: rise 0.6s cubic-bezier(0.2, 1.2, 0.4, 1); }
.quote blockquote {
  margin: 0 0 0.55em; font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(22px, 4.6vw, 36px); line-height: 1.22; font-variation-settings: "SOFT" 100, "WONK" 1;
}
.qmark { color: var(--clay); font-weight: 800; font-style: normal; }
.quote figcaption { font-size: 16px; color: var(--mute); }
.quote figcaption strong { color: var(--ink); }
.qby strong { border-bottom: 3px solid var(--pc, var(--ink)); }
.qpts {
  display: inline-flex; align-items: baseline; gap: 10px; margin-top: 16px; padding: 4px 22px; border-radius: 999px;
  background: var(--ink); color: var(--card); position: relative;
}
.qpts::before, .qpts::after { content: ""; position: absolute; top: 50%; width: 28px; height: 50px; background: var(--laurel) no-repeat center / contain; transform: translateY(-50%); }
.qpts::before { left: -30px; transform: translateY(-50%) scaleX(-1) rotate(-12deg); }
.qpts::after { right: -30px; transform: translateY(-50%) rotate(12deg); }
.qplus { font-family: var(--serif); font-size: 30px; font-weight: 800; }
.qcalc { font-size: 14px; font-weight: 700; opacity: 0.8; }
.qnote { margin: 12px 0 0; font-weight: 700; color: var(--clay); }
.fadebox { max-width: 30em; animation: rise 0.5s ease-out; }
.fadeline { font-family: var(--serif); font-size: 26px; font-weight: 700; }
.fadetext { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--mute); text-decoration: line-through; text-decoration-color: var(--clay); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

/* ---------- book, final ---------- */

.book { margin: 0; padding-left: 1.6em; display: grid; gap: 12px; }
.bookitem::marker { font-family: var(--serif); font-weight: 800; color: var(--mute); }
.btext { font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.3; margin: 0 0 4px; font-variation-settings: "SOFT" 100, "WONK" 1; }
.bmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--mute); margin: 0; }
.bmeta strong { color: var(--ink); }
.scores { list-style: none; margin: 0; padding: 0; width: min(520px, 100%); display: grid; gap: 6px; }
.scores li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--card); border-radius: 12px; border: 2px solid var(--line); }
.scores .pname { flex: 1; }
.place { font-family: var(--serif); font-weight: 800; width: 1.6em; }
.ptotal { font-family: var(--serif); font-weight: 800; }
.final { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px 16px 40px; }
.finalhead { font-size: clamp(44px, 9vw, 80px); font-weight: 850; font-variation-settings: "SOFT" 40, "WONK" 1; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; width: min(620px, 100%); }
.pod {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  padding: 12px 8px 0; background: var(--card); border: 2.5px solid var(--ink); border-top: 12px solid var(--pc, var(--ink));
  border-radius: 14px 14px 0 0; text-align: center;
}
.pod.p1 { order: 2; min-height: 210px; background: #fff; }
.pod.p1::before { content: ""; width: 64px; height: 40px; background: var(--laurel) no-repeat left / 32px 40px, var(--laurel) no-repeat right / 32px 40px; margin-bottom: 4px; }
.pod.p2 { order: 1; min-height: 160px; }
.pod.p3 { order: 3; min-height: 125px; }
.pod .pname { font-size: 18px; overflow-wrap: anywhere; }
.ppts { font-family: var(--serif); font-weight: 800; }
.pplace { font-family: var(--serif); font-size: 44px; font-weight: 900; line-height: 1.1; }
.awards { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; width: min(620px, 100%); }
.awards li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 10px 14px; border: 2px dashed var(--ink); border-radius: 12px; background: var(--card); }
.awards em { flex-basis: 100%; font-family: var(--serif); color: var(--mute); }
main.final + .dock { background: var(--paper); border-top: 2px solid var(--line); }
.finalbook { width: min(680px, 100%); background: var(--card); border: 2.5px solid var(--ink); border-radius: 18px; padding: 18px 20px; box-shadow: 0 4px 0 var(--ink); }
.audtop ol { margin: 0; padding-left: 1.4em; }

/* ---------- table screen: 1600 × 900, scaled to the window ---------- */

.screen {
  position: fixed; left: 50%; top: 50%; width: 1600px; height: 900px; overflow: hidden;
  transform: translate(-50%, -50%) scale(var(--k, 1)); transform-origin: center;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(42, 33, 24, 0.06) 1.4px, transparent 1.7px);
  background-size: 20px 20px;
}
body[data-view^="s-"] { overflow: hidden; background: #1d1711; }
.s-grid { display: grid; grid-template-columns: 1fr 330px; height: 100%; }
.s-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.screen .topbar { position: static; padding: 14px 24px; }
.screen .wordmark.small { font-size: 34px; }
.screen .count { font-size: 24px; }
.screen .timer { font-size: 34px; min-width: 86px; }
.screen .game { max-width: none; min-height: 0; }
.screen .pstrip { padding: 12px 24px; gap: 12px; flex-wrap: wrap; overflow: visible; }
.screen .pchip { font-size: 26px; padding: 6px 20px 6px 14px; gap: 10px; }
.screen .pchip .pscore { font-size: 28px; }
.screen .pchip .inkdot { width: 20px; height: 20px; }
.screen .table { margin: 6px 24px; padding: 28px 30px 24px 40px; }
.screen .sentence .tcard { font-size: 30px; }
.screen .socket { font-size: 30px; }
.screen .newthought { font-size: 34px; }
.screen .value.big .vtotal { font-size: 40px; }
.screen .value.big { padding: 6px 24px; }
.screen .value.big .vlabel, .screen .value.big .vcalc { font-size: 18px; }
.screen .log { font-size: 22px; }
.screen .status { font-size: 26px; }
.screen .handzone { position: static; background: none; padding: 4px 0 18px; }
.screen .hcard.mini { font-size: 17px; }
.screen .quote blockquote { font-size: 54px; }
.screen .quote figcaption { font-size: 26px; }
.screen .qplus { font-size: 48px; }
.screen .qcalc { font-size: 22px; }
.screen .fadeline { font-size: 44px; }
.screen .fadetext { font-size: 32px; }
.rail { border-left: 2.5px solid var(--ink); padding: 22px; display: flex; flex-direction: column; gap: 22px; background: rgba(255, 250, 241, 0.75); }
.railh { font-family: var(--serif); font-weight: 750; font-size: 22px; margin: 0 0 8px; }
.railqr .qr { width: 210px; }
.raillink { font-weight: 800; font-size: 20px; margin: 6px 0 0; overflow-wrap: anywhere; }
.raillink.big { font-size: 34px; }
.railtally { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 90px 1fr 34px; gap: 8px; align-items: center; font-weight: 700; }
.bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt { height: 16px; border-radius: 999px; background: var(--wash); overflow: hidden; }
.bf { display: block; height: 100%; background: var(--pc, var(--ink)); transition: width 0.4s; }
.bn { text-align: right; }
.railtop { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.railtop li { display: flex; justify-content: space-between; font-weight: 700; font-size: 18px; }
.railtop li.empty { color: var(--mute); font-size: 16px; font-weight: 600; }
.railaud { color: var(--mute); font-weight: 700; margin-top: auto; }
.s-lobby { display: grid; grid-template-columns: 1fr 420px; grid-template-rows: 1fr auto; height: 100%; padding: 48px 56px; gap: 24px 48px; }
.s-lhero { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 22px; }
.s-lhero .wordmark.huge { font-size: 150px; align-items: flex-start; }
.s-lhero .tag { font-size: 38px; }
.s-lhero .legend { width: 100%; grid-template-columns: repeat(3, 1fr); gap: 10px 20px; }
.s-lhero .legend li { font-size: 21px; grid-template-columns: 30px 1fr; }
.s-lhero .legend .shape { width: 28px; height: 28px; }
.s-ljoin { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; background: var(--card); border: 3px solid var(--ink); border-radius: 26px; padding: 28px; box-shadow: 0 10px 0 var(--ink); }
.qr.big { width: 300px; }
.s-lplayers { grid-column: 1 / -1; }
.s-players { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; padding: 0; margin: 0; }
.s-players li { display: inline-flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 800; background: var(--card); border: 2.5px solid var(--ink); border-radius: 999px; padding: 6px 18px; }
.s-final { height: 100%; overflow: hidden; }
.s-final .final { height: 100%; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: min-content; align-content: start; justify-items: center; gap: 18px 40px; padding: 30px 48px; }
.s-final .finalhead { grid-column: 1 / -1; font-size: 84px; margin: 0; }
.s-final .lead, .s-final .podium, .s-final .scores, .s-final .awards, .s-final .audtop { grid-column: 1; }
.s-final .lead { margin: 0; }
.s-final .podium { width: 100%; }
.s-final .pod.p1 { min-height: 180px; }
.s-final .pod.p2 { min-height: 140px; }
.s-final .pod.p3 { min-height: 110px; }
.s-final .finalbook { grid-column: 2; grid-row: 2 / span 20; width: 100%; max-height: 720px; overflow: hidden; align-self: start; }
.s-final .awards li { font-size: 19px; }
.s-final .btext { font-size: 24px; }
.soundgate { position: absolute; right: 24px; bottom: 24px; z-index: 9; font: inherit; font-weight: 800; font-size: 20px; padding: 12px 20px; border-radius: 14px; border: 3px solid var(--ink); background: var(--gold); cursor: pointer; }

/* ---------- viewers ---------- */

.viewerlobby { text-align: center; }
.viewerlobby .panel { width: min(420px, 100%); text-align: left; }

/* ---------- misc ---------- */

.qr svg { width: 100%; height: auto; display: block; border-radius: 10px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0; z-index: 50; background: var(--ink); color: var(--card); font-weight: 650; padding: 10px 18px; border-radius: 12px; max-width: calc(100vw - 32px); transition: opacity 0.2s, transform 0.2s; pointer-events: none; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
body.offline::before { content: "Reconnecting…"; position: fixed; top: 0; left: 0; right: 0; z-index: 60; text-align: center; font-weight: 750; background: var(--gold); padding: 4px; }

@media (max-width: 560px) {
  .topbar { gap: 6px; padding: 6px 8px; }
  .gametop .wordmark .wm-random { display: none; }
  .gametop .wordmark.small { font-size: 17px; }
  .count { font-size: 14px; }
  .clabel { display: none; }
  .timer { font-size: 18px; min-width: 42px; padding: 1px 8px; }
  .iconbtn { width: 36px; height: 36px; }
  .hostmenu .btn.tiny { font-size: 12px; padding: 0 6px; min-height: 28px; }
  .table { margin: 2px 8px; padding: 14px 10px 10px 16px; min-height: 150px; }
  .tcard { font-size: 15px; }
  .socket { font-size: 15px; }
  .hcard { font-size: 13px; }
  .hand { gap: 10px 12px; padding: 2px 8px 2px 16px; }
  .btn.big { min-height: 52px; font-size: 17px; padding: 0.5em 1.1em; }
  .onstream-badge { display: none; }
}
@media (max-width: 370px) {
  .gametop .wordmark { display: none; }
}
@media (min-width: 900px) {
  .hcard { font-size: 16px; }
  .tcard { font-size: 20px; }
  .socket { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
