/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f0e17;
  --surface:   #1a1a2e;
  --surface2:  #16213e;
  --accent:    #f72585;
  --accent2:   #7209b7;
  --green:     #2cb67d;
  --yellow:    #f4c542;
  --text:      #fffffe;
  --text-muted:#a0a0b0;
  --radius:    14px;
  --shadow:    0 12px 48px rgba(0,0,0,.5);

  /* Glow & gradient */
  --accent-glow:      rgba(247, 37, 133, 0.35);
  --accent2-glow:     rgba(114, 9, 183, 0.30);
  --surface-border:   rgba(255, 255, 255, 0.07);
  --primary-gradient: linear-gradient(135deg, #f72585 0%, #7209b7 100%);

  /* Spacing scale (8px base) */
  --space-1: 4px;  --space-2: 8px;   --space-3: 12px;
  --space-4: 16px; --space-5: 24px;  --space-6: 32px;
  --space-7: 48px; --space-8: 64px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ── Auth Bar ─────────────────────────────────────────────────────────────── */
#auth-bar {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--surface); border-bottom: 1px solid var(--surface-border);
  padding: .75rem 1.5rem; display: flex; align-items: center;
  justify-content: space-between; z-index: 1000; gap: 1rem;
}
#auth-bar-guest { display: flex; gap: .5rem; align-items: center; }
#auth-bar-user  { display: flex; gap: .75rem; align-items: center; }
#auth-bar-username { font-weight: 600; font-size: .95rem; }
#auth-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: none; }
#auth-avatar.visible { display: block; }
body { padding-top: 4rem; }

/* ── Screens ──────────────────────────────────────────────────────────────── */
.screen { display: none; width: 100%; max-width: 700px; }
.screen.active { display: block; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 2rem; box-shadow: var(--shadow); width: 100%;
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(2px);
}
.center-card { text-align: center; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
.splash-hero {
  width: 100%; max-width: 420px; border-radius: 14px; margin: 0 auto .5rem; display: block;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 0 24px var(--accent-glow));
}
.lobby-back-btn { margin-bottom: .5rem; }

h1 {
  font-size: 2.8rem; color: var(--accent); margin-bottom: .25rem;
  font-weight: 800; letter-spacing: 0.05em;
  text-shadow: 0 0 40px var(--accent-glow);
}
h2 { font-size: 1.8rem; margin-bottom: 1rem; }
h3 { font-size: 1.2rem; margin: 1rem 0 .5rem; color: var(--text-muted); }

.subtitle { color: rgba(255,255,254,.7); margin-bottom: 1.5rem; font-size: 1.15rem; }
.hint      { color: var(--text-muted); font-size: .9rem; margin: .4rem 0 .8rem; }

/* ── Inputs ───────────────────────────────────────────────────────────────── */
input[type="text"], input[type="password"] {
  width: 100%; background: var(--surface2);
  border: 2px solid transparent; border-radius: 8px;
  padding: .75rem 1rem; color: var(--text);
  font-size: 1rem; margin-bottom: .75rem; outline: none;
  transition: border-color .2s;
}
input[type="text"]:focus,
input[type="password"]:focus { border-color: var(--accent); }
input[type="text"]:focus-visible,
input[type="password"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; padding: .75rem 1.5rem;
  border: none; border-radius: 8px; font-size: 1rem;
  font-weight: 600; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease, opacity .2s;
}
.btn:active   { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.btn-primary {
  background: var(--primary-gradient); color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 32px var(--accent-glow);
  filter: brightness(1.1);
}
.btn-secondary { background: var(--accent2); color: #fff; }
.btn-secondary:hover:not(:disabled) {
  background: #5c0899;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--accent2-glow);
}
.btn-ghost     { background: transparent; color: var(--text-muted); border: 2px solid var(--surface2); }
.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent); color: var(--text);
  transform: translateY(-1px);
}
.btn-large     { width: 100%; padding: 1rem; font-size: 1.1rem; margin-top: .5rem; }
.btn-sm        { padding: .35rem .8rem; font-size: .85rem; }

.btn-group { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; margin-top: .5rem; }

