/* Grammar look: bright notebook paper, chunky sticker buttons with black outlines and hard shadows.
   Deliberately unlike the dark Debate pages; only the fonts are shared. Used by /grammar/ and every grammar game. */
:root {
  --paper: #fff8ea;        /* page */
  --rule: #e9dcc0;         /* notebook lines */
  --margin: #ff9a9a;       /* red margin line */
  --ink: #1d1a16;          /* outlines + text */
  --soft: #6d6559;         /* secondary text */
  --card: #ffffff;
  --pink: #ff5fa2; --blue: #3d8bff; --yellow: #ffd23f; --green: #22c97a; --purple: #9b5de5;
  --orange: #ff8c42; --teal: #00bfc4; --red: #ff4f4f; --lime: #b5e655; --sky: #6fd3ff;
  --c: var(--pink);        /* this page's accent, set per game */
  --f-display: "Big Shoulders Display", Impact, "Arial Narrow", sans-serif;
  --f-ui: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--f-ui); font-size: 17px; line-height: 1.4;
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 0 46px, var(--margin) 46px 48px, transparent 48px),
    repeating-linear-gradient(180deg, transparent 0 35px, var(--rule) 35px 37px);
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 4px solid var(--blue); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }

/* ---------- chunky sticker pieces ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 10px 22px; border: 3px solid var(--ink); border-radius: 16px;
  background: var(--c); color: var(--ink); font-weight: 700; font-size: 20px; text-decoration: none;
  box-shadow: 0 6px 0 var(--ink); transition: transform .08s, box-shadow .08s, background .15s;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--ink); }
.btn:active { transform: translateY(6px); box-shadow: 0 0 0 var(--ink); }
.btn.white { background: var(--card); }
.btn.big { font-family: var(--f-display); font-weight: 900; font-size: 34px; text-transform: uppercase; letter-spacing: .02em; min-height: 72px; padding-inline: 40px; }
.btn.yes { background: var(--green) !important; }
.btn.no { background: var(--red) !important; }
.btn:disabled { cursor: default; }
.card { background: var(--card); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 7px 7px 0 var(--ink); padding: 22px; }

/* ---------- game shell ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--paper); border-bottom: 3px solid var(--ink); }
.top .back { display: grid; place-items: center; width: 44px; height: 44px; border: 3px solid var(--ink); border-radius: 12px; background: var(--card); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 20px; box-shadow: 0 3px 0 var(--ink); flex: none; }
.top .ttl { font-family: var(--f-display); font-weight: 900; font-size: 26px; text-transform: uppercase; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top .sp { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border: 3px solid var(--ink); border-radius: 999px; background: var(--card); font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.pill.score { background: var(--c); }
.snd { width: 44px; height: 44px; border: 3px solid var(--ink); border-radius: 12px; background: var(--card); font-size: 20px; box-shadow: 0 3px 0 var(--ink); flex: none; }
.bar { height: 10px; background: var(--card); border-bottom: 3px solid var(--ink); }
.bar i { display: block; height: 100%; width: 100%; background: var(--c); transition: width 1s linear; }
.bar.low i { background: var(--red); }
.dots { display: flex; justify-content: center; gap: 6px; padding: 10px 16px 0; }
.dots i { width: 14px; height: 14px; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--card); }
.dots i.ok { background: var(--green); } .dots i.miss { background: var(--red); } .dots i.now { background: var(--c); transform: scale(1.25); }

#stage { max-width: 760px; margin: 0 auto; padding: 22px 16px 60px; display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }

/* start + end screens */
.hero-emoji { font-size: clamp(90px, 26vw, 150px); line-height: 1; filter: drop-shadow(5px 6px 0 rgba(29,26,22,.9)); animation: bob 2.4s ease-in-out infinite; }
.hero-title { font-family: var(--f-display); font-weight: 900; font-size: clamp(54px, 15vw, 96px); line-height: .85; text-transform: uppercase; }
.how { font-size: 21px; font-weight: 600; background: var(--yellow); border: 3px solid var(--ink); border-radius: 14px; padding: 8px 16px; transform: rotate(-1.5deg); }
.best { color: var(--soft); font-weight: 600; }
.big-num { font-family: var(--f-display); font-weight: 900; font-size: clamp(90px, 28vw, 160px); line-height: .9; }
.stars { font-size: 54px; letter-spacing: 6px; }
.stars .off { filter: grayscale(1); opacity: .25; }
.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }

