:root {
  color-scheme: dark;
  --bg-1: #100024;
  --bg-2: #1a1148;
  --card: rgba(255, 255, 255, 0.08);
  --card-hover: rgba(255, 255, 255, 0.14);
  --text: #f8f8ff;
  --muted: #c7c7dd;
  --accent: #7cf6ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 20%, #2c1f77 0%, var(--bg-1) 45%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}

.page-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(124, 246, 255, 0.08) 0%,
    rgba(180, 100, 255, 0.08) 45%,
    rgba(255, 121, 198, 0.08) 100%
  );
  pointer-events: none;
}

.chat-launch {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 30;
  border: 1px solid rgba(124, 246, 255, 0.45);
  background: rgba(16, 0, 36, 0.82);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.account-launch {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 30;
  border: 1px solid rgba(255, 121, 198, 0.45);
  background: rgba(16, 0, 36, 0.82);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.chat-panel {
  position: fixed;
  z-index: 35;
  top: 58px;
  left: 16px;
  width: min(370px, calc(100vw - 32px));
  min-height: 310px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: rgba(15, 12, 45, 0.98);
  border: 1px solid rgba(124, 246, 255, 0.35);
  border-radius: 14px;
  overflow: hidden;
}

.chat-page-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 74px 16px 24px;
}

.chat-page .chat-panel {
  position: static;
  width: min(680px, 100%);
  height: min(76vh, 720px);
  max-height: 76vh;
  min-height: 380px;
}

.chat-panel > .chat-head {
  flex-shrink: 0;
}

.chat-panel > .chat-setup,
.chat-panel > .chat-room {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.chat-panel > .chat-room {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.chat-head h2 {
  margin: 0;
  font-size: 1rem;
}

.chat-close {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
}

.chat-setup {
  padding: 14px;
}

.chat-room {
  padding: 14px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.chat-help {
  margin: 0 0 12px;
  color: var(--muted);
}

.chat-name-account-hint {
  margin: -4px 0 8px;
  font-size: 0.82rem;
}

input#chatName:read-only {
  opacity: 0.92;
  border-color: rgba(124, 246, 255, 0.35);
}

.chat-setup label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.chat-setup input,
.chat-send input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 11px;
}

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

.join-row {
  display: flex;
  gap: 8px;
}

.join-row input {
  flex: 1;
}

.chat-panel button {
  border: 1px solid rgba(124, 246, 255, 0.4);
  background: rgba(124, 246, 255, 0.14);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.chat-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--accent);
  font-size: 0.85rem;
}

.chat-status-error {
  color: #ff9ec7;
}

.chat-room-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chat-room-top p {
  margin: 0;
}

.chat-online {
  font-size: 0.9rem;
  color: var(--muted);
}

.chat-online strong {
  color: var(--accent);
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chat-send {
  flex-shrink: 0;
}

.chat-public-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.chat-public-title {
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 700;
}

.chat-public-codes strong {
  color: var(--accent);
}

.chat-message {
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(124, 246, 255, 0.1);
  line-height: 1.35;
  word-break: break-word;
}

.chat-message b {
  color: var(--accent);
}

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

.chat-send input {
  flex: 1;
}

.menu {
  position: relative;
  z-index: 1;
  width: min(1000px, 92%);
  margin: 0 auto;
  padding: 56px 0 70px;
}

.hero {
  text-align: center;
  margin-bottom: 34px;
}

.tag {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

h1 {
  margin: 8px 0 10px;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.05;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
}

.game-card {
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  padding: 20px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.game-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  padding: 6px;
}

.game-card:hover,
.game-card:focus-visible {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: rgba(124, 246, 255, 0.55);
  outline: none;
}

.game-card h2 {
  margin: 0 0 6px;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.live-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #071116;
  background: #63f0ff;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 800;
  line-height: 1.2;
}

.game-studio {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: #ff9ec7;
  letter-spacing: 0.02em;
}

.game-card p:not(.game-studio) {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.game-card span {
  margin-top: 18px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.92rem;
}

.account-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 74px 16px 32px;
}

.account-card {
  width: min(420px, 100%);
  border: 1px solid rgba(124, 246, 255, 0.35);
  border-radius: 16px;
  background: rgba(15, 12, 45, 0.97);
  padding: 24px;
}

.account-card h1 {
  margin: 0 0 10px;
  font-size: 1.5rem;
}

.account-note {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.account-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.account-tab {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.account-tab.is-active {
  border-color: rgba(124, 246, 255, 0.55);
  background: rgba(124, 246, 255, 0.16);
}

.account-panel label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.9rem;
}

.account-panel label:first-child {
  margin-top: 0;
}

.account-panel input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 11px;
}

.account-btn {
  width: 100%;
  margin-top: 16px;
  border: 1px solid rgba(124, 246, 255, 0.45);
  background: rgba(124, 246, 255, 0.18);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
}

.account-btn-secondary {
  margin-top: 10px;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.account-message {
  margin: 14px 0 0;
  min-height: 1.4em;
  color: var(--accent);
  font-size: 0.9rem;
}

.account-message-error {
  color: #ff9ec7;
}

.account-signed-in {
  text-align: center;
}

.account-signed-in p {
  margin: 0 0 12px;
}

.account-private {
  margin: 0 0 18px;
  text-align: left;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 121, 198, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

.account-private-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.account-private-code {
  margin: 0 0 12px;
  font-size: 1.35rem;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--accent);
  font-family: ui-monospace, monospace;
}

.account-private .account-btn {
  margin-top: 8px;
  display: block;
  text-align: center;
  text-decoration: none;
  line-height: 1.3;
}

.account-link-join {
  display: block;
  margin-top: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: underline;
}
