:root {
  --bg-0: #081423;
  --bg-1: #13253a;
  --bg-2: #1a4650;
  --ink: #f4f7ff;
  --muted: #acc0d7;
  --card: rgba(11, 23, 37, 0.72);
  --card-2: rgba(24, 40, 62, 0.46);
  --card-border: rgba(255, 255, 255, 0.18);
  --accent: #ffd166;
  --accent-2: #78f0b7;
  --accent-3: #6cb7ff;
  --danger: #ff8fa3;
  --ring: rgba(120, 240, 183, 0.5);
  --grid-line: rgba(255, 255, 255, 0.03);
  --shadow-lg: 0 20px 56px rgba(0, 0, 0, 0.34);
  --heat-0: #102033;
  --heat-1: #234d64;
  --heat-2: #2b7f87;
  --heat-3: #2dc67f;
  --heat-4: #f5f18d;
}

body[data-theme="sunset"] {
  --bg-0: #2a1118;
  --bg-1: #4a1f2f;
  --bg-2: #8a4f37;
  --card: rgba(46, 20, 28, 0.74);
  --card-2: rgba(80, 33, 47, 0.48);
  --accent: #ffd39e;
  --accent-2: #ff9f91;
  --accent-3: #ffc36f;
  --ring: rgba(255, 180, 125, 0.55);
}

body[data-theme="forest"] {
  --bg-0: #0d1c17;
  --bg-1: #16302a;
  --bg-2: #235040;
  --card: rgba(14, 31, 25, 0.74);
  --card-2: rgba(28, 54, 45, 0.5);
  --accent: #c9f27f;
  --accent-2: #68f3bb;
  --accent-3: #8bd6ff;
  --ring: rgba(133, 245, 188, 0.5);
}

body[data-theme="mono"] {
  --bg-0: #141414;
  --bg-1: #232323;
  --bg-2: #2f2f2f;
  --card: rgba(24, 24, 24, 0.8);
  --card-2: rgba(36, 36, 36, 0.56);
  --accent: #f3f3f3;
  --accent-2: #cfcfcf;
  --accent-3: #a9a9a9;
  --ring: rgba(200, 200, 200, 0.45);
  --muted: #b6b6b6;
}

body[data-theme="library"] {
  --bg-0: #f4ead6;
  --bg-1: #dcc4a0;
  --bg-2: #bf9056;
  --ink: #2b1f14;
  --muted: #62503a;
  --card: rgba(253, 241, 219, 0.82);
  --card-2: rgba(245, 225, 191, 0.62);
  --card-border: rgba(80, 56, 28, 0.24);
  --accent: #7c4f21;
  --accent-2: #ab885c;
  --accent-3: #3c6979;
  --ring: rgba(124, 79, 33, 0.38);
  --grid-line: rgba(43, 31, 20, 0.09);
  --heat-0: #f2dfbf;
  --heat-1: #dfbf8f;
  --heat-2: #c99257;
  --heat-3: #9c6b39;
  --heat-4: #6a431b;
}

body[data-theme="cafe"] {
  --bg-0: #21140f;
  --bg-1: #40261c;
  --bg-2: #6a4a3b;
  --card: rgba(36, 22, 17, 0.78);
  --card-2: rgba(58, 36, 27, 0.54);
  --accent: #f6ca9a;
  --accent-2: #d49a6a;
  --accent-3: #9ec8d9;
  --ring: rgba(239, 189, 127, 0.46);
}

body[data-theme="raincabin"] {
  --bg-0: #121b24;
  --bg-1: #1f3040;
  --bg-2: #345162;
  --card: rgba(16, 27, 36, 0.76);
  --card-2: rgba(31, 47, 61, 0.52);
  --accent: #c9deff;
  --accent-2: #89b7d7;
  --accent-3: #74d2cf;
  --ring: rgba(137, 183, 215, 0.5);
}

body[data-theme="spaceship"] {
  --bg-0: #090d1e;
  --bg-1: #161f3e;
  --bg-2: #2a3a73;
  --card: rgba(10, 16, 38, 0.76);
  --card-2: rgba(25, 34, 70, 0.54);
  --accent: #b4dbff;
  --accent-2: #67ffd7;
  --accent-3: #9b7cff;
  --ring: rgba(103, 255, 215, 0.42);
}

