* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f9ff;
  --bg-card: #ffffff;
  --text: #1f2a44;
  --muted: #6c7a92;
  --primary: #3b82f6;
  --primary-600: #2563eb;
  --ok: #22c55e;
  --ok-600: #16a34a;
  --warn: #ef4444;
  --ring: rgba(59, 130, 246, 0.35);
  --shadow: 0 12px 24px rgba(31, 42, 68, 0.08);
}

body.high-contrast {
  --bg: #000;
  --bg-card: #111;
  --text: #fff;
  --muted: #ddd;
  --primary: #ffbf00;
  --primary-600: #ff9900;
  --ok: #00ff66;
  --ok-600: #00cc52;
  --warn: #ff4d4d;
  --ring: rgba(255, 191, 0, 0.5);
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
  color: var(--text);
  background: radial-gradient(
      1200px 600px at 100% -10%,
      #eef5ff 20%,
      transparent 60%
    ),
    var(--bg);
  min-height: 100vh;
  line-height: 1.4;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px;
  gap: 12px;
}

.topbar-actions button {
  font-size: 0.9rem;
}

.tela {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 16px;
  justify-items: center;
}

.escondido {
  display: none;
}

.title {
  font-size: 2rem;
  margin: 16px 0 4px;
}

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

.help {
  color: var(--muted);
  font-size: 0.95rem;
}

.hud {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pill {
  background: var(--bg-card);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.08s ease, background 0.2s ease;
  box-shadow: var(--shadow);
}

.btn:focus {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}
.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-600);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.high-contrast .btn-ghost {
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-ghost:hover {
  color: var(--text);
}

.board {
  display: grid;
  gap: 20px;
  width: 100%;
  grid-template-columns: 1fr;
}

@media (min-width: 840px) {
  .board {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.area-alvos,
.area-opcoes {
  display: grid;
  gap: 16px;
}

.area-alvos {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

@media (min-width: 520px) {
  .area-opcoes {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

.card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  text-align: left;
  border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card[draggable="true"] {
  cursor: grab;
}

.card[draggable="true"]:active {
  cursor: grabbing;
}

.card:focus {
  outline: none;
  border-color: var(--ring);
}

.card-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.card-muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.alvo {
  border: 2px dashed rgba(0, 0, 0, 0.15);
}

body.high-contrast .alvo {
  border-color: rgba(255, 255, 255, 0.4);
}

.alvo.hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.06);
}

.locked {
  background: #eafff0;
  border-color: var(--ok);
  animation: pop 0.25s ease;
}

body.high-contrast .locked {
  background: rgba(0, 190, 90, 0.15);
}

.errado {
  animation: shake 0.25s ease;
  border-color: var(--warn) !important;
}

@keyframes pop {
  from {
    transform: scale(0.98);
  }
  to {
    transform: scale(1);
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(2px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-2px);
  }
  40%,
  60% {
    transform: translateX(2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .card,
  .locked {
    transition: none;
    animation: none;
  }
}
