:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #dbe3ef;
  --primary: #059669;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(2, 6, 23, 0.04);
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

.title {
  margin: 0 0 6px 0;
  font-size: 1.55rem;
  font-weight: 800;
}

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

.small {
  font-size: 0.9rem;
}

.kpi {
  font-size: 1.7rem;
  font-weight: 800;
  margin: 6px 0 0;
  line-height: 1.2;
}

.btn {
  height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

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

.btn-secondary {
  background: #0f172a;
  color: #fff;
}

.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: #334155;
}

.input,
.select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
}

.label {
  display: block;
  font-size: 0.9rem;
  color: #334155;
  margin-bottom: 6px;
  font-weight: 600;
}

.stack > * + * {
  margin-top: 10px;
}

.pill {
  display: inline-block;
  background: #d1fae5;
  color: #065f46;
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 4px 10px;
  font-weight: 700;
}

.item {
  border-radius: 12px;
  padding: 11px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.item.green {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.item.blue {
  border-color: #bae6fd;
  background: #f0f9ff;
}

.item.orange {
  border-color: #fed7aa;
  background: #fff7ed;
}

.item.violet {
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.topbar {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  flex-direction: column;
}

.actions {
  display: grid;
  gap: 8px;
  width: 100%;
}

.timer {
  font-variant-numeric: tabular-nums;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 340px;
}

.memory-cell {
  height: 52px;
  border-radius: 10px;
  border: 1px solid #ddd6fe;
  background: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}

@media (min-width: 700px) {
  .container {
    padding: 18px;
  }

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

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

  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .actions {
    width: auto;
    grid-auto-flow: column;
  }
}
