/* Discord-ish dark theme */
:root {
  --bg-darkest: #1e1f22;   /* server rail */
  --bg-darker: #2b2d31;    /* sidebar, members */
  --bg-chat: #313338;      /* chat area */
  --bg-input: #383a40;
  --bg-hover: #35373c;
  --bg-active: #404249;
  --text-normal: #dbdee1;
  --text-muted: #949ba4;
  --text-header: #f2f3f5;
  --blurple: #5865f2;
  --blurple-hover: #4752c4;
  --green: #23a55a;
  --red: #f23f43;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "gg sans", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg-chat);
  color: var(--text-normal);
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */

.login-screen {
  height: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blurple);
  background: linear-gradient(135deg, #404eed 0%, #5865f2 50%, #7289da 100%);
}

.login-card {
  background: var(--bg-darker);
  padding: 32px;
  border-radius: 8px;
  width: 420px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0px;
  margin-bottom: 30px;
}

.login-brand h1 {
  color: var(--text-header);
  font-size: 42px;
  line-height: 1;
}

.login-logo {
  width: 78px;
  height: 78px;
  display: block;
}

.avatar-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px dashed var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-muted);
  cursor: pointer;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.avatar-preview:hover { border-color: var(--blurple); color: var(--blurple); }
.avatar-preview.has-image { border-style: solid; border-color: var(--blurple); }
.avatar-hint { color: var(--text-muted); font-size: 12px; }

#login-form { text-align: left; }

.field-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.required { color: var(--red); }

#login-form input {
  width: 100%;
  padding: 10px;
  margin-bottom: 16px;
  border: none;
  border-radius: 4px;
  background: var(--bg-darkest);
  color: var(--text-normal);
  font-size: 15px;
  outline: none;
}

.login-error {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 8px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 4px;
  background: var(--blurple);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.login-btn:hover { background: var(--blurple-hover); }
.login-btn:disabled { opacity: 0.6; cursor: default; }

/* ---------- App layout ---------- */

.app {
  display: grid;
  grid-template-columns: 72px 240px 1fr 240px;
  height: 100vh;
  height: 100dvh; /* track the real visible height on mobile (URL bar, keyboard) */
}

/* Server rail */
.server-rail {
  background: var(--bg-darkest);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.server-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-radius 0.15s;
}

.server-icon.active, .server-icon:hover { border-radius: 16px; }

.server-icon img {
  width: 48px;
  height: 48px;
  display: block;
  border-radius: inherit;
  object-fit: cover;
}

/* Sidebar */
.sidebar {
  background: var(--bg-darker);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0 16px;
  height: 48px;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--text-header);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.channels { flex: 1; overflow-y: auto; padding: 8px; }

.channel-category {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 16px 8px 4px;
}

.channel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
}

.channel:hover { background: var(--bg-hover); color: var(--text-normal); }
.channel.active { background: var(--bg-active); color: var(--text-header); }

.channel-hash {
  color: var(--text-muted);
  font-size: 18px;
  display: flex;
  align-items: center;
}

/* Voice members under the voice channel */
.voice-members { padding-left: 24px; }

/* Breathing room between the "Voice" channel row and the first participant. */
.voice-members:not(:empty) { margin-top: 6px; }

.voice-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 14px;
}

.voice-member .avatar { width: 24px; height: 24px; }

.voice-member-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-member-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
  color: var(--text-muted);
}

.voice-status-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.voice-member.speaking .avatar { box-shadow: 0 0 0 2px var(--green); }

/* Voice panel */
.voice-panel {
  display: flex;
  align-items: center;
  padding: 8px;
  border-top: 1px solid var(--bg-darkest);
  background: #232428;
}

.voice-panel-info { flex: 1; display: flex; flex-direction: column; }
.voice-connected { color: var(--green); font-size: 14px; font-weight: 600; }
.voice-channel-name { color: var(--text-muted); font-size: 12px; }

/* User panel */
.user-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #232428;
}

.user-panel-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-panel-name span:first-child {
  color: var(--text-header);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-panel-status { color: var(--text-muted); font-size: 12px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
}

.icon-btn:hover { background: var(--bg-hover); color: var(--text-normal); }
.icon-btn.toggled { color: var(--red); }

/* Voice settings */
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}

