/* ==========================================================================
   SONGLESS — Dark Studio Arcade 0.10s Music Guessing Game
   Self-hosted Bungee & Rubik fonts (zero external CDNs), mobile-first 390x844
   with iOS Safari visualViewport keyboard handling, 3-column wide desktop MP
   arena (>= 1100px), mobile ~74% bottom sheets, full 13-lang + Arabic RTL.
   ========================================================================== */

@font-face {
  font-family: 'Bungee';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/bungee-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bungee';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/bungee-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/rubik-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/rubik-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/rubik-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('assets/fonts/rubik-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font-display: 'Bungee', 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', 'PingFang SC', 'Hiragino Sans', 'Malgun Gothic', 'Noto Sans Arabic', sans-serif;
  --font-sans: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Geeza Pro', 'Noto Sans Arabic', 'Kohinoor Devanagari', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, monospace;

  --bg: #090A0D;
  --stage-bg: #111214;
  --surface: #1B1C20;
  --surface-hover: #23252B;
  --surface-deep: #141519;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);

  --ink: #F8FAFC;
  --ink-dim: #A1A9B8;
  --ink-muted: #70788A;

  --mint: #5FE08D;
  --mint-bright: #7CF0A4;
  --mint-dark: #2BB661;
  --mint-ink: #071A0E;
  --mint-soft: rgba(95, 224, 141, 0.14);
  --mint-border: rgba(95, 224, 141, 0.42);

  --warn: #F87171;
  --warn-soft: rgba(248, 113, 113, 0.15);
  --amber: #FBBF24;

  --vvh: 100dvh;
  --vv-top: 0px;
  --site-bar: var(--h5-site-bar-h, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

/* Multilingual typography safety (Arabic/Hindi zero letter-spacing, Japanese strict line-break) */
html[lang='ar'] *,
html[lang='hi'] * {
  letter-spacing: 0 !important;
}
html[lang='ja'] body {
  line-break: strict;
  word-break: keep-all;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* ==================== APP SHELL (40px Site Bar Clearance + iOS Keyboard Aware) ==================== */
.app-shell {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--vv-top) + var(--site-bar));
  height: calc(var(--vvh) - var(--site-bar));
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 0%, rgba(95, 224, 141, 0.08) 0%, var(--bg) 55%);
  overflow: hidden;
}

/* ==================== TOP STUDIO BAR ==================== */
.top-bar {
  flex: 0 0 auto;
  height: 52px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 14, 17, 0.88);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.brand-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding: 6px 4px;
  min-height: 40px;
  min-width: 0;
  flex-shrink: 1;
}

.brand-eq {
  display: inline-flex;
  align-items: center;
  gap: 2.5px;
  height: 18px;
  flex-shrink: 0;
}
.brand-eq i {
  display: block;
  width: 2.5px;
  border-radius: 2px;
  background: #525866;
  height: 7px;
}
.brand-eq i:nth-child(2),
.brand-eq i:nth-child(6) {
  height: 11px;
}
.brand-eq i.mint {
  background: var(--mint);
  height: 15px;
}
.brand-eq i:nth-child(4) {
  height: 18px;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.profile-pill {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  height: 36px;
  padding: 2px 10px 2px 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  max-width: 132px;
}
.profile-pill:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}
.profile-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  flex-shrink: 0;
}
.profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  unicode-bidi: isolate;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.icon-btn-sm {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-dim);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
}
.icon-btn-sm:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

/* ==================== STAGE & VIEWS ==================== */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
.view.active {
  display: flex;
  flex-direction: column;
}

.home-scroll,
.summary-scroll,
.lobby-scroll,
.play-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px calc(18px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}

