:root {
  color-scheme: dark;
  --void: #07080d;
  --panel: rgba(15, 23, 42, 0.9);
  --panel-soft: rgba(15, 23, 42, 0.64);
  --line: rgba(148, 163, 184, 0.22);
  --text: #f8fafc;
  --muted: #a8b3c7;
  --rune: #38bdf8;
  --oath: #a7f3d0;
  --ember: #f59e0b;
  --blood: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(7, 8, 13, 0.78), rgba(7, 8, 13, 0.94)),
    url("assets/backgrounds/main-bg.webp"),
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.14), transparent 28rem),
    var(--void);
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

.app-shell {
  display: flex;
  gap: 1rem;
  margin: 0 auto;
  max-width: 1280px;
  min-height: 100vh;
  padding: 1rem;
}

.sidebar {
  align-self: flex-start;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.88));
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.16);
  flex: 0 0 16rem;
  padding: 1rem;
  position: sticky;
  top: 1rem;
}

.brand {
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  width: 100%;
}

.brand-title {
  display: block;
  font-size: 1.45rem;
  font-weight: 950;
  margin-top: 0.25rem;
}

.nav {
  display: grid;
  gap: 0.5rem;
}

.nav-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0.5rem;
  color: #d7deea;
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem;
  text-align: left;
}

.nav-button span:first-child:not(.eyebrow):not(.brand-title) {
  background: #020617;
  border-radius: 0.35rem;
  color: var(--rune);
  display: grid;
  height: 2rem;
  place-items: center;
  width: 2rem;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(56, 189, 248, 0.14);
  color: var(--oath);
}

.main {
  flex: 1;
  min-width: 0;
}

.panel {
  background: linear-gradient(135deg, var(--panel), var(--panel-soft));
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.13);
  padding: 1.25rem;
}

.topbar {
  align-items: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(12rem, 1fr) minmax(14rem, 24rem) auto;
  margin-bottom: 1rem;
}

.topbar h1,
.panel h2,
.hero h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 1.6rem;
}

.top-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.eyebrow {
  color: var(--rune);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.primary,
.secondary,
.ghost,
.danger {
  border: 1px solid transparent;
  border-radius: 0.5rem;
  font-weight: 900;
  padding: 0.78rem 1rem;
}

.primary {
  background: var(--ember);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.2);
  color: #111827;
}

.secondary {
  background: var(--rune);
  color: #06111d;
}

.ghost {
  background: rgba(15, 23, 42, 0.5);
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--rune);
}

.danger {
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

.primary:disabled,
.secondary:disabled,
.ghost:disabled {
  background: #334155;
  border-color: #475569;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.bar-label {
  color: #cbd5e1;
  display: flex;
  font-size: 0.76rem;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.xp-bar {
  background: #020617;
  border: 1px solid #334155;
  border-radius: 999px;
  height: 0.75rem;
  overflow: hidden;
}

.xp-fill {
  background: linear-gradient(90deg, var(--rune), var(--oath), var(--ember));
  border-radius: 999px;
  height: 100%;
  transition: width 180ms ease;
  width: 0;
}

.auth-panel {
  align-items: end;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr minmax(18rem, 34rem);
  margin-bottom: 1rem;
}

.auth-form {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quick-task-panel {
  margin-bottom: 1rem;
}

.quick-task-form {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(14rem, 1.5fr) minmax(10rem, 0.75fr) minmax(11rem, 1fr) minmax(10rem, 0.85fr) auto;
  margin-top: 1rem;
}

.quick-task-form textarea {
  grid-column: 1 / -1;
  min-height: 4.5rem;
}

.mission-controls {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(12rem, 16rem) minmax(12rem, 16rem);
  margin: 1rem 0 0.5rem;
}

.mission-tabs {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  margin-top: 1rem;
}

.mission-tab-buttons {
  background: rgba(2, 6, 23, 0.58);
  border: 1px solid #334155;
  border-radius: 0.55rem;
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
}

.mission-tab {
  background: transparent;
  border: 0;
  border-radius: 0.42rem;
  color: #cbd5e1;
  font-weight: 900;
  padding: 0.65rem 0.85rem;
}

.mission-tab.active {
  background: rgba(56, 189, 248, 0.14);
  color: var(--oath);
}

.mission-tab span {
  background: rgba(245, 158, 11, 0.14);
  border-radius: 999px;
  color: #fde68a;
  display: inline-flex;
  font-size: 0.72rem;
  margin-left: 0.35rem;
  min-width: 1.45rem;
  padding: 0.2rem 0.45rem;
}

.archive-toggle {
  align-items: center;
  color: #cbd5e1;
  display: flex;
  font-size: 0.86rem;
  font-weight: 800;
  gap: 0.5rem;
}

.archive-toggle input {
  accent-color: var(--rune);
  width: auto;
}

.mission-controls label {
  display: grid;
  gap: 0.4rem;
}

.mission-controls span {
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 800;
}

.auth-form button {
  min-height: 2.7rem;
}

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

.tab-header h2 {
  margin: 0;
}

input,
select,
textarea {
  background: rgba(2, 6, 23, 0.86);
  border: 1px solid #334155;
  border-radius: 0.5rem;
  color: var(--text);
  outline: none;
  padding: 0.85rem 0.95rem;
  width: 100%;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--rune);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  align-items: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.1fr 0.9fr;
  min-height: 26rem;
  overflow: hidden;
  position: relative;
}

.hero h2 {
  font-size: clamp(2.6rem, 6vw, 5.8rem);
  line-height: 0.98;
  max-width: 12ch;
}

.hero p:not(.eyebrow) {
  color: #d8e1ef;
  font-size: 1.1rem;
  max-width: 42rem;
}

.hero-art {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 18rem;
  position: relative;
}

.hero-art img {
  filter: drop-shadow(0 0 32px rgba(56, 189, 248, 0.35));
  max-height: 24rem;
  object-fit: contain;
}

.art-fallback {
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 50%;
  color: var(--rune);
  display: grid;
  font-size: 7rem;
  height: 15rem;
  place-items: center;
  text-shadow: 0 0 30px rgba(56, 189, 248, 0.8);
  width: 15rem;
}

.grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

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

.missions-layout {
  grid-template-columns: minmax(18rem, 24rem) 1fr;
}

.panel-heading {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.field span {
  color: #cbd5e1;
  font-size: 0.88rem;
  font-weight: 700;
}

.proof {
  background: rgba(167, 243, 208, 0.1);
  border: 1px solid rgba(167, 243, 208, 0.28);
  border-radius: 0.65rem;
  color: var(--oath);
  font-size: 1.15rem;
  font-weight: 900;
  margin: 1rem 0 0;
  padding: 1rem;
}

.skills-grid,
.mission-board,
.mission-list,
.priority-list,
.selector-grid,
.log-list {
  display: grid;
  gap: 0.9rem;
}

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

.skill-card,
.mission-card,
.priority-card,
.event-card,
.stat-card,
.timer-card,
.selector-card {
  background: rgba(2, 6, 23, 0.58);
  border: 1px solid #334155;
  border-radius: 0.7rem;
  padding: 1rem;
}

.skill-card {
  display: grid;
  gap: 0.75rem;
}

.skill-top,
.mission-top,
.event-top {
  align-items: start;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.skill-icon {
  align-items: center;
  display: flex;
  gap: 0.7rem;
}

.skill-icon img {
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 0.55rem;
  height: 3.2rem;
  object-fit: cover;
  width: 3.2rem;
}

.skill-fallback {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 0.55rem;
  color: var(--rune);
  display: grid;
  font-size: 1.5rem;
  height: 3.2rem;
  place-items: center;
  width: 3.2rem;
}

.level-pill,
.tag,
.title-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 0.35rem 0.6rem;
}

.level-pill {
  background: rgba(167, 243, 208, 0.1);
  color: var(--oath);
}

.tag {
  background: rgba(56, 189, 248, 0.1);
  color: var(--rune);
}

.title-badge {
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fde68a;
  margin-top: 0.75rem;
  text-transform: uppercase;
}

.mission-card.completed {
  opacity: 0.68;
}

.mission-card {
  border-left: 0.45rem solid var(--line);
}

.mission-card.very-urgent {
  border-color: rgba(239, 68, 68, 0.86);
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.11);
}

.mission-card.urgent {
  border-color: rgba(245, 158, 11, 0.9);
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.1);
}

.mission-card.moderate {
  border-color: rgba(56, 189, 248, 0.9);
}

.mission-card.low {
  border-color: rgba(167, 243, 208, 0.8);
}

.priority-card {
  border-left: 0.45rem solid var(--line);
}

.priority-card.very-urgent {
  border-color: rgba(239, 68, 68, 0.86);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.12);
}