body[data-theme="ocean"] {
  --bg-0: #071d27;
  --bg-1: #0c3748;
  --bg-2: #1f6678;
  --card: rgba(8, 31, 41, 0.78);
  --card-2: rgba(15, 56, 73, 0.52);
  --accent: #89e6ff;
  --accent-2: #72ffcb;
  --accent-3: #9cb6ff;
  --ring: rgba(114, 255, 203, 0.44);
}

body[data-theme="dawn"] {
  --bg-0: #fff1e8;
  --bg-1: #ffd8c0;
  --bg-2: #ffb690;
  --ink: #3a1f1c;
  --muted: #7a5852;
  --card: rgba(255, 244, 237, 0.84);
  --card-2: rgba(255, 224, 205, 0.62);
  --card-border: rgba(123, 80, 74, 0.22);
  --accent: #c24f2d;
  --accent-2: #ef8363;
  --accent-3: #4d6ea7;
  --ring: rgba(239, 131, 99, 0.4);
  --grid-line: rgba(58, 31, 28, 0.08);
  --heat-0: #ffe3d5;
  --heat-1: #ffc5ac;
  --heat-2: #f79974;
  --heat-3: #e06a4b;
  --heat-4: #bb442f;
}

body[data-theme="midnight"] {
  --bg-0: #07070b;
  --bg-1: #131324;
  --bg-2: #232347;
  --card: rgba(14, 14, 29, 0.8);
  --card-2: rgba(26, 26, 47, 0.56);
  --accent: #ffcf78;
  --accent-2: #8ba8ff;
  --accent-3: #f195ff;
  --ring: rgba(139, 168, 255, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "Sora", "Avenir Next", sans-serif;
  background:
    radial-gradient(circle at 8% 8%, var(--bg-2) 0%, transparent 45%),
    radial-gradient(circle at 88% 90%, var(--bg-1) 0%, transparent 52%),
    var(--bg-0);
  line-height: 1.45;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at center, black 20%, transparent 76%);
  pointer-events: none;
  opacity: 0.34;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(30px);
  pointer-events: none;
  opacity: 0.48;
}

.orb-a {
  width: 420px;
  height: 420px;
  right: -120px;
  top: -170px;
  background: linear-gradient(45deg, var(--accent), transparent);
  animation: drift 14s ease-in-out infinite alternate;
}

.orb-b {
  width: 340px;
  height: 340px;
  left: -130px;
  bottom: -120px;
  background: linear-gradient(45deg, var(--accent-2), transparent);
  animation: drift 11s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(-20px, 26px) scale(1.08);
  }
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.95rem, 4vw, 3.3rem);
  line-height: 1.08;
  letter-spacing: 0.2px;
}

h2 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1;
}

h3 {
  font-size: 1.28rem;
}

.eyebrow,
.tiny {
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.72rem;
}

.tiny {
  color: var(--muted);
  font-size: 0.74rem;
}

.muted {
  margin-top: 6px;
  color: var(--muted);
}

.brand {
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.3px;
  font-size: 1.15rem;
}

.top-nav {
  width: min(1240px, 92vw);
  margin: 20px auto 0;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}

.top-nav nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

.top-nav nav a {
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--muted);
  border: 1px solid transparent;
}

.top-nav nav a.active,
.top-nav nav a:hover {
  color: var(--ink);
  border-color: var(--card-border);
  background: rgba(255, 255, 255, 0.06);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.1);
}