.studio-card {
  width: 100%;
  max-width: 560px;
  background: var(--stage-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
}

/* ==================== BUTTONS ==================== */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  min-height: 46px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
}
.btn:active:not(:disabled) {
  transform: scale(0.985);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-mint {
  background: var(--mint);
  color: var(--mint-ink);
}
.btn-mint:hover:not(:disabled) {
  background: var(--mint-bright);
}

.btn-solo {
  background: var(--mint-soft);
  border-color: var(--mint-border);
  color: var(--mint);
}
.btn-solo:hover:not(:disabled) {
  background: rgba(95, 224, 141, 0.22);
}

.btn-light {
  background: #F4F6FA;
  color: #111214;
}
.btn-light:hover:not(:disabled) {
  background: #FFFFFF;
}

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

.btn-outline-mint {
  background: var(--mint-soft);
  border-color: var(--mint-border);
  color: var(--mint);
}
.btn-outline-mint:hover:not(:disabled) {
  background: rgba(95, 224, 141, 0.24);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink-dim);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.84rem;
}

.btn-full {
  width: 100%;
}

.btn-pill-ghost {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-dim);
  border-radius: 999px;
  min-height: 34px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.btn-pill-ghost:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-link-muted {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
}
.btn-link-muted:hover {
  color: var(--ink);
}

/* ==================== 1. HOME VIEW ==================== */
.home-hero {
  text-align: center;
  margin-bottom: 18px;
}

.hero-eq {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  margin-bottom: 10px;
}
.eq-b {
  width: 5px;
  border-radius: 99px;
  background: #464B57;
  animation: eqPulse 1.6s ease-in-out infinite;
}
.eq-b.mint {
  background: var(--mint);
}
.eq-b.b1 { height: 11px; animation-delay: 0s; }
.eq-b.b2 { height: 18px; animation-delay: 0.14s; }
.eq-b.b3 { height: 26px; animation-delay: 0.28s; }
.eq-b.b4 { height: 34px; animation-delay: 0.42s; }
.eq-b.b5 { height: 24px; animation-delay: 0.56s; }
.eq-b.b6 { height: 16px; animation-delay: 0.7s; }
.eq-b.b7 { height: 10px; animation-delay: 0.84s; }

@keyframes eqPulse {
  0%, 100% { transform: scaleY(0.75); }
  50% { transform: scaleY(1.1); }
}
body.reduced-motion .eq-b {
  animation: none;
}

.daily-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-dim);
  margin-bottom: 8px;
}
.pill-dot,
.mp-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
  flex-shrink: 0;
}

.hero-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.75rem, 6vw, 2.3rem);
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.hero-tagline {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.94rem;
  line-height: 1.4;
}

.home-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-cta {
  width: 100%;
  flex-direction: column;
  gap: 2px;
  padding: 12px 18px;
  border-radius: 16px;
}
.cta-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 800;
}
.cta-sub {
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.82;
}

.btn-mp-cta {
  width: 100%;
  justify-content: space-between;
  border-radius: 16px;
  padding: 12px 18px;
  text-align: start;
}
.mp-cta-left {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}
.mp-cta-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mp-cta-title {
  font-size: 0.98rem;
  font-weight: 800;
}
.mp-cta-sub {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
}
.mp-cta-arrow {
  font-size: 1.35rem;
  font-weight: 700;
  opacity: 0.65;
}
/* Non-Bidi-mirrored directional arrows (← / →) flip cleanly in RTL; › auto-mirrors natively */
html[dir='rtl'] #btn-solo-back > span:first-child,
html[dir='rtl'] #btn-lobby-solo-back > span:first-child,
html[dir='rtl'] #btn-cancel-create-room > span:first-child,
html[dir='rtl'] #btn-solo-next > span:last-child,
html[dir='rtl'] #btn-submit-create-room > span:last-child,
html[dir='rtl'] .pub-room-right > span:last-child {
  display: inline-block;
  transform: scaleX(-1);
}

.home-pool-wrap {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.home-pool-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px 7px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-deep);
  border: 1px solid var(--border);
}
.home-pool-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-dim);
  white-space: nowrap;
  flex-shrink: 0;
}
.pool-flag {
  font-size: 1.05rem;
  line-height: 1;
}
.pool-select {
  min-height: 36px;
  max-width: 220px;
  flex: 1 1 auto;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  text-overflow: ellipsis;
}
.pool-select:focus {
  outline: none;
  border-color: var(--mint);
  box-shadow: 0 0 0 2px rgba(95, 224, 141, 0.18);
}
.pool-select-full {
  max-width: none;
  width: 100%;
  min-height: 40px;
}
.pool-fallback-note {
  font-size: 0.74rem;
  color: var(--amber);
  text-align: center;
  padding: 0 6px;
}

