:root {
  --bg: #070a12;
  --bg2: #101626;
  --panel: rgba(18, 25, 42, .92);
  --panel2: rgba(24, 34, 56, .96);
  --ink: #f5f7ff;
  --muted: #aab4cf;
  --line: rgba(255,255,255,.12);
  --accent: #7c5cff;
  --accent2: #21d4a4;
  --danger: #ff4f6d;
  --warn: #ffbd4a;
  --shadow: rgba(0,0,0,.42);
  font-family: "Arial Black", Impact, "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(124,92,255,.34), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgba(33,212,164,.20), transparent 24rem),
    linear-gradient(160deg, #050711 0%, #0b1020 52%, #11182a 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .14;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}
.shell { position: relative; width: min(1120px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0; }
.hero { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 22px; }
.brand-logo-wrap {
  display: block;
  width: clamp(300px, 46vw, 740px);
  max-width: 100%;
  height: clamp(60px, 9.2vw, 150px);
}
.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  background: transparent;
  border: 0;
  box-shadow: none;
  mix-blend-mode: normal;
  filter: drop-shadow(0 18px 32px rgba(0,0,0,.42));
}
h1, h2 { margin: 0; line-height: .95; letter-spacing: .01em; text-transform: uppercase; }
h2 { font-size: clamp(1.35rem, 3vw, 2.15rem); }
.subhead, .hint, .message, .profile-help, .opponent-note { color: var(--muted); font-family: "Trebuchet MS", system-ui, sans-serif; font-weight: 700; }
.eyebrow { margin: 0 0 8px; text-transform: uppercase; font-size: .78rem; letter-spacing: .18em; color: var(--accent2); font-weight: 900; }
.hidden { display: none !important; }
.panel {
  background: linear-gradient(180deg, var(--panel), rgba(13,18,31,.94));
  border: 2px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 28px 80px var(--shadow), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(18px);
}
.status-card, .pill, .roster-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.06); color: var(--ink); font-weight: 900;
}
.dot { width: 11px; height: 11px; border-radius: 50%; background: #66708a; }
.dot.online { background: var(--accent2); box-shadow: 0 0 0 6px rgba(33,212,164,.14), 0 0 22px rgba(33,212,164,.65); }
.name-form, .guess-form, .lobby-name-form .name-edit-row { display: flex; gap: 12px; margin-top: 18px; }
input {
  width: 100%; border: 2px solid rgba(255,255,255,.16); border-radius: 16px;
  padding: 15px 16px; font-size: 1rem; outline: none;
  background: rgba(5,8,18,.88); color: #fff; font-family: "Trebuchet MS", system-ui, sans-serif; font-weight: 900;
}
input::placeholder { color: #7d88a5; }
input:focus { border-color: var(--accent2); box-shadow: 0 0 0 4px rgba(33,212,164,.15), 0 0 24px rgba(33,212,164,.16); }
button {
  border: 0; border-radius: 16px; padding: 14px 18px;
  font-family: "Arial Black", Impact, system-ui, sans-serif; font-weight: 900; letter-spacing: .02em;
  background: linear-gradient(180deg, #8a74ff, #5d43db); color: #fff; cursor: pointer; white-space: nowrap;
  box-shadow: 0 10px 0 #2b2366, 0 18px 32px rgba(0,0,0,.32);
  transition: transform .12s ease, filter .12s ease;
}
button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
button:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 5px 0 #2b2366, 0 10px 18px rgba(0,0,0,.3); }
button.secondary { background: linear-gradient(180deg, #26324d, #192239); color: var(--ink); box-shadow: 0 8px 0 #0b1020; }
button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.panel-header, .game-topbar, .roster-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.lobby-layout { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 18px; align-items: start; }
.lobby-profile-card, .lobby-roster-card, .progress-card {
  background: var(--panel2); border: 2px solid var(--line); border-radius: 24px; padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.profile-toggle { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; justify-content: flex-start; padding: 12px; background: rgba(255,255,255,.06); box-shadow: none; }
.profile-avatar { font-size: 1.7rem; }
.profile-toggle-copy { display: grid; gap: 3px; min-width: 0; }
.profile-toggle-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chevron { margin-left: auto; }
.profile-body { margin-top: 12px; }
.lobby-profile-card.collapsed .profile-body { display: none; }
.lobby-name-form { display: block; }
.lobby-name-form label { display: block; color: var(--muted); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 900; }

.challenge-options { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.06); width: fit-content; }
.challenge-options label { color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; }
.challenge-options select { appearance: none; border: 1px solid var(--line); border-radius: 12px; background: rgba(5,8,18,.88); color: var(--ink); font-weight: 950; padding: 9px 34px 9px 12px; font-family: inherit; cursor: pointer; }

.players-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 18px; }
.player-card {
  border: 2px solid rgba(255,255,255,.12); background: rgba(7,10,18,.78); border-radius: 20px; padding: 16px; min-height: 92px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink);
}
.player-card:hover { border-color: rgba(33,212,164,.5); box-shadow: 0 0 0 4px rgba(33,212,164,.08); }
.player-card.self { background: linear-gradient(135deg, rgba(124,92,255,.24), rgba(7,10,18,.85)); }
.player-name { font-weight: 900; font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; }
.player-status { color: var(--muted); font-size: .88rem; margin-top: 5px; font-family: "Trebuchet MS", system-ui, sans-serif; font-weight: 800; }
.player-info { min-width: 0; }
.inline-challenge-btn { padding: 10px 12px; border-radius: 13px; font-size: .78rem; background: linear-gradient(180deg, #21d4a4, #12906f); box-shadow: 0 8px 0 #064a3b; color: #05100d; }
.context-menu { position: fixed; z-index: 10; background: #11182a; border: 1px solid var(--line); border-radius: 14px; padding: 8px; box-shadow: 0 20px 45px rgba(0,0,0,.45); }
.context-menu button { border-radius: 10px; padding: 10px 14px; }
.metrics { display: flex; gap: 10px; }
.metrics div { min-width: 94px; text-align: center; background: rgba(5,8,18,.8); border: 2px solid var(--line); border-radius: 18px; padding: 10px; }
.metrics strong { display: block; font-size: 2rem; line-height: 1; color: #fff; }
.metrics span { color: var(--muted); font-size: .72rem; text-transform: uppercase; font-weight: 900; letter-spacing: .1em; }
.difficulty-badge { display: inline-flex; margin-top: 11px; padding: 8px 12px; border-radius: 999px; background: rgba(124,92,255,.18); color: #dcd6ff; font-size: .78rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; border: 1px solid rgba(124,92,255,.3); }
.progress-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .85fr); gap: 16px; margin: 22px 0; }
.progress-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-weight: 900; }
.progress-card-header span { color: var(--muted); text-transform: uppercase; font-size: .74rem; letter-spacing: .14em; }
.progress-card-header strong { color: var(--accent2); }
.word-rows { display: grid; gap: 10px; margin: 0; }
.word-row {
  display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 12px;
  width: 100%; text-align: left; color: var(--ink); background: rgba(5,8,18,.82); border: 2px solid rgba(255,255,255,.12);
  border-radius: 18px; padding: 12px 14px; box-shadow: none;
}
.word-row.active { border-color: var(--accent2); box-shadow: 0 0 0 4px rgba(33,212,164,.12), 0 14px 35px rgba(33,212,164,.08); }
.word-row.done { background: linear-gradient(90deg, rgba(33,212,164,.22), rgba(5,8,18,.82)); }
.word-mask { font-size: clamp(1.1rem, 3vw, 1.7rem); letter-spacing: .14em; font-weight: 900; color: #fff; overflow-wrap: anywhere; }
.word-label { color: var(--muted); font-weight: 900; }
.row-badges { display: inline-flex; gap: 8px; align-items: center; }
.word-check, .opponent-row-check { opacity: 0; color: var(--accent2); font-weight: 900; font-size: 1.1rem; }
.word-row.done .word-check { opacity: 1; }
.word-row.opponent-solved .opponent-row-check { opacity: 1; color: var(--warn); }
.word-row.pop, .mega-correct { animation: correctBlast .52s ease; }
.mega-incorrect { animation: wrongShake .48s ease; }
@keyframes correctBlast { 0% { transform: scale(1); } 45% { transform: scale(1.045); box-shadow: 0 0 0 5px rgba(33,212,164,.22), 0 22px 55px rgba(33,212,164,.25); } 100% { transform: scale(1); } }
@keyframes wrongShake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.opponent-rows { display: grid; gap: 8px; }
.opponent-row { display: grid; grid-template-columns: 30px 1fr 42px; align-items: center; gap: 10px; min-height: 44px; background: rgba(5,8,18,.72); border: 1px solid var(--line); border-radius: 15px; padding: 9px 10px; }
.opponent-row.active { border-color: rgba(33,212,164,.42); }
.opponent-row.done { background: linear-gradient(90deg, rgba(255,189,74,.14), rgba(5,8,18,.72)); }
.opponent-mask { min-height: 1.25em; font-weight: 900; letter-spacing: .12em; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blurred-mask { filter: blur(2.4px); opacity: .72; user-select: none; }
.opponent-state { color: var(--muted); font-size: .75rem; text-align: right; text-transform: uppercase; font-weight: 900; }
.opponent-row.done .opponent-state { color: var(--warn); font-size: 1rem; }
.mobile-focus-strip { display: none; }
.compact-guess-form { position: sticky; bottom: 10px; z-index: 5; align-items: center; background: rgba(7,10,18,.78); border: 1px solid var(--line); border-radius: 22px; padding: 10px; backdrop-filter: blur(16px); }
.icon-action { width: 50px; height: 50px; display: inline-grid; place-items: center; border-radius: 999px; padding: 0; flex: 0 0 50px; font-size: 1.15rem; }
.help-action { background: linear-gradient(180deg, #ffbd4a, #d8840f); box-shadow: 0 7px 0 #6b3b05; color: #1b1002; }
.resign-action { background: linear-gradient(180deg, #ff4f6d, #bb2841); box-shadow: 0 7px 0 #631421; color: #fff; }
.message { min-height: 1.4em; font-size: 1rem; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.68); z-index: 20; padding: 20px; }
.modal-card { width: min(430px, 100%); background: #11182a; color: var(--ink); border: 2px solid var(--line); border-radius: 26px; padding: 24px; box-shadow: 0 35px 90px rgba(0,0,0,.5); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.result-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; overflow: hidden; padding: 24px; background: rgba(0,0,0,.78); animation: overlayIn .22s ease both; }
.result-overlay.win { background: radial-gradient(circle at center, rgba(33,212,164,.32), rgba(0,0,0,.86) 58%); }
.result-overlay.loss { background: radial-gradient(circle at center, rgba(255,79,109,.25), rgba(0,0,0,.88) 58%); }
.result-overlay.timeout { background: radial-gradient(circle at center, rgba(124,92,255,.28), rgba(0,0,0,.88) 58%); }
.result-card { position: relative; width: min(540px, 100%); min-height: 340px; display: grid; place-items: center; text-align: center; padding: 34px; border-radius: 34px; color: white; border: 2px solid rgba(255,255,255,.22); box-shadow: 0 42px 120px rgba(0,0,0,.58); overflow: hidden; animation: resultSlam .78s cubic-bezier(.2, 1.35, .28, 1) both; }
.result-card.win { background: linear-gradient(135deg, #12906f, #5d43db); }
.result-card.loss { background: linear-gradient(135deg, #34111a, #bb2841); animation-name: resultShake; }
.result-card.timeout { background: linear-gradient(135deg, #17213a, #5d43db); }
.result-icon { font-size: clamp(4rem, 13vw, 7rem); filter: drop-shadow(0 20px 18px rgba(0,0,0,.28)); animation: iconBoom 1s ease both; }
.result-kicker { margin-top: 10px; text-transform: uppercase; letter-spacing: .18em; font-size: .78rem; font-weight: 900; opacity: .86; }
.result-card h2 { margin-top: 8px; font-size: clamp(2.4rem, 8vw, 4.8rem); letter-spacing: .02em; }
.result-card p { max-width: 34ch; margin: 10px auto 0; font-size: 1.1rem; opacity: .92; font-family: "Trebuchet MS", system-ui, sans-serif; font-weight: 800; }
.result-card::before { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent, rgba(255,255,255,.28), transparent 22%); animation: shineSweep 1.7s linear infinite; }
.result-card > * { position: relative; z-index: 1; }
.result-ribbon { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.result-ribbon span { position: absolute; top: -24px; left: var(--x); width: 10px; height: 18px; border-radius: 3px; background: rgba(255,255,255,.9); animation: confettiFall 2.6s var(--delay) ease-in forwards; }
.burst { position: absolute; width: 38vmax; height: 38vmax; border-radius: 50%; opacity: .45; filter: blur(8px); transform: scale(.2); animation: burstPulse 1.4s ease-out both; }
.burst-one { background: rgba(255,255,255,.22); }
.burst-two { background: rgba(124,92,255,.28); animation-delay: .16s; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes resultSlam { 0% { opacity: 0; transform: translateY(60px) scale(.72) rotate(-2deg); } 65% { opacity: 1; transform: translateY(-8px) scale(1.04) rotate(1deg); } 100% { transform: translateY(0) scale(1) rotate(0); } }
@keyframes resultShake { 0% { opacity: 0; transform: scale(.7); } 45% { opacity: 1; transform: scale(1.04) rotate(-1deg); } 58% { transform: translateX(-10px) rotate(-1deg); } 72% { transform: translateX(9px) rotate(1deg); } 86% { transform: translateX(-5px); } 100% { transform: translateX(0) scale(1); } }
@keyframes iconBoom { 0% { transform: scale(.1) rotate(-18deg); opacity: 0; } 55% { transform: scale(1.22) rotate(8deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes shineSweep { to { transform: rotate(360deg); } }
@keyframes confettiFall { to { transform: translate(var(--drift), 420px) rotate(var(--spin)); opacity: 0; } }
@keyframes burstPulse { 0% { transform: scale(.1); opacity: .62; } 100% { transform: scale(1.55); opacity: 0; } }
@media (max-width: 900px) { .progress-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .hero { align-items: center; }
  .brand-logo-wrap { width: clamp(240px, 58vw, 430px); height: clamp(48px, 11.5vw, 86px); margin: 0 auto; }
  .brand-logo { object-position: center; }
}
@media (max-width: 720px) {
  .shell { width: min(100% - 18px, 720px); padding: 14px 0 calc(10px + env(safe-area-inset-bottom)); }
  .hero, .panel-header, .game-topbar, .name-form { flex-direction: column; align-items: stretch; }
  .hero { gap: 10px; margin-bottom: 12px; }
  .brand-logo-wrap { width: min(86vw, 360px); height: min(17vw, 72px); margin: 0 auto; }
  .brand-logo { object-position: center; }
  h1 { font-size: clamp(2.6rem, 16vw, 4.4rem); }
  .panel { border-radius: 22px; padding: 14px; }
  .lobby-layout { grid-template-columns: 1fr; }
  .players-list { grid-template-columns: 1fr; }
  .player-card { align-items: stretch; flex-direction: column; }
  .inline-challenge-btn, button { width: 100%; }
  .modal-actions { flex-direction: column; }
  input { font-size: 16px; }
  .game-topbar { gap: 10px; }
  .metrics div { min-width: 0; flex: 1; padding: 8px; }
  .progress-grid { display: block; margin: 12px 0; }
  .opponent-progress { display: none; }
  .your-progress { padding: 10px; }
  .word-rows { gap: 7px; max-height: min(46vh, 390px); overflow: auto; padding-right: 2px; }
  .word-row { grid-template-columns: 28px 1fr auto; padding: 9px 10px; border-radius: 14px; }
  .word-mask { font-size: clamp(1rem, 5vw, 1.25rem); letter-spacing: .1em; }
  .mobile-focus-strip { display: grid; grid-template-columns: 1fr; gap: 7px; margin: 8px 0 7px; position: sticky; bottom: 72px; z-index: 4; }
  .mobile-focus-strip.empty { display: none; }
  .mobile-focus-strip div { background: rgba(5,8,18,.9); border: 1px solid var(--line); border-radius: 14px; padding: 7px 10px; }
  .mobile-focus-strip span { display: block; color: var(--muted); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 900; }
  .mobile-focus-strip strong { display: block; color: #fff; letter-spacing: .1em; font-size: .96rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .compact-guess-form { gap: 6px; margin-top: 8px; bottom: calc(6px + env(safe-area-inset-bottom)); padding: 7px; border-radius: 18px; }
  .compact-guess-form input { min-width: 0; padding: 12px 10px; border-radius: 13px; }
  .icon-action { width: 42px !important; height: 42px; flex-basis: 42px; font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Gameplay UX update: big timer bar and keyboard-safe mobile focus */
.timer-boss {
  margin: 0 0 20px;
  padding: 18px 20px;
  border-radius: 24px;
  border: 2px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(5,8,18,.94), rgba(18,25,42,.92));
  box-shadow: 0 18px 48px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.08);
}
.timer-boss-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 10px; }
.timer-boss-top span { color: var(--muted); font-size: .82rem; letter-spacing: .18em; font-weight: 900; }
.timer-boss-top strong { color: #fff; font-size: clamp(2rem, 7vw, 4rem); line-height: .9; text-shadow: 0 8px 24px rgba(0,0,0,.35); }
.timer-track { position: relative; height: 34px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.14); }
.timer-fill { height: 100%; width: 100%; border-radius: inherit; transform-origin: right center; transition: width .08s linear, background .2s ease, box-shadow .2s ease; }
.timer-fill.time-green { background: linear-gradient(90deg, #19b77f, #38e5b5); box-shadow: 0 0 20px rgba(33,212,164,.42); }
.timer-fill.time-yellow { background: linear-gradient(90deg, #e4a521, #ffd05a); box-shadow: 0 0 20px rgba(255,189,74,.42); }
.timer-fill.time-red { background: linear-gradient(90deg, #d72f4d, #ff6b7f); box-shadow: 0 0 24px rgba(255,79,109,.48); }
.timer-fill.danger-pulse { animation: timerDangerPulse .55s ease-in-out infinite alternate; }
@keyframes timerDangerPulse { from { filter: brightness(1); box-shadow: 0 0 18px rgba(255,79,109,.45); } to { filter: brightness(1.35); box-shadow: 0 0 34px rgba(255,79,109,.82); } }
.word-row.active .word-mask { color: #ffffff; text-shadow: 0 0 18px rgba(33,212,164,.28); }
.word-row.done.pop { scroll-margin-top: 190px; }
@media (max-width: 720px) {
  .timer-boss { position: sticky; top: 6px; z-index: 8; margin-bottom: 12px; padding: 12px; border-radius: 18px; }
  .timer-boss-top { margin-bottom: 7px; }
  .timer-boss-top strong { font-size: clamp(1.8rem, 11vw, 3.2rem); }
  .timer-track { height: 26px; }
  .game-panel { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
  .progress-grid { margin-bottom: 6px; }
  .your-progress { max-height: none; }
  .word-rows { max-height: min(28dvh, 220px); scroll-padding-top: 82px; scroll-padding-bottom: 165px; }
  .word-row:not(.active):not(.done) { display: none; }
  .word-row.done:not(:has(+ .word-row.active)) { display: none; }
  .word-row.active { scroll-margin-top: 82px; scroll-margin-bottom: 165px; }
  .mobile-focus-strip { bottom: calc(68px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 22px rgba(0,0,0,.24); }
  .mobile-focus-strip div { padding: 6px 9px; }
  .mobile-focus-strip strong { font-size: .9rem; }
  .challenge-options { width: 100%; justify-content: space-between; }
  .challenge-options select { flex: 1; }
}
@media (max-height: 660px) and (max-width: 720px) {
  .hero { display: none; }
  .game-topbar { display: none; }
  .timer-boss { padding: 8px 10px; margin-bottom: 6px; }
  .timer-boss-top strong { font-size: 1.6rem; }
  .timer-track { height: 18px; }
  .progress-card-header { display: none; }
  .your-progress { padding: 7px; }
  .word-rows { max-height: 118px; }
  .word-row { padding: 7px 8px; }
  .mobile-focus-strip { gap: 4px; margin: 5px 0; }
  .mobile-focus-strip div { padding: 5px 8px; }
  .compact-guess-form { padding: 5px; }
  .compact-guess-form input { padding: 10px 8px; }
  .icon-action { width: 38px !important; height: 38px; flex-basis: 38px; }
}

/* Audio controls */
.status-card { flex-wrap: wrap; }
.audio-toggle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
  background: rgba(255,255,255,.10);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.audio-toggle:hover:not(:disabled) { transform: translateY(-1px); background: rgba(255,255,255,.16); }
.audio-toggle:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
@media (max-width: 720px) {
  .status-card { justify-content: space-between; width: 100%; }
  .audio-toggle { margin-left: auto; }
}

.result-words { position: relative; z-index: 1; margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.22); color: #fff; font-weight: 900; font-size: clamp(.85rem, 2.6vw, 1rem); line-height: 1.45; max-width: 46ch; }
.result-words.hidden { display: none; }

.icon-action.resign-action { min-width: 42px; width: 42px; height: 42px; padding: 0; font-size: 1.1rem; border-radius: 999px; }

/* Challenge options: color-correct mode */
.challenge-options { flex-wrap: wrap; }
.challenge-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f8fafc;
  font-weight: 900;
  letter-spacing: .02em;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  cursor: pointer;
  user-select: none;
}
.challenge-toggle input { width: 18px; height: 18px; accent-color: var(--accent2); }
.word-mask .letter-correct { color: #3ff1a6; text-shadow: 0 0 16px rgba(63,241,166,.45); }
.word-mask .letter-incorrect { color: #ff5b6e; text-shadow: 0 0 16px rgba(255,91,110,.4); }
.word-row.done .word-mask span,
.word-row.solution .word-mask span { color: #fff; text-shadow: none; }
@media (max-width: 720px) {
  .challenge-toggle { width: 100%; justify-content: center; border-radius: 16px; }
  .compact-guess-form { grid-template-columns: 1fr auto auto; display: grid; }
  .compact-guess-form input { width: 100%; }
}

.challenge-number {
  width: 4.5rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  font: 900 0.95rem var(--block-font);
}
.challenge-number:focus { outline: 2px solid rgba(255,255,255,0.5); outline-offset: 2px; }

/* Challenge setup moved into a focused popup */
.challenge-setup-card { width: min(480px, 100%); }
.modal-copy { margin: 10px 0 16px; color: var(--muted); font-family: "Trebuchet MS", system-ui, sans-serif; font-weight: 800; }
.modal-options { display: grid; grid-template-columns: 1fr; gap: 9px; margin: 16px 0 18px; }
.modal-options label { color: var(--muted); font-family: "Trebuchet MS", system-ui, sans-serif; font-weight: 900; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
.modal-options select, .modal-options input[type="number"] { width: 100%; border: 2px solid rgba(255,255,255,.16); border-radius: 16px; padding: 12px 14px; background: rgba(5,8,18,.88); color: #fff; font-family: "Trebuchet MS", system-ui, sans-serif; font-weight: 900; }
.modal-options .challenge-toggle { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.06); color: #fff; }
.modal-options .challenge-toggle input { width: auto; }
.solo-btn { background: linear-gradient(180deg, #21d4a4, #12906f); box-shadow: 0 6px 0 #075340; color: #03140f; }
.game-panel.single-player .progress-grid { grid-template-columns: 1fr; }
.game-panel.single-player .opponent-progress { display: none; }

@media (max-width: 720px) {
  .brand-logo-wrap { width: min(340px, 86vw); height: min(17vw, 72px); }
}

@media (min-width: 920px) and (min-aspect-ratio: 4/3) {
  .brand-logo-wrap {
    width: clamp(420px, 50vw, 900px);
    height: clamp(82px, 10vw, 180px);
  }
}
@media (max-width: 480px) {
  .brand-logo-wrap {
    width: min(92vw, 340px);
    height: min(18.5vw, 68px);
  }
}

/* Update: full-width sticky gameplay timer bar without text */
body:has(#gamePanel:not(.hidden)) {
  padding-top: calc(16px + env(safe-area-inset-top));
}
#gamePanel .timer-boss {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  height: calc(16px + env(safe-area-inset-top)) !important;
  z-index: 9999 !important;
  margin: 0 !important;
  padding: env(safe-area-inset-top) 0 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(3, 7, 18, .88) !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.35) !important;
  pointer-events: none !important;
}
#gamePanel .timer-boss-top {
  display: none !important;
}
#gamePanel .timer-track {
  width: 100vw !important;
  height: 16px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(255,255,255,.10) !important;
  overflow: hidden !important;
}
#gamePanel .timer-fill {
  height: 16px !important;
  border-radius: 0 !important;
  transition: width .16s linear, background .2s ease, box-shadow .2s ease !important;
}
#gamePanel .timer-fill.time-green { background: linear-gradient(90deg, #16a34a, #22c55e) !important; }
#gamePanel .timer-fill.time-yellow { background: linear-gradient(90deg, #eab308, #facc15) !important; }
#gamePanel .timer-fill.time-red { background: linear-gradient(90deg, #dc2626, #ef4444) !important; }
#gamePanel .game-topbar .metrics div:first-child {
  display: none !important;
}
@media (max-width: 720px) {
  body:has(#gamePanel:not(.hidden)) {
    padding-top: calc(14px + env(safe-area-inset-top));
  }
  #gamePanel .timer-boss {
    height: calc(14px + env(safe-area-inset-top)) !important;
  }
  #gamePanel .timer-track,
  #gamePanel .timer-fill {
    height: 14px !important;
  }
}

/* Light theme restore: high-contrast light UI while preserving gameplay behavior */
:root {
  --bg: #f6f8fd;
  --bg2: #ffffff;
  --panel: rgba(255,255,255,.94);
  --panel2: #ffffff;
  --ink: #172033;
  --muted: #56657f;
  --line: rgba(28,43,68,.14);
  --accent: #2563eb;
  --accent2: #14a576;
  --danger: #dc2626;
  --warn: #b7791f;
  --shadow: rgba(31,45,72,.14);
}
html { background: var(--bg) !important; }
body {
  color: var(--ink) !important;
  background:
    radial-gradient(circle at 18% 8%, rgba(37,99,235,.12), transparent 30rem),
    radial-gradient(circle at 88% 14%, rgba(20,165,118,.10), transparent 25rem),
    linear-gradient(160deg, #f8fbff 0%, #eef4ff 52%, #f7f9fd 100%) !important;
}
body::before { opacity: .28; background-image: linear-gradient(rgba(37,99,235,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(37,99,235,.055) 1px, transparent 1px); }
.brand-logo { filter: drop-shadow(0 14px 22px rgba(31,45,72,.16)) !important; }
.subhead, .hint, .message, .profile-help, .opponent-note, .player-status, .word-label, .opponent-state, .modal-copy, .modal-options label, .lobby-name-form label, .progress-card-header span, .metrics span, .challenge-options label { color: var(--muted) !important; }
.eyebrow, .progress-card-header strong { color: #0f8b63 !important; }
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,248,255,.96)) !important;
  border-color: rgba(28,43,68,.12) !important;
  box-shadow: 0 24px 68px rgba(31,45,72,.14), inset 0 1px 0 rgba(255,255,255,.85) !important;
  backdrop-filter: blur(12px);
}
.lobby-profile-card, .lobby-roster-card, .progress-card {
  background: rgba(255,255,255,.96) !important;
  border-color: rgba(28,43,68,.12) !important;
  box-shadow: 0 14px 34px rgba(31,45,72,.10), inset 0 1px 0 rgba(255,255,255,.9) !important;
}
.status-card, .pill, .roster-pill, .challenge-options, .challenge-toggle, .modal-options .challenge-toggle, .audio-toggle {
  background: rgba(239,245,255,.86) !important;
  color: var(--ink) !important;
  border-color: rgba(28,43,68,.14) !important;
}
input, .modal-options select, .modal-options input[type="number"], .challenge-options select, .challenge-number {
  background: #ffffff !important;
  color: #172033 !important;
  border-color: rgba(28,43,68,.18) !important;
  box-shadow: inset 0 1px 0 rgba(31,45,72,.04) !important;
}
input::placeholder { color: #7a879c !important; }
input:focus, .modal-options select:focus, .modal-options input[type="number"]:focus, .challenge-options select:focus {
  border-color: #14a576 !important;
  box-shadow: 0 0 0 4px rgba(20,165,118,.14) !important;
}
button {
  background: linear-gradient(180deg, #3b82f6, #2563eb) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 0 #1741a6, 0 16px 28px rgba(37,99,235,.20) !important;
}
button:active:not(:disabled) { box-shadow: 0 4px 0 #1741a6, 0 8px 16px rgba(37,99,235,.18) !important; }
button.secondary {
  background: linear-gradient(180deg, #ffffff, #eef3fb) !important;
  color: #1f2a44 !important;
  border: 1px solid rgba(28,43,68,.16) !important;
  box-shadow: 0 6px 0 #d4dceb, 0 12px 24px rgba(31,45,72,.10) !important;
}
.inline-challenge-btn, .solo-btn {
  background: linear-gradient(180deg, #2dd4a0, #14a576) !important;
  box-shadow: 0 7px 0 #087957, 0 14px 26px rgba(20,165,118,.20) !important;
  color: #06261c !important;
}
.help-action { background: linear-gradient(180deg, #facc15, #eab308) !important; box-shadow: 0 7px 0 #a16207 !important; color: #2a1a00 !important; }
.resign-action { background: linear-gradient(180deg, #ef4444, #dc2626) !important; box-shadow: 0 7px 0 #991b1b !important; color: #ffffff !important; }
.profile-toggle, .player-card, .word-row, .opponent-row, .mobile-focus-strip div, .compact-guess-form {
  background: rgba(255,255,255,.92) !important;
  color: var(--ink) !important;
  border-color: rgba(28,43,68,.14) !important;
}
.player-card:hover { border-color: rgba(20,165,118,.42) !important; box-shadow: 0 0 0 4px rgba(20,165,118,.10) !important; }
.player-card.self { background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(255,255,255,.94)) !important; }
.context-menu, .modal-card {
  background: #ffffff !important;
  color: var(--ink) !important;
  border-color: rgba(28,43,68,.14) !important;
  box-shadow: 0 28px 70px rgba(31,45,72,.22) !important;
}
.metrics div {
  background: rgba(239,245,255,.90) !important;
  border-color: rgba(28,43,68,.14) !important;
}
.metrics strong, .word-mask, .opponent-mask, .mobile-focus-strip strong, .timer-boss-top strong { color: #172033 !important; text-shadow: none !important; }
.difficulty-badge {
  background: rgba(37,99,235,.10) !important;
  color: #1d4ed8 !important;
  border-color: rgba(37,99,235,.22) !important;
}
.word-row.active {
  border-color: #14a576 !important;
  box-shadow: 0 0 0 4px rgba(20,165,118,.12), 0 14px 32px rgba(20,165,118,.12) !important;
}
.word-row.done { background: linear-gradient(90deg, rgba(20,165,118,.16), rgba(255,255,255,.94)) !important; }
.opponent-row.done { background: linear-gradient(90deg, rgba(250,204,21,.18), rgba(255,255,255,.94)) !important; }
.word-check, .opponent-row.done .opponent-state { color: #0f8b63 !important; }
.opponent-row-check { color: #b7791f !important; }
.blurred-mask { opacity: .55; }
.result-words { background: rgba(255,255,255,.18) !important; }
.timer-boss {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(239,245,255,.96)) !important;
  border-color: rgba(28,43,68,.14) !important;
  box-shadow: 0 14px 36px rgba(31,45,72,.14) !important;
}
.timer-track { background: rgba(28,43,68,.10) !important; border-color: rgba(28,43,68,.10) !important; }
.audio-toggle:hover:not(:disabled) { background: rgba(226,236,255,.95) !important; }
#gamePanel .timer-boss {
  background: rgba(255,255,255,.90) !important;
  box-shadow: 0 6px 18px rgba(31,45,72,.16) !important;
}
#gamePanel .timer-track { background: rgba(28,43,68,.12) !important; }
@media (max-width: 720px) {
  .mobile-focus-strip { box-shadow: 0 -8px 22px rgba(31,45,72,.12) !important; }
  .compact-guess-form { background: rgba(255,255,255,.95) !important; box-shadow: 0 -10px 28px rgba(31,45,72,.12) !important; }
}

/* Flat buttons + fun cartoon typography update */
:root {
  --fun-font: "Comic Sans MS", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}
html, body, button, input, select, textarea, .panel, .modal-card, .word-row, .player-card, .metrics, .result-card {
  font-family: var(--fun-font) !important;
}
body {
  letter-spacing: .005em;
}
button,
.inline-challenge-btn,
.solo-btn,
.help-action,
.resign-action,
.audio-toggle,
.profile-toggle,
.context-menu button {
  border: 0 !important;
  box-shadow: none !important;
  background-image: none !important;
  transform: none !important;
  text-shadow: none !important;
  font-family: var(--fun-font) !important;
  font-weight: 900 !important;
  letter-spacing: .02em !important;
}
button {
  background: #2563eb !important;
  color: #ffffff !important;
}
button.secondary,
.profile-toggle,
.audio-toggle {
  background: #eaf1ff !important;
  color: #172033 !important;
  border: 1px solid rgba(28,43,68,.14) !important;
}
.inline-challenge-btn,
.solo-btn {
  background: #20c997 !important;
  color: #06261c !important;
}
.help-action {
  background: #facc15 !important;
  color: #2a1a00 !important;
}
.resign-action {
  background: #ef4444 !important;
  color: #ffffff !important;
}
button:hover:not(:disabled),
.inline-challenge-btn:hover:not(:disabled),
.solo-btn:hover:not(:disabled),
.help-action:hover:not(:disabled),
.resign-action:hover:not(:disabled),
.audio-toggle:hover:not(:disabled) {
  transform: none !important;
  filter: brightness(1.04) !important;
  box-shadow: none !important;
}
button:active:not(:disabled),
.inline-challenge-btn:active:not(:disabled),
.solo-btn:active:not(:disabled),
.help-action:active:not(:disabled),
.resign-action:active:not(:disabled) {
  transform: none !important;
  filter: brightness(.96) !important;
  box-shadow: none !important;
}
button:disabled {
  box-shadow: none !important;
  transform: none !important;
}
.subhead, .hint, .message, .profile-help, .opponent-note, .player-status, .modal-copy, .modal-options label, .lobby-name-form label {
  font-family: var(--fun-font) !important;
}

/* Update: fun non-Comic font + better spaced sticky timer bar */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&display=swap');
:root {
  --fun-font: "Fredoka", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}
html, body, button, input, select, textarea, .panel, .modal-card, .word-row, .player-card, .metrics, .result-card,
h1, h2, .subhead, .hint, .message, .profile-help, .opponent-note, .player-status,
.modal-copy, .modal-options label, .lobby-name-form label, .word-mask, .player-name {
  font-family: var(--fun-font) !important;
}
button,
.inline-challenge-btn,
.solo-btn,
.help-action,
.resign-action,
.audio-toggle,
.profile-toggle,
.context-menu button {
  font-family: var(--fun-font) !important;
  font-weight: 700 !important;
}

/* Replace flush-edge timer with a polished, viewport-spaced sticky bar. */
body:has(#gamePanel:not(.hidden)) {
  padding-top: calc(50px + env(safe-area-inset-top)) !important;
}
#gamePanel .timer-boss {
  position: fixed !important;
  top: calc(10px + env(safe-area-inset-top)) !important;
  left: clamp(12px, 3vw, 32px) !important;
  right: clamp(12px, 3vw, 32px) !important;
  width: auto !important;
  height: 24px !important;
  z-index: 9999 !important;
  margin: 0 !important;
  padding: 3px !important;
  border: 1px solid rgba(28,43,68,.16) !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.88) !important;
  box-shadow: 0 8px 24px rgba(31,45,72,.18) !important;
  pointer-events: none !important;
  backdrop-filter: blur(10px) !important;
}
#gamePanel .timer-boss-top {
  display: none !important;
}
#gamePanel .timer-track {
  width: 100% !important;
  height: 16px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(28,43,68,.12) !important;
  overflow: hidden !important;
}
#gamePanel .timer-fill {
  height: 16px !important;
  border-radius: 999px !important;
  transition: width .18s linear, background .2s ease, box-shadow .2s ease !important;
}
#gamePanel .timer-fill.time-green { background: linear-gradient(90deg, #16a34a, #22c55e) !important; }
#gamePanel .timer-fill.time-yellow { background: linear-gradient(90deg, #eab308, #facc15) !important; }
#gamePanel .timer-fill.time-red { background: linear-gradient(90deg, #dc2626, #ef4444) !important; }
#gamePanel .game-topbar .metrics div:first-child {
  display: none !important;
}
@media (max-width: 720px) {
  body:has(#gamePanel:not(.hidden)) {
    padding-top: calc(42px + env(safe-area-inset-top)) !important;
  }
  #gamePanel .timer-boss {
    top: calc(7px + env(safe-area-inset-top)) !important;
    left: 10px !important;
    right: 10px !important;
    height: 20px !important;
    padding: 3px !important;
  }
  #gamePanel .timer-track,
  #gamePanel .timer-fill {
    height: 14px !important;
  }
}

/* Update: off-white theme + borderless panels */
:root {
  --bg: #fbf7ef;
  --panel: rgba(255, 252, 246, .97);
  --panel2: rgba(255, 255, 255, .96);
  --line: transparent;
  --shadow: rgba(79, 62, 38, .12);
}
html { background: #fbf7ef !important; }
body {
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 214, 129, .28), transparent 26rem),
    radial-gradient(circle at 88% 14%, rgba(105, 188, 255, .14), transparent 24rem),
    linear-gradient(160deg, #fffaf1 0%, #fbf7ef 48%, #f7f1e8 100%) !important;
}
body::before { opacity: .18 !important; }
.panel,
.lobby-profile-card,
.lobby-roster-card,
.progress-card,
.player-card,
.word-row,
.opponent-row,
.metrics div,
.status-card,
.pill,
.roster-pill,
.challenge-options,
.challenge-toggle,
.modal-options .challenge-toggle,
.mobile-focus-strip div,
.compact-guess-form,
.timer-boss,
.modal-card,
.context-menu,
.result-card,
.result-words {
  border: 0 !important;
}
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,250,241,.96)) !important;
  box-shadow: 0 24px 58px rgba(79, 62, 38, .12), inset 0 1px 0 rgba(255,255,255,.92) !important;
}
.lobby-profile-card,
.lobby-roster-card,
.progress-card,
.player-card,
.word-row,
.opponent-row,
.metrics div,
.mobile-focus-strip div,
.compact-guess-form {
  background: rgba(255,255,255,.92) !important;
  box-shadow: 0 12px 28px rgba(79, 62, 38, .08) !important;
}
.player-card:hover,
.word-row.active {
  box-shadow: 0 0 0 4px rgba(20,165,118,.12), 0 14px 30px rgba(79, 62, 38, .10) !important;
}
.status-card,
.pill,
.roster-pill,
.challenge-options,
.challenge-toggle,
.modal-options .challenge-toggle,
.audio-toggle,
button.secondary,
.profile-toggle {
  border: 0 !important;
  background: #fff4df !important;
  box-shadow: none !important;
}
input,
select,
.modal-options select,
.modal-options input[type="number"],
.challenge-options select,
.challenge-number {
  border: 0 !important;
  background: #ffffff !important;
  box-shadow: inset 0 0 0 2px rgba(79,62,38,.08) !important;
}
input:focus,
select:focus,
.modal-options select:focus,
.modal-options input[type="number"]:focus,
.challenge-options select:focus {
  box-shadow: inset 0 0 0 2px #14a576, 0 0 0 4px rgba(20,165,118,.14) !important;
}
#gamePanel .timer-boss {
  border: 0 !important;
  background: rgba(255,250,241,.92) !important;
  box-shadow: 0 8px 22px rgba(79,62,38,.14) !important;
}


/* Themed lobby device icons */
.player-main-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.device-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffdf8, #f4eadc);
  box-shadow: 0 5px 0 rgba(61, 45, 26, .16), 0 10px 20px rgba(79, 62, 38, .12);
  color: #2d261e;
}
.device-icon svg {
  width: 26px;
  height: 26px;
  fill: #fffaf2;
  stroke: #2d261e;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.device-icon svg path,
.device-icon svg rect,
.device-icon svg circle,
.device-icon svg line {
  vector-effect: non-scaling-stroke;
}
.device-phone { background: linear-gradient(180deg, #dff7ff, #bfeaff); }
.device-tablet { background: linear-gradient(180deg, #fff3be, #ffe078); }
.device-desktop { background: linear-gradient(180deg, #e9ffe9, #c9f4c9); }
@media (max-width: 760px) {
  .device-icon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 10px; }
  .device-icon svg { width: 23px; height: 23px; }
}

/* Theme cohesion pass: flat, limited-palette buttons + thin-outline icons */
:root {
  --btn-primary: #2f6fdb;
  --btn-primary-hover: #255fc2;
  --btn-secondary: #fff1d8;
  --btn-secondary-hover: #ffe7bf;
  --btn-positive: #39c58c;
  --btn-positive-hover: #2fb27b;
  --btn-help: #f6c945;
  --btn-help-hover: #e7b92e;
  --btn-danger: #ee6b5f;
  --btn-danger-hover: #de5549;
  --icon-ink: #24324a;
  --icon-paper: #fffdf7;
}
button,
.inline-challenge-btn,
.solo-btn,
.help-action,
.resign-action,
.audio-toggle,
.profile-toggle,
.context-menu button {
  border-radius: 14px !important;
  border: 0 !important;
  background-image: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  outline-offset: 3px !important;
}
button { background: var(--btn-primary) !important; color: #ffffff !important; }
button:hover:not(:disabled) { background: var(--btn-primary-hover) !important; filter: none !important; }
button.secondary,
.profile-toggle,
.audio-toggle {
  background: var(--btn-secondary) !important;
  color: #24324a !important;
}
button.secondary:hover:not(:disabled),
.profile-toggle:hover:not(:disabled),
.audio-toggle:hover:not(:disabled) { background: var(--btn-secondary-hover) !important; }
.inline-challenge-btn,
.solo-btn { background: var(--btn-positive) !important; color: #113b2d !important; }
.inline-challenge-btn:hover:not(:disabled),
.solo-btn:hover:not(:disabled) { background: var(--btn-positive-hover) !important; }
.help-action { background: var(--btn-help) !important; color: #3a2a00 !important; }
.help-action:hover:not(:disabled) { background: var(--btn-help-hover) !important; }
.resign-action { background: var(--btn-danger) !important; color: #ffffff !important; }
.resign-action:hover:not(:disabled) { background: var(--btn-danger-hover) !important; }
button:active:not(:disabled),
.inline-challenge-btn:active:not(:disabled),
.solo-btn:active:not(:disabled),
.help-action:active:not(:disabled),
.resign-action:active:not(:disabled),
.audio-toggle:active:not(:disabled) {
  transform: translateY(1px) !important;
  box-shadow: none !important;
  filter: none !important;
}
.icon-action,
.audio-toggle {
  display: inline-grid !important;
  place-items: center !important;
}
.theme-icon {
  width: 1.35em;
  height: 1.35em;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.audio-toggle .theme-icon { width: 1.25em; height: 1.25em; }
.result-icon .theme-icon { width: clamp(4rem, 12vw, 6.5rem); height: clamp(4rem, 12vw, 6.5rem); margin: 0 auto; stroke-width: 1.9; }
.result-card.win .result-icon { color: #14845f; }
.result-card.loss .result-icon { color: #c2413a; }
.result-card.tie .result-icon { color: #9a6a00; }
.device-icon {
  background: var(--icon-paper) !important;
  color: var(--icon-ink) !important;
  border: 1.5px solid rgba(36,50,74,.18) !important;
  box-shadow: none !important;
}
.device-phone,
.device-tablet,
.device-desktop,
.device-unknown { background: var(--icon-paper) !important; }
.device-icon svg {
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.4 !important;
}
.device-icon svg .device-accent,
.theme-icon .theme-accent {
  stroke: var(--btn-positive) !important;
}
.device-phone { color: #2f6fdb !important; }
.device-tablet { color: #b7791f !important; }
.device-desktop { color: #14845f !important; }
.device-unknown { color: #56637a !important; }


/* Themed profile avatar: flat, thin-outline, limited palette */
.profile-avatar {
  width: 42px !important;
  height: 42px !important;
  flex: 0 0 42px;
  display: inline-grid !important;
  place-items: center !important;
  font-size: 0 !important;
  line-height: 1 !important;
}
.profile-avatar-icon {
  width: 42px;
  height: 42px;
  display: block;
  fill: none;
  stroke: var(--icon-ink, #24324a);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile-avatar-icon .avatar-bg {
  fill: var(--icon-paper, #fffdf7);
  stroke: rgba(36, 50, 74, .24);
}
.profile-avatar-icon .avatar-face,
.profile-avatar-icon .avatar-head,
.profile-avatar-icon .avatar-body {
  fill: #fff7e8;
}
.profile-avatar-icon .avatar-accent {
  stroke: var(--btn-positive, #39c58c);
}
.profile-avatar-icon circle:not(.avatar-bg):not(.avatar-face) {
  fill: var(--icon-ink, #24324a);
  stroke: none;
}
@media (max-width: 760px) {
  .profile-avatar,
  .profile-avatar-icon {
    width: 36px !important;
    height: 36px !important;
  }
  .profile-avatar { flex-basis: 36px; }
}

/* Update: small-caps typography regenerated from attached project */
:root {
  --fun-font: "Trebuchet MS", "Segoe UI", "Arial Rounded MT Bold", system-ui, sans-serif;
}
html,
body,
button,
select,
textarea,
.panel,
.modal-card,
.word-row,
.player-card,
.metrics,
.result-card,
h1,
h2,
.subhead,
.hint,
.message,
.profile-help,
.opponent-note,
.player-status,
.modal-copy,
.modal-options label,
.lobby-name-form label,
.word-mask,
.word-label,
.progress-card-header,
.metrics span,
.difficulty-badge,
.status-card,
.pill,
.roster-pill {
  font-family: var(--fun-font) !important;
}
body,
button,
select,
.panel,
.modal-card,
.player-card,
.word-row,
.status-card,
.pill,
.roster-pill,
.metrics,
.result-card,
.progress-card-header,
.modal-options label,
.lobby-name-form label,
.difficulty-badge,
.player-status,
.word-label,
.message,
.hint,
.subhead,
.profile-help,
.opponent-note {
  font-variant-caps: small-caps;
  font-feature-settings: "smcp" 1, "c2sc" 1;
  letter-spacing: .045em;
}
input,
#guessInput,
#playerNameInput,
#lobbyNameInput,
.player-name,
.profile-toggle-copy strong,
.result-word,
.answer-word,
.word-mask {
  font-variant-caps: normal !important;
  font-feature-settings: normal !important;
}
button,
.inline-challenge-btn,
.solo-btn,
.help-action,
.resign-action,
.audio-toggle,
.profile-toggle,
.context-menu button {
  font-weight: 800 !important;
  letter-spacing: .055em !important;
}
.player-name {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere;
  line-height: 1.12;
}
.player-info,
.player-main-line {
  min-width: 0;
  flex: 1 1 auto;
}
.player-card {
  align-items: flex-start !important;
}
@media (min-width: 760px) {
  .players-list { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important; }
}


/* Word-art label assets */
.word-art-heading {
  margin: -6px 0 4px;
  line-height: 1;
}
.word-art-heading img {
  display: block;
  width: min(100%, 360px);
  max-height: 86px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.32));
}
.word-art-btn-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 28px;
  object-fit: contain;
  margin: 0 auto;
  pointer-events: none;
}
.inline-challenge-btn,
.solo-btn,
#challengeBtn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 128px !important;
  min-height: 48px !important;
  padding: 7px 14px !important;
  overflow: hidden !important;
}
.inline-challenge-btn .word-art-btn-img,
#challengeBtn .word-art-btn-img { height: 30px; }
.solo-btn .word-art-btn-img { height: 32px; max-width: 96px; }
#challengeBtn { min-width: 150px !important; }
@media (max-width: 720px) {
  .word-art-heading img { width: min(100%, 300px); max-height: 72px; }
  .inline-challenge-btn,
  .solo-btn,
  #challengeBtn { width: 100% !important; min-height: 52px !important; }
  .inline-challenge-btn .word-art-btn-img,
  #challengeBtn .word-art-btn-img { height: 28px; }
  .solo-btn .word-art-btn-img { height: 30px; }
}

/* Requested lobby/gameplay refinements */
.player-card.self {
  opacity: .82 !important;
  background: rgba(255,255,255,.76) !important;
  border-style: dashed !important;
  border-color: rgba(36,50,74,.18) !important;
  box-shadow: none !important;
}
.player-card.self .player-name {
  font-size: .98rem !important;
  color: rgba(36,50,74,.76) !important;
}
.player-card.self .device-icon {
  opacity: .72;
  transform: scale(.92);
}
.player-card.self .player-info::after {
  content: "You";
  display: inline-flex;
  margin-top: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(36,50,74,.08);
  color: rgba(36,50,74,.62);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
}
.player-card.self .solo-btn {
  margin-left: auto !important;
  align-self: center !important;
  background: #fff1d8 !important;
  color: #6a3a00 !important;
  border: 1px solid rgba(181,106,0,.18) !important;
}
.player-card.self .solo-btn:hover:not(:disabled) {
  background: #ffe3b8 !important;
}
.player-card:not(.self) .inline-challenge-btn {
  background: #39c58c !important;
  color: #113b2d !important;
}
#matchTitle {
  text-transform: none !important;
  font-variant-caps: normal !important;
  letter-spacing: .01em !important;
  line-height: 1.08 !important;
}
.category-spotlight {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  margin: 10px 0 0;
  padding: 10px 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(57,197,140,.18), rgba(47,111,219,.12));
  border: 1px solid rgba(57,197,140,.34);
  box-shadow: 0 10px 22px rgba(31,45,72,.10);
}
.category-spotlight span {
  color: #0f8b63;
  font-size: .7rem;
  font-weight: 950;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.category-spotlight strong {
  color: #172033;
  font-size: clamp(1.15rem, 2.4vw, 1.75rem);
  font-weight: 950;
  line-height: 1;
}
.difficulty-badge {
  text-transform: none !important;
  font-variant-caps: normal !important;
  letter-spacing: .03em !important;
  font-size: .82rem !important;
}
.timer-fill {
  width: 100% !important;
  transform: scaleX(1);
  transform-origin: left center !important;
  will-change: transform;
  transition: background .2s ease, box-shadow .2s ease !important;
}
.timer-track {
  contain: paint;
}
@media (max-width: 720px) {
  .player-card.self {
    flex-direction: row !important;
    align-items: center !important;
  }
  .player-card.self .solo-btn {
    width: auto !important;
    min-width: 96px !important;
    flex: 0 0 auto;
  }
  .category-spotlight {
    display: flex;
    width: 100%;
  }
}

/* Readability and merged category/difficulty panel update */
.modal-options select,
.modal-options input[type="number"],
.challenge-options select,
.challenge-number {
  font-size: 1.08rem !important;
  line-height: 1.25 !important;
  min-height: 48px !important;
}
.modal-options label,
.challenge-options label,
.modal-options .challenge-toggle {
  font-size: .95rem !important;
  line-height: 1.25 !important;
}
.modal-options .challenge-toggle {
  font-weight: 950 !important;
}
.difficulty-badge.merged-hidden {
  display: none !important;
}
.category-spotlight {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: min(100%, 720px);
  padding: 14px 16px !important;
}
.category-spotlight .category-copy,
.category-spotlight .difficulty-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.category-spotlight .category-copy strong {
  font-size: clamp(1.35rem, 3.4vw, 2.18rem) !important;
  line-height: .98 !important;
  overflow-wrap: anywhere;
}
.category-spotlight .difficulty-copy {
  justify-items: end;
  padding-left: 14px;
  border-left: 1px solid rgba(57,197,140,.24);
}
.category-spotlight .difficulty-copy span {
  color: rgba(15,139,99,.72) !important;
  font-size: .66rem !important;
}
.category-spotlight .difficulty-copy strong {
  color: #23415a !important;
  font-size: clamp(.95rem, 1.7vw, 1.18rem) !important;
  text-transform: capitalize;
  line-height: 1 !important;
}
.result-text-disconnect,
.result-card p {
  line-height: 1.45;
}
@media (max-width: 720px) {
  .brand-logo-wrap {
    width: min(94vw, 430px) !important;
    height: clamp(76px, 22vw, 104px) !important;
  }
  .word-art-heading img {
    width: min(76vw, 280px) !important;
    max-height: 62px !important;
  }
  .category-spotlight {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .category-spotlight .difficulty-copy {
    justify-items: start;
    padding-left: 0;
    padding-top: 10px;
    border-left: 0;
    border-top: 1px solid rgba(57,197,140,.24);
  }
  .modal-options select,
  .modal-options input[type="number"],
  .challenge-options select,
  .challenge-number {
    font-size: 1.15rem !important;
    min-height: 52px !important;
  }
}

/* Mobile UX refinement: app-like hierarchy, lighter chrome, thumb-friendly controls */
@media (max-width: 720px) {
  html, body {
    min-height: 100%;
    overflow-x: hidden;
  }

  body {
    background:
      radial-gradient(circle at 18% 0%, rgba(57,197,140,.16), transparent 18rem),
      linear-gradient(180deg, #f8f3e7 0%, #f4ecd9 54%, #efe2c8 100%) !important;
  }

  body::before {
    opacity: .06 !important;
    background-size: 28px 28px !important;
  }

  .shell {
    width: min(100% - 18px, 560px) !important;
    padding: 10px 0 calc(82px + env(safe-area-inset-bottom)) !important;
  }

  .hero {
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 10px !important;
    gap: 8px !important;
  }

  .brand-logo-wrap {
    width: min(72vw, 310px) !important;
    height: clamp(46px, 13vw, 68px) !important;
    margin: 0 auto !important;
  }

  .brand-logo {
    object-position: center !important;
    filter: drop-shadow(0 8px 12px rgba(31,45,72,.14)) !important;
  }

  .status-card {
    position: fixed !important;
    top: calc(8px + env(safe-area-inset-top));
    right: 8px;
    z-index: 12;
    padding: 5px 7px !important;
    min-height: 30px;
    font-size: 0 !important;
    box-shadow: 0 8px 20px rgba(31,45,72,.10) !important;
  }

  .status-card #connectionStatus { display: none !important; }
  .status-card .dot { width: 9px !important; height: 9px !important; }
  .audio-toggle { width: 28px !important; height: 28px !important; font-size: .86rem !important; }

  .panel,
  .lobby-profile-card,
  .lobby-roster-card,
  .progress-card,
  .metrics div,
  .word-row,
  .opponent-row,
  .compact-guess-form,
  .category-spotlight,
  .timer-boss,
  #gamePanel .timer-boss {
    box-shadow: none !important;
  }

  .panel {
    padding: 12px !important;
    border-radius: 22px !important;
    border-width: 1px !important;
    background: rgba(255,250,240,.74) !important;
    backdrop-filter: blur(10px) !important;
  }

  .lobby-layout {
    display: block !important;
  }

  .lobby-profile-card,
  .lobby-roster-card,
  .progress-card {
    border-radius: 18px !important;
    border-width: 1px !important;
    padding: 10px !important;
    background: rgba(255,255,255,.62) !important;
  }

  .lobby-profile-card {
    margin-bottom: 10px !important;
  }

  .profile-toggle {
    min-height: 48px !important;
    padding: 8px 10px !important;
    border-radius: 14px !important;
  }

  .profile-avatar { font-size: 1.2rem !important; }
  .profile-toggle-copy strong { font-size: .98rem !important; }
  .profile-help, .lobby-name-form label { display: none !important; }
  .profile-body { margin-top: 8px !important; }
  .lobby-name-form .name-edit-row { margin-top: 8px !important; gap: 8px !important; }

  .roster-header {
    align-items: center !important;
    min-height: 46px !important;
  }

  .word-art-heading {
    margin: 0 !important;
    line-height: 0 !important;
  }

  .word-art-heading img {
    width: min(54vw, 210px) !important;
    max-height: 44px !important;
    object-fit: contain !important;
  }

  .hint {
    margin: 4px 2px 10px !important;
    font-size: .9rem !important;
    line-height: 1.3 !important;
  }

  .players-list {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-top: 8px !important;
  }

  .player-card,
  .player-card.self {
    min-height: 54px !important;
    padding: 8px 10px !important;
    border-radius: 15px !important;
    border-width: 1px !important;
    flex-direction: row !important;
    align-items: center !important;
    background: rgba(255,255,255,.70) !important;
  }

  .player-card.self {
    opacity: .86;
    background: rgba(255,247,228,.70) !important;
  }

  .player-main-line { gap: 8px !important; }
  .device-icon { width: 26px !important; height: 26px !important; }
  .player-name { font-size: 1rem !important; line-height: 1.1 !important; }
  .player-status { margin-top: 2px !important; font-size: .75rem !important; }

  .inline-challenge-btn,
  .player-card.self .solo-btn {
    min-width: 86px !important;
    width: auto !important;
    height: 40px !important;
    padding: 5px 9px !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    flex: 0 0 auto !important;
  }

  .word-art-btn-img {
    max-width: 80px !important;
    max-height: 30px !important;
  }

  #gamePanel {
    padding: 10px !important;
    background: transparent !important;
    border-color: transparent !important;
  }

  #gamePanel .timer-boss {
    position: sticky !important;
    top: 6px !important;
    z-index: 8 !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: transparent !important;
  }

  #gamePanel .timer-boss-top { display: none !important; }
  #gamePanel .timer-track,
  #gamePanel .timer-fill {
    height: 10px !important;
    border-radius: 999px !important;
  }

  .game-topbar {
    display: block !important;
    margin-bottom: 8px !important;
  }

  .eyebrow { display: none !important; }

  #matchTitle {
    font-size: 1.05rem !important;
    line-height: 1.18 !important;
    margin: 0 0 8px !important;
    color: #334155 !important;
    font-weight: 850 !important;
  }

  .category-spotlight {
    width: 100% !important;
    grid-template-columns: 1fr auto !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 10px 12px !important;
    border-radius: 16px !important;
    background: rgba(255,255,255,.72) !important;
    border: 1px solid rgba(45,92,69,.18) !important;
  }

  .category-spotlight span {
    font-size: .6rem !important;
    letter-spacing: .12em !important;
  }

  .category-spotlight .category-copy strong {
    font-size: clamp(1.15rem, 5.2vw, 1.55rem) !important;
    line-height: 1.02 !important;
  }

  .category-spotlight .difficulty-copy {
    justify-items: end !important;
    padding: 0 0 0 10px !important;
    border-top: 0 !important;
    border-left: 1px solid rgba(45,92,69,.16) !important;
  }

  .category-spotlight .difficulty-copy strong {
    font-size: .9rem !important;
  }

  .metrics {
    display: none !important;
  }

  .progress-grid {
    display: block !important;
    margin: 8px 0 0 !important;
  }

  .your-progress {
    padding: 8px !important;
    background: rgba(255,255,255,.58) !important;
  }

  .opponent-progress {
    margin-top: 8px !important;
    padding: 8px !important;
    background: rgba(255,255,255,.42) !important;
  }

  .progress-card-header {
    margin-bottom: 7px !important;
  }

  .progress-card-header span {
    font-size: .66rem !important;
    letter-spacing: .1em !important;
  }

  .progress-card-header strong {
    font-size: .86rem !important;
  }

  .word-rows,
  .opponent-rows {
    gap: 6px !important;
  }

  .word-row {
    grid-template-columns: 24px 1fr auto !important;
    gap: 8px !important;
    min-height: 45px !important;
    padding: 7px 9px !important;
    border-width: 1px !important;
    border-radius: 13px !important;
    background: rgba(255,255,255,.72) !important;
  }

  .word-row.active {
    box-shadow: 0 0 0 3px rgba(57,197,140,.14) !important;
  }

  .word-label {
    font-size: .78rem !important;
  }

  .word-mask {
    font-size: clamp(1rem, 5.3vw, 1.36rem) !important;
    letter-spacing: .1em !important;
  }

  .opponent-note { display: none !important; }

  .opponent-row {
    min-height: 34px !important;
    grid-template-columns: 22px 1fr 32px !important;
    padding: 5px 7px !important;
    border-radius: 11px !important;
    background: rgba(255,255,255,.48) !important;
  }

  .opponent-mask,
  .opponent-state {
    font-size: .72rem !important;
  }

  .mobile-focus-strip {
    display: none !important;
  }

  .compact-guess-form {
    position: fixed !important;
    left: 9px !important;
    right: 9px !important;
    bottom: calc(7px + env(safe-area-inset-bottom)) !important;
    z-index: 14 !important;
    margin: 0 !important;
    padding: 7px !important;
    border-radius: 18px !important;
    background: rgba(255,252,244,.92) !important;
    border: 1px solid rgba(31,45,72,.12) !important;
    backdrop-filter: blur(14px) !important;
    gap: 6px !important;
  }

  .compact-guess-form input {
    min-height: 44px !important;
    padding: 10px 12px !important;
    font-size: 1rem !important;
    border-radius: 13px !important;
  }

  .icon-action {
    width: 42px !important;
    height: 42px !important;
    flex-basis: 42px !important;
    font-size: 1rem !important;
    box-shadow: none !important;
  }

  .message {
    min-height: 1.1em !important;
    margin: 8px 2px 0 !important;
    font-size: .9rem !important;
    line-height: 1.3 !important;
  }

  .modal {
    padding: 12px !important;
    align-items: end !important;
  }

  .modal-card {
    width: 100% !important;
    max-height: calc(100vh - 32px) !important;
    overflow: auto !important;
    border-radius: 22px !important;
    padding: 18px !important;
  }

  .modal-card h2 {
    font-size: 1.45rem !important;
  }

  .modal-options select,
  .modal-options input[type="number"],
  .challenge-number {
    min-height: 46px !important;
    font-size: 1rem !important;
    border-radius: 14px !important;
  }

  .modal-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }

  .modal-actions button {
    min-height: 44px !important;
    padding: 10px 12px !important;
    border-radius: 14px !important;
    box-shadow: none !important;
    font-size: .92rem !important;
  }

  .result-card {
    min-height: auto !important;
    padding: 24px 18px !important;
    border-radius: 24px !important;
  }
}

@media (max-width: 380px) {
  .brand-logo-wrap {
    width: min(70vw, 270px) !important;
    height: 44px !important;
  }

  .word-art-heading img {
    width: min(50vw, 180px) !important;
    max-height: 38px !important;
  }

  .player-name { font-size: .94rem !important; }
  .inline-challenge-btn,
  .player-card.self .solo-btn {
    min-width: 76px !important;
  }
  .word-art-btn-img { max-width: 70px !important; }
}

/* Mobile header overlap fix: keep logo in normal flow above all content panels */
@media (max-width: 720px) {
  .shell {
    padding-top: calc(18px + env(safe-area-inset-top)) !important;
  }

  .hero {
    position: relative !important;
    z-index: 30 !important;
    display: flex !important;
    min-height: clamp(58px, 15vw, 76px) !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
    isolation: isolate !important;
  }

  .hero > div:first-child,
  .brand-logo-wrap,
  .brand-logo {
    position: relative !important;
    z-index: 31 !important;
  }

  .brand-logo-wrap {
    display: block !important;
    width: min(78vw, 330px) !important;
    height: clamp(50px, 14vw, 72px) !important;
  }

  #namePanel,
  #lobbyPanel,
  #gamePanel,
  .panel {
    position: relative !important;
    z-index: 1 !important;
  }

  .status-card {
    top: calc(10px + env(safe-area-inset-top)) !important;
    right: 10px !important;
    z-index: 40 !important;
    transform: none !important;
  }

  body:has(#gamePanel:not(.hidden)) .shell {
    padding-top: calc(18px + env(safe-area-inset-top)) !important;
  }

  body:has(#gamePanel:not(.hidden)) .hero {
    margin-bottom: 8px !important;
  }
}

@media (max-width: 380px) {
  .brand-logo-wrap {
    width: min(76vw, 300px) !important;
    height: clamp(46px, 13vw, 62px) !important;
  }
}

/* Final mobile logo/header fix: remove fixed overlay from the connection panel */
@media (max-width: 720px) {
  .shell {
    padding-top: calc(12px + env(safe-area-inset-top)) !important;
  }

  .hero {
    position: relative !important;
    z-index: 50 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    align-items: center !important;
    min-height: auto !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  .hero > div:first-child {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    position: relative !important;
    z-index: 52 !important;
  }

  .brand-logo-wrap {
    position: relative !important;
    z-index: 53 !important;
    display: block !important;
    width: min(78vw, 340px) !important;
    height: clamp(52px, 14vw, 74px) !important;
    margin: 0 auto !important;
  }

  .brand-logo {
    position: relative !important;
    z-index: 54 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
  }

  .status-card {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    z-index: 51 !important;
    justify-self: center !important;
    width: auto !important;
    max-width: max-content !important;
    min-height: 28px !important;
    padding: 4px 8px !important;
    margin: -2px 0 0 !important;
    border-radius: 999px !important;
    background: rgba(255,250,240,.68) !important;
    border: 1px solid rgba(31,45,72,.12) !important;
    backdrop-filter: blur(10px) !important;
  }

  .status-card #connectionStatus {
    display: none !important;
  }

  #namePanel,
  #lobbyPanel,
  #gamePanel,
  .panel {
    margin-top: 0 !important;
    position: relative !important;
    z-index: 1 !important;
  }
}

@media (max-width: 380px) {
  .brand-logo-wrap {
    width: min(80vw, 310px) !important;
    height: clamp(48px, 13vw, 64px) !important;
  }
}

/* Mobile gameplay input-panel coverage fix: keep the guess controls in normal flow while sticky */
@media (max-width: 720px) {
  :root {
    --mobile-guess-panel-space: calc(88px + env(safe-area-inset-bottom));
  }

  body:has(#gamePanel:not(.hidden)) .shell {
    padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
  }

  #gamePanel {
    padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important;
    min-height: calc(100dvh - 112px - env(safe-area-inset-top)) !important;
    overflow: visible !important;
  }

  #gamePanel .progress-grid {
    margin-bottom: 10px !important;
    padding-bottom: 0 !important;
    overflow: visible !important;
  }

  #gamePanel .your-progress {
    margin-bottom: 10px !important;
  }

  #wordRows.word-rows {
    max-height: clamp(190px, 42dvh, 420px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    padding-bottom: 10px !important;
    scroll-padding-bottom: var(--mobile-guess-panel-space) !important;
  }

  #wordRows .word-row.active {
    scroll-margin-bottom: var(--mobile-guess-panel-space) !important;
  }

  #guessForm.compact-guess-form {
    position: sticky !important;
    left: auto !important;
    right: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    width: 100% !important;
    margin: 10px 0 0 !important;
    z-index: 20 !important;
  }

  #gameMessage {
    margin-bottom: 0 !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
  }
}

@media (max-height: 660px) and (max-width: 720px) {
  #wordRows.word-rows {
    max-height: clamp(150px, 36dvh, 300px) !important;
  }
}

/* Mobile chain-fit refinement: show the maximum useful chain rows without letting input cover gameplay */
@media (max-width: 720px) {
  body:has(#gamePanel:not(.hidden)) {
    overflow-x: hidden !important;
  }

  body:has(#gamePanel:not(.hidden)) .shell {
    min-height: 100dvh !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }

  #gamePanel {
    display: flex !important;
    flex-direction: column !important;
    min-height: auto !important;
    max-height: none !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    overflow: visible !important;
  }

  #gamePanel .game-topbar {
    flex: 0 0 auto !important;
  }

  #gamePanel .progress-grid {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    margin-top: 8px !important;
    margin-bottom: 8px !important;
    overflow: visible !important;
  }

  #gamePanel .your-progress {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 7px !important;
    margin-bottom: 7px !important;
  }

  #gamePanel .opponent-progress {
    flex: 0 0 auto !important;
    margin-top: 0 !important;
    padding: 6px 8px !important;
  }

  #gamePanel .opponent-rows {
    display: none !important;
  }

  #gamePanel .progress-card-header {
    flex: 0 0 auto !important;
    margin-bottom: 6px !important;
  }

  #wordRows.word-rows {
    display: grid !important;
    gap: 5px !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: clamp(232px, calc(100dvh - 342px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 520px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    padding: 0 2px 2px 0 !important;
    scroll-padding-top: 8px !important;
    scroll-padding-bottom: 18px !important;
  }

  #wordRows .word-row,
  #wordRows .word-row:not(.active):not(.done),
  #wordRows .word-row.done:not(:has(+ .word-row.active)) {
    display: grid !important;
  }

  #wordRows .word-row {
    min-height: 38px !important;
    padding: 5px 8px !important;
    border-radius: 11px !important;
    grid-template-columns: 22px 1fr auto !important;
    gap: 7px !important;
  }

  #wordRows .word-label {
    font-size: .72rem !important;
  }

  #wordRows .word-mask {
    font-size: clamp(.94rem, 4.45vw, 1.16rem) !important;
    letter-spacing: .075em !important;
    line-height: 1.1 !important;
  }

  #guessForm.compact-guess-form {
    flex: 0 0 auto !important;
    position: sticky !important;
    bottom: calc(7px + env(safe-area-inset-bottom)) !important;
    width: 100% !important;
    margin: 8px 0 0 !important;
    z-index: 20 !important;
  }

  #gameMessage {
    flex: 0 0 auto !important;
    margin-top: 6px !important;
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  #gamePanel .category-spotlight {
    padding: 8px 10px !important;
  }

  #gamePanel .category-spotlight .category-copy strong {
    font-size: 1.08rem !important;
  }

  #matchTitle {
    font-size: .96rem !important;
    margin-bottom: 6px !important;
  }

  #wordRows.word-rows {
    max-height: clamp(198px, calc(100dvh - 316px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 420px) !important;
  }

  #wordRows .word-row {
    min-height: 35px !important;
    padding: 4px 7px !important;
  }

  #guessForm.compact-guess-form input {
    min-height: 40px !important;
  }

  #guessForm .icon-action {
    width: 39px !important;
    height: 39px !important;
    flex-basis: 39px !important;
  }
}

/* Home-screen cleanup fix: keep gameplay-only UI completely hidden outside active matches.
   Mobile refinements previously used high-specificity #gamePanel rules that could override .hidden. */
#gamePanel.hidden,
#gamePanel.hidden * {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body:not(:has(#gamePanel:not(.hidden))) #guessForm,
body:not(:has(#gamePanel:not(.hidden))) #mobileFocusStrip,
body:not(:has(#gamePanel:not(.hidden))) .timer-boss,
body:not(:has(#gamePanel:not(.hidden))) .game-topbar,
body:not(:has(#gamePanel:not(.hidden))) .progress-grid,
body:not(:has(#gamePanel:not(.hidden))) #gameMessage {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body:not(:has(#gamePanel:not(.hidden))) {
  padding-top: 0 !important;
  overflow: auto !important;
}

body:not(:has(#gamePanel:not(.hidden))) .shell {
  min-height: auto !important;
  padding-bottom: 24px !important;
}

@media (max-width: 720px) {
  #gamePanel.hidden {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
  }

  body:not(:has(#gamePanel:not(.hidden))) .hero {
    margin-bottom: 12px !important;
  }

  body:not(:has(#gamePanel:not(.hidden))) #lobbyPanel {
    display: block !important;
  }
}

/* Final mobile display pass: use explicit body state classes so mobile browsers do not rely on :has(). */
body:not(.game-active) #gamePanel,
body:not(.game-active) #gamePanel * {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.name-active #lobbyPanel,
body.name-active #gamePanel,
body.lobby-active #namePanel,
body.lobby-active #gamePanel,
body.game-active #namePanel,
body.game-active #lobbyPanel {
  display: none !important;
}

@media (max-width: 720px) {
  body.lobby-active .timer-boss,
  body.lobby-active .game-topbar,
  body.lobby-active .progress-grid,
  body.lobby-active #guessForm,
  body.lobby-active #mobileFocusStrip,
  body.lobby-active #gameMessage,
  body.name-active .timer-boss,
  body.name-active .game-topbar,
  body.name-active .progress-grid,
  body.name-active #guessForm,
  body.name-active #mobileFocusStrip,
  body.name-active #gameMessage {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  body.lobby-active .shell,
  body.name-active .shell {
    min-height: auto !important;
    padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important;
  }

  body.lobby-active #lobbyPanel,
  body.name-active #namePanel {
    display: block !important;
    margin-top: 0 !important;
  }

  body.game-active #gamePanel {
    display: flex !important;
  }

  body.game-active #wordRows.word-rows {
    max-height: min(var(--mobile-chain-fit-height, 46dvh), 520px) !important;
    overflow-y: auto !important;
  }

  body.game-active #guessForm.compact-guess-form {
    position: sticky !important;
    bottom: calc(7px + env(safe-area-inset-bottom)) !important;
  }
}

/* Regenerated update: mobile current-word visibility + app-wide readable small caps */
html,
body,
button,
input,
select,
textarea,
.panel,
.modal-card,
.player-card,
.word-row,
.progress-card,
.metrics,
.result-card,
.status-card,
.message,
.hint,
.subhead,
.profile-help,
.opponent-note,
.player-name,
.profile-toggle-copy strong,
.word-mask,
.word-label,
.result-word,
.answer-word,
.modal-options label,
.lobby-name-form label,
.difficulty-badge,
.category-spotlight,
.category-copy,
.timer-boss,
.mobile-focus-strip,
.mobile-focus-strip span,
.mobile-focus-strip strong {
  font-family: var(--fun-font, "Trebuchet MS", "Segoe UI", system-ui, sans-serif) !important;
  font-variant-caps: all-small-caps !important;
  font-feature-settings: "smcp" 1, "c2sc" 1 !important;
}

body,
button,
select,
.panel,
.modal-card,
.player-card,
.word-row,
.progress-card,
.metrics,
.result-card,
.status-card,
.message,
.hint,
.profile-help,
.opponent-note,
.player-name,
.profile-toggle-copy strong,
.word-label,
.modal-options label,
.lobby-name-form label,
.difficulty-badge,
.category-spotlight,
.timer-boss,
.mobile-focus-strip span {
  letter-spacing: .045em !important;
}

input,
textarea,
#guessInput,
#nameInput,
#lobbyNameInput,
.word-mask,
.mobile-focus-strip strong {
  letter-spacing: .055em !important;
}

@media (max-width: 720px) {
  body.game-active #gamePanel {
    overflow: visible !important;
  }

  body.game-active #wordRows.word-rows {
    max-height: min(var(--mobile-chain-fit-height, 48dvh), 520px) !important;
    padding-bottom: 6px !important;
    scroll-padding-top: 10px !important;
    scroll-padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important;
  }

  body.game-active #wordRows .word-row.active {
    position: sticky !important;
    top: 0 !important;
    bottom: 0 !important;
    z-index: 8 !important;
    scroll-margin-top: 10px !important;
    scroll-margin-bottom: calc(96px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 10px 24px rgba(14, 22, 44, .18) !important;
  }

  body.game-active #mobileFocusStrip {
    display: block !important;
    position: sticky !important;
    bottom: calc(62px + env(safe-area-inset-bottom)) !important;
    z-index: 30 !important;
    margin: 4px 0 6px !important;
    pointer-events: none !important;
  }

  body.game-active #mobileFocusStrip.empty {
    display: none !important;
  }

  body.game-active #mobileFocusStrip div {
    display: none !important;
  }

  body.game-active #mobileFocusStrip div:nth-child(2) {
    display: grid !important;
    gap: 2px !important;
    padding: 7px 10px !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, .96) !important;
    border: 1px solid rgba(31, 45, 72, .18) !important;
    box-shadow: 0 10px 28px rgba(31, 45, 72, .14) !important;
  }

  body.game-active #mobileFocusStrip span {
    font-size: .66rem !important;
    line-height: 1 !important;
    color: #60708d !important;
  }

  body.game-active #mobileFocusStrip strong {
    font-size: clamp(1rem, 4.8vw, 1.28rem) !important;
    line-height: 1.06 !important;
    color: #172033 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.game-active #guessForm.compact-guess-form {
    z-index: 40 !important;
    margin-top: 4px !important;
  }

  body.game-active #guessInput {
    font-size: 1rem !important;
    min-height: 42px !important;
  }
}

@media (max-width: 380px) {
  body.game-active #wordRows .word-row {
    min-height: 33px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }

  body.game-active #wordRows .word-mask {
    font-size: .95rem !important;
  }

  body.game-active #mobileFocusStrip strong {
    font-size: 1rem !important;
  }
}

/* Mobile gameplay focus window: keep previous, current, and next words visible above the keyboard. */
@media (max-width: 720px) {
  body.game-active #mobileFocusStrip {
    display: grid !important;
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.36fr) minmax(0, .82fr) !important;
    gap: 5px !important;
    position: sticky !important;
    bottom: calc(62px + env(safe-area-inset-bottom)) !important;
    z-index: 35 !important;
    margin: 4px 0 6px !important;
    padding: 0 !important;
    pointer-events: none !important;
  }

  body.game-active #mobileFocusStrip .focus-word,
  body.game-active #mobileFocusStrip div:nth-child(2) {
    display: grid !important;
    align-content: center !important;
    min-width: 0 !important;
    min-height: 48px !important;
    gap: 2px !important;
    padding: 6px 7px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, .94) !important;
    border: 1px solid rgba(31, 45, 72, .14) !important;
    box-shadow: 0 8px 20px rgba(31, 45, 72, .10) !important;
  }

  body.game-active #mobileFocusStrip .focus-current {
    min-height: 58px !important;
    padding: 7px 9px !important;
    background: rgba(255, 249, 224, .98) !important;
    border: 2px solid rgba(171, 122, 20, .34) !important;
    box-shadow: 0 10px 26px rgba(31, 45, 72, .16) !important;
    transform: translateY(-2px) !important;
  }

  body.game-active #mobileFocusStrip .focus-previous,
  body.game-active #mobileFocusStrip .focus-next {
    opacity: .84 !important;
  }

  body.game-active #mobileFocusStrip span {
    font-size: .58rem !important;
    line-height: 1 !important;
    letter-spacing: .04em !important;
    color: #60708d !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.game-active #mobileFocusStrip strong {
    display: block !important;
    font-size: clamp(.78rem, 3.5vw, 1rem) !important;
    line-height: 1.05 !important;
    color: #172033 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.game-active #mobileFocusStrip .focus-current strong {
    font-size: clamp(1rem, 4.7vw, 1.28rem) !important;
    letter-spacing: .065em !important;
  }

  body.game-active #wordRows.word-rows {
    scroll-padding-bottom: calc(132px + env(safe-area-inset-bottom)) !important;
  }

  body.game-active #wordRows .word-row.active {
    scroll-margin-bottom: calc(136px + env(safe-area-inset-bottom)) !important;
  }
}