.coin-chip {
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.sync-status {
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.2px;
}

.sync-status[data-mode="cloud"] {
  color: var(--accent-2);
}

.sync-status[data-mode="error"] {
  color: var(--danger);
}

.home-wrap {
  width: min(1240px, 92vw);
  margin: 14px auto 54px;
  position: relative;
  z-index: 1;
}

.home-hero {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: center;
}

.home-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.auth-card h2 {
  margin-top: 4px;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.auth-methods {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.auth-divider {
  margin-top: 12px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

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

.auth-card label.tiny {
  display: block;
  margin-top: 10px;
}

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
  margin-top: 6px;
}

.continue-wrap {
  margin-top: 14px;
  border-top: 1px dashed var(--card-border);
  padding-top: 12px;
}

.hero-pills {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.hero-pills span {
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.page-home::before {
  opacity: 0.14;
  mask-image: radial-gradient(circle at center, black 42%, transparent 92%);
}

.page-home .bg-orb {
  opacity: 0.22;
  filter: blur(44px);
}

.page-home .home-wrap {
  width: min(1080px, 92vw);
  margin: 18px auto 42px;
}

.page-home .top-nav {
  border-radius: 14px;
  padding: 10px 14px;
  background: rgba(10, 19, 31, 0.52);
  box-shadow: none;
}

.page-home .top-nav nav {
  gap: 12px;
}

.page-home .top-nav nav a {
  padding: 5px 8px;
}

.page-home .card {
  border-radius: 14px;
  padding: 16px;
  background: rgba(11, 22, 35, 0.6);
  box-shadow: none;
  backdrop-filter: blur(8px);
}

.page-home .card::before {
  display: none;
}

.page-home .home-hero {
  margin-top: 14px;
  gap: 14px;
  grid-template-columns: 1.25fr 0.75fr;
}

.page-home .home-hero h1 {
  font-size: clamp(1.95rem, 4.1vw, 3rem);
  letter-spacing: 0.1px;
}

.page-home .home-hero .muted {
  margin-top: 10px;
  max-width: 56ch;
}

.page-home .home-grid {
  margin-top: 14px;
  gap: 14px;
  grid-template-columns: 1.15fr 0.85fr;
}

.page-home .hero-pills {
  margin-top: 10px;
  gap: 6px;
}

.page-home .hero-pills span {
  padding: 5px 9px;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.03);
}

.page-home .auth-card h2 {
  margin-top: 2px;
  font-size: clamp(1.35rem, 2.8vw, 1.8rem);
}

.page-home .auth-divider {
  margin-top: 10px;
  margin-bottom: 0;
}

.page-home .auth-card label.tiny {
  margin-top: 8px;
}

.page-home .continue-wrap {
  margin-top: 12px;
  padding-top: 10px;
}

.page-home .feature-card h3 {
  margin-top: 4px;
}

.page-home .feature-card .simple-list {
  margin-top: 10px;
  gap: 7px;
}

.page-home .feature-card .simple-list li {
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.025);
}

.dashboard {
  width: min(1240px, 92vw);
  margin: 14px auto 56px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  position: relative;
  z-index: 1;
}

.card {
  position: relative;
  background:
    linear-gradient(145deg, var(--card), var(--card-2)),
    var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.card::before {
  content: "";
  position: absolute;
  left: -16%;
  right: -16%;
  top: -28%;
  height: 42%;
  pointer-events: none;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.02) 38%,
    transparent 68%
  );
}

.xp-main-card {
  grid-column: span 12;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr 0.8fr;
  align-items: center;
}

.xp-main-card h1 {
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.36);
}

.xp-mega {
  text-align: center;
}

#xp-total {
  margin-top: 2px;
  font-size: clamp(3.2rem, 8vw, 5.6rem);
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 0.95;
}

.hero-stats {
  display: grid;
  gap: 10px;
}

.hero-stats.compact {
  align-self: stretch;
}

.pill {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.xp-wrap {
  margin-top: 4px;
}

.xp-wrap.big {
  margin-top: 10px;
}

.xp-label {
  display: flex;
  justify-content: space-between;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.xp-bar,
.momentum-bar {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.24);
}

.xp-bar.big {
  height: 14px;
}

#xp-fill,
#momentum-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.34s ease;
}

.timer-card {
  grid-column: span 5;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
  align-items: center;
}

.timer-card.large {
  min-height: 250px;
}

.collab-main-card {
  grid-column: span 7;
}

.collab-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.collab-header.compact {
  align-items: flex-start;
}

.momentum-pill {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 8px 12px;
  display: grid;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.momentum-pill span {
  font-size: 0.72rem;
  color: var(--muted);
}

.collab-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 12px;
}