.pool-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-dim);
  white-space: nowrap;
  max-width: 155px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pool-odometer-row {
  margin: 14px 0 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.pool-odometer {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-dim);
}
.pool-warn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--warn);
}

/* ==================== RUN OPTIONS PANEL ==================== */
.run-options-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-deep);
  overflow: hidden;
  margin-bottom: 14px;
}

.options-toggle {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  width: 100%;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: start;
}
.options-toggle-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.options-title {
  font-size: 0.92rem;
  font-weight: 700;
}
.options-summary {
  font-size: 0.78rem;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.options-chevron {
  font-size: 1rem;
  color: var(--ink-dim);
  transition: transform 0.18s ease;
}
.options-toggle[aria-expanded='true'] .options-chevron {
  transform: rotate(180deg);
}

.options-body {
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.options-pool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.genre-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-pill {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 6px 11px;
  min-height: 34px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.chip-pill:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}
.chip-pill.active {
  background: var(--mint-soft);
  border-color: var(--mint-border);
  color: var(--mint);
}
.chip-count {
  font-size: 0.74rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.options-subgrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 520px) {
  .options-subgrid {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

.options-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.artist-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  inset-inline-start: 12px;
  font-size: 0.85rem;
  opacity: 0.65;
  pointer-events: none;
}

.pill-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  outline: none;
}
.artist-search-wrap .pill-input {
  padding-inline-start: 34px;
}
.pill-input:focus {
  border-color: var(--mint);
}

.artist-listbox {
  max-height: 168px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0F1014;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.artist-opt {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-dim);
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: start;
}
.artist-opt:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}
.artist-opt.selected {
  background: var(--mint-soft);
  color: var(--mint);
  font-weight: 700;
}
.artist-opt-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Era Dual-Thumb Slider */
.era-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.era-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sub-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}
.era-val {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--mint);
}

.dual-range-wrap {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}
.dual-range-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 5px;
  border-radius: 99px;
  background: #2C3039;
}
.dual-range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 99px;
  background: var(--mint);
}
.dual-range {
  position: absolute;
  left: 0;
  width: 100%;
  margin: 0;
  appearance: none;
  background: transparent;
  pointer-events: none;
}
.dual-range::-webkit-slider-thumb {
  appearance: none;
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 3px solid var(--mint);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.dual-range::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 3px solid var(--mint);
  cursor: pointer;
}
.era-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.content-switches {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.switch-row-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}
.mini-switch {
  width: 36px;
  height: 20px;
  border-radius: 99px;
  background: #353944;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.mini-switch span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #CBD5E1;
  transition: transform 0.15s ease, background 0.15s ease;
}
.mini-switch.on {
  background: var(--mint);
}
.mini-switch.on span {
  transform: translateX(16px);
  background: var(--mint-ink);
}
html[dir='rtl'] .mini-switch.on span {
  transform: translateX(-16px);
}

/* Guest Save Progress Banner & Home Footer Stats */
.save-progress-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(95, 224, 141, 0.08);
  border: 1px solid var(--mint-border);
  margin-bottom: 14px;
}
.save-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  color: var(--ink-dim);
}
.save-banner-text strong {
  color: var(--ink);
  font-size: 0.84rem;
}
.save-progress-banner .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.home-footer-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.mini-stat-val {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--ink);
}
.mini-stat-lbl {
  font-size: 0.74rem;
  color: var(--ink-muted);
}
.mini-stat-div {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.1);
}

/* ==================== 2. SOLO PLAY VIEW ==================== */
.solo-stage-card {
  position: relative;
  overflow: visible;
}

.solo-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.stages-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.stage-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stage-seg-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.stage-seg-bar {
  width: 100%;
  height: 3.5px;
  border-radius: 99px;
  background: #272A32;
}
.stage-seg.active .stage-seg-lbl,
.stage-seg.solved .stage-seg-lbl {
  color: var(--mint);
}
.stage-seg.active .stage-seg-bar,
.stage-seg.solved .stage-seg-bar {
  background: var(--mint);
}
.stage-seg.skipped .stage-seg-bar {
  background: #5B6170;
}