/* Landing screen utility row */
.landing-divider {
  border: none; border-top: 1px solid var(--surface-border);
  margin: var(--space-4) 0; width: 100%;
}
.landing-utils {
  display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap;
}

.btn-mode        { background: var(--surface2); color: var(--text-muted); }
.btn-mode.active { background: var(--accent); color: #fff; }

/* ── Form Errors ──────────────────────────────────────────────────────────── */
.form-error {
  color: var(--accent); font-size: .88rem;
  margin-bottom: .5rem; min-height: 1.2em;
}

/* ── Room Code Display ────────────────────────────────────────────────────── */
.room-code-display {
  font-size: 1.5rem; font-weight: 700; color: var(--accent);
  letter-spacing: .15em; background: var(--surface2);
  padding: .6rem 1.2rem; border-radius: 8px;
  display: inline-flex; align-items: center; gap: .75rem; margin-bottom: 1rem;
}

.room-code-btns { display: inline-flex; gap: .75rem; }

@media (max-width: 480px) {
  .room-code-display { flex-direction: column; align-items: flex-start; gap: .5rem; }
}

/* ── Player List (Lobby) ──────────────────────────────────────────────────── */
.player-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.player-list li {
  background: var(--surface2); padding: .6rem 1rem;
  border-radius: 8px; display: flex; justify-content: space-between; align-items: center;
}
.player-list .host-badge {
  background: var(--accent); color: #fff;
  font-size: .7rem; padding: .2rem .5rem; border-radius: 4px; font-weight: 700;
}
.player-list .verified-badge {
  background: var(--green); color: #fff;
  font-size: .7rem; padding: .2rem .4rem; border-radius: 4px; font-weight: 700;
}
.player-list .disconnected-badge {
  background: var(--yellow); color: #000;
  font-size: .7rem; padding: .2rem .5rem; border-radius: 4px; font-weight: 700;
}
.disconnected-player { opacity: .6; }
.player-list .kick-btn {
  background: transparent; border: 1px solid #ff4466; color: #ff4466;
  border-radius: 4px; padding: .2rem .5rem; font-size: .75rem; cursor: pointer;
}

/* ── Spectator styles ─────────────────────────────────────────────────────── */
.spectator-list li { opacity: .7; }
.spectator-badge {
  font-size: .7rem; background: var(--accent2); color: #fff;
  padding: .2rem .5rem; border-radius: 4px; font-weight: 600;
}
#spectator-waiting-msg p {
  color: var(--yellow); background: var(--surface2);
  padding: .75rem 1rem; border-radius: 8px;
  border-left: 3px solid var(--yellow); font-size: .95rem;
}

