:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0eb;
  --accent: #1167d8;
  --accent-strong: #0b4fa8;
  --good: #0f7b49;
  --warn: #a15c00;
  --bad: #b42318;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

.button-link {
  display: inline-flex;
  width: fit-content;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}

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

.link-button {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 800;
}

.link-button:hover {
  color: var(--accent-strong);
}

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

.role-admin {
  --bg: #f4f3ff;
  --panel: #ffffff;
  --ink: #201b43;
  --muted: #625f7a;
  --line: #d8d3f4;
  --accent: #5b4bc4;
  --accent-strong: #372a91;
  --shadow: 0 18px 45px rgba(55, 42, 145, 0.12);
}

.role-host {
  --bg: #effbf8;
  --panel: #ffffff;
  --ink: #12312f;
  --muted: #58706d;
  --line: #c8e8e0;
  --accent: #087f73;
  --accent-strong: #056257;
  --shadow: 0 18px 45px rgba(8, 127, 115, 0.11);
}

.role-player {
  --bg: #fff8ed;
  --panel: #ffffff;
  --ink: #352112;
  --muted: #7d6653;
  --line: #f1d7b7;
  --accent: #d97706;
  --accent-strong: #a94f00;
  --shadow: 0 18px 45px rgba(217, 119, 6, 0.12);
}

.role-admin,
.role-host,
.role-player {
  position: relative;
}

.role-admin::before,
.role-host::before,
.role-player::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 13%, transparent), transparent 42%),
    linear-gradient(315deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 36%),
    var(--bg);
}

.lobby {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 22px;
}

.brand {
  max-width: 760px;
}

.brand h1,
.topbar h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.05;
}

.brand p {
  color: var(--muted);
  font-size: 18px;
}

.rules-page {
  max-width: 920px;
}

.rules-hero {
  margin: 20px 0 24px;
}

.rules-hero h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 58px);
}

.rules-hero p {
  color: var(--muted);
  font-size: 18px;
}