.settings-panel {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  border-radius: 8px;
  background: var(--bg-darker);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  overflow-x: hidden;
  overflow-y: auto;
}

.settings-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--bg-darkest);
}

.settings-header h2 {
  color: var(--text-header);
  font-size: 16px;
}

.settings-section,
.settings-row {
  padding: 16px;
  border-bottom: 1px solid rgba(30, 31, 34, 0.75);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-label,
.settings-value {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.settings-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 8px;
  padding: 4px;
  border-radius: 6px;
  background: var(--bg-darkest);
}

.segmented-control button,
.keybind-btn {
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.segmented-control button:hover,
.keybind-btn:hover { background: var(--bg-hover); color: var(--text-normal); }

.segmented-control button.selected {
  background: var(--blurple);
  color: #fff;
}

.keybind-btn {
  min-width: 112px;
  padding: 0 12px;
  background: var(--bg-darkest);
  color: var(--text-header);
}

.input-meter {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg-darkest);
}

.input-meter-fill {
  width: 0;
  height: 100%;
  background: var(--text-muted);
  transition: width 0.1s linear, background 0.1s linear;
}

.input-meter-fill.transmitting { background: var(--green); }

.input-threshold-marker {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.sensitivity-slider,
.settings-slider {
  width: 100%;
  margin-top: 14px;
  accent-color: var(--blurple);
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Avatars */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; }

/* ---------- Chat ---------- */

.chat {
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  min-width: 0;
}

.chat-header {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  font-weight: 700;
  color: var(--text-header);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.message {
  display: flex;
  gap: 16px;
  padding: 2px 16px;
}

.message:hover { background: rgba(0, 0, 0, 0.06); }

.message.first-of-group { margin-top: 16px; }

.message .avatar-slot { width: 40px; flex-shrink: 0; }

.message-body { min-width: 0; }

.message-meta { display: flex; align-items: baseline; gap: 8px; }

.message-author {
  color: var(--text-header);
  font-weight: 600;
  font-size: 15px;
}

.message-time { color: var(--text-muted); font-size: 12px; }

.message-text {
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message-form { padding: 0 16px 24px; }

#message-input {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-normal);
  font-size: 15px;
  outline: none;
}

#message-input::placeholder { color: var(--text-muted); }

/* ---------- Member list ---------- */

.members {
  background: var(--bg-darker);
  padding: 8px;
  overflow-y: auto;
}

.member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 500;
}

.member:hover { background: var(--bg-hover); color: var(--text-normal); }

.member .avatar { width: 32px; height: 32px; }

.member-avatar-wrap { position: relative; display: flex; }

.status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid var(--bg-darker);
}

.member-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Activities ---------- */

.chat-header-spacer { flex: 1; }

/* Sidebar banners, one per running session */
#activity-banners {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-banner {
  margin: 8px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-active);
}

.activity-banner-emoji { font-size: 20px; }