/* ── Round Info & Timer ───────────────────────────────────────────────────── */
.round-info {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text-muted); font-size: .95rem; margin-bottom: 1rem;
}
.timer { font-size: 1.4rem; font-weight: 700; color: var(--yellow); min-width: 60px; text-align: right; }
.timer.urgent { color: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ── Acronym Display ──────────────────────────────────────────────────────── */
.acronym-display {
  font-size: 5rem; font-weight: 900; letter-spacing: .2em;
  color: var(--accent); text-shadow: 0 0 30px #f7258555;
  margin: 1rem 0; text-align: center;
}
.acronym-inline { font-weight: 800; color: var(--accent); letter-spacing: .1em; }
@media (max-width: 480px) {
  #sub-acronym[data-len="5"] { font-size: 4rem; }
  #sub-acronym[data-len="6"] { font-size: 3.3rem; letter-spacing: .15em; }
  #sub-acronym[data-len="7"] { font-size: 2.8rem; letter-spacing: .12em; }
}

/* ── Phrase Preview ───────────────────────────────────────────────────────── */
.phrase-preview {
  background: var(--surface2); padding: .6rem 1rem;
  border-radius: 8px; margin-bottom: .75rem; font-size: .9rem; min-height: 36px;
}
.phrase-preview .letter-ok  { color: var(--green); font-weight: 700; }
.phrase-preview .letter-bad { color: var(--accent); font-weight: 700; }
.progress-bar-container { margin-top: 1rem; color: var(--text-muted); font-size: .9rem; }

/* ── Success Box ──────────────────────────────────────────────────────────── */
.success-box {
  background: #0d3326; border: 1px solid var(--green);
  border-radius: 8px; padding: 1rem; color: var(--green); margin-top: .75rem;
}
.accepted-phrase { color: var(--text); margin-top: .5rem; font-style: italic; }

/* ── Vote List ────────────────────────────────────────────────────────────── */
.vote-list { display: flex; flex-direction: column; gap: .6rem; }
.vote-option {
  background: var(--surface2); border: 2px solid transparent;
  border-radius: 10px; padding: 1rem 1.2rem;
  cursor: pointer; font-size: 1rem; transition: border-color .2s, background .2s;
}
.vote-option:hover   { border-color: var(--accent); }
.vote-option.selected { border-color: var(--green); background: #0d3326; }

/* ── Own submission on voting screen ─────────────────────────────────────── */
.vote-option-own {
  opacity: .45; cursor: not-allowed; border-color: transparent !important;
}
.vote-option-own:hover { border-color: transparent !important; background: var(--surface2) !important; }
.vote-own-label { font-size: .8rem; color: var(--text-muted); margin-left: .5rem; }

/* ── Results ──────────────────────────────────────────────────────────────── */
.results-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.5rem; }
.result-item {
  background: var(--surface2); border-radius: 10px;
  padding: .9rem 1.2rem; display: flex; justify-content: space-between;
  align-items: flex-start; flex-wrap: wrap; gap: .4rem;
}
.result-item.winner { border-left: 4px solid var(--yellow); }
.result-meta   { font-size: .85rem; color: var(--text-muted); }
.result-voters { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }
.result-pts    { font-weight: 700; color: var(--yellow); white-space: nowrap; }

/* ── Leaderboard ──────────────────────────────────────────────────────────── */
.leaderboard { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.lb-row {
  background: var(--surface2); border-radius: 8px;
  padding: .6rem 1rem; display: flex; justify-content: space-between;
}
.lb-row .lb-rank  { color: var(--text-muted); width: 30px; }
.lb-row .lb-score { font-weight: 700; color: var(--accent); }
.lb-row.first-place { border-left: 4px solid var(--yellow); }
.next-round-msg {
  text-align: center; color: var(--text-muted); font-size: .9rem;
  margin-top: .75rem; animation: pulse 1.5s infinite;
}

/* ── Global Leaderboard Table ─────────────────────────────────────────────── */
.lb-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.lb-table th { color: var(--text-muted); font-weight: 600; padding: .5rem .75rem; text-align: left; border-bottom: 1px solid var(--surface2); }
.lb-table td { padding: .6rem .75rem; border-bottom: 1px solid var(--surface2); }
.lb-table tr:last-child td { border-bottom: none; }
.lb-acronym { font-weight: 800; color: var(--accent); letter-spacing: .1em; }
.lb-phrase  { font-style: italic; color: var(--text-muted); }
.lb-player  { font-weight: 600; }
.lb-points  { color: var(--yellow); font-weight: 700; }
.loading-msg { text-align: center; color: var(--text-muted); padding: 2rem; }

/* ── Stats ────────────────────────────────────────────────────────────────── */
#stats-content {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-top: 1rem;
}
.stat-card {
  background: var(--surface2); border-radius: 10px; padding: 1.2rem;
  text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 900; color: var(--accent); }
.stat-label { font-size: .85rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Rejoin Modal ─────────────────────────────────────────────────────────── */
#rejoin-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
}
#rejoin-modal.hidden { display: none; }
#rejoin-modal .card  { max-width: 400px; text-align: center; }
#rejoin-details { color: var(--text-muted); margin: 1rem 0; line-height: 1.8; }
#rejoin-details span { color: var(--text); font-weight: 600; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--accent2);
  color: var(--text); padding: .75rem 1.5rem; border-radius: 8px;
  box-shadow: var(--shadow); z-index: 9999; font-size: .95rem; transition: opacity .3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Google Button ────────────────────────────────────────────────────────── */
.btn-google {
  background: #fff; color: #444; border: 1px solid #ddd;
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: .9rem;
}
.btn-google:hover { background: #f5f5f5; border-color: #bbb; }
.google-icon { width: 18px; height: 18px; object-fit: contain; }

/* ── Auth Bar ─────────────────────────────────────────────────────────────── */
.auth-bar { display: flex; align-items: center; gap: .75rem; }
.auth-bar-name { font-weight: 600; font-size: .95rem; }
.auth-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
/* Chip-style buttons in the logged-in auth bar */
#auth-bar-user .btn-ghost {
  background: var(--surface2);
  font-size: .82rem;
}

/* ── Full-width button variant ────────────────────────────────────────────── */
.btn-full { width: 100%; justify-content: center; margin-bottom: .5rem; }

/* ── Room Settings Panel ─────────────────────────────────────────────────── */
#room-settings {
  margin-top: 1.5rem;
  border-top: 1px solid var(--surface2);
  padding-top: 1rem;
}
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .75rem; gap: 1rem; flex-wrap: wrap;
}
.setting-row label { color: var(--text-muted); font-size: .9rem; flex-shrink: 0; }
.setting-row .btn-group { margin-top: 0; }
.hint-inline { font-size: .78rem; color: var(--text-muted); font-style: italic; }