.solo-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.solo-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.solo-score-readout {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--ink);
}
.solo-meta-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.solo-ratio {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-dim);
}

.worth-block {
  text-align: center;
  margin: 2px 0 12px;
}
.worth-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}
.worth-value {
  font-size: clamp(2rem, 8vw, 2.6rem);
  font-weight: 800;
  color: var(--mint);
  line-height: 1.1;
}

/* Waveform Section */
.waveform-section {
  position: relative;
  margin-bottom: 10px;
}
.waveform-box {
  position: relative;
  height: 76px;
  border-radius: var(--radius-md);
  background: #16181D;
  border: 1px solid var(--border);
  overflow: hidden;
}
.waveform-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: ew-resize;
  touch-action: none;
}
.sr-scrubber {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.waveform-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.unlocked-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--mint-soft);
  border: 1px solid var(--mint-border);
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 800;
}
.max-dur-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
}

/* 4 Quick-Jump Presets */
.preset-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.preset-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  min-height: 36px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.preset-btn:hover:not(:disabled) {
  color: var(--ink);
}
.preset-btn.passed {
  color: var(--mint);
}
.preset-btn.active {
  background: #282B33;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* Transport Controls */
.transport-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.btn-transport-play {
  flex: 1 1 58%;
  font-size: 0.96rem;
}
.btn-transport-ext {
  flex: 0 0 auto;
  min-width: 74px;
  font-family: var(--font-mono);
}
.btn-transport-skip {
  flex: 0 0 48px;
  padding: 0;
}

.audio-status {
  text-align: center;
  font-size: 0.8rem;
  color: var(--amber);
  margin-bottom: 8px;
}

/* Upward-Opening Song Search Autocomplete */
.search-wrap {
  position: relative;
  margin-bottom: 10px;
}
.search-input-row {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 40px 10px 38px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  outline: none;
}
.search-input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(95, 224, 141, 0.16);
}
.search-clear {
  position: absolute;
  inset-inline-end: 8px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.autocomplete-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  max-height: 264px;
  overflow-y: auto;
  background: #17191E;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 -14px 36px rgba(0, 0, 0, 0.72);
  padding: 6px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ac-item {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  width: 100%;
  padding: 7px 9px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: start;
  font-family: inherit;
}
.ac-item:hover,
.ac-item.highlighted {
  background: #252831;
}
.ac-item.guessed {
  opacity: 0.45;
  cursor: not-allowed;
}
.ac-thumb {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  object-fit: cover;
  background: #262933;
  flex-shrink: 0;
}
.ac-thumb-ph {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: linear-gradient(135deg, #252A36, #1B1E27);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.ac-meta {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ac-title {
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-sub {
  font-size: 0.78rem;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-alias {
  font-size: 0.72rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-hl {
  color: var(--mint);
  font-weight: 800;
}
.ac-empty {
  padding: 12px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

/* Wrong Guess Chips */
.wrong-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
}
.wrong-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--ink-muted);
}
.wrong-chip s {
  text-decoration-thickness: 1.5px;
}
.wrong-chip .same-artist-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
}
.wrong-chip .same-artist-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--amber);
}

/* ==================== DUAL REVEAL CARDS ==================== */
.reveal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}
.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  animation: confettiDrop 1.4s ease-out forwards;
}
@keyframes confettiDrop {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(280px) rotate(520deg); opacity: 0; }
}

.reveal-solved {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
}
.reveal-art-ring {
  position: relative;
  width: 118px;
  height: 118px;
  border-radius: 18px;
  box-shadow: 0 0 0 8px rgba(95, 224, 141, 0.1), 0 0 0 18px rgba(95, 224, 141, 0.04);
  margin: 6px 0 8px;
}
.reveal-art-lg {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  object-fit: cover;
  display: block;
}
.reveal-named-pill {
  position: absolute;
  bottom: -8px;
  inset-inline-end: -10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--mint-ink);
  font-size: 0.74rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.reveal-title-lg {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.25;
}
.reveal-sub-lg {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-dim);
}
.reveal-score-earned {
  font-size: 2rem;
  font-weight: 800;
  color: var(--mint);
  margin-top: 4px;
}
.reveal-solved-meta {
  font-size: 0.82rem;
  color: var(--ink-dim);
}

