:root {
  --bg: #000000;
  --surface: #020b12;
  --surface-soft: #061822;
  --blue: #31d7ff;
  --blue-strong: #1aa7ff;
  --purple: #8f63ff;
  --text: #f4fbff;
  --muted: #a9c4d8;
  --line: rgba(49, 215, 255, 0.22);
  --line-strong: rgba(49, 215, 255, 0.38);
  --track: #102230;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.36);
  --radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  min-height: 100svh;
  color: var(--text);
  background: var(--bg);
  font-family: Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  text-rendering: geometricPrecision;
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.85rem, 3vw, 2.4rem);
  min-height: 64px;
  padding: calc(0.45rem + env(safe-area-inset-top)) clamp(1rem, 2vw, 1.35rem) 0.45rem;
  border-bottom: 1px solid #dde3ee;
  background: #ffffff;
}

.brand-mark {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
  justify-self: start;
}

.brand-logo {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 0.3rem;
}

.brand-logo img {
  display: block;
  width: 150%;
  height: 150%;
  object-fit: contain;
  transform: translateY(-14%);
  transform-origin: center center;
}

.brand-copy {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 0.46rem;
  transform: translateY(-0.06rem);
}

.brand-title {
  color: #111827;
  font-size: clamp(1.2rem, 1.55vw, 1.48rem);
  font-weight: 700;
  line-height: 1.08;
  white-space: nowrap;
}

.brand-title strong {
  color: #4f62ff;
  font-weight: 500;
}

.header-metric.brand-credits span:last-child {
  display: flex;
  align-items: baseline;
  gap: 0.24rem;
  color: #4b5570;
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.05;
}

.header-metric strong,
.header-metric.brand-credits strong {
  color: #155df5;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.user-info {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
  justify-content: center;
  justify-self: stretch;
  max-width: min(28rem, 100%);
  overflow: hidden;
  color: #111827;
  font-size: 0.94rem;
  font-weight: 650;
}

.user-info span:last-child,
.user-info strong {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-icon {
  display: inline-grid;
  width: 1.48rem;
  height: 1.48rem;
  flex: 0 0 auto;
  place-items: center;
}

.metric-icon svg,
.menu-btn svg,
.action-icon svg,
.action-link svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-menu {
  position: relative;
  justify-self: end;
}

.menu-btn {
  position: relative;
  display: grid;
  width: 2.7rem;
  min-height: 2.78rem;
  border: 0;
  border-radius: 0.35rem;
  place-items: center;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
}

.menu-btn svg {
  display: block;
  width: 1.65rem;
  height: 1.65rem;
  stroke-width: 2.4;
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 40;
  display: none;
  min-width: 160px;
  overflow: hidden;
  border: 1px solid #dde3ee;
  border-radius: 0.65rem;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.08);
}

.menu-dropdown.show {
  display: block;
}

.menu-dropdown a,
.menu-dropdown button {
  display: block;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 0;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
}

.menu-dropdown a[aria-current="page"] {
  color: var(--blue-strong);
}

.menu-dropdown a:hover,
.menu-dropdown button:hover {
  background: #f2f5fb;
}

.home-container {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 2.4vw, 1.9rem) clamp(1rem, 2.8vw, 2.3rem) 2.5rem;
}

.welcome-panel,
.overview-panel,
.action-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(2, 11, 18, 0.96);
  box-shadow: var(--shadow);
}

.signed-out-panel {
  display: grid;
  position: fixed;
  inset: 0;
  width: 100%;
  min-height: 100svh;
  margin: 0;
  align-items: center;
  justify-items: center;
  padding: clamp(1rem, 2.8vw, 2.3rem);
  text-align: center;
}

.signed-out-logo {
  width: min(18.72rem, 83.52vw);
}

.primary-link,
.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  border: 1.5px solid var(--blue);
  border-radius: var(--radius);
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.primary-link {
  position: fixed;
  top: calc(1.1rem + env(safe-area-inset-top));
  right: clamp(1rem, 2.8vw, 2.3rem);
  min-width: 10rem;
  padding: 0 1.25rem;
}

.primary-link:hover,
.action-link:hover {
  background: rgba(49, 215, 255, 0.12);
}

.dashboard-view {
  display: grid;
  gap: clamp(1rem, 2vw, 1.35rem);
}

.welcome-panel,
.overview-panel {
  display: grid;
  gap: clamp(1.4rem, 2.4vw, 2rem);
  padding: clamp(1.4rem, 2.8vw, 2.2rem);
}

.welcome-copy {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 0.45rem;
  text-align: center;
}

.welcome-copy h1 {
  color: var(--text);
  font-size: clamp(1.55rem, 2.6vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.welcome-copy p {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.overview-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: 1fr;
  gap: clamp(1rem, 2vw, 1.6rem);
  align-items: stretch;
}

.action-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--blue);
  border-radius: 50%;
  color: var(--blue);
}

.levels-card {
  display: grid;
  align-content: start;
  gap: 0.8rem;
  min-width: 0;
}

.levels-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.levels-head h2,
.action-card h2 {
  color: var(--text);
  font-size: clamp(1.02rem, 1.45vw, 1.22rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.levels-head h2 {
  color: var(--blue);
}

.levels-head span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.level-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.65rem, 1.4vw, 0.9rem);
}

.level-tile {
  display: grid;
  min-height: 12rem;
  justify-items: center;
  align-content: center;
  gap: 0.75rem;
  padding: 1rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(6, 24, 34, 0.74);
}