/* feedback */
.float { position: fixed; z-index: 20; pointer-events: none; font-family: var(--f-display); font-weight: 900; font-size: 40px; color: var(--ink); -webkit-text-stroke: 1.5px var(--ink); text-shadow: 3px 3px 0 var(--c); animation: floatUp .9s ease-out forwards; }
.fix { background: var(--card); border: 3px dashed var(--ink); border-radius: 14px; padding: 10px 16px; font-weight: 600; font-size: 19px; animation: pop .25s ease-out; }
.fix b { background: var(--yellow); padding: 0 4px; border-radius: 4px; }
.streak { position: fixed; left: 50%; top: 40%; z-index: 20; pointer-events: none; transform: translate(-50%,-50%); font-family: var(--f-display); font-weight: 900; font-size: 64px; text-transform: uppercase; color: var(--yellow); -webkit-text-stroke: 3px var(--ink); animation: zoomOut 1s ease-out forwards; white-space: nowrap; }
.confetti { position: fixed; top: -20px; z-index: 30; width: 12px; height: 16px; border: 2px solid var(--ink); pointer-events: none; animation: fall linear forwards; }
.shake { animation: shake .4s; }
.pop { animation: pop .3s ease-out; }

@keyframes bob { 50% { transform: translateY(-10px) rotate(-3deg); } }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0) scale(.8); } to { opacity: 0; transform: translate(-50%, -80px) scale(1.2); } }
@keyframes zoomOut { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.4); } 25% { opacity: 1; transform: translate(-50%,-50%) scale(1.1) rotate(-4deg); } 100% { opacity: 0; transform: translate(-50%,-70%) scale(1.3) rotate(-4deg); } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-9px) rotate(-1deg); } 40%, 80% { transform: translateX(9px) rotate(1deg); } }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* ---------- /grammar/ hub ---------- */
.hub { max-width: 1040px; margin: 0 auto; padding: 28px 16px 72px 64px; }
.hub .crumb { display: inline-block; margin-bottom: 26px; color: var(--soft); font-weight: 600; text-decoration: none; }
.hub .crumb:hover { color: var(--ink); }
.word { display: flex; flex-wrap: wrap; gap: 6px; }
.word span { display: grid; place-items: center; width: clamp(48px, 11vw, 96px); height: clamp(60px, 13vw, 116px); font-family: var(--f-display); font-weight: 900; font-size: clamp(44px, 10vw, 92px); line-height: 1; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 5px 5px 0 var(--ink); }
.word span:nth-child(odd) { transform: rotate(-4deg); } .word span:nth-child(even) { transform: rotate(3deg) translateY(6px); }
.hub .sub { font-family: var(--f-display); font-weight: 900; font-size: clamp(30px, 6vw, 46px); text-transform: uppercase; margin: 22px 0 6px; }
.hub .lead { color: var(--soft); font-size: 19px; font-weight: 600; margin-bottom: 36px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px; min-height: 190px; background: var(--card); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 7px 7px 0 var(--c); color: var(--ink); text-decoration: none; transition: transform .12s, box-shadow .12s; }
.tile:nth-child(3n+1) { transform: rotate(-1deg); } .tile:nth-child(3n+2) { transform: rotate(.8deg); }
.tile:hover, .tile:focus-visible { transform: translateY(-5px) rotate(0); box-shadow: 9px 12px 0 var(--c); outline: none; }
.tile .em { font-size: 54px; line-height: 1; }
.tile h2 { font-family: var(--f-display); font-weight: 900; font-size: 32px; line-height: .95; text-transform: uppercase; margin-top: auto; }
.tile p { color: var(--soft); font-size: 15px; font-weight: 600; }
.tile .tag { position: absolute; top: 14px; right: 14px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--c); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 9px; }

@media (max-width: 560px) {
  body { background-image: repeating-linear-gradient(180deg, transparent 0 35px, var(--rule) 35px 37px); }
  .hub { padding-left: 16px; }
  .top .ttl { font-size: 21px; }
  .pill { padding: 0 9px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