.reveal-skipped {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.reveal-zero {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink-muted);
}
.reveal-track-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
}
.reveal-art-sm {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.reveal-track-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reveal-track-title {
  font-size: 0.98rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reveal-track-artist {
  font-size: 0.84rem;
  color: var(--ink-dim);
}
.reveal-track-year {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-muted);
  flex-shrink: 0;
}

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

/* ==================== 3. SOLO SUMMARY VIEW ==================== */
.summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.summary-top-tags {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mode-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--mint-soft);
  border: 1px solid var(--mint-border);
  color: var(--mint);
  font-size: 0.74rem;
  font-weight: 800;
}
.summary-named {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-dim);
}
.summary-score-wrap {
  text-align: center;
  margin: 6px 0 12px;
}
.summary-score-big {
  font-size: clamp(2.3rem, 9vw, 3.1rem);
  font-weight: 800;
  color: var(--ink);
}
.summary-score-max {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-left: 6px;
}
.rank-stamp-wrap {
  text-align: center;
  margin-bottom: 14px;
}
.rank-stamp {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 999px;
  border: 2px solid var(--mint);
  background: var(--mint-soft);
  color: var(--mint);
  font-size: 0.92rem;
  font-weight: 800;
  transform: rotate(-4deg);
}
.new-best-pill {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--amber);
  margin-bottom: 8px;
}
.next-daily-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.summary-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
}
.summary-bar {
  width: 4px;
  align-self: stretch;
  border-radius: 99px;
  background: #4B5263;
  flex-shrink: 0;
}
.summary-row.solved .summary-bar {
  background: var(--mint);
}
.summary-row-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.summary-row-title {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.summary-row-sub {
  font-size: 0.78rem;
  color: var(--ink-dim);
}
.summary-row-right {
  text-align: end;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.summary-row-pts {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--ink-muted);
}
.summary-row.solved .summary-row-pts {
  color: var(--mint);
}
.summary-row-clip {
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.summary-ctas {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.summary-cta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ==================== 4. MULTIPLAYER LOBBY VIEW ==================== */
.lobby-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.online-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-dim);
}

.nickname-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.nickname-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lobby-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 8px;
}
.lobby-section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.create-room-cta {
  appearance: none;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--mint-soft);
  border: 1.5px solid var(--mint-border);
  color: var(--mint);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 14px;
}
.create-room-cta:hover {
  background: rgba(95, 224, 141, 0.22);
}
.plus-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mint);
  color: var(--mint-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
}

.join-code-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.join-code-row {
  display: flex;
  gap: 8px;
}
.code-input {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-family: var(--font-mono);
  font-weight: 800;
}

.lobby-pool-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 6px;
  scrollbar-width: none;
}
.lobby-pool-filter::-webkit-scrollbar {
  display: none;
}
.lobby-pool-filter .chip-pill {
  flex-shrink: 0;
  min-height: 30px;
  padding: 4px 10px;
  font-size: 0.76rem;
}

.public-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.public-room-card {
  appearance: none;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: start;
}
.public-room-card:hover {
  border-color: var(--mint-border);
  background: var(--surface-hover);
}
.pub-room-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pub-room-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.pub-room-name {
  font-size: 0.94rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-pool-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-dim);
  flex-shrink: 0;
  white-space: nowrap;
}
.pub-room-sub {
  font-size: 0.76rem;
  color: var(--ink-dim);
}
.room-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pub-room-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.room-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-dim);
}
.room-count-badge.live {
  background: var(--mint-soft);
  color: var(--mint);
}
.pool-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--mint);
}

