/* =============================================================
   KidCoder Lab - theme.css
   Design tokens, reset, typography and the base button system.
   ============================================================= */

:root {
  /* surfaces */
  --bg: #eef2ff;
  --bg-2: #f7f8ff;
  --card: #ffffff;
  --ink: #1f2440;
  --ink-soft: #4a5080;
  --muted: #7279a6;
  --line: #dfe3f5;

  /* accents */
  --primary: #5c7cfa;
  --primary-dark: #4263eb;
  --ok: #2f9e44;
  --ok-soft: #d3f9d8;
  --bad: #e03131;
  --bad-soft: #ffe3e3;
  --warn: #f08c00;
  --gold: #fcc419;

  /* categories */
  --c-pixels: #ff6b6b;
  --c-robot: #4dabf7;
  --c-logic: #9775fa;
  --c-python: #38d9a9;

  /* shape */
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --shadow: 0 6px 0 rgba(31, 36, 64, .08), 0 10px 24px rgba(31, 36, 64, .08);
  --shadow-sm: 0 3px 0 rgba(31, 36, 64, .07), 0 4px 12px rgba(31, 36, 64, .07);

  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, "Verdana", sans-serif;
  --mono: "SFMono-Regular", "Consolas", "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 12% -8%, #ffe9ec 0%, rgba(255, 233, 236, 0) 60%),
    radial-gradient(900px 480px at 92% 4%, #e2f2ff 0%, rgba(226, 242, 255, 0) 62%),
    var(--bg);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.large-text { font-size: 20px; }
body.reduce-motion * { animation: none !important; transition: none !important; }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 .8em; }

b, strong { color: var(--ink); }
code, .mono { font-family: var(--mono); font-size: .92em; }

code {
  background: #eef1ff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: #364fc7;
}

a { color: var(--primary-dark); }

/* ------------------------------ buttons ------------------------------ */

.btn {
  appearance: none;
  border: 0;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border-radius: var(--r);
  padding: 12px 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .08s ease, box-shadow .12s ease, background .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(31, 36, 64, .1); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 5px 0 var(--primary-dark), 0 10px 20px rgba(92, 124, 250, .28); }
.btn.primary:active { box-shadow: 0 2px 0 var(--primary-dark); }
.btn.ok { background: var(--ok); color: #fff; box-shadow: 0 5px 0 #217a35, 0 10px 20px rgba(47, 158, 68, .25); }
.btn.ok:active { box-shadow: 0 2px 0 #217a35; }
.btn.warn { background: var(--warn); color: #fff; box-shadow: 0 5px 0 #c97a00; }
.btn.danger { background: #fff; color: var(--bad); border: 2px solid var(--bad-soft); box-shadow: none; }
.btn.ghost { background: rgba(255, 255, 255, .7); }
.btn.big { font-size: 1.2rem; padding: 16px 26px; border-radius: var(--r-lg); }
.btn.huge { font-size: 1.35rem; padding: 18px 30px; border-radius: var(--r-xl); }
.btn.small { font-size: .85rem; padding: 7px 12px; border-radius: var(--r-sm); }
.btn.block { width: 100%; }
.btn.icon { padding: 10px 12px; border-radius: 14px; }

/* ------------------------------- cards ------------------------------- */

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card.pad { padding: 24px; }
.card.tight { padding: 12px; }

.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef1ff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .82rem;
  font-weight: 700;
}

.tag-cat { background: var(--cat, #eee); color: #fff; }

/* ------------------------------- input ------------------------------- */

input[type="text"], input[type="number"], select, textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--r);
  background: #fff;
  color: var(--ink);
  width: 100%;
}

input:focus, select:focus, textarea:focus { outline: 3px solid rgba(92, 124, 250, .35); border-color: var(--primary); }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 700; margin-bottom: 6px; font-size: .95rem; }

/* ------------------------------ utility ------------------------------ */

.hidden { display: none !important; }
.stack > * + * { margin-top: 12px; }
.nowrap { white-space: nowrap; }
.scroll-x { overflow-x: auto; }

@keyframes pop {
  0% { transform: scale(.85); opacity: 0; }
  70% { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}
.pop { animation: pop .28s ease both; }

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.floaty { animation: floaty 3.2s ease-in-out infinite; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.shake { animation: shake .35s ease both; }

.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;
}
