/* ======================================= */
/* FLADDER - TOOLIFY STIJL                 */
/* ======================================= */

@import url('/fonts/nunito-fredokaone-ee51d9.css');

:root {
  --bg:         #f0f4ff;
  --surface:    #ffffff;
  --surface2:   #f8faff;
  --border:     #dde3f5;
  --text:       #2d3561;
  --text-muted: #7b84b0;

  --blue:   #3b82f6;
  --purple: #8b5cf6;
  --pink:   #ec4899;
  --teal:   #14b8a6;
  --orange: #f97316;
  --red:    #ef4444;
  --green:  #22c55e;

  --shadow-sm: 0 2px 8px  rgba(59,82,246,0.08);
  --shadow-md: 0 6px 24px rgba(59,82,246,0.13);
  --shadow-lg: 0 12px 40px rgba(59,82,246,0.18);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 1.2rem 1rem 1rem;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.game-header { text-align: center; margin-bottom: 0.9rem; }
.game-title { font-family: 'Fredoka One', 'Nunito', sans-serif; font-size: clamp(1.8rem, 5vw, 2.6rem); color: var(--purple); letter-spacing: 0.02em; }
.game-subtitle { color: var(--text-muted); font-weight: 600; margin-top: 0.2rem; }

/* keuzes: figuurtje en opening */
.keuzes { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem 2rem; margin-bottom: 1rem; }
.keuze-groep { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; justify-content: center; }
.keuze-label { font-weight: 800; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.figuren { display: flex; gap: 0.6rem; }
.figuur {
  width: 68px; padding: 6px 4px 5px; text-align: center; cursor: pointer;
  background: var(--surface); border: 3px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); font-family: inherit; color: var(--text);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.figuur canvas { display: block; width: 52px; height: 52px; margin: 0 auto; }
.figuur span { display: block; font-size: 0.72rem; font-weight: 800; margin-top: 2px; }
.figuur:hover { transform: translateY(-2px); border-color: var(--purple); }
.figuur:focus-visible, .segment button:focus-visible, .action-btn:focus-visible, .overlay-btn:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.figuur[aria-pressed="true"] { border-color: var(--purple); background: #f3eeff; box-shadow: 0 0 0 3px rgba(139,92,246,0.2), var(--shadow-md); }
.segment { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.segment button { border: 0; background: transparent; color: var(--text-muted); font: 800 0.95rem 'Nunito', sans-serif; padding: 8px 16px; border-radius: 10px; cursor: pointer; }
.segment button:hover { color: var(--text); }
.segment button[aria-pressed="true"] { background: var(--purple); color: #fff; }

/* indeling zoals bij Snake: info links, spel in het midden, lijst rechts */
.game-layout { display: flex; justify-content: center; align-items: flex-start; gap: 1.2rem; flex-wrap: wrap; }
.side-panel { display: flex; flex-direction: column; gap: 0.8rem; width: 170px; }
.info-card, .hs-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-md); padding: 0.7rem 0.9rem; box-shadow: var(--shadow-sm); }
.info-label { font-size: 0.78rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.info-val { font-family: 'Fredoka One', 'Nunito', sans-serif; font-size: 2rem; color: var(--text); line-height: 1.2; }
.score-val { color: var(--purple); }
.action-btns { display: flex; flex-direction: column; gap: 0.5rem; }
.action-btn { font: 800 0.95rem 'Nunito', sans-serif; padding: 0.6rem 0.8rem; border: 2px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text); cursor: pointer; box-shadow: var(--shadow-sm); transition: transform 0.12s; }
.action-btn:hover { transform: translateY(-1px); border-color: var(--purple); }
.new-btn { background: var(--purple); border-color: var(--purple); color: #fff; }
.hs-mini { list-style: none; margin-top: 0.3rem; display: grid; gap: 3px; counter-reset: p; }
.hs-mini li { display: flex; justify-content: space-between; font-weight: 700; font-size: 0.95rem; counter-increment: p; }
.hs-mini li::before { content: counter(p) "."; color: var(--text-muted); margin-right: 6px; }
.hs-mini li b { margin-left: auto; }
.hs-mini .leeg { color: var(--text-muted); font-weight: 600; font-size: 0.85rem; }
.hs-mini .leeg::before { content: ""; margin: 0; }
.legend-line { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-top: 0.25rem; line-height: 1.35; }

.canvas-wrap { position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 4px solid var(--surface); box-shadow: var(--shadow-lg); background: #cfe3ff; touch-action: none; cursor: pointer; }
#game { display: block; height: min(640px, calc(100vh - 260px)); min-height: 360px; aspect-ratio: 420 / 640; width: auto; max-width: 100%; touch-action: none; }
.canvas-wrap.schok { animation: schok 0.28s ease; }
@keyframes schok { 20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(2px, 0); } }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(45,53,97,0.45); backdrop-filter: blur(3px); }
.overlay[hidden] { display: none; }
.overlay-card { width: min(340px, 100%); text-align: center; padding: 1.6rem 1.4rem; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); animation: pop 0.25s ease; }
@keyframes pop { from { transform: scale(0.88); opacity: 0; } to { transform: none; opacity: 1; } }
.overlay-emoji { font-size: 3rem; display: block; }
.overlay-title { font-family: 'Fredoka One', 'Nunito', sans-serif; font-size: 1.9rem; color: var(--purple); margin: 0.2rem 0; }
.overlay-sub { color: var(--text-muted); font-weight: 700; min-height: 1.3em; margin-bottom: 0.6rem; }
.overlay-stats { display: flex; justify-content: center; gap: 1.6rem; margin: 0.6rem 0 1rem; }
.overlay-stat { display: flex; flex-direction: column; }
.overlay-stat-val { font-family: 'Fredoka One', 'Nunito', sans-serif; font-size: 2.2rem; color: var(--text); line-height: 1; }
.overlay-stat-lbl { font-size: 0.75rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.overlay-btn { font: 800 1.05rem 'Nunito', sans-serif; padding: 0.7rem 1.6rem; border: 0; border-radius: var(--radius-md); background: var(--purple); color: #fff; cursor: pointer; box-shadow: var(--shadow-md); }
.overlay-btn:hover { filter: brightness(1.08); }

@media (max-width: 760px) {
  body { padding: 0.8rem 0.6rem; }
  .game-layout { flex-direction: column; align-items: center; }
  .side-left, .side-right { width: min(420px, 100%); flex-direction: row; flex-wrap: wrap; }
  .side-left > *, .side-right > * { flex: 1 1 140px; }
  .side-right { order: 3; }
  #game { height: min(560px, calc(100vh - 330px)); }
}
@media (prefers-reduced-motion: reduce) { .canvas-wrap.schok, .overlay-card { animation: none; } }