.rules-section {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.rules-section h2 {
  margin: 0 0 10px;
}

.rules-section p,
.rules-section li {
  line-height: 1.55;
}

.rules-section pre {
  overflow-x: auto;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 12px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.lobby-grid,
.game-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-card-create {
  margin-bottom: 14px;
  box-shadow: none;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px;
}

.admin-tabs button.active {
  background: var(--accent);
  color: #fff;
}

.admin-section {
  margin-top: 18px;
}

.admin-users-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-user-list {
  display: grid;
  gap: 8px;
}

.user-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.user-filter-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.user-filter-tabs button.active {
  background: var(--accent);
  color: #fff;
}

.user-filter-tabs span {
  display: inline-grid;
  min-width: 24px;
  min-height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 12px;
}

.user-filter-tabs .ghost span {
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  color: var(--accent-strong);
}

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(170px, 1fr) 120px minmax(220px, 1.4fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.admin-user-row.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, #fff);
}

.admin-user-login {
  width: fit-content;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent-strong);
  box-shadow: none;
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-user-login:hover {
  transform: none;
  box-shadow: none;
  color: var(--accent);
}

.admin-user-row > span,
.admin-user-row > small {
  overflow-wrap: anywhere;
}

.admin-user-row > small {
  color: var(--accent-strong);
  font-weight: 800;
}

.admin-user-editor-wrap {
  margin-top: 16px;
}

.admin-user-editor {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.admin-user-main b,
.admin-user-main span,
.admin-user-main small {
  display: block;
}

.admin-user-main span {
  margin-top: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.admin-user-main small {
  margin-top: 6px;
  color: var(--accent-strong);
  font-weight: 800;
}

.admin-user-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.checkbox-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.checkbox-line input {
  width: auto;
}

.form-help {
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.consent-list {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 6%, #fff);
}

.consent-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: start;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.consent-line input {
  width: auto;
  margin-top: 2px;
}

.consent-line a {
  color: var(--accent-strong);
  font-weight: 800;
}

.admin-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.admin-card-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.admin-card-editor textarea,
.card-admin-create textarea {
  min-height: 76px;
  resize: vertical;
}

.admin-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.effect-editor {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.section-title.compact {
  align-items: center;
  gap: 10px;
}

.section-title.compact h4 {
  margin: 0;
}

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

.effect-row {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 0.8fr 1.1fr auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.effect-row label {
  margin: 0;
}

.remove-effect {
  white-space: nowrap;
}

.game-grid {
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
}

.panel,
.board,
.organizer,
.players,
.ranking,
.host-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel h2,
.section-title h2 {
  margin: 0;
}

.demo p {
  margin: 12px 0;
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  margin: 16px 0;
  color: var(--muted);
  font-weight: 650;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 13px;
  color: var(--ink);
}

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

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  background: #e8f1ff;
  color: var(--accent-strong);
}

.role-admin .secondary,
.role-host .secondary,
.role-player .secondary {
  background: color-mix(in srgb, var(--accent) 13%, #fff);
  color: var(--accent-strong);
}

.ghost {
  background: #edf1f7;
  color: var(--ink);
}

.role-admin .ghost,
.role-host .ghost,
.role-player .ghost {
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
}

.danger {
  background: #fff1f0;
  color: var(--bad);
  border: 1px solid #ffccc7;
}

.danger:hover {
  background: #ffccc7;
}

.wide {
  width: 100%;
  margin-top: 14px;
}

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

.role-admin .topbar,
.role-host .topbar,
.role-player .topbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 15%, #fff), #fff 68%);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.profile-heading,
.player-name-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar,
.chat-avatar,
.profile-preview {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 15%, #fff);
  color: var(--accent-strong);
  font-weight: 900;
  flex: 0 0 auto;
}

.avatar {
  width: 54px;
  height: 54px;
  font-size: 22px;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, #fff);
}

.small-avatar {
  width: 36px;
  height: 36px;
  font-size: 16px;
}

.chat-avatar {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

.avatar img,
.chat-avatar img,
.profile-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.role-admin .eyebrow,
.role-host .eyebrow,
.role-player .eyebrow {
  color: var(--accent-strong);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.score-grid,
.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metric,
.result-grid div {
  background: color-mix(in srgb, var(--accent) 4%, #fff);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric span,
.result-grid span,
.section-title span,
.card p,
.player-row span,
.rank-row span {
  color: var(--muted);
}

.metric b,
.result-grid b {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.player-month-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 18px;
  margin: 18px 0;
  padding: 22px;
  border-radius: 8px;
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, #fff);
}

.player-month-card span {
  color: var(--accent-strong);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
}

.player-month-card b {
  grid-row: span 2;
  color: var(--accent-strong);
  font-size: clamp(46px, 8vw, 84px);
  line-height: 0.9;
}

.player-month-card p {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.turn-timer {
  position: sticky;
  top: 10px;
  z-index: 8;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 14px;
  margin: 14px 0;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  box-shadow: var(--shadow);
  padding: 12px 16px;
}

.turn-timer span {
  color: var(--accent-strong);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.turn-timer b {
  grid-row: span 2;
  color: var(--accent-strong);
  font-size: 34px;
  line-height: 1;
}

.turn-timer small {
  color: var(--muted);
  font-weight: 700;
}

.turn-timer.danger-time {
  border-color: var(--bad);
  background: #fff1f0;
}

.turn-timer.danger-time span,
.turn-timer.danger-time b {
  color: var(--bad);
}

.warning-modal h2 {
  color: var(--bad);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 14px;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

td {
  font-size: 12px;
}

.table-wrap {
  overflow-x: visible;
}

.cell-value {
  display: block;
  font-weight: 800;
}

.delta {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.1;
}

.delta.up {
  color: var(--good);
}

.delta.down {
  color: var(--bad);
}

.delta.flat {
  color: var(--muted);
}

.event-effects {
  margin: 8px 0 0;
  padding-left: 18px;
  color: inherit;
}

.event-effects li + li {
  margin-top: 4px;
}

.random-events-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.random-events-panel h3 {
  margin: 0;
}

.event-history-list {
  display: grid;
  gap: 8px;
}

.event-history-item {
  padding: 12px;
}

.event-history-item span {
  display: block;
  margin-top: 4px;
}

.cards-section {
  margin-top: 20px;
}

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

.card {
  position: relative;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.card.repeatable::before,
.card.repeatable::after {
  content: "";
  position: absolute;
  inset: 7px -7px -7px 7px;
  z-index: -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.card.repeatable::after {
  inset: 14px -14px -14px 14px;
  opacity: 0.55;
}

.card.used {
  background: #f2f4f7;
  color: var(--muted);
}

.card.used .card-footer button {
  background: #cfd6e1;
  color: #667085;
}

.card h3 {
  margin: 12px 0 8px;
}

.tag {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.usage-tag {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.usage-tag.repeatable {
  background: #dcfae6;
  color: var(--good);
}

.usage-tag.one-time {
  background: #fff7e6;
  color: var(--warn);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-footer button {
  background: #172033;
  color: #fff;
}

.stack {
  display: grid;
  gap: 10px;
}

.stack-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.stack-card span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.players,
.ranking {
  margin-top: 20px;
}

.ai-panel {
  display: grid;
  gap: 12px;
}

.ai-summary {
  display: grid;
  gap: 10px;
}

.ai-summary-item {
  border: 1px solid #c7dcff;
  border-radius: 8px;
  background: #f3f8ff;
  color: var(--ink);
  line-height: 1.55;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 14px 16px;
}

.ai-summary-item b {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
}

.ai-summary-item p {
  margin: 0;
}

.room-block {
  margin-top: 20px;
}

.player-list,
.ranking {
  display: grid;
  gap: 10px;
}

.player-row,
.user-row,
.rank-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.player-row.self {
  border-color: var(--accent);
}

.room-code-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.room-code-line small {
  color: var(--good);
  font-size: 12px;
  font-weight: 800;
}

.copy-room-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 9%, #fff);
  color: var(--accent-strong);
  line-height: 1;
}

.copy-room-button:hover {
  background: color-mix(in srgb, var(--accent) 16%, #fff);
}

.user-row {
  margin-top: 10px;
}

.host-table-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.host-player-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.host-player-card.active {
  border-color: var(--accent);
}

.host-player-card.ready {
  border-color: rgba(15, 123, 73, 0.45);
  background: #f6fffb;
}

.host-player-card.timed-out {
  border-color: #ffccc7;
  background: #fff1f0;
}

.host-player-card.winner,
.final-score-card.winner {
  border-color: #f5b301;
  background: #fff9db;
  box-shadow: 0 0 0 3px rgba(245, 179, 1, 0.18);
}

.host-player-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.host-player-head span {
  border-radius: 999px;
  background: #eef4ff;
  color: var(--accent-strong);
  padding: 5px 9px;
  font-weight: 800;
  font-size: 12px;
}

.ready .host-player-head span {
  background: #dcfae6;
  color: var(--good);
}

.timed-out .host-player-head span {
  background: #ffccc7;
  color: var(--bad);
}

.host-player-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.host-player-meta div {
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px;
}

.host-player-meta span,
.host-player-actions span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.host-player-meta b {
  display: block;
  margin-top: 4px;
}

.host-player-actions p {
  margin: 6px 0 0;
}

.host-funnel-details {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.host-funnel-details summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 800;
}

.host-funnel-details .result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.win-criterion {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.win-criterion strong {
  color: var(--good);
}

.room-timer-control {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  padding: 14px;
}

.room-timer-control b,
.room-timer-control span {
  display: block;
}

.room-timer-control span {
  margin-top: 4px;
  color: var(--muted);
}

.winner-banner {
  margin: 18px 0;
  border-radius: 8px;
  border: 2px solid #f5b301;
  background: #fff9db;
  padding: 20px;
}

.winner-banner span {
  color: var(--muted);
  font-weight: 800;
}

.winner-banner h2 {
  margin: 8px 0 0;
  font-size: clamp(28px, 5vw, 44px);
}

.you-won {
  margin: 10px 0 0;
  color: var(--good);
  font-size: 22px;
  font-weight: 900;
}

.final-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.final-score-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.final-score-card > b,
.final-score-card > span {
  grid-column: 1 / -1;
}

.final-score-card > b {
  font-size: 20px;
}

.final-score-card > span {
  color: var(--muted);
}

.final-score-card small {
  display: block;
  color: var(--muted);
}

.final-score-card strong {
  display: block;
  margin-top: 4px;
}

.month-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  margin-top: 12px;
}

.month-table h3 {
  margin: 0;
}

.summary-results {
  border-width: 2px;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.summary-results-table th,
.summary-results-table td {
  font-size: 11px;
  padding: 7px 5px;
}

.summary-results-table td:first-child {
  color: var(--accent-strong);
}

.summary-baseline-row {
  background: color-mix(in srgb, var(--accent) 7%, #fff);
}

.month-event {
  margin: 10px 0 12px;
}

.month-event span {
  display: block;
  margin-top: 4px;
}

.empty,
.error,
.event {
  border-radius: 8px;
  padding: 14px;
}

.empty {
  background: #f8fafc;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.empty.small {
  min-height: 140px;
}

.error {
  background: #fff1f0;
  border: 1px solid #ffccc7;
  color: var(--bad);
}

.notice {
  border-radius: 8px;
  padding: 14px;
  background: #ecfdf3;
  border: 1px solid #abefc6;
  color: var(--good);
}

.user-row-expanded {
  grid-template-columns: minmax(160px, 1fr) auto minmax(220px, 1.2fr) minmax(260px, 1.4fr) auto;
}

.user-row-expanded > div:first-child span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.user-statuses,
.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-user-editor .user-actions {
  justify-content: flex-end;
}

.user-statuses span {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.user-statuses .ok {
  background: #dcfae6;
  color: var(--good);
}

.user-statuses .wait {
  background: #fff7e6;
  color: var(--warn);
}

.user-statuses .blocked {
  background: #fff1f0;
  color: var(--bad);
}

.event {
  background: #fff7e6;
  border: 1px solid #ffd591;
  color: var(--warn);
}

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

.modal {
  position: relative;
  width: min(520px, 100%);
  border-radius: 8px;
  background: #fff;
  padding: 34px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
  text-align: center;
}

.modal h2 {
  margin: 0;
  font-size: clamp(34px, 6vw, 52px);
}

.modal > p:not(.eyebrow) {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

.modal button {
  margin-top: 22px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin: 0;
  border-radius: 50%;
  background: #edf1f7;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  font-weight: 500;
}

.modal-close:hover {
  background: #d9e0eb;
}

.profile-modal {
  text-align: left;
}

.profile-modal h2 {
  font-size: 34px;
}

.profile-modal label {
  margin-top: 14px;
}

.profile-preview {
  width: 96px;
  height: 96px;
  margin: 18px auto 6px;
  border: 3px solid color-mix(in srgb, var(--accent) 24%, #fff);
  font-size: 38px;
}

.profile-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.host-panel {
  margin: 18px 0;
}

.host-panel summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.host-panel summary b {
  display: block;
  font-size: 20px;
}

.host-panel summary small {
  color: var(--muted);
}

.funnel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.funnel-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.funnel-row b {
  display: block;
  margin-bottom: 8px;
}

.funnel-row label,
.funnel-totals label {
  margin: 10px 0 0;
}

.funnel-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.host-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.host-actions span {
  color: var(--muted);
}

.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.22);
}

.chat-fab > span:first-child {
  font-size: 25px;
  line-height: 1;
}

.chat-fab > span:last-child {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 12px;
  border: 2px solid #fff;
}

.chat-window {
  position: fixed;
  z-index: 31;
  min-width: 300px;
  min-height: 360px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  resize: both;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.24);
}

.chat-window-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, #fff), #fff);
  border-bottom: 1px solid var(--line);
  cursor: move;
  user-select: none;
}

.chat-window-head b,
.chat-window-head small {
  display: block;
}

.chat-window-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.chat-window-head .modal-close {
  position: static;
  flex: 0 0 auto;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 14px;
  overflow: auto;
  background: color-mix(in srgb, var(--accent) 4%, #fff);
}

.chat-empty {
  margin: auto 0;
}

.chat-message {
  max-width: 86%;
  align-self: flex-start;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.chat-message.own {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
}

.chat-message div {
  min-width: 0;
}

.chat-message span {
  display: block;
  margin: 2px 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.chat-message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.chat-form textarea {
  min-height: 44px;
  max-height: 140px;
  resize: vertical;
}

@media (max-width: 920px) {
  .lobby-grid,
  .game-grid,
  .admin-grid,
  .admin-users-layout,
  .admin-user-row,
  .score-grid,
  .result-grid,
  .cards,
  .funnel-grid,
  .funnel-totals,
  .host-table-grid,
  .final-score-grid,
  .admin-user-edit-grid,
  .admin-card-grid,
  .effect-row {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .brand h1,
  .topbar h1 {
    font-size: 32px;
  }

  .player-row,
  .user-row,
  .rank-row {
    grid-template-columns: 1fr;
  }

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

  .player-month-card b {
    grid-row: auto;
  }

  .final-score-card,
  .host-player-meta {
    grid-template-columns: 1fr;
  }
}

/* Public game description */
.about-page {
  --about-ink: #18334a;
  --about-green: #2f9eb8;
  --about-green-dark: #18334a;
  --about-coral: #ed672f;
  --about-lime: #f5b719;
  --about-soft: #8bc5cc;
  --about-leaf: #367b5d;
  background: #f5f0e8;
  color: var(--about-ink);
}

.about-page h1,
.about-page h2,
.about-page h3,
.about-page p {
  letter-spacing: 0;
}

.about-container {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.about-nav {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  height: 82px;
  display: flex;
  align-items: center;
  gap: 34px;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  color: #fff;
}

.about-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: inherit;
  text-decoration: none;
}

.about-logo-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--about-lime);
  color: #18334a;
  font-size: 24px;
  font-weight: 900;
}

.about-logo b,
.about-logo small {
  display: block;
}

.about-logo small {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
}

.about-nav nav {
  display: flex;
  gap: 26px;
}

.about-nav nav a,
.about-footer a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.about-nav nav a:hover,
.about-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.about-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 6px;
  background: var(--about-coral);
  color: #fff;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(238, 104, 77, 0.24);
}

.about-button:hover {
  background: #d95322;
  transform: translateY(-1px);
}

.about-button-small {
  min-height: 40px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.48);
  box-shadow: none;
}

.about-hero {
  position: relative;
  min-height: 860px;
  display: grid;
  align-items: center;
  overflow: hidden;
  background: var(--about-green-dark);
  color: #fff;
}

.about-hero > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: saturate(1.02) contrast(1.01);
}

.about-hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(24, 51, 74, 0.97) 0%, rgba(24, 51, 74, 0.9) 35%, rgba(24, 51, 74, 0.48) 58%, rgba(24, 51, 74, 0.08) 82%),
    linear-gradient(0deg, rgba(24, 51, 74, 0.4), transparent 52%);
}

.about-hero-content {
  position: relative;
  z-index: 2;
  padding-top: 145px;
  padding-bottom: 105px;
}

.about-kicker,
.about-section-label {
  margin: 0 0 14px;
  color: var(--about-coral);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.about-hero h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(44px, 6.2vw, 78px);
  line-height: 0.98;
}

.about-lead {
  max-width: 650px;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 20px;
  line-height: 1.55;
}

.about-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 30px;
}

.about-text-link {
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.about-text-link span {
  color: var(--about-lime);
}

.about-hero-facts {
  display: flex;
  gap: 50px;
  margin: 54px 0 0;
  padding: 0;
  list-style: none;
}

.about-hero-facts li {
  display: grid;
  gap: 3px;
}

.about-hero-facts b {
  color: var(--about-lime);
  font-size: 26px;
}

.about-hero-facts span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.about-band {
  padding: 72px 0;
}

.about-intro {
  background: var(--about-lime);
}

.about-intro-grid {
  display: grid;
  grid-template-columns: 0.6fr 2fr;
  gap: 60px;
}

.about-intro .about-section-label {
  color: var(--about-green-dark);
}

.about-intro h2,
.about-heading h2,
.about-custom h2,
.about-cta h2 {
  margin: 0;
  font-size: clamp(34px, 4.3vw, 56px);
  line-height: 1.06;
}

.about-intro p:last-child {
  max-width: 820px;
  margin: 22px 0 0;
  font-size: 18px;
  line-height: 1.7;
}

.about-section {
  padding: 96px 0;
}

.about-heading {
  max-width: 850px;
  margin-bottom: 46px;
}

.about-heading > p:last-child {
  max-width: 720px;
  margin: 20px 0 0;
  color: #5d6b6d;
  font-size: 18px;
  line-height: 1.65;
}

.industry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid #cdd8d4;
  border-left: 1px solid #cdd8d4;
}

.industry-grid article {
  min-height: 260px;
  padding: 28px;
  border-right: 1px solid #cdd8d4;
  border-bottom: 1px solid #cdd8d4;
}

.industry-grid article:hover {
  background: #fffdf8;
}

.industry-grid span {
  color: var(--about-coral);
  font-weight: 900;
}

.industry-grid h3 {
  margin: 45px 0 12px;
  font-size: 24px;
}

.industry-grid p,
.steps p,
.about-custom p,
.about-custom li,
.about-product-shot p {
  color: #61706f;
  line-height: 1.6;
}

.about-skills {
  background: #18334a;
  color: #fff;
}

.about-heading-light .about-section-label {
  color: var(--about-lime);
}

.skills-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 70px;
  align-items: start;
}

.skills-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: skill;
}

.skills-list li {
  position: relative;
  display: grid;
  grid-template-columns: 0.8fr 1.3fr;
  gap: 28px;
  padding: 25px 0 25px 55px;
  border-top: 1px solid rgba(139, 197, 204, 0.36);
  counter-increment: skill;
}

.skills-list li::before {
  content: "0" counter(skill);
  position: absolute;
  left: 0;
  color: var(--about-lime);
  font-weight: 900;
}

.skills-list b {
  font-size: 20px;
}

.skills-list span {
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.55;
}

.ai-callout {
  position: sticky;
  top: 24px;
  padding: 32px;
  background: #fffdf8;
  color: var(--about-ink);
  border-radius: 8px;
}

.ai-spark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 36px;
  border-radius: 50%;
  background: var(--about-green);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.ai-callout h3 {
  margin: 0 0 16px;
  font-size: 30px;
}

.ai-callout p:last-child {
  color: #61706f;
  line-height: 1.65;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: #8bc5cc;
  border: 1px solid #8bc5cc;
}

.steps article {
  min-height: 250px;
  padding: 28px;
  background: #fffdf8;
}

.steps b {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--about-leaf);
  color: #fff;
}

.steps h3 {
  margin: 42px 0 10px;
  font-size: 21px;
}

.about-product-shot {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 55px;
  align-items: center;
  margin-top: 70px;
  padding: 45px;
  background: #fff;
  border: 1px solid #cdd8d4;
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(24, 51, 74, 0.13);
}

.about-product-shot h3 {
  margin: 0;
  font-size: 32px;
}

.about-product-shot img {
  width: 100%;
  border: 1px solid #cdd8d4;
  border-radius: 5px;
}

.about-custom {
  background: #dce9e4;
}

.about-custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
}

.about-custom-grid > div:last-child {
  padding-top: 30px;
}

.about-custom p,
.about-custom li {
  font-size: 17px;
}

.about-custom ul {
  display: grid;
  gap: 10px;
  padding-left: 22px;
}

.about-cta {
  padding: 100px 0;
  background: var(--about-green);
  color: #fff;
  text-align: center;
}

.about-cta .about-section-label {
  color: #fff;
  opacity: 0.75;
}

.about-cta h2 {
  max-width: 900px;
  margin: 0 auto 34px;
}

.about-button-light {
  margin: 0 auto;
  background: #fff;
  color: var(--about-green-dark);
  box-shadow: none;
}

.about-footer {
  padding: 28px 0;
  background: #132c40;
  color: rgba(255, 255, 255, 0.7);
}

.about-footer .about-container {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.about-footer-grid {
  align-items: flex-start;
}

.about-footer b,
.about-footer span,
.about-footer p,
.about-footer a {
  display: block;
}

.about-footer p {
  margin: 8px 0 0;
  max-width: 460px;
  line-height: 1.55;
}

.about-footer a + a,
.about-footer a + span {
  margin-top: 8px;
}

.legal-page {
  background: #f6f3ee;
}

.legal-main {
  padding: 120px 0 70px;
}

.legal-document {
  max-width: 900px;
  padding: 44px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(24, 51, 74, 0.12);
}

.legal-document h1 {
  margin: 0 0 22px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
}

.legal-document h2 {
  margin: 30px 0 10px;
  font-size: 23px;
}

.legal-document p {
  margin: 0 0 12px;
  line-height: 1.7;
  color: #3f5365;
}

.legal-date {
  margin-top: 30px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .about-nav nav {
    display: none;
  }

  .industry-grid,
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .skills-layout,
  .about-product-shot {
    grid-template-columns: 1fr;
  }

  .ai-callout {
    position: static;
  }
}

@media (max-width: 640px) {
  .about-container,
  .about-nav {
    width: min(100% - 24px, 1160px);
  }

  .about-nav {
    height: 70px;
  }

  .about-logo small,
  .about-button-small {
    display: none;
  }

  .about-hero {
    min-height: 880px;
  }

  .about-hero-content {
    padding-top: 125px;
    padding-bottom: 85px;
  }

  .about-hero h1 {
    font-size: 43px;
  }

  .about-lead {
    font-size: 17px;
  }

  .about-actions,
  .about-hero-facts,
  .about-footer .about-container {
    align-items: flex-start;
    flex-direction: column;
  }

  .legal-main {
    padding: 95px 0 48px;
  }

  .legal-document {
    padding: 28px 20px;
  }

  .about-hero-facts {
    gap: 16px;
  }

  .about-intro-grid,
  .about-custom-grid,
  .industry-grid,
  .steps {
    grid-template-columns: 1fr;
  }

  .about-section,
  .about-cta {
    padding: 70px 0;
  }

  .about-intro-grid,
  .about-custom-grid {
    gap: 24px;
  }

  .skills-list li {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .about-product-shot {
    padding: 22px;
  }
}