.level-tile h3 {
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: 0;
}

.level-donut {
  display: grid;
  width: 4.35rem;
  height: 4.35rem;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 0%, var(--track) 0% 100%);
}

.level-donut::after {
  content: "";
  width: 3.18rem;
  height: 3.18rem;
  border-radius: 50%;
  background: var(--surface);
}

.level-percent {
  color: var(--text);
  font-size: 1.38rem;
  font-weight: 820;
  line-height: 1;
}

.level-tile.active .level-percent {
  color: var(--blue);
}

.level-meta {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
}

.action-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.35rem);
}

.action-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem 1.45rem;
  min-height: 13.8rem;
  align-items: center;
  padding: clamp(1.2rem, 2.5vw, 2rem);
  border-color: var(--line-strong);
}

.action-card > div {
  min-width: 0;
}

.action-icon {
  width: 5.2rem;
  height: 5.2rem;
}

.action-icon.purple {
  border-color: var(--purple);
  color: var(--purple);
}

.action-icon svg {
  width: 2.35rem;
  height: 2.35rem;
}

.action-card p {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.45vw, 1.18rem);
  line-height: 1.35;
  font-weight: 600;
}

.action-balance {
  display: block;
  max-width: 100%;
  margin-top: 0.62rem;
  color: var(--blue);
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  font-weight: 820;
  line-height: 1;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-link {
  grid-column: 1 / -1;
  gap: 0.7rem;
  width: 100%;
  min-height: 3.25rem;
  font-size: clamp(0.98rem, 1.5vw, 1.16rem);
}

.action-link svg {
  width: 1.2rem;
  height: 1.2rem;
  stroke-width: 2.4;
}

@media (max-width: 1180px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .level-tile {
    min-height: 10.5rem;
  }
}

@media (max-width: 900px) {
  .level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .action-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .top-bar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.55rem;
    min-height: auto;
    padding: calc(0.5rem + env(safe-area-inset-top)) 0.8rem 0.5rem;
  }

  .brand-mark {
    width: min(13rem, 43vw);
    max-width: 43vw;
    gap: 0.5rem;
    overflow: hidden;
  }

  .brand-logo {
    width: 2rem;
    height: 2rem;
  }

  .brand-copy {
    gap: 0.34rem;
    overflow: hidden;
  }

  .brand-title {
    font-size: 1.02rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-metric.brand-credits span:last-child {
    font-size: 0.68rem;
  }

  .header-metric.brand-credits strong {
    font-size: 0.76rem;
  }

  .user-info {
    justify-self: center;
    gap: 0.3rem;
    max-width: 10.6rem;
    padding-left: 0;
    font-size: 0.74rem;
  }

  .metric-icon {
    width: 1.25rem;
    height: 1.25rem;
  }

  .menu-btn {
    width: 2.2rem;
    min-height: 2.2rem;
    font-size: 1.55rem;
  }

  .welcome-panel,
  .overview-panel,
  .action-card {
    padding: 1rem;
  }

  .levels-head {
    display: grid;
    gap: 0.3rem;
  }

  .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .level-tile {
    min-height: 8rem;
    gap: 0.55rem;
    padding: 0.85rem;
  }

  .level-donut {
    width: 3.55rem;
    height: 3.55rem;
  }

  .level-donut::after {
    width: 2.56rem;
    height: 2.56rem;
  }

  .action-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem 1rem;
    justify-items: start;
    min-height: 0;
  }
}

@media (max-width: 480px) {
  .top-bar {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.5rem;
    padding-right: 0.65rem;
    padding-left: 0.65rem;
  }

  .primary-link {
    top: calc(0.85rem + env(safe-area-inset-top));
    right: 0.85rem;
    min-width: 7.75rem;
    min-height: 2.55rem;
    padding: 0 1rem;
  }

  .brand-mark {
    width: min(10rem, 42vw);
    max-width: 42vw;
  }

  .brand-logo {
    width: 1.9rem;
    height: 1.9rem;
  }

  .brand-title {
    font-size: 0.94rem;
  }

  .brand-copy {
    gap: 0.3rem;
  }

  .user-info {
    justify-self: end;
    gap: 0.24rem;
    max-width: 8.8rem;
    font-size: 0.7rem;
  }

  .metric-icon {
    width: 1rem;
    height: 1rem;
  }

  .header-metric.brand-credits span:last-child {
    font-size: 0.62rem;
  }

  .header-metric.brand-credits strong,
  .header-metric strong {
    font-size: 0.72rem;
  }

  .home-container {
    padding: 0.9rem 0.72rem 1.6rem;
  }

  .welcome-copy h1 {
    font-size: 1.34rem;
  }

  .level-grid {
    grid-template-columns: 1fr;
  }

  .level-tile {
    grid-template-columns: 3.4rem minmax(0, 1fr) auto;
    min-height: 4.9rem;
    justify-items: start;
    align-content: center;
    text-align: left;
  }

  .level-donut {
    width: 3.1rem;
    height: 3.1rem;
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .level-donut::after {
    width: 2.22rem;
    height: 2.22rem;
  }

  .level-tile h3 {
    grid-column: 2;
    font-size: 1rem;
  }

  .level-percent {
    grid-column: 3;
    grid-row: 1 / 3;
    justify-self: end;
    font-size: 1.12rem;
  }

  .level-meta {
    grid-column: 2;
  }

  .action-icon {
    width: 3.55rem;
    height: 3.55rem;
  }

  .action-icon svg {
    width: 1.7rem;
    height: 1.7rem;
  }
}