.activity-banner-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.activity-banner-name {
  color: var(--text-header);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-banner-count { color: var(--text-muted); font-size: 11px; }

.activity-banner-btn {
  border: none;
  border-radius: 4px;
  padding: 5px 12px;
  background: var(--blurple);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.activity-banner-btn:hover { background: var(--blurple-hover); }
.activity-banner-btn:disabled { opacity: 0.5; cursor: default; }

.activity-banner-copy { flex-shrink: 0; }
.activity-banner-copy.copied { color: var(--green); }

.activity-view-emoji { font-size: 18px; }

.activity-view-players {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

/* The standalone activity page (/a/<sessionId>) */
.activity-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-chat);
}

.activity-page-header {
  flex-shrink: 0;
  gap: 8px;
}

.ap-home { display: flex; align-items: center; }
.ap-home img { width: 26px; height: 26px; display: block; }

.ap-copy-btn {
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  background: var(--blurple);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ap-copy-btn:hover { background: var(--blurple-hover); }

.ap-status {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg-chat);
}

.ap-status-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  padding: 32px;
  border-radius: 8px;
  background: var(--bg-darker);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.ap-status-emoji { font-size: 48px; }
.ap-status-box h2 { color: var(--text-header); font-size: 20px; }
.ap-status-box p { color: var(--text-muted); font-size: 14px; }

.ap-name-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.ap-name-form input {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 4px;
  background: var(--bg-darkest);
  color: var(--text-normal);
  font-size: 16px;
  outline: none;
}

.activity-container {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.activity-container > * {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Picker modal */
.activity-picker-panel { width: min(640px, 100%); }

.activity-picker-note {
  padding: 12px 16px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.activity-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  padding: 16px;
}

.activity-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--bg-darkest);
  color: var(--text-normal);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.activity-card:hover:not(:disabled) { border-color: var(--blurple); }
.activity-card:disabled { opacity: 0.45; cursor: default; }
.activity-card.live { border-color: var(--green); }

.activity-card-emoji { font-size: 32px; }
.activity-card-name { color: var(--text-header); font-size: 15px; font-weight: 700; }
.activity-card-tagline { color: var(--text-muted); font-size: 12px; }
.activity-card-players { color: var(--text-muted); font-size: 11px; font-weight: 600; }

.activity-card-live {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.activity-card.live .activity-card-live { display: block; }

/* Shared lobby screen */
.activity-lobby {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  overflow-y: auto;
}

.activity-lobby-emoji { font-size: 56px; }
.activity-lobby-name { color: var(--text-header); font-size: 24px; }
.activity-lobby-tagline { color: var(--text-muted); font-size: 14px; }
.activity-lobby-hint { color: var(--text-muted); font-size: 12px; }

.activity-lobby-players {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
}

.activity-player-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  background: var(--bg-darker);
  font-size: 13px;
  font-weight: 500;
}

.activity-player-chip .avatar { width: 24px; height: 24px; }

.activity-start-btn {
  padding: 10px 28px;
  border: none;
  border-radius: 6px;
  background: var(--blurple);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.activity-start-btn:hover:not(:disabled) { background: var(--blurple-hover); }
.activity-start-btn:disabled { opacity: 0.5; cursor: default; }

/* Shared in-game overlay (word choices, results, podium…) */
.activity-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 8px;
}

.activity-overlay-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: min(90%, 420px);
  max-height: 90%;
  overflow-y: auto;
  padding: 20px 28px;
  border-radius: 8px;
  background: var(--bg-darker);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.activity-overlay-box h3 { color: var(--text-header); font-size: 18px; }

.activity-result-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: min(280px, 70vw);
}

.activity-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  font-size: 14px;
}

.activity-result-name {
  flex: 1;
  text-align: left;
  color: var(--text-header);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-result-value { color: var(--text-muted); }

/* ---------- Sketch Heads ---------- */

.sketch-game {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-height: 0;
}

.sketch-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}

.sketch-round { color: var(--text-muted); font-size: 13px; font-weight: 600; width: 90px; }

.sketch-word {
  flex: 1;
  text-align: center;
  color: var(--text-header);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sketch-timer { color: var(--text-muted); font-size: 16px; font-weight: 700; width: 90px; text-align: right; }

.sketch-main {
  flex: 1;
  display: flex;
  gap: 12px;
  min-height: 0;
}

.sketch-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.sketch-stage { position: relative; }

.sketch-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}

.sketch-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sketch-swatches { display: flex; gap: 4px; flex-wrap: wrap; }

.sketch-swatch {
  width: 24px;
  height: 24px;
  border: 2px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  padding: 0;
}

.sketch-swatch.selected { border-color: var(--text-header); }

.sketch-sizes { display: flex; gap: 4px; }

.sketch-size {
  width: 30px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 5px;
  background: var(--bg-darker);
  cursor: pointer;
}

.sketch-size.selected { background: var(--bg-active); outline: 2px solid var(--blurple); }

.sketch-size-dot { display: block; border-radius: 50%; background: var(--text-normal); }

.sketch-clear-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 5px;
  background: var(--bg-darker);
  color: var(--text-normal);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.sketch-clear-btn:hover { background: var(--red); color: #fff; }

.sketch-panel {
  width: 250px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.sketch-scores {
  max-height: 38%;
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-darker);
}

.sketch-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  font-size: 13px;
}

