:root {
  color-scheme: dark;
  --bg-a: #16143d;
  --bg-b: #263a75;
  --panel: rgba(255, 255, 255, 0.1);
  --panel-strong: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.2);
  --text: #ffffff;
  --muted: #c7d2fe;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --accent-a: #f97316;
  --accent-b: #fbbf24;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at 18% 14%, rgba(236, 72, 153, 0.2), transparent 25rem),
    radial-gradient(circle at 80% 4%, rgba(14, 165, 233, 0.22), transparent 27rem),
    linear-gradient(155deg, var(--bg-a), #2a2771 45%, var(--bg-b));
  color: var(--text);
}

button {
  font: inherit;
}

.screen {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px clamp(14px, 3vw, 28px);
}

.hero {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: 12px 0 24px;
}

.logo {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, #fb6b30, #ec4899 48%, #3b82f6);
  box-shadow: var(--shadow);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.02;
  font-weight: 900;
}

.gradient-text {
  display: block;
  background: linear-gradient(90deg, #fbbf24, #f97316, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  max-width: 34rem;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  line-height: 1.6;
}

.section-label {
  margin: 8px 4px 12px;
  color: #c4b5fd;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.level-list {
  display: grid;
  gap: 12px;
}

.level-card {
  width: 100%;
  min-height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.13);
  text-align: left;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.level-card:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.36);
}

.level-card:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.level-card.active {
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  border-color: rgba(255, 255, 255, 0.62);
}

.level-no {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 1.25rem;
  font-weight: 900;
}

.level-title {
  font-weight: 900;
}

.level-meta {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.level-action {
  min-width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 900;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pill {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #e0e7ff;
  font-size: 0.82rem;
  font-weight: 800;
}

.game-title {
  margin-bottom: 16px;
}

.game-title h2 {
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  font-weight: 900;
}

.game-title p {
  color: var(--muted);
}

.progress {
  height: 10px;
  margin: 14px 0 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}

.progress > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  transition: width 0.25s ease;
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(18px, 6vw, 140px);
  padding: clamp(12px, 2vw, 22px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

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

.card {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 14px 16px;
  color: white;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.13);
  font-weight: 900;
  text-align: center;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

.card:not(:disabled):hover,
.card.selected {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.22);
}

.card.matched {
  border-color: rgba(255, 255, 255, 0.42);
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
}

.card.wrong {
  animation: shake 0.24s ease;
  border-color: #fca5a5;
  background: rgba(239, 68, 68, 0.28);
}

.card:disabled {
  cursor: default;
}

.lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.lines line {
  stroke: url(#lineGradient);
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.footer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.primary,
.secondary {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  font-weight: 900;
}

.primary {
  color: white;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 16px 36px rgba(249, 115, 22, 0.26);
}

.secondary {
  color: #e0e7ff;
  background: rgba(255, 255, 255, 0.12);
}

.dialog {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 10, 25, 0.72);
  backdrop-filter: blur(10px);
}

.dialog-card {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 24px;
  background: #ffffff;
  color: #182033;
  text-align: center;
  box-shadow: var(--shadow);
}

.dialog-card h2 {
  font-size: 1.75rem;
  font-weight: 900;
}

.dialog-card p {
  margin-top: 8px;
  color: #64748b;
}

.result-grid {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
}

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #475569;
}

.result-row strong {
  color: #111827;
}

@keyframes shake {
  33% {
    transform: translateX(-5px);
  }
  66% {
    transform: translateX(5px);
  }
}

@media (max-width: 700px) {
  .screen {
    padding-bottom: 18px;
  }

  .hero {
    padding-top: 4px;
  }

  .level-card {
    grid-template-columns: 48px 1fr 38px;
    padding: 13px;
  }

  .bar {
    align-items: flex-start;
  }

  .stats {
    max-width: 72%;
  }

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

  .lines {
    display: none;
  }

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