.create-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.create-switches-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.visibility-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.visibility-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.vis-card {
  appearance: none;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: start;
  font-family: inherit;
  cursor: pointer;
}
.vis-card strong {
  font-size: 0.9rem;
}
.vis-card span {
  font-size: 0.75rem;
  color: var(--ink-dim);
  line-height: 1.3;
}
.vis-card.active {
  border-color: var(--mint);
  background: var(--mint-soft);
}

/* ==================== 5. MULTIPLAYER 3-COLUMN ARENA & MOBILE SHEETS ==================== */
.view-mp-arena {
  position: relative;
  padding: 8px 10px calc(10px + var(--safe-bottom));
  gap: 8px;
  overflow: hidden;
}

.mp-mobile-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 45;
}
.mp-mob-pill {
  flex: 1 1 0;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  min-height: 40px;
  border-radius: 999px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
}
.mp-mob-leave {
  flex: 0 0 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-dim);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
  display: inline-block;
}

.mp-arena-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  gap: 10px;
}

.mp-center-col {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Keep round header + live countdown above mobile bottom-sheet backdrop! */
.mp-round-bar {
  width: 100%;
  max-width: 580px;
  background: var(--stage-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  flex-shrink: 0;
  z-index: 45;
  position: relative;
}
.mp-round-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.mp-phase-label {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink);
}
.mp-timer-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--mint);
  font-family: var(--font-mono);
}
.mp-round-bar.urgent .mp-timer-val {
  color: var(--warn);
}
.mp-round-bar.reveal .mp-timer-val {
  color: var(--ink);
}

.mp-progress-track {
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.mp-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: var(--mint);
  transition: width 0.12s linear, background-color 0.2s ease;
}
.mp-round-bar.urgent .mp-progress-fill {
  background: var(--warn);
}
.mp-round-bar.reveal .mp-progress-fill {
  background: #E2E8F0;
}

.mp-stage-card {
  max-width: 580px;
  width: 100%;
}

/* Waiting / Countdown / Solved / Results subviews */
.waiting-hero,
.countdown-hero {
  text-align: center;
  padding: 24px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.waiting-hero h2 {
  margin: 0;
  font-size: 1.25rem;
}
.muted-text {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.88rem;
}
.muted-sm {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.8rem;
}
.ready-big {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--mint);
}
.ready-dots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.ready-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #333845;
}
.ready-dot.on {
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
}
.waiting-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin-top: 6px;
}
.waiting-actions .btn {
  flex: 1 1 0;
}
.waiting-code {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink-dim);
  letter-spacing: 0.1em;
}

.countdown-sub {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.countdown-big {
  font-family: var(--font-display);
  font-size: 5rem;
  color: var(--mint);
  line-height: 1;
}

.mp-solved-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--mint-soft);
  border: 1.5px solid var(--mint-border);
  margin-bottom: 12px;
}
.solved-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mint);
  color: var(--mint-ink);
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.solved-banner-copy {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.solved-banner-copy strong {
  color: var(--ink);
  font-size: 0.92rem;
}
.solved-banner-copy span {
  color: var(--mint);
  font-weight: 800;
  font-size: 1rem;
}

.mp-reveal-hero {
  margin-bottom: 10px;
}
.mp-reveal-audio-row {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.mp-results-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mp-res-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.84rem;
}
.mp-res-row.me {
  background: rgba(95, 224, 141, 0.11);
  border: 1px solid var(--mint-border);
}
.mp-res-rank {
  font-weight: 800;
  color: var(--ink-muted);
}
.mp-res-rank.top3 {
  color: var(--mint);
}
.mp-res-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-res-clip {
  font-size: 0.78rem;
  color: var(--ink-dim);
  font-family: var(--font-mono);
}
.mp-res-pts {
  font-weight: 800;
  color: var(--mint);
  font-family: var(--font-mono);
}
.mp-res-pts.zero {
  color: var(--ink-muted);
}

/* ==================== SIDE PANELS (Mobile Bottom Sheets < 1100px | 3-Col Wide >= 1100px) ==================== */
.mp-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 9, 0.65);
  z-index: 40;
}