.sketch-score-row.me .sketch-score-name { color: var(--text-header); }
.sketch-score-rank { color: var(--text-muted); font-weight: 700; width: 26px; }

.sketch-score-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sketch-score-points { color: var(--text-muted); font-weight: 600; }

.sketch-chat {
  flex: 1;
  min-height: 60px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-darker);
  font-size: 13px;
}

.sketch-chat-line { padding: 2px 0; word-wrap: break-word; }
.sketch-chat-line strong { color: var(--text-header); }
.sketch-chat-line.correct { color: var(--green); font-weight: 600; }
.sketch-chat-line.system { color: var(--text-muted); font-style: italic; }

.sketch-guess-input {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-normal);
  font-size: 14px;
  outline: none;
}

.sketch-guess-input::placeholder { color: var(--text-muted); }

.sketch-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.sketch-choice-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  background: var(--blurple);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.sketch-choice-btn:hover { background: var(--blurple-hover); }

/* ---------- Curve Fever ---------- */

.curve-game {
  flex: 1;
  display: flex;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

.curve-side {
  width: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.curve-target { color: var(--text-header); font-size: 13px; font-weight: 700; }

.curve-scores {
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-darker);
  overflow-y: auto;
}

.curve-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  font-size: 13px;
}

.curve-score-row.dead { opacity: 0.45; }

.curve-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.curve-score-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.curve-score-points { color: var(--text-muted); font-weight: 600; }

.curve-hint { color: var(--text-muted); font-size: 11px; }

.curve-stage {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}

.curve-field {
  position: relative;
  width: 100%;
  max-width: min(100%, calc(100dvh - 140px));
}

.curve-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.curve-canvas-top {
  position: absolute;
  inset: 0;
  height: 100%;
  pointer-events: none;
}

.curve-msg {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-header);
  font-size: 44px;
  font-weight: 800;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  text-align: center;
}

.curve-touch {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  touch-action: none;
}

.curve-touch-left { left: 0; }
.curve-touch-right { right: 0; }

/* ---------- Type Racer ---------- */

.typerace-game {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
  overflow-y: auto;
}

.typerace-tracks { display: flex; flex-direction: column; gap: 8px; }

.typerace-track {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.typerace-track .avatar { width: 24px; height: 24px; }
.typerace-track.me .typerace-track-name { color: var(--text-header); }

.typerace-track-name {
  width: 110px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.typerace-bar {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: var(--bg-darkest);
  overflow: hidden;
}

.typerace-bar-fill {
  width: 0;
  height: 100%;
  border-radius: 5px;
  background: var(--blurple);
  transition: width 0.15s linear;
}

.typerace-track.me .typerace-bar-fill { background: var(--green); }

.typerace-track-stat { width: 90px; text-align: right; color: var(--text-muted); font-weight: 600; }

.typerace-passage {
  padding: 16px;
  border-radius: 8px;
  background: var(--bg-darker);
  font-family: "Consolas", "Menlo", monospace;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-muted);
  user-select: none;
}

.typerace-passage .done { color: var(--green); }
.typerace-passage .error { background: rgba(242, 63, 67, 0.4); border-radius: 2px; }
.typerace-passage .current { background: rgba(255, 255, 255, 0.25); border-radius: 2px; }

.typerace-input {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-normal);
  font-family: "Consolas", "Menlo", monospace;
  font-size: 16px;
  outline: none;
}

.typerace-input:disabled { opacity: 0.6; }
.typerace-status { color: var(--text-muted); font-size: 13px; font-weight: 600; }

/* Exquisite Corpse */
.corpse-game {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
}

.corpse-top {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(520px, 100%);
}

.corpse-round { color: var(--text-header); font-size: 14px; font-weight: 700; white-space: nowrap; }
.corpse-hint { color: var(--text-muted); font-size: 12px; flex: 1; }
.corpse-timer { color: var(--red); font-size: 14px; font-weight: 700; width: 44px; text-align: right; }

.corpse-stage { position: relative; width: min(520px, 100%); }