.collab-panel {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.rooms-unified-section {
  grid-column: span 12;
  display: grid;
  gap: 16px;
}

.rooms-timer-strip {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 16px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.rooms-collab-wrap {
  display: grid;
  gap: 12px;
}

.page-rooms .rooms-extra {
  display: none;
}

.page-rooms::before {
  opacity: 0.16;
  mask-image: radial-gradient(circle at center, black 34%, transparent 88%);
}

.page-rooms .bg-orb {
  opacity: 0.2;
  filter: blur(36px);
}

.page-rooms .dashboard {
  max-width: 1180px;
  gap: 14px;
}

.page-rooms .card {
  padding: 16px;
}

.page-rooms .xp-main-card {
  gap: 14px;
}

.page-rooms .rooms-unified-section {
  gap: 14px;
}

.page-rooms .rooms-timer-strip {
  gap: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.page-rooms .rooms-collab-wrap {
  gap: 10px;
}

.page-rooms .collab-header {
  gap: 8px;
}

.page-rooms .collab-header h3 {
  font-size: 1.38rem;
}

.page-rooms .momentum-pill {
  padding: 6px 10px;
}

.page-rooms .room-browser-panel {
  margin-top: 0;
}

.page-rooms .collab-grid {
  margin-top: 0;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}

.page-rooms .rooms-chat-stack {
  display: grid;
  gap: 10px;
}

.page-rooms .collab-panel {
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.page-rooms .room-control-panel > .tiny:first-child {
  margin-bottom: 2px;
}

.room-advanced {
  margin-top: 10px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
}

.room-advanced summary {
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.11em;
  color: var(--muted);
  text-transform: uppercase;
  list-style: none;
}

.room-advanced summary::-webkit-details-marker {
  display: none;
}

.room-advanced[open] summary {
  margin-bottom: 8px;
}

.page-rooms .quick-replies {
  margin-top: 8px;
}

.page-rooms .quick-replies .btn-row {
  margin-top: 0;
}

.page-rooms .chat-list {
  min-height: 220px;
  max-height: 220px;
}

.page-rooms .member-list {
  max-height: 220px;
  overflow: auto;
}

.page-rooms .room-meta-grid {
  margin-top: 8px;
 }

.page-rooms .pill {
  padding: 8px 10px;
}

.room-browser-panel {
  margin-top: 12px;
}

.room-browser-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.room-browser-item {
  border: 1px solid var(--card-border);
  border-radius: 11px;
  padding: 10px 11px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
}

.room-browser-item p {
  margin-top: 4px;
}

.room-browser-join {
  min-width: 88px;
}

.room-browser-empty {
  border: 1px dashed var(--card-border);
  border-radius: 11px;
  padding: 10px 11px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
}

.friend-code-row {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: end;
  justify-content: space-between;
}

.friend-code-row h3 {
  margin-top: 2px;
  font-size: 1.25rem;
  letter-spacing: 1px;
  font-family: "IBM Plex Mono", monospace;
}

.request-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.room-meta-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.third-card {
  grid-column: span 4;
}

.half-card {
  grid-column: span 6;
}

.heatmap-card {
  grid-column: span 12;
}

.reward-card {
  min-height: 365px;
}

.dashboard-home .dashboard {
  gap: 22px;
}

.dashboard-home .card {
  padding: 22px;
}

.dashboard-home .muted {
  line-height: 1.55;
}

.dashboard-home .xp-main-card {
  gap: 20px;
  grid-template-columns: 1.1fr 1fr 1fr;
}

.dashboard-home .hero-stats.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: start;
}

.dashboard-home .timer-main-card {
  grid-column: span 7;
  min-height: 280px;
}

.dashboard-home .rooms-teaser-card {
  grid-column: span 5;
  display: grid;
  gap: 14px;
  align-content: space-between;
}

.rooms-teaser-head h3 {
  margin-top: 4px;
  font-size: 1.5rem;
}

.rooms-teaser-head .muted {
  margin-top: 8px;
}

.rooms-pills {
  margin-top: 2px;
}

.rooms-teaser-footer {
  display: grid;
  gap: 10px;
}

.rooms-teaser-footer .tiny {
  font-size: 0.7rem;
}

input[type="range"] {
  margin-top: 8px;
  width: 100%;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18);
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  margin-top: 8px;
  width: 100%;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--ink);
  padding: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  font-family: "IBM Plex Mono", monospace;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--ring);
}