.mp-panel {
  background: var(--stage-bg);
  border: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 73%;
  max-height: calc(var(--vvh) - var(--site-bar) - 118px);
  z-index: 50;
  transform: translateY(105%);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.65);
}
.mp-panel.sheet-open {
  transform: translateY(0);
}

.mp-panel-inner {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 12px calc(12px + var(--safe-bottom));
  gap: 8px;
}

.mp-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.mp-panel-head h2 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
}
.room-info-head {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.room-filter-sub {
  font-size: 0.74rem;
  color: var(--ink-muted);
}

/* Desktop 3-Column Wide Arena (>= 1100px) */
.desktop-only {
  display: none;
}
.mobile-only {
  display: inline-flex;
}

@media (min-width: 1100px) {
  .desktop-only {
    display: inline-flex;
  }
  .mobile-only {
    display: none !important;
  }
  .mp-mobile-bar,
  .mp-sheet-backdrop {
    display: none !important;
  }
  .mp-arena-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 260px;
    align-items: stretch;
    gap: 14px;
    padding: 6px 8px;
  }
  .mp-arena-grid.chat-collapsed {
    grid-template-columns: 42px minmax(0, 1fr) 260px;
  }
  .mp-panel {
    position: relative;
    height: auto;
    max-height: none;
    transform: none !important;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    z-index: 1;
  }
  .mp-panel-inner {
    padding: 12px;
  }
  .mp-chat-panel.collapsed {
    padding: 0;
    align-items: center;
    justify-content: center;
  }
  .mp-chat-panel.collapsed .mp-panel-inner {
    display: none;
  }
  .mp-chat-panel.collapsed .chat-collapsed-rail {
    display: flex !important;
  }
}

.chat-collapsed-rail {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  width: 100%;
  height: 100%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.chat-collapsed-rail:hover {
  background: var(--surface);
}
.rail-icon-wrap {
  position: relative;
  font-size: 1.1rem;
}
.rail-icon-wrap .unread-dot {
  position: absolute;
  top: -3px;
  right: -4px;
}

/* ==================== LIVE CHAT ROOM ==================== */
.chat-feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 2px;
}
.chat-empty {
  margin: auto 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.chat-row {
  position: relative;
  padding: 4px 28px 4px 6px;
  border-radius: 7px;
  font-size: 0.83rem;
  line-height: 1.38;
  word-break: break-word;
}
html[dir='rtl'] .chat-row {
  padding: 4px 6px 4px 28px;
}
.chat-row:hover {
  background: rgba(255, 255, 255, 0.04);
}
.chat-user {
  font-weight: 800;
  color: #FFFFFF;
  margin-inline-end: 6px;
}
.chat-user.me {
  color: var(--mint);
}
.chat-msg {
  color: var(--ink-dim);
}
.chat-row.system {
  color: var(--ink-muted);
  font-style: italic;
  font-size: 0.8rem;
  padding-inline-end: 6px;
}

.chat-react-trigger {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-dim);
  font-size: 0.78rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.chat-row:hover .chat-react-trigger,
.chat-row:focus-within .chat-react-trigger,
.chat-react-trigger.open {
  opacity: 1;
}
@media (hover: none) {
  .chat-react-trigger {
    opacity: 0.65;
  }
}

.chat-react-picker {
  display: inline-flex;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #23262E;
  border: 1px solid var(--border-strong);
  margin-top: 4px;
}
.chat-react-opt {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.92rem;
  padding: 2px 4px;
  border-radius: 6px;
}
.chat-react-opt:hover {
  background: rgba(255, 255, 255, 0.12);
}

.chat-reactions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}
.chat-react-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.chat-react-chip.mine {
  border-color: var(--mint-border);
  background: var(--mint-soft);
  color: var(--mint);
}

.chat-notice {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--warn);
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--warn-soft);
}

.chat-composer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.chat-composer:focus-within {
  border-color: var(--mint);
}
.chat-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  padding: 6px 10px;
  outline: none;
}
.chat-send-btn {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--mint);
  color: var(--mint-ink);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-send-btn:disabled {
  background: #1D3426;
  color: #4D7C5E;
  cursor: default;
}

