:root {
  --bg: #0a0c10;
  --surface: #111318;
  --surface-2: #151922;
  --border: #1e2330;
  --text: #f3f5f8;
  --muted: #9aa3b2;
  --soft: #c7ced9;
  --accent: #f5c842;
  --green: #3ddc97;
  --red: #f05252;
  --blue: #4d9fff;
  --orange: #e8873a;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
  --radius: 8px;
  --font-display: "Bebas Neue", sans-serif;
  --font-body: "DM Sans", sans-serif;
  --font-mono: "DM Mono", monospace;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(245, 200, 66, 0.05), transparent 34%),
    radial-gradient(circle at top right, rgba(77, 159, 255, 0.08), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.landing-panel {
  width: min(100%, 680px);
  text-align: center;
}

.landing-kicker,
.section-kicker,
.modal-kicker {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.landing h1,
.brand {
  font-family: var(--font-display);
  letter-spacing: 0;
}

.landing h1 {
  margin: 10px 0 4px;
  font-size: clamp(4.5rem, 24vw, 9rem);
  line-height: 0.88;
}

.landing-copy {
  max-width: 460px;
  margin: 0 auto 32px;
  color: var(--soft);
  line-height: 1.6;
}

.btn {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 16px;
  color: var(--text);
  background: var(--surface-2);
  font-weight: 700;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(245, 200, 66, 0.5);
}

.btn-primary {
  border-color: rgba(245, 200, 66, 0.55);
  background: var(--accent);
  color: #171106;
}

.btn-hero {
  min-width: 180px;
  height: 52px;
  font-family: var(--font-mono);
}

.btn-ghost {
  background: transparent;
}

.btn-muted {
  background: #191d26;
}

.btn-wide {
  width: 100%;
}

.dashboard {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  font-size: 2rem;
  line-height: 1;
  color: var(--accent);
}

.user-greeting {
  color: var(--soft);
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-shell {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 22px 16px 48px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.stat-card,
.mission-card,
.modal {
  border: 1px solid var(--border);
  background: rgba(17, 19, 24, 0.92);
  box-shadow: var(--shadow);
}

.stat-card {
  border-radius: var(--radius);
  padding: 18px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.5rem;
}

.board-section {
  margin-top: 28px;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 4px 0 0;
  font-size: 1.6rem;
}

.board-status {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.missions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.mission-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 18px;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.mission-card:hover {
  transform: translateY(-4px);
  border-color: rgba(245, 200, 66, 0.45);
  background: rgba(21, 25, 34, 0.98);
}

.mission-top,
.mission-meta,
.mission-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.mission-top {
  justify-content: space-between;
  margin-bottom: 18px;
}

.mission-number {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 500;
}

.badge,
.tag,
.state {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  border: 1px solid currentColor;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.badge.easy,
.state.completada {
  color: var(--green);
}

.badge.medium,
.state.disponible {
  color: var(--accent);
}

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

.tag {
  color: var(--blue);
}

.state.proceso {
  color: var(--blue);
}

.state.revision {
  color: var(--orange);
}

.mission-title {
  margin: 0 0 12px;
  font-size: 1.18rem;
  line-height: 1.25;
}

.reward {
  margin: 16px 0 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 500;
}

.deadline {
  color: var(--muted);
}

.deadline.urgent {
  color: var(--red);
}

.mission-actions {
  margin-top: 18px;
}

.success-flash {
  animation: successPulse 850ms ease;
}

.success-mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(61, 220, 151, 0.12);
  color: var(--green);
  font-family: var(--font-display);
  font-size: 5rem;
  pointer-events: none;
  animation: successMark 850ms ease forwards;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 6, 9, 0.72);
  backdrop-filter: blur(16px);
  opacity: 1;
  transition: opacity 180ms ease;
}

.modal {
  position: relative;
  width: min(100%, 760px);
  max-height: min(86vh, 900px);
  overflow: auto;
  border-radius: var(--radius);
  padding: 22px;
  animation: modalIn 180ms ease;
}

.modal-small {
  width: min(100%, 420px);
}

.modal-wide {
  width: min(100%, 860px);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #181c25;
  color: var(--soft);
}

.modal h2 {
  margin: 6px 42px 20px 0;
  font-size: 1.65rem;
}

.form-stack,
.mission-form {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--soft);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0d1016;
  color: var(--text);
  padding: 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(245, 200, 66, 0.65);
  box-shadow: 0 0 0 3px rgba(245, 200, 66, 0.08);
}

.form-error {
  margin: 0;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

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

.detail-grid {
  display: grid;
  gap: 16px;
}

.detail-body {
  display: grid;
  gap: 12px;
}

.detail-body p {
  margin: 0;
  color: var(--soft);
  line-height: 1.6;
}

.conditions-list {
  margin: 0;
  padding-left: 18px;
  color: var(--soft);
}

.conditions-list li {
  margin-bottom: 8px;
}

.conversation-placeholder {
  border: 1px dashed rgba(245, 200, 66, 0.42);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(245, 200, 66, 0.04);
}

.conversation-placeholder strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-family: var(--font-mono);
}

.admin-tools {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--border);
  margin-top: 18px;
  padding-top: 18px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  max-width: min(380px, calc(100vw - 32px));
  border: 1px solid rgba(61, 220, 151, 0.45);
  border-radius: var(--radius);
  background: #0d1513;
  color: var(--green);
  padding: 14px 16px;
  font-family: var(--font-mono);
  box-shadow: var(--shadow);
}

.fade-in {
  animation: fadeIn 260ms ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes successPulse {
  0% {
    border-color: var(--border);
  }
  45% {
    border-color: var(--green);
  }
  100% {
    border-color: var(--border);
  }
}

@keyframes successMark {
  0% {
    opacity: 0;
    transform: scale(0.82);
  }
  35% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

@media (min-width: 640px) {
  .app-header {
    grid-template-columns: 1fr auto 1fr;
    padding: 14px 24px;
  }

  .header-actions {
    justify-content: flex-end;
  }

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

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

  .section-head {
    flex-direction: row;
    align-items: end;
    justify-content: space-between;
  }

  .mission-form {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-full {
    grid-column: 1 / -1;
  }
}

@media (min-width: 980px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .missions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