@media (max-width: 380px) {
  body.game-active #mobileFocusStrip {
    gap: 3px !important;
    grid-template-columns: minmax(0, .74fr) minmax(0, 1.5fr) minmax(0, .74fr) !important;
  }

  body.game-active #mobileFocusStrip .focus-word {
    padding-left: 5px !important;
    padding-right: 5px !important;
  }

  body.game-active #mobileFocusStrip strong {
    font-size: .74rem !important;
  }

  body.game-active #mobileFocusStrip .focus-current strong {
    font-size: 1rem !important;
  }
}

/* Fit the largest useful contiguous word-chain window on mobile.
   Previous/current/next are the minimum; additional surrounding rows appear
   automatically whenever the visible viewport has room. */
@media (max-width: 720px) {
  body.game-active #wordRows .word-row.mobile-window-hidden {
    display: none !important;
  }

  body.game-active #wordRows.word-rows {
    overflow-y: hidden !important;
  }
}


/* Custom word-list creator */
.roster-tools { display:flex; justify-content:flex-end; margin: 10px 0 14px; }
.custom-lists-btn { min-height:42px; padding:9px 15px; }
.custom-lists-card { width:min(680px, 100%); max-height:min(88vh, 780px); overflow:auto; }
.custom-lists-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.compact-button { min-height:38px; padding:8px 12px; }
.custom-list-form { display:grid; gap:10px; margin:18px 0 22px; }
.custom-list-form > label, .saved-custom-lists h3 { font-size:1rem; font-weight:900; letter-spacing:.05em; }
.custom-word-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.custom-list-error { min-height:1.25em; margin:0; color:#9c2948; font-weight:800; }
.custom-lists-list { display:grid; gap:10px; }
.custom-list-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.62); }
.custom-list-row div { min-width:0; display:grid; gap:4px; }
.custom-list-row strong { font-size:1.05rem; }
.custom-list-row span { color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:.82rem; }
.custom-list-empty { color:var(--muted); }
.challenge-options.using-custom-list #challengeDifficulty { opacity:.55; }
@media (max-width:720px) {
  .roster-tools { justify-content:stretch; }
  .custom-lists-btn { width:100%; }
  .custom-lists-card { max-height:calc(100dvh - 24px); padding:18px; }
  .custom-lists-header { align-items:center; }
  .custom-word-grid { grid-template-columns:1fr; }
  .custom-list-row { align-items:flex-start; }
}