/* ==================== LEADERBOARD & EXPANDABLE PLAYER CARDS ==================== */
.room-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.leaderboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  padding: 4px 4px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.leaderboard-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-card {
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.lb-card.me {
  background: rgba(95, 224, 141, 0.09);
  border-color: rgba(95, 224, 141, 0.28);
}
.lb-card.expanded {
  background: var(--surface);
  border-color: var(--border);
}

.lb-row-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  width: 100%;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
  text-align: start;
}
.lb-rank {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink-muted);
}
.lb-rank.top3 {
  color: var(--mint);
}
.lb-name-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lb-name {
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-status {
  font-size: 0.72rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-status.solved {
  color: var(--mint);
}
.lb-pts {
  font-size: 0.84rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--ink);
}
.lb-chev {
  font-size: 0.72rem;
  color: var(--ink-muted);
  transition: transform 0.15s ease;
}
.lb-card.expanded .lb-chev {
  transform: rotate(180deg);
}

.lb-details {
  padding: 4px 10px 10px 34px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
html[dir='rtl'] .lb-details {
  padding: 4px 34px 10px 10px;
}
.lb-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.lb-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lb-metric-k {
  font-size: 0.7rem;
  color: var(--ink-muted);
}
.lb-metric-v {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink);
}
.lb-mod-row {
  display: flex;
  gap: 6px;
}
.lb-mod-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--stage-bg);
  color: var(--ink-dim);
  border-radius: 6px;
  padding: 3px 8px;
  font-family: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}
.lb-mod-btn:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}

/* ==================== MODALS & TOAST ==================== */
.modal-backdrop {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--site-bar);
  bottom: 0;
  background: rgba(4, 5, 8, 0.72);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 90;
}

.modal-sheet {
  width: 100%;
  max-width: 440px;
  max-height: calc(var(--vvh) - var(--site-bar) - 36px);
  overflow-y: auto;
  background: var(--stage-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}
.modal-close {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-dim);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
}

.modal-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.help-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.help-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--mint-soft);
  color: var(--mint);
  font-size: 0.8rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.help-step p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-dim);
  line-height: 1.45;
}
.scoring-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--ink-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.scoring-card p {
  margin: 0;
  line-height: 1.45;
}

.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.kpi-box {
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}
.kpi-lbl {
  font-size: 0.72rem;
  color: var(--ink-muted);
}
.stat-extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.86rem;
  color: var(--ink-dim);
}
.stat-extra-row strong {
  color: var(--mint);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.setting-title {
  font-size: 0.9rem;
  font-weight: 700;
}
.setting-desc {
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.lang-select {
  min-height: 38px;
  max-width: 190px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.84rem;
  padding: 6px 10px;
}

.vol-slider {
  width: 120px;
  accent-color: var(--mint);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .slider {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: #343844;
  cursor: pointer;
  transition: background 0.16s ease;
}
.switch .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  border-radius: 50%;
  background: #E2E8F0;
  transition: transform 0.16s ease;
}
.switch input:checked + .slider {
  background: var(--mint);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
  background: var(--mint-ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: #1F232C;
  border: 1px solid var(--border-strong);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 120;
  max-width: calc(100vw - 28px);
  text-align: center;
}

/* ==================== iOS SAFARI KEYBOARD COMPACTION ==================== */
body.keyboard-open .solo-header,
body.keyboard-open .worth-block,
body.keyboard-open .preset-row {
  display: none;
}
body.keyboard-open .waveform-box {
  height: 52px;
}
body.keyboard-open .autocomplete-menu {
  max-height: 170px;
}

@media (max-width: 420px) {
  .studio-card {
    padding: 16px 14px;
  }
  .top-bar {
    padding: 0 10px;
    gap: 6px;
  }
  .brand-btn {
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
  }
  .brand-wordmark {
    white-space: nowrap;
    font-size: 0.92rem;
  }
  .top-actions {
    gap: 4px;
    flex-shrink: 0;
  }
  .profile-pill {
    padding: 3px;
    width: 34px;
    height: 34px;
    justify-content: center;
  }
  .profile-name {
    display: none;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
  }
  .stats-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