/* ── Lobby Auto-Start Timer ──────────────────────────────────────────────── */
#lobby-timer {
  text-align: center; margin-top: 1rem;
  padding: .75rem 1rem; background: var(--surface2); border-radius: 8px;
  border-left: 3px solid var(--yellow);
}
.lobby-timer-countdown {
  font-size: 2.2rem; font-weight: 900; color: var(--yellow);
}
.lobby-timer-label { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Chat Panel ──────────────────────────────────────────────────────────── */
#chat-panel {
  position: fixed; bottom: 0; right: 1.5rem; width: 300px;
  background: var(--surface); border: 1px solid var(--surface2);
  border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow); z-index: 900; display: flex; flex-direction: column;
}
#chat-panel.hidden { display: none; }
#chat-panel.collapsed #chat-messages,
#chat-panel.collapsed #chat-input-row { display: none; }

#chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .75rem; background: var(--surface2);
  border-radius: var(--radius) var(--radius) 0 0; cursor: pointer;
  font-weight: 600; font-size: .9rem; user-select: none;
}
#chat-toggle {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: .9rem; padding: 0 .25rem;
}
#chat-unread {
  background: var(--accent); color: #fff;
  font-size: .7rem; padding: .15rem .4rem; border-radius: 10px;
  font-weight: 700; min-width: 18px; text-align: center;
}

#chat-messages {
  height: 260px; overflow-y: auto; padding: .5rem .75rem;
  display: flex; flex-direction: column; gap: .3rem;
}
.chat-msg { font-size: .85rem; line-height: 1.4; word-break: break-word; }
.chat-msg-name { font-weight: 700; color: var(--accent); margin-right: .3rem; }
.chat-msg-text { color: var(--text); }

#chat-input-row {
  display: flex; gap: .4rem; padding: .5rem .75rem;
  border-top: 1px solid var(--surface2);
}
#chat-input {
  flex: 1; margin-bottom: 0; padding: .4rem .6rem;
  font-size: .85rem; background: var(--surface2);
  border: 1px solid transparent; border-radius: 6px; color: var(--text);
}
#chat-input:focus { outline: none; border-color: var(--accent); }

/* ── Setting Tooltips ────────────────────────────────────────────────────── */
.setting-tip {
  position: relative; display: inline-flex; align-items: center;
  justify-content: center; width: 16px; height: 16px;
  border-radius: 50%; background: var(--surface2); border: 1px solid var(--text-muted);
  color: var(--text-muted); font-size: .65rem; font-weight: 700;
  cursor: default; vertical-align: middle; margin-left: .3rem;
  line-height: 1; font-style: normal; user-select: none;
  transition: border-color .15s, color .15s;
}
.setting-tip:hover {
  border-color: var(--accent); color: var(--accent);
}
.setting-tip-text {
  display: none;
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  width: 220px; padding: .5rem .7rem;
  background: var(--surface); border: 1px solid var(--surface2);
  border-radius: 8px; box-shadow: var(--shadow);
  font-size: .8rem; color: var(--text); font-weight: 400;
  line-height: 1.4; white-space: normal; z-index: 950;
  pointer-events: none; text-align: left;
}
.setting-tip:hover .setting-tip-text { display: block; }