.priority-card.urgent {
  border-color: rgba(245, 158, 11, 0.9);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.11);
}

.priority-card.moderate {
  border-color: rgba(56, 189, 248, 0.9);
}

.priority-card.low {
  border-color: rgba(167, 243, 208, 0.8);
}

.priority-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 950;
  padding: 0.35rem 0.6rem;
  text-transform: uppercase;
}

.priority-pill.very-urgent {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
}

.priority-pill.urgent {
  background: rgba(245, 158, 11, 0.16);
  color: #fde68a;
}

.priority-pill.moderate {
  background: rgba(56, 189, 248, 0.14);
  color: #bae6fd;
}

.priority-pill.low {
  background: rgba(167, 243, 208, 0.12);
  color: #bbf7d0;
}

.mission-meta,
.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.9rem 0;
}

.mission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.mission-notes {
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.55rem;
  color: #dbeafe;
  margin-top: 0.75rem;
  padding: 0.75rem;
}

.mission-notes strong {
  color: var(--oath);
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
}

.mission-notes p {
  margin: 0;
  white-space: pre-wrap;
}

.mission-edit-form {
  display: grid;
  gap: 0.75rem;
}

.mission-edit-form label {
  display: grid;
  gap: 0.4rem;
}

.mission-edit-form label span {
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 800;
}

.mission-edit-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mission-card.editing {
  background: rgba(15, 23, 42, 0.86);
}

.stack {
  display: grid;
  gap: 0.75rem;
}

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

.selector-card {
  color: var(--text);
  text-align: left;
}

.selector-card.active {
  border-color: var(--rune);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.16);
}

.timer-card {
  color: var(--muted);
  font-weight: 900;
  margin: 1rem 0;
  text-align: center;
}

.timer-card.running {
  background: rgba(56, 189, 248, 0.12);
  color: var(--rune);
  font-size: 2.5rem;
}

.proof-panel h2 {
  color: var(--oath);
  font-size: 1.8rem;
  line-height: 1.2;
}

.character-card {
  min-height: 16rem;
}

.big-level {
  color: var(--rune);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 950;
  margin: 1rem 0 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
    padding: 0.65rem;
  }

  .sidebar {
    margin-bottom: 0.75rem;
    position: static;
  }

  .nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .nav-button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .topbar,
  .auth-panel,
  .tab-header,
  .quick-task-form,
  .mission-controls,
  .mission-edit-grid,
  .mission-tabs,
  .hero,
  .two,
  .missions-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .panel {
    padding: 1rem;
  }

  .auth-form,
  .selector-grid,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero h2 {
    font-size: 2.55rem;
  }

  .top-actions,
  .button-row,
  .mission-tab-buttons {
    display: grid;
  }
}
