:root {
  --ink: #172033;
  --muted: #667085;
  --paper: #f7f4ee;
  --panel: #ffffff;
  --line: #d9dee8;
  --green: #2f9f75;
  --green-dark: #197056;
  --gold: #f2b84b;
  --coral: #e66b55;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(47, 159, 117, 0.18), transparent 38%),
    linear-gradient(240deg, rgba(230, 107, 85, 0.16), transparent 34%),
    var(--paper);
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(300px, 440px) 1fr;
  align-items: center;
  gap: 56px;
  padding: 48px 0;
}

.login-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 22px 70px rgba(23, 32, 51, 0.12);
}

.account-actions {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
}

.icon-action {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  cursor: pointer;
}

.icon-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action:hover,
.icon-action:focus-visible {
  border-color: var(--green);
  color: var(--green-dark);
  outline: none;
}

.icon-action::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: max-content;
  max-width: 160px;
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 2;
}

.icon-action:hover::after,
.icon-action:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
  margin-bottom: 32px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.home-title {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.08;
  white-space: nowrap;
}

.login-form {
  display: grid;
  gap: 10px;
}

label {
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--ink);
  background: #fbfcfe;
}

input,
select {
  height: 48px;
}

textarea {
  min-height: 150px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.4;
}

input[type="file"] {
  height: auto;
  padding: 12px 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(47, 159, 117, 0.22);
  border-color: var(--green);
}

input:disabled,
select:disabled {
  color: var(--muted);
  background: #eef2f7;
  cursor: not-allowed;
}

.password-field {
  position: relative;
  margin-bottom: 10px;
}

.password-field input {
  margin-bottom: 0;
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--green-dark);
  border-color: var(--line);
  outline: none;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.public-page-link {
  margin: 12px 0 0;
  text-align: center;
}

.public-page-link a {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.public-page-link a:hover,
.public-page-link a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  outline: none;
}

.seo-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.seo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 42px;
}

.seo-brand-mark {
  text-decoration: none;
}

.seo-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.seo-nav a {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
}

.seo-nav a:hover,
.seo-nav a:focus-visible {
  color: var(--green-dark);
  text-decoration: underline;
  outline: none;
}

.seo-hero,
.seo-content,
.seo-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(23, 32, 51, 0.08);
}

.seo-hero {
  padding: 36px;
}

.seo-hero h1 {
  margin-bottom: 14px;
  white-space: normal;
}

.seo-hero p,
.seo-content p,
.seo-grid p {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.62;
}

.seo-play-link {
  width: fit-content;
  margin-top: 22px;
  text-decoration: none;
}

.seo-content {
  margin-top: 18px;
  padding: 28px;
}

.seo-content h2,
.seo-grid h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.seo-content p + p {
  margin-top: 10px;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.seo-grid article {
  padding: 22px;
}

.remember-option {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.remember-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.46);
}

.modal-backdrop[hidden],
.auth-panel[hidden] {
  display: none;
}

.auth-modal {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.28);
}

.modal-backdrop[data-active-panel="guest-room-create"] .auth-modal,
.modal-backdrop[data-active-panel="room-create"] .auth-modal {
  width: min(980px, calc(100vw - 40px));
}

.auth-modal h2 {
  margin: 0 0 22px;
  font-size: 26px;
  line-height: 1.1;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
}

.modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.profile-picker {
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.profile-avatar {
  position: relative;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #f3f6fa;
  color: var(--muted);
  cursor: pointer;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-button,
.profile-photo-button {
  width: auto;
  height: auto;
  display: inline-grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  cursor: pointer;
}

.avatar-button:hover .player-avatar,
.avatar-button:focus-visible .player-avatar,
.profile-photo-button:hover .player-avatar,
.profile-photo-button:focus-visible .player-avatar {
  outline: 3px solid rgba(47, 159, 117, 0.22);
  outline-offset: 2px;
}

.user-name-button,
.clickable-user-name {
  width: auto;
  height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.user-name-button:hover,
.user-name-button:focus-visible,
.clickable-user-name:hover,
.clickable-user-name:focus-visible {
  color: var(--green-dark);
  text-decoration: underline;
  outline: none;
}

.avatar-placeholder {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.edit-badge {
  position: absolute;
  right: 0;
  bottom: 3px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--green);
  color: #fff;
}

.edit-badge svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-form .primary-action {
  margin-top: 6px;
}

.text-link {
  width: max-content;
  height: auto;
  margin: -2px auto 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
}

.text-link:hover,
.text-link:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  outline: none;
}

.reset-code-panel {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.reset-code-panel[hidden] {
  display: none;
}

.auth-message {
  min-height: 20px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.game-message {
  min-height: 20px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.auth-message[data-type="success"] {
  color: var(--green-dark);
}

.auth-message[data-type="error"],
.game-message[data-type="error"] {
  color: #b42318;
}

.game-message[data-type="success"] {
  color: var(--green-dark);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.actions .primary-action {
  grid-column: 1 / -1;
}

button {
  height: 48px;
  border: 0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

button.avatar-button,
button.profile-photo-button,
button.user-name-button {
  width: auto;
  height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

button.user-name-button {
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  text-align: left;
}

.primary-action {
  background: var(--green);
  color: #fff;
}

.primary-action:not(:disabled):hover,
.primary-action:not(:disabled):focus-visible {
  background: var(--green-dark);
  outline: none;
}

.quick-action {
  grid-column: 1 / -1;
  background: #f28c28;
  color: #fff;
}

.quick-action:not(:disabled):hover,
.quick-action:not(:disabled):focus-visible {
  background: #d87518;
  outline: none;
}

.secondary-action {
  background: #eef2f7;
  color: var(--ink);
}

.secondary-action:not(:disabled):hover,
.secondary-action:not(:disabled):focus-visible {
  background: #dfe6f1;
  outline: none;
}

.word-preview {
  min-height: 420px;
  display: grid;
  align-content: center;
  gap: 28px;
}

.tile-row {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 8px;
  width: min(760px, 100%);
}

.tile-row span {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  border: 2px solid var(--line);
  box-shadow: 0 12px 26px rgba(23, 32, 51, 0.1);
  font-size: 34px;
  font-weight: 900;
}

.tile-row .word-gap {
  margin-right: clamp(4px, 1.4vw, 16px);
}

.tile-row span:nth-child(2),
.tile-row span:nth-child(7),
.tile-row span:nth-child(12) {
  background: var(--gold);
  border-color: #d89a28;
}

.tile-row span:nth-child(4),
.tile-row span:nth-child(9),
.tile-row span:nth-child(13) {
  background: var(--coral);
  border-color: #c95443;
  color: #fff;
}

.tile-row span:nth-child(1),
.tile-row span:nth-child(5),
.tile-row span:nth-child(8),
.tile-row span:nth-child(11) {
  background: var(--green);
  border-color: var(--green-dark);
  color: #fff;
}

.score-strip {
  width: min(260px, 100%);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.score-strip p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.score-strip strong {
  font-size: 26px;
}

.dashboard-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 36px 0;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.dashboard-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  white-space: nowrap;
}

.dashboard-logout {
  width: auto;
  padding: 0 18px;
}

.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.dashboard-summary > div,
.dashboard-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 22px;
  box-shadow: 0 16px 40px rgba(23, 32, 51, 0.1);
}

.dashboard-summary strong {
  display: block;
  font-size: 28px;
}

.dashboard-actions {
  display: grid;
  grid-template-columns: minmax(280px, 440px);
}

.dashboard-home {
  position: relative;
  display: grid;
  place-items: center;
}

.dashboard-topbar {
  position: absolute;
  top: 28px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
}

.dashboard-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.tool-button {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: 0 10px 26px rgba(23, 32, 51, 0.08);
}

.tool-button svg,
.invite-icon svg,
.mini-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-button:hover,
.tool-button:focus-visible {
  border-color: var(--green);
  color: var(--green-dark);
  transform: translateY(-1px);
  outline: none;
}

.top-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.top-badge[hidden] {
  display: none;
}

.second-entry-actions {
  width: min(360px, 100%);
  display: grid;
  gap: 14px;
}

.second-action {
  width: 100%;
  height: 56px;
  box-shadow: 0 16px 34px rgba(23, 32, 51, 0.1);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.second-action:hover,
.second-action:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 20px 46px rgba(23, 32, 51, 0.16);
  outline: none;
}

.second-action.quick {
  background: #f28c28;
  color: #fff;
}

.second-action.quick:hover,
.second-action.quick:focus-visible {
  background: #d87518;
}

.second-action.primary {
  background: var(--green);
  color: #fff;
}

.second-action.primary:hover,
.second-action.primary:focus-visible {
  background: var(--green-dark);
}

.second-action.secondary {
  background: #eef2f7;
  color: var(--ink);
}

.second-action.secondary:hover,
.second-action.secondary:focus-visible {
  background: #dfe6f1;
}

.dashboard-floating-message {
  position: absolute;
  bottom: 34px;
  left: 0;
  right: 0;
  text-align: center;
}

.game-page-body {
  min-height: 100vh;
  overflow-x: hidden;
}

.game-page-shell {
  width: min(1480px, calc(100% - 32px));
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  margin: 0 auto;
  padding: 20px 0;
}

.game-live-layout {
  min-height: calc(100vh - 148px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  align-items: stretch;
  gap: 16px;
}

.game-page-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.game-page-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.game-page-room {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 0 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.game-page-room strong {
  color: var(--ink);
}

.game-exit-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(21, 34, 54, 0.18);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(21, 34, 54, 0.13);
}

.game-exit-button:hover,
.game-exit-button:focus-visible {
  border-color: var(--coral);
  color: #b42318;
  outline: none;
}

.game-exit-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-stage {
  position: relative;
  min-height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 159, 117, 0.12), rgba(242, 142, 43, 0.12)),
    #fbfcfe;
  box-shadow: 0 22px 70px rgba(23, 32, 51, 0.1);
}

.game-page-player {
  position: absolute;
  top: 18px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
  max-width: min(280px, 42%);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(21, 34, 54, 0.1);
}

.game-page-player.guess-correct .player-avatar {
  box-shadow: 0 0 0 4px rgba(47, 159, 117, 0.32);
}

.game-page-player.guess-wrong .player-avatar {
  box-shadow: 0 0 0 4px rgba(210, 66, 54, 0.28);
}

.game-page-player[hidden] {
  display: none;
}

.game-page-player-left {
  left: 18px;
}

.game-page-player-right {
  right: 18px;
}

.game-page-player-name {
  width: auto;
  height: auto;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: none;
}

.game-page-player-name:hover,
.game-page-player-name:focus-visible {
  color: var(--green-dark);
  text-decoration: underline;
  outline: none;
}

.game-page-player-name:disabled {
  cursor: default;
  opacity: 1;
}

.game-player-score {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.game-player-score[hidden] {
  display: none;
}

.game-guess-bubble {
  position: absolute;
  top: calc(100% + 8px);
  left: 12px;
  max-width: 260px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  box-shadow: 0 10px 24px rgba(21, 34, 54, 0.12);
  z-index: 2;
}

.game-guess-bubble[hidden] {
  display: none;
}

.game-page-player-right .game-guess-bubble {
  right: 12px;
  left: auto;
}

.game-playground {
  position: relative;
  width: min(780px, calc(100% - 48px));
  min-height: 560px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 18px;
  text-align: center;
}

.game-playground h1 {
  white-space: normal;
}

.game-playground p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.game-timer {
  position: absolute;
  right: 18px;
  bottom: 84px;
  min-width: 64px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(21, 34, 54, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 22px;
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(21, 34, 54, 0.1);
}

.game-shared-score {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(47, 159, 117, 0.24);
  border-radius: 8px;
  background: rgba(47, 159, 117, 0.1);
  padding: 8px 14px;
  color: var(--green-dark);
  font-weight: 950;
  white-space: nowrap;
}

.game-shared-score[hidden] {
  display: none;
}

.game-shared-score strong {
  color: var(--ink);
}

.game-ready-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.game-ready-panel[hidden],
.game-round-panel[hidden] {
  display: none;
}

.game-ready-panel h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(44px, 8vw, 96px);
  line-height: 0.95;
}

.game-ready-panel strong {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 42px;
  font-weight: 950;
}

.game-round-panel {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 26px;
}

.game-clue {
  width: min(680px, 100%);
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--ink) !important;
  font-size: 22px;
  line-height: 1.35;
}

.game-answer-mask {
  width: min(720px, 100%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 18px;
}

.game-mask-word {
  display: inline-flex;
  gap: 8px;
  white-space: nowrap;
}

.game-mask-cell {
  min-width: 30px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  font-size: 25px;
  font-weight: 950;
}

.game-mask-cell.letter {
  border-bottom: 4px solid var(--ink);
}

.game-mask-cell.space {
  width: 22px;
  min-width: 22px;
}

.game-mask-cell.punctuation {
  min-width: 16px;
  color: var(--muted);
}

.game-guess-form {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 8px;
}

.game-guess-form input {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.game-guess-form button {
  min-width: 54px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
}

.game-guess-form button:hover,
.game-guess-form button:focus-visible {
  background: var(--green-dark);
  outline: none;
}

.game-guess-form button:disabled,
.game-guess-form input:disabled {
  cursor: default;
  opacity: 0.55;
}

.game-guess-form svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-coop-panel,
.game-final-panel {
  width: min(620px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
}

.game-coop-panel[hidden],
.game-final-panel[hidden] {
  display: none;
}

.game-coop-panel h2,
.game-final-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
}

.game-coop-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(520px, 100%);
}

.game-final-scores {
  width: min(420px, 100%);
  display: grid;
  gap: 8px;
}

.game-final-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 900;
}

.game-page-message {
  min-height: 22px;
  text-align: center;
}

.game-page-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.46);
}

.game-page-overlay[hidden],
[data-overlay-panel][hidden] {
  display: none;
}

.game-profile-dialog {
  width: min(560px, 100%);
}

.wide-modal {
  width: min(620px, 100%);
}

.dashboard-modal-panel h2 {
  padding-right: 34px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0;
}

.panel-icon-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 42px;
}

.leaderboard-panel {
  min-height: 420px;
}

.rules-panel {
  max-height: min(720px, calc(100vh - 80px));
  overflow-y: auto;
}

.rules-list {
  display: grid;
  gap: 12px;
}

.rules-list section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 14px 16px;
}

.rules-list h3 {
  margin: 0 0 7px;
  color: var(--green-dark);
  font-size: 15px;
}

.rules-list p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.rules-list p + p {
  margin-top: 7px;
}

.sound-setting {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.sound-setting[hidden] {
  display: none;
}

.sound-setting > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sound-setting label,
.sound-setting span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.sound-setting input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  accent-color: var(--green);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.sound-setting input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--green) 0 var(--sound-volume-progress, 100%),
    #dfe6ee var(--sound-volume-progress, 100%) 100%
  );
}