/* ── Shop Screen ─────────────────────────────────────────────── */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.shop-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  border: 2px solid transparent;
  transition: border-color .2s;
  position: relative;
}
.shop-card:hover { border-color: var(--accent2); }
.shop-card.equipped { border-color: var(--green); }
.shop-card.previewing {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.shop-card.previewing::after {
  content: 'Previewing';
  position: absolute;
  top: .5rem;
  left: .5rem;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: .05em;
}

.shop-card-type {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  font-weight: 700;
}
.shop-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.shop-card-desc {
  font-size: .82rem;
  color: var(--text-muted);
  flex: 1;
}
.shop-card-price {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--yellow);
}
.shop-card-price.free { color: var(--green); }

.shop-card-preview {
  width: 100%;
  height: 80px;
  background: var(--bg);
  border-radius: 8px;
  object-fit: cover;
}
.shop-card-preview-placeholder {
  width: 100%;
  height: 80px;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
}

.shop-card-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.badge-owned {
  background: var(--accent2);
  color: #fff;
  font-size: .7rem;
  padding: .2rem .5rem;
  border-radius: 4px;
  font-weight: 700;
  position: absolute;
  top: .75rem;
  right: .75rem;
}
.badge-equipped {
  background: var(--green);
  color: #fff;
  font-size: .7rem;
  padding: .2rem .5rem;
  border-radius: 4px;
  font-weight: 700;
  position: absolute;
  top: .75rem;
  right: .75rem;
}

.shop-section-label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  font-weight: 700;
  margin: 1.5rem 0 .5rem;
  border-bottom: 1px solid var(--surface2);
  padding-bottom: .4rem;
}
.shop-login-prompt {
  color: var(--text-muted);
  font-size: .95rem;
  margin-top: 1rem;
}

