/* Word search with others (room.js): the room's parts of the strip, the lobby, countdown and
   results over the puzzle card, and the players and chat beside it, or on narrow windows a
   strip of players above the puzzle and the chat below it. */
.ws-page { --ws-card: #161616; --ws-shadow: 0 10px 30px rgba(0,0,0,.45); --ws-mine: rgba(48,209,88,.2); }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .ws-page { --ws-card: #fff; --ws-shadow: 0 8px 26px rgba(0,0,0,.09); --ws-mine: rgba(40,167,69,.16); } }
:root[data-theme="light"] .ws-page { --ws-card: #fff; --ws-shadow: 0 8px 26px rgba(0,0,0,.09); --ws-mine: rgba(40,167,69,.16); }
:where(.ws-page) svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:where(.ws-page) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:where(.ws-page) button:disabled { cursor: default; opacity: .45; }
:where(.ws-page) button:focus-visible { outline: 1.5px solid var(--stroke); outline-offset: 2px; }
:where(.ws-page) input { font: inherit; color: var(--text); }
.ws-room-on #ws { flex-basis: 520px; }

/* The strip: Play with others (there with or without a puzzle), then in a room its code and Leave */
.ws-roomchip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; margin-inline-end: 4px; padding: 0 10px; border-radius: 14px;
  background: var(--field); color: var(--text2); font-weight: 600; font-size: 12px; white-space: nowrap; }
.ws-roomchip b { color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.ws-roomchip svg { width: 16px; height: 16px; }
.ws-roomchip.ws-copied b { color: var(--green); }
.ws-leave { flex: none; width: 32px; height: 32px; margin-inline-start: 4px; border-radius: 50%; display: grid; place-items: center; background: #f6b4b4; color: #7a1f1f;
  transition: transform .15s, filter .2s; }
.ws-leave:hover { filter: brightness(1.06); }
.ws-leave:active { transform: scale(.94); }
.ws-leave svg { width: 15px; height: 15px; stroke-width: 2.2; }
.ws-credit-more a { color: var(--text2); }

.ws-roommenu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 6; width: min(100%, 300px); display: flex; flex-direction: column; gap: 12px; padding: 16px;
  border-radius: 14px; background: var(--ws-card); border: 1px solid var(--divider); box-shadow: 0 16px 44px rgba(0,0,0,.35); animation: ws-drop .22s cubic-bezier(.2,.9,.3,1.15); }
.ws-roommenu:focus { outline: none; }
.ws-roommenu > b { font-size: 15px; }
.ws-rm-hint { margin: -6px 0 0; color: var(--text2); font-size: 12px; }
.ws-rm-name { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text2); }
.ws-rm-name input, .ws-rm-join input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: var(--field); outline: none; }
.ws-rm-name input:focus-visible, .ws-rm-join input:focus-visible, .ws-compose input:focus-visible, .ws-name-edit:focus-visible { box-shadow: inset 0 0 0 1.5px var(--stroke); }
.ws-rm-name input::placeholder, .ws-rm-join input::placeholder, .ws-compose input::placeholder { color: var(--text3); }
.ws-rm-join input { letter-spacing: .08em; }
.ws-roommenu .ws-rm-create { justify-content: center; height: 42px; background: var(--green); color: #04210d; }
.ws-rm-or { display: flex; align-items: center; gap: 8px; color: var(--text3); font-size: 11px; }
.ws-rm-or i { flex: 1; height: 1px; background: var(--divider); }
.ws-rm-join { display: flex; gap: 6px; }
.ws-rm-go { height: 36px; padding: 0 16px; border-radius: 18px; background: var(--field); font-weight: 700; }
.ws-rm-go:hover { background: var(--hover); }
.ws-rm-note { margin: 0; color: var(--red); font-size: 12px; }
.ws-rm-note:empty { display: none; }

/* Over the puzzle card */
.ws-in-room .ws-start { display: none; }
.ws-lobby .ws-words { visibility: hidden; }
/* Until the countdown ends nobody sees the puzzle, the host included. */
.ws-in-room.ws-waiting .ws-letters, .ws-in-room.ws-waiting .ws-words { visibility: hidden; }
.ws-stage { position: absolute; top: 0; left: 50%; z-index: 3; width: var(--ws-span, 500px); height: var(--ws-card-h, 500px); transform: translateX(-50%);
  display: grid; place-items: center; border-radius: 16px; }
.ws-stage[hidden] { display: none; }
.ws-s-card { background: var(--ws-card); box-shadow: var(--ws-shadow); }
.ws-s-board { background: color-mix(in srgb, var(--ws-card) 88%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ws-sbox { width: 100%; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px; text-align: center;
  animation: ws-rise .28s cubic-bezier(.2,.8,.2,1); }
.ws-eyebrow { font-size: 11px; font-weight: 600; color: var(--text3); letter-spacing: .06em; text-transform: uppercase; }
.ws-roomcode { margin-top: -6px; font-size: 42px; font-weight: 800; letter-spacing: .06em; line-height: 1.1; }
.ws-stitle { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.2; }
.ws-shint { margin: 0; max-width: 340px; color: var(--text2); font-size: 12.5px; }
.ws-shint a, .ws-rm-hint a { color: var(--text); text-decoration: underline; text-decoration-color: var(--stroke); text-underline-offset: 2px; }
.ws-shint a:hover, .ws-rm-hint a:hover { text-decoration-color: currentColor; }
.ws-snote { margin: -4px 0 0; color: var(--yellow); font-size: 12px; }
.ws-seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--field); }
.ws-seg button { padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 12.5px; color: var(--text2); }
.ws-seg button.ws-on { background: var(--ws-card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.ws-sbox .ws-btn { height: 44px; padding: 0 24px; border-radius: 22px; font-size: 14px; }
.ws-sbox .ws-btn svg, .ws-roommenu svg { width: 15px; height: 15px; }
.ws-btn.ws-go { background: var(--green); color: #04210d; }
.ws-btn.ws-go svg { fill: currentColor; stroke: none; }
.ws-btn.ws-go svg:has(path[d^="M4.5"]) { fill: none; stroke: currentColor; }
.ws-btn.ws-ghost { background: var(--field); color: var(--text); }
.ws-btn:disabled { transform: none; }
.ws-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* The countdown: a ring that empties over the blurred puzzle */
.ws-s-count .ws-sbox { gap: 12px; }
.ws-ring { position: relative; width: 150px; height: 150px; display: grid; place-items: center; border-radius: 50%;
  background: color-mix(in srgb, var(--ws-card) 85%, transparent); border: 1px solid var(--divider); }
.ws-ring svg { position: absolute; inset: -4px; width: 158px; height: 158px; transform: rotate(-90deg); stroke: var(--green); stroke-width: 3; }
.ws-ring circle { transition: stroke-dashoffset 1s linear; }
.ws-ring b { font-size: 68px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ws-cap { margin: 0; font-weight: 600; color: var(--text2); }

/* Results */
.ws-rows { width: min(100%, 360px); display: flex; flex-direction: column; gap: 4px; }
.ws-r { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 12px; background: var(--field); text-align: start; }
.ws-r.ws-win { background: color-mix(in srgb, var(--yellow) 14%, transparent); }
.ws-rank { width: 16px; flex: none; font-weight: 800; color: var(--text3); font-variant-numeric: tabular-nums; }
.ws-win .ws-rank { color: var(--yellow); }
.ws-crown { display: inline-flex; color: var(--yellow); }
.ws-crown svg { width: 14px; height: 14px; }

/* Players: a row each */
.ws-av { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #111; }
.ws-pn { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; text-align: start; }
.ws-pn b { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-pn small { font-size: 11px; color: var(--text3); }
.ws-pen { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; color: var(--text3); }
.ws-pen:hover { color: var(--text); background: var(--hover); }
.ws-pen svg { width: 13px; height: 13px; }
.ws-name-edit { flex: 1; min-width: 0; height: 28px; padding: 0 8px; border: 0; border-radius: 8px; background: var(--field); outline: none; font-weight: 600; }
.ws-st { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text2); white-space: nowrap; }
.ws-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.ws-dot.ws-relay { background: var(--yellow); }
.ws-dot.ws-away { background: var(--text3); animation: ws-blink 1.4s ease-in-out infinite; }
.ws-dot.ws-gone { background: var(--red); }
@keyframes ws-blink { 50% { opacity: .35; } }
.ws-time { flex: none; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.ws-prog { flex: none; display: inline-flex; align-items: center; gap: 8px; }
.ws-bar-p { width: 56px; height: 5px; border-radius: 3px; background: var(--field); overflow: hidden; }
.ws-bar-p i { display: block; height: 100%; border-radius: 3px; background: var(--text2); transition: width .4s; }
.ws-count { min-width: 30px; font-size: 11px; color: var(--text2); font-variant-numeric: tabular-nums; text-align: end; }

/* Beside the puzzle: players, then the chat */
.ws-rail { flex: 0 0 300px; height: 100%; display: none; flex-direction: column; gap: 12px; }
.ws-room-on .ws-rail { display: flex; }
.ws-panel-box { position: relative; padding: 12px; border-radius: 16px; background: var(--ws-card); box-shadow: var(--ws-shadow); }
.ws-ph { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; margin: 0 4px 8px; font-size: 11px; font-weight: 600;
  color: var(--text3); letter-spacing: .05em; text-transform: uppercase; }
.ws-endround { padding: 3px 10px; border-radius: 11px; background: var(--field); color: var(--text2); font-size: 11px; letter-spacing: 0; text-transform: none; }
.ws-endround:hover { color: var(--text); }
.ws-plist { display: flex; flex-direction: column; gap: 2px; }
.ws-p { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 6px; border-radius: 10px; }
.ws-p.ws-me { background: var(--field); }
.ws-empty { margin: 4px; color: var(--text3); }
.ws-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ws-msgs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 2px 10px; }
.ws-msgs > :first-child { margin-top: auto; }
.ws-m { max-width: 85%; display: flex; align-items: flex-end; gap: 7px; }
.ws-m .ws-av { width: 22px; height: 22px; font-size: 10px; }
.ws-bub { padding: 7px 10px; border-radius: 14px 14px 14px 4px; background: var(--field); line-height: 1.35; overflow-wrap: anywhere; text-align: start; }
.ws-bub small { display: block; margin-bottom: 1px; font-size: 10.5px; font-weight: 600; color: var(--text3); }
.ws-m.ws-mine { align-self: flex-end; }
.ws-m.ws-mine .ws-bub { border-radius: 14px 14px 4px 14px; background: var(--ws-mine); }
.ws-sys { align-self: center; max-width: 92%; font-size: 11px; color: var(--text3); text-align: center; }
.ws-compose { flex: none; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 4px 0 12px; border-radius: 20px; background: var(--field); }
.ws-compose input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; }
.ws-compose input:focus-visible { box-shadow: none; }
.ws-send { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--text); color: var(--bg); }
.ws-send svg { width: 15px; height: 15px; stroke-width: 2.2; }

/* Narrow windows and phones: players above the puzzle, the chat right below its words; the page
   scrolls. Tap your own chip to change your name. */
.ws-chips { display: none; }
@media (max-width: 879px) {
  body:has(.ws-room-on) { overflow-y: auto; }
  .ws-page.ws-room-on { height: auto; min-height: 100%; gap: 0; }
  .ws-room-on #ws { flex-basis: 1000px; height: auto; }
  .ws-in-room .ws-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .ws-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 3px; border-radius: 15px; background: var(--field);
    font-weight: 600; font-size: 12px; }
  .ws-chip .ws-av { width: 24px; height: 24px; font-size: 11px; }
  .ws-chip-n { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ws-chip-me { cursor: pointer; box-shadow: inset 0 0 0 1px var(--stroke); }
  .ws-chip-me:focus-visible { outline: 1.5px solid var(--stroke); outline-offset: 2px; }
  .ws-chip-pen { display: grid; color: var(--text3); }
  .ws-chip-pen svg { width: 13px; height: 13px; }
  .ws-chip .ws-name-edit { width: 120px; height: 24px; padding: 0 8px; border: 0; border-radius: 12px; background: var(--field); outline: none; font-size: 16px; }
  .ws-chip .ws-count { min-width: 0; color: var(--text3); font-weight: 600; }
  .ws-chip .ws-time { font-size: 12px; color: var(--green); }
  .ws-chip .ws-st { color: var(--text3); }
  .ws-chip-left { opacity: .45; }
  .ws-room-on .ws-rail { display: none; }
  .ws-in-room > .ws-chat { flex: none; width: 100%; max-width: var(--ws-span, 520px); align-self: center; }
  .ws-in-room > .ws-chat .ws-msgs { flex: none; min-height: 60px; max-height: 220px; }
  .ws-compose input { font-size: 16px; } /* 16px: phones don't zoom in on it */
}
@media (prefers-reduced-motion: reduce) {
  .ws-sbox, .ws-roommenu, .ws-dot.ws-away { animation: none; }
  .ws-ring circle { transition: none; }
}