/* Custom-list manager uses a simple overview -> editor flow. */
.saved-custom-lists-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; margin:18px 0 12px; }
.saved-custom-lists-heading h3 { margin:0; }
.custom-list-editor { padding-top:8px; }
.custom-list-back { margin-top:10px; }
@media (max-width: 640px) {
  .saved-custom-lists-heading { align-items:stretch; flex-direction:column; }
  .saved-custom-lists-heading button { width:100%; }
  .custom-list-back { width:100%; }
}

/* Mobile gameplay control dock: keep input, Hint, and Resign visible above the soft keyboard. */
@media (max-width: 720px) {
  body.game-active {
    --mobile-control-dock-height: 62px;
    --mobile-focus-window-height: 66px;
  }

  body.game-active #gamePanel {
    padding-bottom: calc(var(--mobile-control-dock-height) + var(--mobile-focus-window-height) + 22px + env(safe-area-inset-bottom)) !important;
  }

  body.game-active #guessForm.compact-guess-form {
    position: fixed !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    bottom: max(6px, env(safe-area-inset-bottom)) !important;
    width: auto !important;
    min-height: 54px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    align-items: stretch !important;
    gap: 7px !important;
    margin: 0 !important;
    padding: 7px !important;
    border: 1px solid rgba(31, 45, 72, .18) !important;
    border-radius: 16px !important;
    background: rgba(255, 253, 248, .98) !important;
    box-shadow: 0 -8px 30px rgba(31, 45, 72, .18) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    z-index: 1000 !important;
  }

  body.game-active #guessInput {
    min-width: 0 !important;
    width: 100% !important;
    min-height: 44px !important;
    font-size: 1rem !important;
    padding: 9px 11px !important;
  }

  body.game-active #revealBtn,
  body.game-active #resignBtn {
    width: auto !important;
    min-width: 58px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 5px 8px !important;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1px !important;
    border-radius: 12px !important;
  }

  body.game-active #revealBtn::after,
  body.game-active #resignBtn::after {
    display: block !important;
    font-size: .56rem !important;
    line-height: 1 !important;
    font-weight: 900 !important;
    letter-spacing: .055em !important;
    font-variant-caps: all-small-caps !important;
  }

  body.game-active #revealBtn::after { content: "Hint"; }
  body.game-active #resignBtn::after { content: "Resign"; }

  body.game-active #revealBtn .theme-icon,
  body.game-active #resignBtn .theme-icon {
    width: 19px !important;
    height: 19px !important;
  }

  body.game-active #mobileFocusStrip {
    position: fixed !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    bottom: calc(var(--mobile-control-dock-height) + 12px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    margin: 0 !important;
    z-index: 990 !important;
  }

  body.game-active #wordRows.word-rows {
    max-height: var(--mobile-chain-fit-height, 42dvh) !important;
    padding-bottom: 4px !important;
    scroll-padding-bottom: 8px !important;
  }

  body.game-active #gameMessage {
    position: relative !important;
    z-index: 1 !important;
    margin-bottom: 0 !important;
  }
}

@media (max-width: 390px) {
  body.game-active #guessForm.compact-guess-form {
    gap: 5px !important;
    padding: 6px !important;
  }

  body.game-active #revealBtn,
  body.game-active #resignBtn {
    min-width: 51px !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
  }
}
