:root {
  color-scheme: dark;
  --bg: #0a0e13;
  --bg-soft: #10161d;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e9eef4;
  --muted: #8b98a8;
  --jade: #43c6a2;
  --jade-deep: #2fae8c;
  --jade-soft: rgba(67, 198, 162, 0.13);
  --gold: #d8ab63;
  --danger: #e06c5f;
  --radius: 16px;
  --font-sans: "Inter", "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    "Segoe UI", sans-serif;
  --font-serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient i {
  position: absolute;
  border-radius: 50%;
  filter: blur(130px);
}

.ambient i:nth-child(1) {
  width: 560px;
  height: 560px;
  left: -160px;
  top: -180px;
  background: rgba(46, 170, 140, 0.18);
}

.ambient i:nth-child(2) {
  width: 520px;
  height: 520px;
  right: -180px;
  bottom: -200px;
  background: rgba(198, 146, 66, 0.12);
}

/* ============ 大厅 ============ */

.lobby {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.lobby-card {
  width: min(100%, 432px);
  padding: 34px 32px 26px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.032));
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  animation: cardIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.lobby h1 {
  margin: 0;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  color: #f2f6fa;
}

.lobby-sub {
  margin: 10px 0 30px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.field > span {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding-left: 2px;
}

.field input,
.join-row input,
.chat-form input {
  height: 44px;
  width: 100%;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  outline: none;
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input::placeholder,
.join-row input::placeholder,
.chat-form input::placeholder {
  color: #63707f;
}

.field input:focus,
.join-row input:focus,
.chat-form input:focus {
  border-color: rgba(67, 198, 162, 0.55);
  box-shadow: 0 0 0 3px rgba(67, 198, 162, 0.12);
  background: rgba(0, 0, 0, 0.36);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease,
    box-shadow 0.16s ease, opacity 0.16s ease;
}

.btn:hover:not(:disabled) {
  background: var(--panel-strong);
  border-color: var(--line-strong);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(180deg, #4fd3ac, #2fae8c);
  border-color: transparent;
  color: #06231b;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(67, 198, 162, 0.22);
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.05);
  background: linear-gradient(180deg, #58dcb5, #34b593);
}

.btn.block {
  width: 100%;
  height: 46px;
}

.btn.secondary {
  margin-top: 8px;
  height: 38px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.btn.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.btn.danger {
  background: rgba(224, 108, 95, 0.12);
  border-color: rgba(224, 108, 95, 0.32);
  color: #ffb9b1;
}

.btn.danger:hover:not(:disabled) {
  background: rgba(224, 108, 95, 0.2);
  border-color: rgba(224, 108, 95, 0.45);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.theme-toggle:hover {
  background: var(--panel-strong);
  border-color: var(--line-strong);
  color: var(--text);
}

.theme-toggle.floating {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 30;
}

.btn.sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 9px;
  letter-spacing: 0.03em;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
  color: #6d7a89;
  font-size: 11px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.join-row {
  display: grid;
  grid-template-columns: 1fr 84px;
  gap: 10px;
}

.code-input {
  font-family: var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 13px !important;
}

.lobby-note {
  margin: 22px 0 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.7;
  color: #6d7a89;
}

/* ============ 顶栏 ============ */

.game {
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
  padding: 0 24px;
  background: rgba(10, 14, 19, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  flex: none;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 0.16em;
  color: #dfe7ef;
}

.room-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 5px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.room-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.room-chip code {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: #a9e8d6;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

.conn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.conn i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8b98a8;
}

.conn.online i {
  background: var(--jade);
  box-shadow: 0 0 0 3px rgba(67, 198, 162, 0.14);
}

.conn.connecting i {
  background: var(--gold);
  animation: pulse 1.2s ease-in-out infinite;
}

.conn.offline i {
  background: var(--danger);
}

/* ============ 布局 ============ */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  width: min(1180px, calc(100% - 40px));
  margin: 18px auto 40px;
  align-items: start;
}

.play {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.players {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.player {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 11px;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.player.right {
  flex-direction: row-reverse;
  text-align: right;
}

.player.active {
  background: rgba(67, 198, 162, 0.07);
  border-color: rgba(67, 198, 162, 0.22);
}

.player.winner {
  background: rgba(216, 171, 99, 0.08);
  border-color: rgba(216, 171, 99, 0.3);
}

.player.offline {
  opacity: 0.55;
}

.stone-icon {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.stone-icon.black {
  background: radial-gradient(circle at 32% 28%, #74777f, #202228 58%, #0a0b0e);
}

.stone-icon.white {
  background: radial-gradient(circle at 32% 28%, #ffffff, #efe9dd 55%, #c9bfae);
}

.pinfo {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pname {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.pmeta {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.me-badge {
  display: none;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(67, 198, 162, 0.28);
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 9.5px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  flex: none;
}

.player.me .me-badge {
  display: inline-block;
}

.turn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 108px;
}

.pill {
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.pill.yourturn {
  background: linear-gradient(180deg, #4fd3ac, #33b18f);
  border-color: transparent;
  color: #06231b;
  box-shadow: 0 6px 22px rgba(67, 198, 162, 0.24);
}

.pill.oppturn {
  color: var(--muted);
}

.pill.waiting {
  color: var(--muted);
}

.pill.finished {
  color: #f0cf95;
  border-color: rgba(216, 171, 99, 0.32);
  background: rgba(216, 171, 99, 0.08);
}

.turn-note {
  height: 14px;
  margin-top: 5px;
  font-size: 10.5px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ============ 棋盘 ============ */

.board-stage {
  position: relative;
  padding: 10px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(
    150deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.02) 45%,
    rgba(255, 255, 255, 0.055)
  );
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  line-height: 0;
}

.board-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 16px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.board-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 9px 17px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(12, 16, 20, 0.74);
  color: #f4e7d2;
  font-size: 12px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  line-height: 1.4;
}

.play-foot {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.dot-sep {
  opacity: 0.5;
}

/* ============ 侧栏 ============ */

.sidebar {
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 100px);
  max-height: 840px;
  min-height: 420px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
}

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

.side-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.side-actions {
  display: flex;
  gap: 8px;
}

.result-banner {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(216, 171, 99, 0.24);
  background: linear-gradient(180deg, rgba(216, 171, 99, 0.12), rgba(216, 171, 99, 0.035));
  animation: cardIn 0.25s ease-out both;
}

.result-banner b {
  font-size: 14px;
  font-weight: 600;
  color: #f0cf95;
  letter-spacing: 0.02em;
}

.result-banner span {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

.chat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.chat-hint {
  font-size: 9.5px;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

.chat-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-list::-webkit-scrollbar {
  width: 6px;
}

.chat-list::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
}

.chat-list::-webkit-scrollbar-track {
  background: transparent;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 88%;
  animation: msgIn 0.2s ease-out both;
}

.msg.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.msg.theirs {
  align-self: flex-start;
}

.msg-meta {
  padding: 0 3px;
  font-size: 9.5px;
  letter-spacing: 0.03em;
  color: #6d7a89;
}

.msg-body {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg.theirs .msg-body {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-top-left-radius: 5px;
  color: #dce4ec;
}

.msg.mine .msg-body {
  background: rgba(67, 198, 162, 0.13);
  border: 1px solid rgba(67, 198, 162, 0.2);
  border-top-right-radius: 5px;
  color: #ddf6ee;
}

.msg.sys {
  align-self: center;
  max-width: 100%;
  padding: 2px 6px;
  font-size: 10.5px;
  line-height: 1.6;
  text-align: center;
  color: #6d7a89;
  letter-spacing: 0.02em;
}

.chat-form {
  display: flex;
  gap: 8px;
  flex: none;
}

.chat-form input {
  flex: 1;
  height: 38px;
  font-size: 12.5px;
}

.chat-form .btn {
  height: 38px;
  padding: 0 14px;
  flex: none;
}

/* ============ 弹窗与提示 ============ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 8, 12, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  width: min(100%, 380px);
  padding: 26px 24px 22px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: #121922;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: pop 0.22s ease-out both;
}

.modal-card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.modal-sub {
  margin: 7px 0 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.modal-card .field {
  margin-bottom: 16px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  padding: 10px 17px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 27, 36, 0.95);
  color: var(--text);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: min(90vw, 480px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    width: min(760px, calc(100% - 28px));
    gap: 18px;
    margin-top: 14px;
  }

  .sidebar {
    position: static;
    height: 440px;
    max-height: none;
    min-height: 0;
  }

  .topbar {
    padding: 0 16px;
    gap: 10px;
  }

  .conn span {
    display: none;
  }
}

@media (max-width: 560px) {
  .lobby-card {
    padding: 28px 22px 22px;
  }

  .players {
    gap: 6px;
  }

  .player {
    padding: 6px 7px;
    gap: 7px;
  }

  .pname {
    font-size: 12.5px;
    max-width: 84px;
  }

  .pmeta {
    font-size: 9.5px;
  }

  .stone-icon {
    width: 23px;
    height: 23px;
  }

  .me-badge {
    display: none !important;
  }

  .turn-wrap {
    min-width: 96px;
  }

  .pill {
    padding: 6px 11px;
    font-size: 11.5px;
  }

  .turn-note {
    font-size: 9.5px;
  }

  .room-label {
    display: none;
  }

  .board-stage {
    padding: 7px;
    border-radius: 18px;
  }

  .board-stage canvas {
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============ 浅色主题 ============ */

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f5f7;
  --bg-soft: #ffffff;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(18, 30, 42, 0.1);
  --line-strong: rgba(18, 30, 42, 0.18);
  --text: #17222c;
  --muted: #667382;
  --jade: #1a9b7c;
  --jade-deep: #14856b;
  --jade-soft: rgba(26, 155, 124, 0.1);
  --gold: #a9721f;
  --danger: #c05046;
}

:root[data-theme="light"] .ambient i:nth-child(1) {
  background: rgba(46, 170, 140, 0.1);
}

:root[data-theme="light"] .ambient i:nth-child(2) {
  background: rgba(198, 146, 66, 0.08);
}

:root[data-theme="light"] .lobby-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.74));
  border-color: rgba(18, 30, 42, 0.08);
  box-shadow: 0 40px 100px rgba(23, 35, 48, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"] .lobby h1 {
  color: #101a24;
}

:root[data-theme="light"] .divider,
:root[data-theme="light"] .lobby-note {
  color: #7c8894;
}

:root[data-theme="light"] .field input,
:root[data-theme="light"] .join-row input,
:root[data-theme="light"] .chat-form input {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(18, 30, 42, 0.12);
  color: var(--text);
}

:root[data-theme="light"] .field input::placeholder,
:root[data-theme="light"] .join-row input::placeholder,
:root[data-theme="light"] .chat-form input::placeholder {
  color: #9aa5b1;
}

:root[data-theme="light"] .field input:focus,
:root[data-theme="light"] .join-row input:focus,
:root[data-theme="light"] .chat-form input:focus {
  background: #ffffff;
  border-color: rgba(26, 155, 124, 0.55);
  box-shadow: 0 0 0 3px rgba(26, 155, 124, 0.12);
}

:root[data-theme="light"] .btn.secondary:hover:not(:disabled) {
  background: rgba(18, 30, 42, 0.05);
  color: var(--text);
}

:root[data-theme="light"] .topbar {
  background: rgba(248, 250, 252, 0.78);
  border-bottom-color: rgba(18, 30, 42, 0.08);
}

:root[data-theme="light"] .brand-name {
  color: #22303c;
}

:root[data-theme="light"] .room-chip {
  background: rgba(255, 255, 255, 0.65);
}

:root[data-theme="light"] .room-chip code {
  color: #14795f;
}

:root[data-theme="light"] .icon-btn:hover {
  background: rgba(18, 30, 42, 0.06);
  color: var(--text);
}

:root[data-theme="light"] .player.active {
  background: rgba(26, 155, 124, 0.08);
  border-color: rgba(26, 155, 124, 0.25);
}

:root[data-theme="light"] .player.winner {
  background: rgba(169, 114, 31, 0.1);
  border-color: rgba(169, 114, 31, 0.3);
}

:root[data-theme="light"] .pill.finished {
  color: #8a5a12;
  border-color: rgba(169, 114, 31, 0.35);
  background: rgba(169, 114, 31, 0.1);
}

:root[data-theme="light"] .board-stage {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.55));
  border-color: rgba(18, 30, 42, 0.1);
  box-shadow: 0 30px 80px rgba(23, 35, 48, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"] .board-hint {
  background: rgba(255, 252, 246, 0.9);
  border-color: rgba(90, 60, 25, 0.18);
  color: #4a3a24;
}

:root[data-theme="light"] .result-banner {
  border-color: rgba(169, 114, 31, 0.28);
  background: linear-gradient(180deg, rgba(216, 171, 99, 0.18), rgba(216, 171, 99, 0.06));
}

:root[data-theme="light"] .result-banner b {
  color: #8a5a12;
}

:root[data-theme="light"] .chat-list::-webkit-scrollbar-thumb {
  background: rgba(18, 30, 42, 0.16);
}

:root[data-theme="light"] .msg.theirs .msg-body {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(18, 30, 42, 0.08);
  color: #25313d;
}

:root[data-theme="light"] .msg.mine .msg-body {
  background: rgba(26, 155, 124, 0.12);
  border-color: rgba(26, 155, 124, 0.22);
  color: #0d4a3a;
}

:root[data-theme="light"] .msg-meta,
:root[data-theme="light"] .msg.sys {
  color: #6f7b88;
}

:root[data-theme="light"] .modal {
  background: rgba(20, 30, 40, 0.32);
}

:root[data-theme="light"] .modal-card {
  background: #ffffff;
  border-color: rgba(18, 30, 42, 0.1);
  box-shadow: 0 30px 80px rgba(23, 35, 48, 0.25);
}

:root[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(18, 30, 42, 0.12);
  color: var(--text);
}

:root[data-theme="light"] .btn.danger {
  background: rgba(192, 80, 70, 0.08);
  border-color: rgba(192, 80, 70, 0.25);
  color: #a83a30;
}

:root[data-theme="light"] .btn.danger:hover:not(:disabled) {
  background: rgba(192, 80, 70, 0.14);
  border-color: rgba(192, 80, 70, 0.38);
}
