* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  color: rgba(255, 255, 255, 0.92);
  background: radial-gradient(1200px 800px at 60% 30%, #1b0b33, #060812 55%, #02030a);
  overflow: hidden;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
}

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.topbar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  backdrop-filter: blur(10px);
  background: rgba(10, 12, 24, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 35%, #a6f, #2ef 55%, #08f);
  box-shadow: 0 0 20px rgba(144, 84, 255, 0.65), 0 0 26px rgba(46, 239, 255, 0.35);
}

.titles {
  min-width: 0;
}

.title {
  font-weight: 750;
  letter-spacing: 0.2px;
  line-height: 1.1;
}

.subtitle {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.76;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.hudBlock {
  min-width: 120px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hudLabel {
  font-size: 11px;
  opacity: 0.72;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.hudValue {
  font-size: 18px;
  font-weight: 800;
  margin-top: 2px;
}

.controls {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.pill {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  user-select: none;
}

.pill:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.pill:active {
  transform: translateY(0px) scale(0.98);
}

.pill.danger {
  border-color: rgba(255, 76, 126, 0.35);
  background: rgba(255, 76, 126, 0.12);
}

.userPillLabel {
  opacity: 0.72;
  margin-right: 6px;
  font-weight: 700;
}

.userPillName {
  font-weight: 900;
}

.goalBar {
  position: relative;
  z-index: 2;
  padding: 8px 14px 10px;
  background: rgba(10, 12, 24, 0.38);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.goalTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.goalTitle {
  font-weight: 900;
}

.goalMeta {
  font-size: 12px;
  opacity: 0.76;
  font-weight: 800;
}

.goalTrack {
  margin-top: 8px;
}

.goalFill {
  background: linear-gradient(90deg, rgba(255, 210, 92, 0.85), rgba(46, 239, 255, 0.85), rgba(217, 92, 255, 0.85));
}

.stormRow {
  margin-top: 6px;
}

.stormTitle {
  font-weight: 900;
  background: linear-gradient(90deg, rgba(255, 210, 92, 0.92), rgba(46, 239, 255, 0.92), rgba(217, 92, 255, 0.92));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stormTrack {
  margin-top: 6px;
}

.stormFill {
  background: linear-gradient(90deg, rgba(255, 210, 92, 0.85), rgba(255, 110, 40, 0.85), rgba(217, 92, 255, 0.85));
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
}

.modal[hidden] {
  display: none;
}

.modalCard {
  width: min(560px, 96vw);
  border-radius: 18px;
  padding: 14px;
  background: rgba(10, 12, 24, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.35);
}

.modalTitle {
  font-weight: 900;
  font-size: 18px;
}

.modalDesc {
  margin-top: 6px;
  opacity: 0.76;
  font-size: 13px;
  line-height: 1.25;
}

.modalRow {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.modalRow.split {
  grid-template-columns: 1fr 1fr;
}

.input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 750;
  outline: none;
}

.input:focus {
  border-color: rgba(46, 239, 255, 0.28);
  box-shadow: 0 0 0 4px rgba(46, 239, 255, 0.08);
}

.userList {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.userRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.userRow:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

.userRow:active {
  transform: translateY(0px) scale(0.99);
}

.userName {
  font-weight: 900;
}

.userMeta {
  font-size: 12px;
  opacity: 0.76;
  margin-top: 3px;
}

.userBest {
  font-weight: 900;
  opacity: 0.86;
}

.helpText {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.25;
  opacity: 0.78;
}

.helpText strong {
  opacity: 0.95;
}

.layout {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: clamp(260px, 18vw, 320px) 1fr clamp(300px, 22vw, 360px);
  grid-template-areas: "left play right";
  gap: 12px;
  padding: 12px;
}

.play {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  grid-area: play;
}

.coreWrap {
  width: min(560px, 92vw);
  display: grid;
  gap: 14px;
  justify-items: center;
}

.core {
  position: relative;
  width: min(440px, 82vw);
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 40% 55%, rgba(126, 231, 255, 0.28), rgba(0, 0, 0, 0) 55%),
    radial-gradient(circle at 65% 65%, rgba(217, 92, 255, 0.24), rgba(0, 0, 0, 0) 60%),
    rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 45px rgba(60, 140, 255, 0.22), 0 0 80px rgba(220, 60, 255, 0.12);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transform: translateZ(0);
}

.core::before {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 50%, rgba(102, 255, 249, 0.10), rgba(102, 255, 249, 0) 55%),
    radial-gradient(circle at 35% 60%, rgba(255, 109, 216, 0.10), rgba(255, 109, 216, 0) 60%);
  filter: blur(1px);
  opacity: 0.85;
  pointer-events: none;
}

.coreInner {
  position: absolute;
  inset: 16px;
  border-radius: inherit;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0) 45%),
    radial-gradient(circle at 55% 70%, rgba(0, 255, 200, 0.18), rgba(0, 0, 0, 0) 55%),
    radial-gradient(circle at 70% 45%, rgba(120, 60, 255, 0.22), rgba(0, 0, 0, 0) 60%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35);
}

.coreText {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}

.coreHint {
  font-size: 13px;
  opacity: 0.72;
  letter-spacing: 0.2px;
}

.coreValue {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 900;
  text-shadow: 0 0 16px rgba(46, 239, 255, 0.30), 0 0 20px rgba(217, 92, 255, 0.22);
}

.mini {
  width: min(440px, 82vw);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.centerDock {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.miniItem {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.miniLabel {
  font-size: 11px;
  opacity: 0.72;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.miniValue {
  font-size: 16px;
  font-weight: 850;
  margin-top: 2px;
}

.panel {
  min-width: 0;
  min-height: 0;
  border-radius: 18px;
  padding: 12px;
  background: rgba(10, 12, 24, 0.52);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.panelLeft,
.panelRight {
  display: grid;
  align-content: start;
  gap: 10px;
}

.panelLeft {
  grid-area: left;
}

.panelRight {
  grid-area: right;
}

.panelRight .cards {
  grid-template-columns: 1fr 1fr;
}

.fold {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  padding: 0 12px 12px;
}

.fold > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold[open] > summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 10px;
}

.fold > summary.panelHeader {
  padding: 10px 0 10px;
}

.fold > summary.panelHeader .panelMeta {
  opacity: 0.82;
}

.centerOverlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
}

.centerOverlay[hidden] {
  display: none;
}

.centerCard {
  width: min(740px, 96vw);
  max-height: min(80vh, 700px);
  border-radius: 18px;
  background: rgba(10, 12, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.centerHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.centerTitle {
  font-weight: 900;
}

.centerContent {
  overflow: auto;
  min-height: 0;
}

.centerHost {
  display: grid;
  gap: 10px;
}

.panelHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 2px 8px;
}

.panelTitle {
  font-weight: 850;
  letter-spacing: 0.2px;
}

.panelMeta {
  font-size: 12px;
  opacity: 0.72;
}

.cards {
  display: grid;
  gap: 10px;
}

.card {
  text-align: left;
  appearance: none;
  width: 100%;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

.card:active {
  transform: translateY(0px) scale(0.99);
}

.card:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.cardTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.cardTitle {
  font-weight: 850;
}

.cardOwned {
  font-weight: 800;
  opacity: 0.86;
}

.cardDesc {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.78;
  line-height: 1.25;
}

.cardBottom {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  opacity: 0.80;
}

.card.overclock {
  border-color: rgba(46, 239, 255, 0.20);
  background: radial-gradient(circle at 20% 10%, rgba(46, 239, 255, 0.10), rgba(0, 0, 0, 0) 50%),
    radial-gradient(circle at 80% 90%, rgba(217, 92, 255, 0.10), rgba(0, 0, 0, 0) 55%),
    rgba(255, 255, 255, 0.06);
}

.achievements {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
}

.quests,
.leaderboard {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
}

.unlocks {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
}

.labChoices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-bottom: 10px;
}

.routeChoices {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding-bottom: 10px;
}

.unlockItem {
  padding: 9px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

@media (min-width: 981px) {
  .panelLeft .unlocks {
    grid-template-columns: 1fr 1fr;
  }

  .panelLeft .unlockDesc {
    display: none;
  }
}

.unlockItem:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

.unlockItem:active {
  transform: translateY(0px) scale(0.99);
}

.unlockTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.unlockTitle {
  font-weight: 850;
}

.unlockMeta {
  font-size: 12px;
  opacity: 0.78;
  font-weight: 850;
}

.unlockDesc {
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.72;
  line-height: 1.25;
}

.unlockItem.unlocked {
  border-color: rgba(46, 239, 255, 0.16);
  background: radial-gradient(circle at 20% 10%, rgba(46, 239, 255, 0.08), rgba(0, 0, 0, 0) 55%),
    radial-gradient(circle at 90% 90%, rgba(217, 92, 255, 0.08), rgba(0, 0, 0, 0) 60%),
    rgba(255, 255, 255, 0.05);
}

.quest,
.lbRow {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
}

.questTop,
.lbTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.questTitle,
.lbTitle {
  font-weight: 800;
}

.questMeta,
.lbMeta {
  font-size: 12px;
  opacity: 0.76;
  font-weight: 750;
}

.questDesc {
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.72;
  line-height: 1.25;
}

.progressTrack {
  margin-top: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.progressFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(46, 239, 255, 0.85), rgba(217, 92, 255, 0.85));
  box-shadow: 0 0 18px rgba(46, 239, 255, 0.18), 0 0 18px rgba(217, 92, 255, 0.12);
}

.questDone .progressFill {
  background: linear-gradient(90deg, rgba(120, 255, 190, 0.85), rgba(46, 239, 255, 0.75));
}

.ach {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
}

.achDot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.ach.unlocked .achDot {
  background: radial-gradient(circle at 40% 40%, #fff, #2ef 40%, #a6f);
  box-shadow: 0 0 18px rgba(46, 239, 255, 0.38), 0 0 24px rgba(217, 92, 255, 0.25);
}

.achTitle {
  font-weight: 800;
}

.achDesc {
  font-size: 12px;
  opacity: 0.76;
  margin-top: 2px;
  line-height: 1.25;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 3;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 12, 24, 0.65);
  backdrop-filter: blur(10px);
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  #fx {
    position: fixed;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 12px;
  }

  .goalBar {
    padding: 10px 12px 12px;
  }

  .hud {
    justify-content: flex-start;
  }

  .layout {
    height: auto;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .panel {
    overflow: visible;
  }

  .panelRight .cards {
    grid-template-columns: 1fr;
  }

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

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

@media (prefers-reduced-motion: reduce) {
  .pill,
  .card {
    transition: none;
  }

  .pill:hover,
  .card:hover {
    transform: none;
  }
}