.switch {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.switch input {
  margin: 0;
  width: auto;
  accent-color: var(--accent-2);
}

.btn-row,
.inline-controls {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-controls > * {
  flex: 1;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, filter 0.2s ease;
}

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

.btn:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.primary {
  background: linear-gradient(90deg, var(--accent), #ffe79d);
  color: #1e1e1e;
}

.secondary {
  background: linear-gradient(90deg, var(--accent-2), #93f7ff);
  color: #0a2521;
}

.ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--ink);
}

.quest-list,
.member-list,
.mini-list,
.leaderboard-list,
.simple-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.quest-list li,
.member-list li,
.mini-list li,
.leaderboard-list li,
.simple-list li {
  border: 1px solid var(--card-border);
  border-radius: 11px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.simple-list li {
  justify-content: flex-start;
}

.quest-list li.done {
  border-color: rgba(120, 240, 183, 0.8);
  background: rgba(120, 240, 183, 0.14);
}

.quest-btn {
  font: inherit;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.badge-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.badge {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.badge.locked {
  opacity: 0.46;
}

.badge-title {
  font-weight: 700;
  font-size: 0.87rem;
}

.badge-desc {
  color: var(--muted);
  font-size: 0.74rem;
  margin-top: 3px;
}

.chat-list {
  margin-top: 10px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 8px;
  min-height: 238px;
  max-height: 238px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 7px;
}

.chat-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 7px 8px;
  background: rgba(0, 0, 0, 0.16);
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  margin-bottom: 4px;
}

.chat-text {
  font-size: 0.84rem;
}

.member-list li span,
.leaderboard-list li span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  color: var(--muted);
}

.member-list li .focus-on {
  color: var(--accent-2);
}

.stats-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.study-crate {
  width: 154px;
  height: 154px;
  margin: 8px auto 0;
  position: relative;
  animation: float-crate 5.6s ease-in-out infinite;
  transform-style: preserve-3d;
}

.study-crate.large {
  width: 188px;
  height: 188px;
}

.study-crate .face {
  position: absolute;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-size: clamp(2rem, 5vw, 2.9rem);
  font-weight: 800;
  color: #ffe8a5;
  text-shadow: 0 2px 7px rgba(0, 0, 0, 0.32);
  border: 2px solid rgba(255, 214, 171, 0.78);
  backdrop-filter: blur(2px);
}

.study-crate .front {
  width: 62%;
  height: 62%;
  left: 19%;
  top: 24%;
  background: linear-gradient(165deg, rgba(160, 56, 223, 0.8), rgba(98, 34, 181, 0.72));
  border-radius: 28px;
  z-index: 4;
}

.study-crate .side {
  width: 62%;
  height: 62%;
  left: 27%;
  top: 17%;
  background: linear-gradient(170deg, rgba(133, 36, 200, 0.6), rgba(79, 24, 147, 0.52));
  border-radius: 26px;
  color: rgba(255, 231, 171, 0.58);
  z-index: 3;
  transform: skewY(-10deg);
}

.study-crate .flap {
  color: transparent;
  border-radius: 18px;
  background: linear-gradient(170deg, rgba(184, 92, 230, 0.42), rgba(118, 41, 188, 0.24));
  border: 2px solid rgba(255, 220, 188, 0.58);
  backdrop-filter: blur(1px);
}

.study-crate .flap-a {
  width: 90%;
  height: 34%;
  left: 5%;
  top: 3%;
  transform: rotate(-12deg);
  transform-origin: 60% 100%;
  z-index: 5;
}

.study-crate .flap-b {
  width: 34%;
  height: 90%;
  left: 59%;
  top: -1%;
  transform: rotate(13deg);
  transform-origin: 0% 100%;
  z-index: 4;
}

.study-crate::before {
  content: "";
  position: absolute;
  inset: -10% -14% -16%;
  border-radius: 30px;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 18%, rgba(245, 204, 255, 0.36), transparent 58%),
    radial-gradient(circle at 70% 82%, rgba(173, 75, 217, 0.24), transparent 62%);
}

.study-crate::after {
  content: "";
  position: absolute;
  width: 55%;
  height: 58%;
  left: 20%;
  top: 27%;
  border-radius: 24px;
  border-left: 2px solid rgba(255, 234, 194, 0.36);
  border-top: 1px solid rgba(255, 234, 194, 0.24);
  pointer-events: none;
}

.page-home .study-crate {
  width: 182px;
  height: 182px;
  animation: float-crate 6.2s ease-in-out infinite;
  transform-style: flat;
}

.page-home .study-crate .side,
.page-home .study-crate .flap {
  display: none;
}

.page-home .study-crate .front {
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  border-radius: 28px;
  border: 3px solid rgba(255, 214, 171, 0.9);
  background:
    linear-gradient(150deg, rgba(184, 79, 238, 0.92), rgba(105, 41, 194, 0.9)),
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.28), transparent 58%);
  box-shadow:
    inset 0 10px 24px rgba(255, 255, 255, 0.08),
    inset 0 -16px 28px rgba(27, 8, 62, 0.34),
    0 10px 24px rgba(9, 5, 28, 0.28);
  font-size: clamp(2.3rem, 5vw, 3.2rem);
  z-index: 2;
}

