/* Shared look & feel for every game. Keep game-specific styles inside each game. */
:root {
  --bg: #fff8ec;
  --ink: #2b2350;
  --muted: #6b6490;
  --card: #ffffff;
  --line: #eadfcb;
  --primary: #6c5ce7;
  --primary-dark: #4b3cc4;
  --good: #20bf6b;
  --good-dark: #148a4b;
  --warn: #fa8231;
  --bad: #eb3b5a;
  --sun: #fed330;
  --sky: #45aaf2;
  --radius: 18px;
  --shadow: 0 4px 0 rgba(43, 35, 80, .12), 0 10px 24px rgba(43, 35, 80, .08);
  --font: "Nunito", "Segoe UI Rounded", "Arial Rounded MT Bold", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { line-height: 1.15; margin: 0; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 2px solid var(--line);
  position: relative;
  z-index: 10;
}
.topbar h1 { font-size: clamp(1.1rem, 3vw, 1.5rem); flex: 1; text-align: center; }
.topbar .home {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink); text-decoration: none; font-weight: 800;
  padding: 8px 12px; border-radius: 12px; background: var(--bg);
}
.topbar .home:hover { background: #f3e9d6; }
@media (max-width: 520px) { .topbar .home span { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 800; font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px;
  border: 0; border-radius: 14px; cursor: pointer;
  color: #fff; background: var(--primary);
  box-shadow: 0 4px 0 var(--primary-dark);
  transition: transform .06s, box-shadow .06s, filter .15s;
  user-select: none; touch-action: manipulation;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-good { background: var(--good); box-shadow: 0 4px 0 var(--good-dark); }
.btn-good:active { box-shadow: 0 1px 0 var(--good-dark); }
.btn-light { background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn-light:active { box-shadow: 0 1px 0 var(--line); }
.btn-big { font-size: 1.3rem; min-height: 60px; padding: 14px 28px; }
.btn-small { font-size: .9rem; min-height: 38px; padding: 6px 12px; border-radius: 10px; }

.icon-btn {
  font: inherit; font-size: 1.4rem; line-height: 1;
  width: 48px; height: 48px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--card); cursor: pointer;
  touch-action: manipulation;
}
.icon-btn:hover { background: var(--bg); }

:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* ---------- Cards & chips ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.chip {
  display: inline-flex; align-items: center;
  font-size: .8rem; font-weight: 800; padding: 3px 10px; border-radius: 999px;
  background: #efeafe; color: var(--primary-dark);
}

/* ---------- Modal ---------- */
.kit-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; padding: 16px;
  background: rgba(43, 35, 80, .45);
  animation: kit-fade .15s ease-out;
}
.kit-modal {
  width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--card); border-radius: 24px; padding: 24px;
  text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: kit-pop .25s cubic-bezier(.2, 1.4, .5, 1);
}
.kit-modal h2 { font-size: 1.7rem; margin-bottom: 10px; }
.kit-modal .kit-body { font-size: 1.1rem; color: var(--muted); margin-bottom: 20px; }
.kit-modal .kit-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.stars { font-size: 2.4rem; letter-spacing: 4px; color: var(--sun); text-shadow: 0 2px 0 #d9a800; }
.stars .off { color: #e6e0d4; text-shadow: none; }

@keyframes kit-fade { from { opacity: 0; } }
@keyframes kit-pop { from { transform: scale(.8); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

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

[hidden] { display: none !important; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field > span { font-weight: 800; }
.field small { color: var(--muted); font-size: .85rem; }
.input {
  font: inherit; font-size: 1.05rem; color: var(--ink);
  min-height: 48px; padding: 10px 14px; width: 100%;
  border: 2px solid var(--line); border-radius: 12px; background: #fff;
}
.input:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(69, 170, 242, .25); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; text-align: left; line-height: 1.4; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--primary); }

.notice { padding: 12px 14px; border-radius: 12px; font-weight: 700; text-align: left; line-height: 1.4; }
.notice.error { background: #fde7eb; color: #a11d38; }
.notice.success { background: #dcf7e8; color: #0f6b3a; }
.notice.info { background: #e8f4fd; color: #1c5f91; }
.link-btn { font: inherit; font-weight: 800; color: var(--primary-dark); background: none; border: 0; padding: 4px; cursor: pointer; text-decoration: underline; }

/* ---------- Locked levels (see shared/levels.js) ---------- */
[data-locked] { position: relative; opacity: .7; }
.lock-badge { position: absolute; top: -6px; right: -6px; font-size: .8rem; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