.corpse-canvas {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}

.corpse-tools { display: flex; gap: 10px; }

.corpse-tool-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-normal);
  font-size: 13px;
  cursor: pointer;
}

.corpse-tool-btn:hover:not(:disabled) { background: var(--red); color: #fff; }

.corpse-done-btn {
  padding: 8px 22px;
  border: none;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.corpse-tool-btn:disabled,
.corpse-done-btn:disabled { opacity: 0.5; cursor: default; }

.corpse-reveal {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px;
  overflow-y: auto;
}

.corpse-reveal-title { color: var(--text-header); font-size: 22px; }

.corpse-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.corpse-gallery-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.corpse-gallery-canvas {
  width: min(240px, 80vw);
  height: auto;
  border-radius: 8px;
  background: #fff;
}

.corpse-gallery-caption { color: var(--text-muted); font-size: 11px; max-width: 240px; text-align: center; }

/* Rushlings (micro RTS) */
.rts-game {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.rts-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rts-gold { color: var(--text-header); font-size: 15px; font-weight: 700; min-width: 84px; }

.rts-spawn-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: var(--blurple);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.rts-spawn-btn:hover:not(:disabled) { background: var(--blurple-hover); }
.rts-spawn-btn:disabled { opacity: 0.5; cursor: default; }

.rts-hint { color: var(--text-muted); font-size: 11px; margin-left: auto; }

.rts-main {
  flex: 1;
  display: flex;
  gap: 12px;
  min-height: 0;
}

.rts-stage { position: relative; flex: 1; min-width: 0; }

.rts-canvas {
  display: block;
  width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: #111214;
  touch-action: none;
}

.rts-scores {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rts-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--bg-secondary);
  font-size: 12px;
}

.rts-score-row.dead { opacity: 0.45; }

.rts-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.rts-score-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rts-score-info { color: var(--text-muted); white-space: nowrap; }

/* Fragfest (FPS) */
.fps-game {
  height: 100%;
  display: flex;
  gap: 12px;
  padding: 12px;
}

.fps-side {
  width: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fps-target { color: var(--text-header); font-size: 13px; font-weight: 700; }

.fps-scores {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fps-score-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--bg-secondary);
  font-size: 12px;
}

.fps-score-row.me .fps-score-name { color: var(--text-header); font-weight: 700; }

.fps-score-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fps-score-frags { color: var(--text-muted); white-space: nowrap; }

.fps-hint { color: var(--text-muted); font-size: 11px; margin-top: auto; }

.fps-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fps-canvas {
  display: block;
  width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: #000;
  image-rendering: pixelated;
  cursor: crosshair;
}

.fps-msg {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--text-header);
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.fps-feed {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-header);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.fps-feed.show { opacity: 1; }

/* Activities on narrow screens */
@media (max-width: 900px) {
  .sketch-main { flex-direction: column; overflow-y: auto; }
  .sketch-panel { width: 100%; }
  .sketch-scores { max-height: 120px; }
  .sketch-chat { min-height: 120px; }
  .curve-game { flex-direction: column-reverse; overflow-y: auto; }
  .curve-side { width: 100%; }
  .curve-hint { display: none; }
  .rts-main { flex-direction: column; overflow-y: auto; }
  .rts-scores { width: 100%; }
  .rts-hint { display: none; }
  .fps-game { flex-direction: column-reverse; overflow-y: auto; }
  .fps-side { width: 100%; }
  .fps-hint { display: none; }
}

/* Hidden outside the mobile layout */
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--bg-darkest); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* Narrowish screens: hide member list and server rail */
@media (max-width: 900px) {
  .app { grid-template-columns: 240px 1fr; }
  .server-rail, .members { display: none; }
}

/* Phones: full-width chat; the sidebar becomes a slide-in drawer
   toggled by the hamburger button in the chat header. */
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(85vw, 320px);
    z-index: 20;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.4);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle { display: flex; }

  /* 16px stops iOS from auto-zooming into focused inputs */
  #login-form input,
  #message-input,
  .sketch-guess-input,
  .typerace-input { font-size: 16px; }

  .message-form { padding-bottom: 12px; }
}