/* ── Public Rooms ─────────────────────────────────────────────── */
#public-rooms-section {
  margin-top: 1.5rem;
  width: 100%;
  max-width: 480px;
  text-align: left;
}
.public-rooms-heading {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: .5rem;
}
.public-rooms-empty { opacity: .5; font-size: .9rem; text-align: center; }
.public-room-card {
  background: var(--surface2);
  border: 1px solid var(--surface-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: transform .15s ease, box-shadow .15s ease;
}
.public-room-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.prc-meta { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.prc-code { font-weight: 700; letter-spacing: .1em; color: var(--accent); font-size: 1.1rem; }
.prc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.prc-tag  { background: var(--surface); border-radius: 4px; padding: 2px 8px; font-size: .75rem; color: var(--text-muted); }
.prc-tag--mode { color: var(--accent2); }
.prc-players { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }

/* Legacy room-info classes (unused after card redesign but kept for safety) */
.room-info { flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.room-host  { font-weight: 600; font-size: .95rem; }
.room-meta  { font-size: .8rem; opacity: .65; }
.mode-badge {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  padding: .2em .5em; border-radius: 4px; white-space: nowrap;
}
.mode-clean   { background: #2d6a2d; color: #a8f0a8; }
.mode-rated   { background: #6a2d2d; color: #f0a8a8; }
.mode-anything{ background: #4a3a6a; color: #d0c0f0; }

/* ── How to Play Modal ──────────────────────────────────────── */
#how-to-play-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 1rem;
}
#how-to-play-modal.hidden { display: none; }
.htp-card { max-width: 480px; width: 100%; text-align: left; max-height: 90vh; overflow-y: auto; }
.htp-lobby-btn { display: block; margin: -.25rem auto .75rem; }
.htp-steps { padding-left: 1.25rem; line-height: 1.9; margin: .75rem 0 1rem; }
.htp-steps li { margin-bottom: .2rem; }
.htp-letters { font-family: monospace; font-weight: 700; font-size: 1.05em; color: var(--accent); }
.htp-example {
  background: var(--surface2, rgba(255,255,255,.06));
  border-radius: 8px; padding: 1rem 1.1rem; margin: 1rem 0;
}
.htp-example-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  opacity: .5; margin-bottom: .5rem;
}
.htp-acronym {
  font-size: 1.5rem; font-weight: 800; letter-spacing: .12em;
  color: var(--accent); margin-bottom: .6rem;
}
.htp-phrase-list { list-style: none; padding: 0; margin: 0; }
.htp-phrase-list li { font-size: .9rem; line-height: 1.9; opacity: .85; }
.htp-scoring { display: flex; flex-direction: column; gap: .4rem; }
.htp-score-item { display: flex; align-items: center; gap: .55rem; font-size: .9rem; }
.htp-pts {
  background: var(--accent); color: #000;
  font-weight: 800; font-size: .72rem;
  padding: .15em .5em; border-radius: 4px; white-space: nowrap;
}

/* ── Profile Screen ─────────────────────────────────────── */
.profile-header {
  display: flex; align-items: center; gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.profile-avatar-wrap {
  position: relative; flex-shrink: 0;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--accent);
  background: var(--surface2, rgba(255,255,255,.06));
}
.profile-avatar-upload-btn {
  position: absolute; bottom: 0; right: 0;
  background: var(--accent); color: #000;
  border-radius: 50%; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; cursor: pointer;
}
.profile-header-info {
  display: flex; flex-direction: column; gap: .25rem;
}
.profile-username {
  font-size: 1.35rem; font-weight: 800; color: var(--text);
}
.profile-member-since {
  font-size: .82rem; opacity: .55;
}
.profile-auth-badge {
  font-size: .78rem; opacity: .65;
}
.profile-section {
  margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.profile-section h3 { margin: 0 0 .85rem; font-size: 1rem; opacity: .75; }
.profile-form {
  display: flex; flex-direction: column; gap: .6rem;
}
.profile-history {
  display: flex; flex-direction: column; gap: .4rem;
}
.round-history-item {
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface2, rgba(255,255,255,.06));
  border-radius: 8px; padding: .55rem .85rem; font-size: .88rem;
}
.rh-acronym {
  font-weight: 800; color: var(--accent);
  min-width: 60px; letter-spacing: .05em;
}
.rh-phrase { flex: 1; opacity: .9; }
.rh-points { font-weight: 700; color: var(--accent2, #f4c542); white-space: nowrap; }

/* ── Privacy link ───────────────────────────────────────── */
.privacy-link {
  display: block; margin-top: .75rem;
  font-size: .72rem; opacity: .4; color: inherit; text-decoration: none;
}
.privacy-link:hover { opacity: .7; }

/* ── Report / Generic Modal ─────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--surface, #1a1a2e);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 1.5rem;
  min-width: 280px; max-width: 380px; width: 90%;
  display: flex; flex-direction: column; gap: .85rem;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.modal-box h3 { font-size: 1.15rem; margin: 0; }
.modal-target-name { font-size: .9rem; opacity: .75; margin: 0; }
.modal-box select {
  width: 100%; padding: .55rem .75rem;
  background: var(--bg, #0d0d1a); color: var(--text, #fffffe);
  border: 1px solid rgba(255,255,255,.15); border-radius: 8px;
  font-size: .9rem;
}
.modal-actions {
  display: flex; gap: .6rem; justify-content: flex-end;
}
/* ── Report flag buttons ────────────────────────────────── */
.report-btn {
  background: none; border: none; cursor: pointer;
  font-size: .85rem; opacity: .4; padding: 0 .25rem;
  transition: opacity .15s;
  vertical-align: middle; line-height: 1;
}
.report-btn:hover { opacity: 1; }
.report-btn-small {
  background: none; border: none; cursor: pointer;
  font-size: .75rem; opacity: .35; padding: 0 .2rem;
  margin-left: .4rem; transition: opacity .15s;
  vertical-align: middle; line-height: 1; flex-shrink: 0;
}
.report-btn-small:hover { opacity: 1; }
/* ── Chat timestamp ─────────────────────────────────────── */
.chat-msg-time {
  font-size: .72rem; opacity: .45; margin-right: .35rem;
  font-variant-numeric: tabular-nums;
}