.sound-setting input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 2px 8px rgba(23, 32, 51, 0.2);
  appearance: none;
  -webkit-appearance: none;
}

.sound-setting input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--green) 0 var(--sound-volume-progress, 100%),
    #dfe6ee var(--sound-volume-progress, 100%) 100%
  );
}

.sound-setting input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 2px 8px rgba(23, 32, 51, 0.2);
}

.score-period-tabs,
.score-scope-tabs {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.score-period-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.score-scope-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.score-tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  font-weight: 900;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.score-tab:hover,
.score-tab:focus-visible {
  border-color: var(--green);
  color: var(--green-dark);
  outline: none;
  transform: translateY(-1px);
}

.score-tab.active {
  border-color: var(--green-dark);
  background: rgba(47, 159, 117, 0.12);
  color: var(--green-dark);
}

.leaderboard-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.leaderboard-meta strong {
  color: var(--ink);
  font-size: 15px;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 38px 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 8px 10px;
}

.leaderboard-row.current {
  border-color: rgba(47, 159, 117, 0.5);
  background: rgba(47, 159, 117, 0.08);
}

.leaderboard-rank {
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.leaderboard-person {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.leaderboard-name-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.leaderboard-person span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-self {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
}

.leaderboard-points {
  min-width: 72px;
  color: var(--coral);
  font-size: 18px;
  text-align: right;
}

.room-code-badge {
  width: max-content;
  margin: 0 0 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.room-code-badge strong {
  color: var(--ink);
}

.player-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 0;
}

.player-slots[data-mode="tek"] {
  grid-template-columns: minmax(0, 240px);
  justify-content: center;
}

.player-slots[data-mode="tek"] .player-card.invited {
  display: none;
}

.player-card {
  min-height: 72px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

.player-card.invited {
  padding-left: 48px;
}

.player-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.player-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.player-avatar[data-user-photo],
.player-avatar[data-guest-photo] {
  cursor: pointer;
}

.player-avatar[data-user-photo]:hover,
.player-avatar[data-user-photo]:focus-visible,
.player-avatar[data-guest-photo]:hover,
.player-avatar[data-guest-photo]:focus-visible {
  outline: 2px solid rgba(47, 159, 117, 0.35);
  outline-offset: 2px;
}

.avatar-text {
  color: var(--green-dark);
  font-size: 22px;
  font-weight: 900;
}

.player-avatar.empty {
  background: #e8edf4;
  color: var(--muted);
}

.player-avatar.small {
  width: 38px;
  height: 38px;
  font-size: 12px;
}

.invite-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
}

.invite-icon:hover,
.invite-icon:focus-visible,
.mini-icon:hover,
.mini-icon:focus-visible {
  border-color: var(--green);
  background: rgba(47, 159, 117, 0.1);
  outline: none;
}

.room-settings {
  display: grid;
  gap: 8px;
}

.room-lobby-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 360px);
  align-items: stretch;
  gap: 14px;
}

.room-lobby-main {
  display: grid;
  align-content: start;
  gap: 18px;
}

.room-settings-panel {
  min-height: 360px;
}

.room-chat {
  min-height: 360px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.room-chat h3 {
  margin: 0;
  font-size: 15px;
}

.room-chat-messages {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding-right: 4px;
}

.room-chat-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.room-chat-message {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid rgba(47, 159, 117, 0.22);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.room-chat-message.own {
  border-color: rgba(242, 140, 40, 0.4);
  background: rgba(242, 140, 40, 0.08);
}

.room-chat-message strong {
  font-size: 12px;
  color: var(--green-dark);
}

.room-chat-message p {
  margin: 0;
  overflow-wrap: anywhere;
}

.room-chat-compose {
  display: grid;
  gap: 8px;
}

.room-chat-compose textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
}

.game-room-chat {
  min-height: 100%;
}

.full-button {
  width: 100%;
  margin-top: 4px;
}

.cropper-frame {
  width: min(320px, 72vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
}

.cropper-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
}

.cropper-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.friend-list {
  display: grid;
  gap: 10px;
}

.friend-row {
  min-height: 64px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px;
}

.friend-row strong,
.friend-row p {
  margin: 0;
}

.friend-row p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.friend-row .online {
  color: var(--green-dark);
}

.friend-row .offline {
  color: #98a2b3;
}

.message-counter {
  margin: -6px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.settings-tabs {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.settings-tab {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid #d87518;
  background: #f28c28;
  color: #fff;
}

.settings-tab.active,
.settings-tab:hover,
.settings-tab:focus-visible {
  border-color: #c76711;
  background: #d87518;
  color: #fff;
  outline: none;
}

.account-form {
  margin-bottom: 16px;
}

.account-form textarea {
  min-height: 84px;
}

.account-form[hidden],
[data-password-change-panel][hidden] {
  display: none;
}

.password-change-button {
  margin-top: 2px;
}

.compact-profile-picker {
  margin-bottom: 12px;
}

.compact-profile-picker .profile-avatar {
  width: 78px;
  height: 78px;
}

.profile-heading {
  margin-bottom: 12px;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 42px;
}

.profile-detail {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.profile-large {
  width: 118px;
  height: 118px;
  font-size: 28px;
}

.profile-fields {
  width: 100%;
  display: grid;
  gap: 8px;
  margin: 0;
}

.profile-fields div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 9px 10px;
}

.profile-fields dt,
.profile-fields dd {
  margin: 0;
}

.profile-fields dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.profile-fields dd {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.photo-viewer {
  display: grid;
  place-items: center;
  min-height: 240px;
}

.photo-viewer img {
  max-width: min(520px, 84vw);
  max-height: 70vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
}

.photo-fallback {
  width: min(260px, 70vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 54px;
  font-weight: 900;
}

.message-notification {
  position: relative;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 6px 8px;
  padding-bottom: 28px;
  cursor: pointer;
}

.message-notification.incoming {
  border-color: var(--green);
}

.message-notification.outgoing {
  border-color: #f28c28;
}

.message-notification:hover,
.message-notification:focus-visible {
  border-color: var(--green);
  outline: none;
}

.message-notification.outgoing:hover,
.message-notification.outgoing:focus-visible {
  border-color: #d87518;
}

.message-notification-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-notification-header .player-avatar.small {
  width: 26px;
  height: 26px;
  font-size: 10px;
}

.message-notification-header strong {
  font-size: 13px;
}

.message-notification-header strong,
.message-notification-header p,
.message-preview {
  margin: 0;
}

.message-notification-header p {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.message-preview {
  white-space: pre-line;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.message-preview.expanded {
  font-weight: 600;
}

.reply-button {
  position: absolute;
  right: 8px;
  bottom: 6px;
  width: auto;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
  font-size: 11px;
}

.reply-button:hover,
.reply-button:focus-visible {
  border-color: var(--green);
  background: rgba(47, 159, 117, 0.1);
  outline: none;
}

.mini-icon {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 18px;
}

.suggestions-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(21, 34, 54, 0.14);
  border-radius: 50%;
  background: #fff;
  color: var(--green-dark);
  box-shadow: 0 14px 32px rgba(21, 34, 54, 0.16);
}

.suggestions-fab:hover,
.suggestions-fab:focus-visible {
  border-color: var(--green);
  background: rgba(47, 159, 117, 0.1);
  outline: none;
}

.suggestions-fab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini-icon.accept {
  color: var(--green-dark);
}

.mini-icon.reject {
  color: #b42318;
}

.request-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.request-badge[hidden] {
  display: none;
}

.match-countdown {
  width: min(220px, 100%);
  margin: 12px auto 10px;
  padding: 12px;
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 1px solid rgba(47, 159, 117, 0.28);
  border-radius: 8px;
  background: rgba(47, 159, 117, 0.08);
  color: var(--green-dark);
}

.match-countdown[hidden] {
  display: none;
}

.match-countdown strong {
  font-size: 15px;
}

.match-countdown span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}

.search-animation {
  position: relative;
  width: min(280px, 100%);
  height: 230px;
  margin: 12px auto 6px;
}

.world {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 170px;
  height: 170px;
  transform: translate(-50%, -50%);
  border: 3px solid var(--green-dark);
  border-radius: 50%;
  background:
    linear-gradient(160deg, rgba(47, 159, 117, 0.2), rgba(242, 184, 75, 0.16)),
    #fbfcfe;
  overflow: hidden;
  box-shadow: inset 0 0 0 8px rgba(47, 159, 117, 0.08);
}

.mountain {
  position: absolute;
  bottom: 36px;
  width: 0;
  height: 0;
  border-left: 44px solid transparent;
  border-right: 44px solid transparent;
  border-bottom: 70px solid #8aa3a0;
}

.mountain-a {
  left: 18px;
}

.mountain-b {
  right: 10px;
  bottom: 30px;
  border-left-width: 36px;
  border-right-width: 36px;
  border-bottom-color: #6f8f89;
}

.house {
  position: absolute;
  width: 22px;
  height: 18px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 2px;
}

.house::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -12px;
  width: 20px;
  height: 20px;
  border-left: 2px solid var(--ink);
  border-top: 2px solid var(--ink);
  background: var(--gold);
  transform: rotate(45deg);
}

.house-a {
  left: 50px;
  bottom: 48px;
}

.house-b {
  right: 44px;
  bottom: 58px;
  transform: scale(0.82);
}

.house-c {
  left: 84px;
  bottom: 28px;
  transform: scale(0.7);
}

.magnifier {
  position: absolute;
  left: calc(50% - 36px);
  top: 32px;
  width: 58px;
  height: 58px;
  border: 5px solid var(--coral);
  border-radius: 50%;
  transform-origin: 72px 82px;
  animation: search-around 2.4s linear infinite;
}

.magnifier::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -16px;
  width: 34px;
  height: 7px;
  border-radius: 999px;
  background: var(--coral);
  transform: rotate(45deg);
}

@keyframes search-around {
  0% {
    transform: rotate(0deg) translateX(34px) rotate(0deg);
  }
  100% {
    transform: rotate(360deg) translateX(34px) rotate(-360deg);
  }
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 820px) {
  .page-shell {
    grid-template-columns: 1fr;
    gap: 28px;
    align-content: center;
  }

  .game-live-layout {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .word-preview {
    min-height: auto;
  }

  .tile-row {
    grid-template-columns: repeat(13, 1fr);
  }

  .game-stage {
    place-items: stretch;
    align-content: start;
    gap: 12px;
    padding: 14px;
  }

  .game-page-player {
    position: static;
    max-width: 100%;
  }

  .game-guess-bubble {
    top: auto;
    right: auto;
    bottom: -6px;
    left: 66px;
    transform: translateY(100%);
  }

  .game-page-player-right .game-guess-bubble {
    right: auto;
    left: 66px;
  }

  .game-shared-score {
    position: static;
    justify-self: center;
    transform: none;
    margin-top: 4px;
  }

  .game-timer {
    right: 14px;
    bottom: 74px;
  }

  .game-playground {
    width: 100%;
    min-height: 440px;
    align-content: center;
    padding-top: 54px;
  }

  .game-room-chat {
    min-height: 300px;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding: 24px 0;
  }

  .login-panel {
    padding: 22px;
    padding-top: 64px;
  }

  .brand {
    margin-top: 0;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .tile-row {
    gap: 4px;
  }

  .tile-row span {
    font-size: clamp(12px, 4vw, 22px);
  }

  .score-strip {
    grid-template-columns: auto 1fr;
  }

  .dashboard-header,
  .dashboard-summary {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-logout {
    width: 100%;
  }

  .dashboard-topbar {
    top: 16px;
  }

  .dashboard-tools {
    gap: 6px;
  }

  .tool-button {
    width: 40px;
    height: 40px;
  }

  .player-slots {
    grid-template-columns: 1fr;
  }

  .player-slots[data-mode="tek"] {
    grid-template-columns: 1fr;
  }

  .friend-row {
    grid-template-columns: auto 1fr auto;
  }

  .game-page-shell {
    width: min(100% - 20px, 1480px);
    padding: 10px 0;
  }

  .game-page-topbar {
    gap: 10px;
  }

  .game-page-brand {
    gap: 8px;
  }

  .game-page-brand .brand-mark {
    width: 44px;
    height: 44px;
    font-size: 13px;
  }

  .game-page-room {
    min-height: 36px;
    padding: 0 9px;
    font-size: 12px;
  }

  .game-exit-button {
    width: 42px;
    height: 42px;
  }

  .game-stage {
    min-height: calc(100vh - 126px);
  }

  .game-playground {
    min-height: 420px;
  }

  .game-clue {
    min-height: 58px;
    font-size: 17px;
  }

  .game-answer-mask {
    gap: 8px 6px;
  }

  .game-mask-cell {
    min-width: 22px;
    height: 34px;
    font-size: 20px;
  }

  .game-mask-cell.space {
    width: 14px;
    min-width: 14px;
  }

  .profile-fields div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 760px) {
  .seo-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .seo-nav {
    flex-wrap: wrap;
  }

  .seo-hero,
  .seo-content {
    padding: 22px;
  }

  .seo-grid {
    grid-template-columns: 1fr;
  }

  .room-lobby-layout {
    grid-template-columns: 1fr;
  }

  .room-settings-panel,
  .room-chat {
    min-height: 300px;
  }
}
