/* Mr Kon Quiz: shared colours, fonts and buttons. */
:root {
  --bg: #FFF8EE;
  --bg-2: #FDEFD9;
  --ink: #3D2C4E;
  --muted: #7B6D88;
  --card: #FFFFFF;
  --line: #EEDFF0;
  --purple: #7A5CFA;
  --purple-dark: #5B3FD9;
  --purple-soft: #EFEAFF;
  --good: #20A880;
  --good-soft: #DDF7EE;
  --bad: #E0566A;
  --bad-soft: #FFE3E7;
  --gold: #F5B82E;
  --silver: #B7C0CC;
  --bronze: #D98E5A;
  --s0: #FF7A8A; --s0d: #E0566A;
  --s1: #F5A524; --s1d: #D4870A;
  --s2: #3CC9A0; --s2d: #20A880;
  --s3: #4FA8F0; --s3d: #2F88D2;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(61, 44, 78, .10);
  --font: 'Baloo 2', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  /* Soft drifting paw prints */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='%23F3DFC4' opacity='.55'%3E%3Cg transform='translate(30 34) rotate(-18)'%3E%3Cellipse cx='0' cy='8' rx='9' ry='7.5'/%3E%3Ccircle cx='-9' cy='-4' r='3.6'/%3E%3Ccircle cx='-3' cy='-9' r='3.6'/%3E%3Ccircle cx='4' cy='-9' r='3.6'/%3E%3Ccircle cx='10' cy='-4' r='3.6'/%3E%3C/g%3E%3Cg transform='translate(112 110) rotate(22)'%3E%3Cellipse cx='0' cy='8' rx='9' ry='7.5'/%3E%3Ccircle cx='-9' cy='-4' r='3.6'/%3E%3Ccircle cx='-3' cy='-9' r='3.6'/%3E%3Ccircle cx='4' cy='-9' r='3.6'/%3E%3Ccircle cx='10' cy='-4' r='3.6'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  animation: paws 60s linear infinite;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
@keyframes paws { to { background-position: 160px -160px; } }

h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* Animal drawings are square. Safari gives SVGs a 300×150 default size, so set the shape explicitly. */
.animal { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; max-width: 100%; overflow: visible; }

.logo { display: inline-flex; align-items: center; gap: .5em; font-weight: 800; line-height: 1; letter-spacing: -.01em; }
.logo .animal { width: 1.8em; height: 1.8em; }
.logo b { color: var(--purple); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 2px solid var(--line); }

.btn {
  --c: var(--purple); --cd: var(--purple-dark);
  appearance: none; border: 0; cursor: pointer;
  background: var(--c); color: #fff;
  font-weight: 800; font-size: 1.15rem; line-height: 1;
  padding: .85em 1.4em; border-radius: 999px;
  box-shadow: 0 5px 0 var(--cd);
  transition: transform .08s, box-shadow .08s, filter .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--cd); }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: 0 5px 0 var(--cd); }
.btn.ghost { --c: #fff; --cd: var(--line); color: var(--ink); border: 2px solid var(--line); }
.btn.good { --c: var(--good); --cd: #148565; }
.btn.bad { --c: var(--bad); --cd: #B93A4E; }
.btn.small { font-size: .95rem; padding: .6em 1em; box-shadow: 0 3px 0 var(--cd); }
.btn.small:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--cd); }

.icon-btn {
  appearance: none; border: 2px solid var(--line); background: #fff; cursor: pointer;
  width: 2.6rem; height: 2.6rem; border-radius: 50%; font-size: 1.2rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}

.input {
  width: 100%; border: 3px solid var(--line); border-radius: 16px; background: #fff;
  padding: .7em .9em; font-size: 1.4rem; font-weight: 700; text-align: center; outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--purple); }

.status-dot { position: fixed; top: 10px; right: 10px; z-index: 50; font-size: .8rem; font-weight: 700;
  background: var(--bad); color: #fff; border-radius: 999px; padding: .25em .8em; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; font-weight: 700; padding: .7em 1.2em; border-radius: 999px;
  box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* Shared animations */
@keyframes pop-in { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes slide-up { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.pop { animation: pop-in .45s cubic-bezier(.2, .9, .3, 1.3) both; }
.bob { animation: bob 2.4s ease-in-out infinite; }
.wiggle { animation: wiggle .6s ease-in-out 2; }
.shake { animation: shake .5s ease-in-out; }
.slide-up { animation: slide-up .4s ease-out both; }

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

/* Drawn icons inside buttons */
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.18em; }
.icon-btn .ico { width: 1.3rem; height: 1.3rem; }
.paused-overlay .ico { width: 3rem; height: 3rem; }
.q-timer .ico { width: 1.1em; height: 1.1em; }
.scan .ico { width: 1.3em; height: 1.3em; }
.link-btn .ico { width: 1em; height: 1em; }
