:root {
  --background: hsl(240 10% 4%);
  --foreground: hsl(240 5% 90%);
  --card: hsl(240 8% 7%);
  --card-2: hsl(240 7% 8.5%);
  --border: hsl(240 6% 14%);
  --muted: hsl(240 5% 45%);
  --muted-2: hsl(240 5% 62%);
  --gold: hsl(45 80% 52%);
  --emerald: #34d399;
  --sky: #38bdf8;
  --amber: #fbbf24;
  --yellow: #facc15;
  --orange: #fb923c;
  --purple: #c084fc;
  --danger: #f87171;
  --radius: 0.5rem;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(circle at 20% -5%, rgba(251, 191, 36, 0.1), transparent 38%),
    radial-gradient(circle at 90% -15%, rgba(56, 189, 248, 0.08), transparent 42%),
    var(--background);
  color: var(--foreground);
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

.aura {
  position: fixed;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  filter: blur(84px);
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}

.aura-left {
  background: #1f3c66;
  left: -9rem;
  top: -9rem;
}

.aura-right {
  background: #845914;
  right: -10rem;
  bottom: -10rem;
}

.shell {
  width: min(64rem, 100%);
  margin: 1.5rem 1.5rem 3rem;
  position: relative;
  z-index: 1;
  justify-self: start;
}

.app-layout {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 16rem;
  height: 100vh;
  background: hsl(240 8% 7%);
  border-right: 1px solid hsl(240 6% 14%);
  display: flex;
  flex-direction: column;
  z-index: 3;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.brand-mark {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: hsl(45 80% 52%);
  color: hsl(240 10% 4%);
  font-weight: 800;
}

.brand-mark svg {
  width: 0.95rem;
  height: 0.95rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-top {
  padding: 1.5rem 1.5rem;
  border-bottom: 1px solid hsl(240 6% 14%);
}

.brand-kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand h2 {
  margin: 0.06rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav {
  flex: 1;
  display: grid;
  gap: 0.32rem;
  padding: 1rem 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.52rem;
  position: relative;
  text-decoration: none;
  color: var(--muted-2);
  padding: 0.5rem 0.62rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: calc(var(--radius) - 1px);
  border: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.nav-item:hover {
  border-color: var(--border);
  color: var(--foreground);
  background: hsl(240 7% 10%);
}

.nav-item svg {
  width: 0.9rem;
  height: 0.9rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.active {
  border-color: hsla(45, 80%, 52%, 0.25);
  color: var(--gold);
  background: hsla(45, 80%, 52%, 0.08);
  box-shadow: 0 0 0 1px hsla(45, 80%, 52%, 0.06), 0 0 18px -12px hsla(45, 80%, 52%, 0.55);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -0.6rem;
  top: 0.34rem;
  bottom: 0.34rem;
  width: 3px;
  border-radius: 999px;
  background: var(--gold);
}

.side-panel {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 1px);
  background: hsl(240 8% 6%);
  padding: 0.72rem;
  margin: 0 0.75rem 0.75rem;
}

.side-title {
  margin: 0 0 0.48rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.side-stats {
  display: grid;
  gap: 0.44rem;
}

.side-stats div {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  color: var(--muted-2);
  font-size: 0.84rem;
}

.side-stats strong {
  color: var(--foreground);
}

.muted-panel p {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.86rem;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid hsl(240 6% 14%);
}

.sidebar-footer p {
  margin: 0;
  color: hsl(240 5% 45%);
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.shell {
  margin-left: 16rem;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dash-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.dash-header p {
  margin: 0.25rem 0 0;
  font-size: 0.86rem;
  color: hsl(240 5% 45%);
}

.text-gold {
  color: var(--gold);
}

.cta-quest {
  border: none;
  border-radius: calc(var(--radius) - 1px);
  padding: 0.56rem 0.92rem;
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--gold);
  color: hsl(240 10% 4%);
}

.card {
  background: linear-gradient(160deg, color-mix(in srgb, var(--card) 96%, black), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 22px 38px -32px rgba(0, 0, 0, 0.92);
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
  align-items: stretch;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 0.7rem;
}

.hero h1 {
  margin: 0.35rem 0 0.6rem;
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.hero-copy p:last-child {
  margin: 0;
  color: var(--muted-2);
  max-width: 62ch;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.stat-tile {
  background: rgba(9, 11, 16, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.68rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.58rem;
}

.stat-copy {
  min-width: 0;
}

.stat-tile span {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.stat-tile strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1rem;
}

.stat-icon {
  width: 1.58rem;
  height: 1.58rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-icon-level {
  color: var(--gold);
}

.stat-icon-gold {
  color: var(--yellow);
}

.stat-icon-streak {
  color: var(--orange);
}

.progress-card {
  margin-top: 1rem;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.progress-head h2 {
  margin: 0;
  font-size: 1rem;
}

.progress-head span {
  color: var(--muted-2);
  font-size: 0.9rem;
}

.xp-track {
  width: 100%;
  height: 12px;
  background: hsl(240 7% 9%);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(45 75% 42%) 0%, hsl(45 80% 52%) 60%, hsl(44 90% 68%) 100%);
  transition: width 0.35s ease;
}

.grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 1rem;
}

h2 {
  margin: 0 0 0.95rem;
  font-size: 1.06rem;
}

.quest-form {
  display: grid;
  gap: 0.82rem;
}

.quest-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted-2);
  font-size: 0.88rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid var(--border);
  background: hsl(240 7% 10%);
  color: var(--foreground);
  border-radius: calc(var(--radius) - 1px);
  padding: 0.62rem 0.72rem;
}

input:focus,
select:focus {
  outline: 2px solid hsla(45, 80%, 52%, 0.35);
  outline-offset: 1px;
}

button {
  border: none;
  background: hsl(45 80% 52%);
  color: hsl(240 10% 4%);
  font-weight: 700;
  border-radius: calc(var(--radius) - 1px);
  padding: 0.72rem;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button:active {
  transform: translateY(0);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.15rem;
}

.panel-head span {
  min-width: 2rem;
  text-align: center;
  padding: 0.2rem 0.45rem;
  border: 1px solid hsla(45, 80%, 52%, 0.24);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.83rem;
  font-weight: 700;
}

.quest-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.66rem;
}

.quest-item {
  border: 1px solid var(--border);
  background: hsl(240 8% 6%);
  border-radius: calc(var(--radius) + 1px);
  padding: 0.72rem;
}

.quest-item:hover {
  border-color: hsl(240 6% 22%);
}

.quest-row {
  display: flex;
  align-items: flex-start;
  gap: 0.62rem;
}

.quest-content {
  flex: 1;
  min-width: 0;
}

.quest-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.quest-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.97rem;
}

.badges {
  margin-top: 0.36rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.14rem 0.45rem;
  font-size: 0.72rem;
  color: var(--muted-2);
}

.badge.type-main {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
  background-color: color-mix(in srgb, var(--amber) 10%, transparent);
}

.badge.type-side {
  color: var(--sky);
  border-color: color-mix(in srgb, var(--sky) 30%, transparent);
  background-color: color-mix(in srgb, var(--sky) 10%, transparent);
}

.badge.type-daily {
  color: var(--emerald);
  border-color: color-mix(in srgb, var(--emerald) 30%, transparent);
  background-color: color-mix(in srgb, var(--emerald) 10%, transparent);
}

.badge.diff-easy {
  color: var(--emerald);
}

.badge.diff-medium {
  color: var(--yellow);
}

.badge.diff-hard {
  color: var(--orange);
}

.badge.diff-epic {
  color: var(--purple);
}

.badge.reward {
  color: var(--gold);
}

.quest-complete,
.quest-delete {
  border: none;
  background: transparent;
  color: hsl(240 5% 45%);
  padding: 0.12rem;
  border-radius: 0.32rem;
  line-height: 0;
  cursor: pointer;
}

.quest-complete svg,
.quest-delete svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quest-complete {
  margin-top: 0.08rem;
}

.quest-complete:hover,
.quest-complete:focus-visible {
  color: var(--emerald);
  transform: none;
  filter: none;
}

.quest-delete {
  margin-top: 0.08rem;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.quest-item:hover .quest-delete,
.quest-delete:focus-visible {
  opacity: 1;
}

.quest-delete:hover,
.quest-delete:focus-visible {
  color: var(--danger);
  transform: none;
  filter: none;
}

.quest-actions {
  margin-top: 0.66rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.quest-actions button {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.42rem 0.58rem;
  border-radius: calc(var(--radius) - 1px);
  background: hsl(240 7% 14%);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.quest-actions .complete {
  background: color-mix(in srgb, var(--emerald) 14%, transparent);
  color: var(--emerald);
  border-color: color-mix(in srgb, var(--emerald) 38%, transparent);
}

.quest-actions .remove {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.empty {
  color: var(--muted);
  margin: 0.95rem 0 0;
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    border-right: none;
    border-bottom: 1px solid hsl(240 6% 14%);
  }

  .sidebar-top {
    padding: 1rem;
  }

  .nav {
    padding: 0.75rem 0.75rem;
  }

  .sidebar-footer {
    padding: 0.75rem 1rem;
  }

  .shell {
    margin-left: 0;
    margin: 1rem;
    width: auto;
  }

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

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

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

@media (max-width: 520px) {
  .card {
    border-radius: var(--radius);
    padding: 1rem;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }
}