.page-home .study-crate::before {
  inset: 0;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(315deg, rgba(255, 227, 153, 0.1), transparent 46%);
}

.page-home .study-crate::after {
  width: 68%;
  height: 68%;
  left: 16%;
  top: 16%;
  border-radius: 22px;
  border: 2px solid rgba(255, 238, 190, 0.34);
  border-top-color: rgba(255, 238, 190, 0.56);
  border-left-color: rgba(255, 238, 190, 0.52);
}

.study-crate.opening {
  animation: crate-open 0.76s ease forwards;
}

.study-crate.revealed {
  animation: crate-reveal 1.2s ease;
}

.crate-wrap {
  text-align: center;
}

@keyframes float-crate {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes crate-open {
  0% {
    transform: translateY(0) scale(1) rotate(0deg);
    filter: brightness(1);
  }
  35% {
    transform: translateY(-8px) scale(1.04) rotate(-3deg);
    filter: brightness(1.12);
  }
  70% {
    transform: translateY(3px) scale(0.98) rotate(2deg);
    filter: brightness(1.03);
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes crate-reveal {
  0% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-3px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.heatmap {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(28, 1fr);
  gap: 6px;
}

.heatmap-wide {
  grid-template-columns: repeat(42, 1fr);
}

.heat-cell {
  width: 100%;
  padding-top: 100%;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.heat-cell::after {
  content: attr(data-mins) "m";
  position: absolute;
  bottom: 105%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  border: 1px solid var(--card-border);
  background: rgba(6, 10, 18, 0.94);
  padding: 2px 6px;
  border-radius: 6px;
}

.heat-cell:hover::after {
  opacity: 1;
}

.heat-0 {
  background: var(--heat-0);
}

.heat-1 {
  background: var(--heat-1);
}

.heat-2 {
  background: var(--heat-2);
}

.heat-3 {
  background: var(--heat-3);
}

.heat-4 {
  background: var(--heat-4);
}

.bars {
  margin-top: 10px;
  min-height: 210px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.bars.weekly {
  min-height: 180px;
}

.bar {
  flex: 1;
  min-width: 10px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent-3));
  position: relative;
}

.bar span {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.58rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  white-space: nowrap;
}

.analytics-hero {
  grid-column: span 12;
}

.analytics-layout .half-card {
  grid-column: span 6;
}

.shop-wallet {
  grid-column: span 12;
}

.shop-layout .half-card {
  grid-column: span 6;
}

.rarity-menu {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rarity-filter.active {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px var(--ring);
}

.shop-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.shop-item {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 8px;
}

.shop-item h3 {
  font-size: 1rem;
}

.shop-cost {
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent);
  font-size: 0.82rem;
}

.rarity-common {
  border-color: rgba(255, 255, 255, 0.2);
}

.rarity-rare {
  border-color: rgba(108, 183, 255, 0.48);
}

.rarity-epic {
  border-color: rgba(170, 115, 255, 0.56);
}

.rarity-legendary {
  border-color: rgba(255, 209, 112, 0.65);
  background: linear-gradient(145deg, rgba(51, 37, 10, 0.32), rgba(20, 20, 20, 0.14));
}

.lockin-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(4, 10, 18, 0.74);
  backdrop-filter: blur(7px);
  display: grid;
  place-items: center;
  text-align: center;
}

.lockin-overlay h2 {
  font-size: clamp(3rem, 11vw, 7rem);
  margin: 8px 0;
}

.settings-panel {
  position: fixed;
  right: 14px;
  top: 78px;
  width: min(370px, calc(100vw - 28px));
  z-index: 60;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  background:
    linear-gradient(145deg, var(--card), var(--card-2)),
    var(--card);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

.settings-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.avatar-picker {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.avatar-option {
  border: 1px solid var(--card-border);
  border-radius: 11px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.avatar-option img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  display: block;
}

.avatar-option.active {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px var(--ring);
}

.cookie-banner {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(430px, calc(100vw - 32px));
  z-index: 80;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  background:
    linear-gradient(145deg, var(--card), var(--card-2)),
    var(--card);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

.cookie-banner p {
  font-size: 0.85rem;
  color: var(--muted);
}

.cookie-banner a {
  color: var(--accent-2);
}


body.focus-locked .card {
  opacity: 0.45;
  filter: saturate(0.75);
  pointer-events: none;
}

body.focus-locked .xp-main-card,
body.focus-locked .timer-card {
  opacity: 1;
  filter: none;
  pointer-events: auto;
}

.hidden {
  display: none;
}

.honeypot-input {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(5, 10, 18, 0.62);
  backdrop-filter: blur(6px);
}

.access-gate-card {
  width: min(420px, calc(100vw - 28px));
  text-align: center;
}

.legal-wrap {
  max-width: 980px;
}

.legal-hero {
  margin-top: 20px;
}

.legal-hero h1 {
  margin-bottom: 10px;
}

.legal-section {
  margin-top: 16px;
}

.legal-section h2 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.legal-section p,
.legal-section li {
  color: var(--muted);
  line-height: 1.65;
}

.legal-section ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.legal-section code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  background: rgba(10, 17, 44, 0.45);
  border: 1px solid rgba(146, 170, 255, 0.25);
  border-radius: 8px;
  padding: 2px 6px;
  color: var(--ink);
}

.legal-section a {
  color: var(--accent-2);
}

body.loadout-theme-wave .card {
  border-color: rgba(108, 183, 255, 0.42);
}

body.loadout-theme-neon .top-nav nav a.active,
body.loadout-theme-neon .btn.secondary {
  box-shadow: 0 0 0 1px rgba(157, 132, 255, 0.55), 0 0 28px rgba(157, 132, 255, 0.28);
}

body.loadout-crate-fx .study-crate::before {
  background:
    radial-gradient(circle at 30% 18%, rgba(246, 220, 255, 0.56), transparent 58%),
    radial-gradient(circle at 70% 82%, rgba(126, 247, 233, 0.34), transparent 62%);
}

body.loadout-poster .home-hero,
body.loadout-poster .analytics-hero {
  border-color: rgba(255, 209, 112, 0.45);
}

body.loadout-lamp .bg-orb.orb-a {
  opacity: 0.62;
}

body.loadout-holo .profile-avatar {
  box-shadow: 0 0 0 1px rgba(114, 255, 203, 0.55), 0 0 16px rgba(114, 255, 203, 0.3);
}

@media (max-width: 1120px) {
  .home-hero {
    grid-template-columns: 1fr;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .xp-main-card {
    grid-template-columns: 1fr;
  }

  .timer-card,
  .collab-main-card,
  .half-card,
  .third-card {
    grid-column: span 12;
  }

  .timer-card {
    grid-template-columns: 1fr;
  }

  .rooms-timer-strip {
    grid-template-columns: 1fr;
  }

  .collab-grid {
    grid-template-columns: 1fr;
  }

  .analytics-layout .half-card {
    grid-column: span 12;
  }

  .shop-layout .half-card {
    grid-column: span 12;
  }

  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .heatmap,
  .heatmap-wide {
    grid-template-columns: repeat(18, 1fr);
  }
}

@media (max-width: 760px) {
  .top-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-right {
    width: 100%;
    justify-content: center;
  }

  .nav-identity {
    flex-wrap: wrap;
    justify-content: center;
  }

  .avatar-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .room-meta-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .bars {
    min-height: 170px;
  }

  .friend-code-row {
    align-items: stretch;
    flex-direction: column;
  }

  .shop-grid {
    grid-template-columns: 1fr;
  }

  .heatmap,
  .heatmap-wide {
    grid-template-columns: repeat(12, 1fr);
  }
}
