/* ============================================================
   SIMPLE PAST — Microdesign ESL Lesson
   High-contrast borders · bold type · clear hierarchy
   ============================================================ */

:root {
  --bg:        #f7f1e3;   /* warm cream */
  --paper:     #fffdf7;   /* card paper */
  --ink:       #161412;   /* near-black */
  --ink-soft:  #4a463f;

  --c01: #ffd23d;  /* yellow  — Grammar Detective */
  --c02: #6fd99a;  /* green   — Verb Battle */
  --c03: #74b6f7;  /* sky     — Find Someone */
  --c04: #ff8c6b;  /* coral   — Time Travel */
  --c05: #b69cff;  /* lavender— The Case */

  --ok:   #2fbf71;
  --no:   #ff5a4d;

  --bd: 3px solid var(--ink);
  --bd-thick: 4px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 4px 4px 0 var(--ink);
  --shadow-lg: 10px 10px 0 var(--ink);

  --r: 4px;

  --mono: 'Space Mono', ui-monospace, monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* faint grid texture */
  background-image:
    linear-gradient(rgba(22,20,18,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22,20,18,0.035) 1px, transparent 1px);
  background-size: 26px 26px;
}

::selection { background: var(--c01); color: var(--ink); }

/* ---------- Top progress bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink);
  border-bottom: var(--bd-thick);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
}
.topbar .brand {
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  letter-spacing: 0.14em; color: var(--bg);
  text-transform: uppercase; white-space: nowrap;
}
.nav-pills { display: flex; gap: 8px; margin-left: auto; flex-wrap: nowrap; }
.topbar .brand { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nav-pill {
  width: 34px; height: 34px; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 14px;
  background: var(--bg); color: var(--ink);
  border: 2px solid var(--bg); border-radius: var(--r);
  cursor: pointer; text-decoration: none; transition: transform .08s ease;
}
.nav-pill:hover { transform: translateY(-2px); }
.nav-pill.active { outline: 3px solid var(--c01); outline-offset: 1px; }
.nav-pill[data-c="1"] { background: var(--c01); }
.nav-pill[data-c="2"] { background: var(--c02); }
.nav-pill[data-c="3"] { background: var(--c03); }
.nav-pill[data-c="4"] { background: var(--c04); }
.nav-pill[data-c="5"] { background: var(--c05); }

/* ---------- Layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 120px; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 36px; }
.hero .kicker {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.22em;
  text-transform: uppercase; font-weight: 700;
  display: inline-block; background: var(--ink); color: var(--bg);
  padding: 6px 12px; border-radius: var(--r);
}
.hero h1 {
  font-size: clamp(56px, 13vw, 132px); line-height: 0.86;
  font-weight: 700; letter-spacing: -0.04em; margin: 22px 0 0;
  text-transform: uppercase;
}
.hero h1 em {
  font-style: normal; color: var(--bg);
  -webkit-text-stroke: 2.5px var(--ink);
  text-shadow: 5px 5px 0 var(--ink);
}
.hero .lede {
  margin: 26px 0 0; max-width: 640px; font-size: 19px;
  color: var(--ink-soft); text-wrap: pretty;
}
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px;
}
.tag {
  font-family: var(--mono); font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 7px 12px; border: var(--bd); border-radius: 999px;
  background: var(--paper);
}

/* ---------- Activity card ---------- */
.activity {
  background: var(--paper);
  border: var(--bd-thick);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  margin-top: 52px;
  overflow: hidden;
  scroll-margin-top: 96px;
}
.act-head {
  display: flex; align-items: stretch; gap: 0;
  border-bottom: var(--bd-thick);
}
.act-num {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 88px; font-family: var(--mono); font-weight: 700;
  font-size: 40px; border-right: var(--bd-thick);
}
.act-titles { padding: 16px 22px; display: flex; flex-direction: column; justify-content: center; }
.act-titles .eyebrow {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.7;
}
.act-titles h2 {
  margin: 2px 0 0; font-size: clamp(26px, 4vw, 38px);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1;
}
.activity[data-c="1"] .act-num, .activity[data-c="1"] .act-head { background: var(--c01); }
.activity[data-c="2"] .act-num, .activity[data-c="2"] .act-head { background: var(--c02); }
.activity[data-c="3"] .act-num, .activity[data-c="3"] .act-head { background: var(--c03); }
.activity[data-c="4"] .act-num, .activity[data-c="4"] .act-head { background: var(--c04); }
.activity[data-c="5"] .act-num, .activity[data-c="5"] .act-head { background: var(--c05); }
.act-body { padding: 26px 26px 30px; }

.instruct {
  font-size: 18px; margin: 0 0 20px; max-width: 70ch; text-wrap: pretty;
}
.instruct strong { background: var(--c01); padding: 0 4px; border-radius: 3px; box-decoration-break: clone; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--mono); font-weight: 700; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--ink); color: var(--bg);
  border: var(--bd); border-radius: var(--r);
  padding: 11px 18px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--ink); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.score-tag {
  font-family: var(--mono); font-weight: 700; font-size: 14px;
  padding: 9px 14px; border: var(--bd); border-radius: var(--r);
  background: var(--paper);
}
.score-tag b { font-size: 16px; }

/* ============================================================
   ACT 1 — Grammar Detective (sorting)
   ============================================================ */
.sort-pool {
  border: var(--bd); border-radius: 8px; background: #fff;
  padding: 14px; min-height: 72px;
  display: flex; flex-wrap: wrap; gap: 10px;
  background-image: repeating-linear-gradient(45deg, rgba(22,20,18,.03) 0 8px, transparent 8px 16px);
}
.pool-label {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 8px; opacity: .65;
}
.word {
  font-family: var(--sans); font-weight: 600; font-size: 17px;
  background: var(--paper); border: var(--bd); border-radius: 999px;
  padding: 8px 16px; cursor: grab; user-select: none;
  box-shadow: var(--shadow-sm); transition: transform .08s ease, box-shadow .08s ease, background .12s;
  touch-action: none;
}
.word:hover { transform: translate(-1px,-1px); }
.word.selected { background: var(--c01); transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--ink); }
.word.dragging { opacity: .35; }
.word.flying { position: fixed; z-index: 999; pointer-events: none; box-shadow: var(--shadow); margin: 0; }
.word.ok  { background: var(--ok);  color: #fff; }
.word.no  { background: var(--no);  color: #fff; animation: shake .3s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

.bins { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-top: 18px; }
.bin {
  border: var(--bd-thick); border-radius: 8px; background: #fff;
  min-height: 150px; padding: 0; overflow: hidden;
  transition: background .12s, transform .08s;
}
.bin.over { background: var(--c01); transform: translateY(-3px); }
.bin-head {
  font-family: var(--mono); font-weight: 700; font-size: 14px;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 10px 14px; border-bottom: var(--bd); background: var(--ink); color: var(--bg);
  display: flex; justify-content: space-between; align-items: center;
}
.bin-head .cnt { background: var(--bg); color: var(--ink); padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.bin-drop { padding: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; min-height: 100px; }
.hint {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft);
  margin-top: 12px; display: flex; align-items: center; gap: 8px;
}
.silly {
  margin-top: 24px; border-top: 2px dashed var(--ink); padding-top: 20px;
}

/* ---------- inputs (shared) ---------- */
.field {
  font-family: var(--sans); font-size: 17px; font-weight: 600;
  border: var(--bd); border-radius: var(--r); background: #fff;
  padding: 11px 14px; width: 100%; color: var(--ink);
}
.field::placeholder { color: #aaa297; opacity: 1; font-weight: 400; }
.field:focus { outline: 4px solid var(--c01); outline-offset: 0; }
textarea.field { resize: vertical; line-height: 1.5; min-height: 56px; }
.label-mono { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .7; display:block; margin-bottom: 6px; }

/* ============================================================
   ACT 2 — Irregular Verb Battle
   ============================================================ */
.verbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; }
.verb-card {
  border: var(--bd); border-radius: 8px; background: #fff; padding: 14px;
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-sm);
}
.verb-present {
  font-weight: 700; font-size: 19px; min-width: 78px;
}
.verb-present span { font-family: var(--mono); font-size: 11px; display: block; opacity: .55; font-weight: 700; }
.verb-arrow { font-family: var(--mono); font-weight: 700; opacity: .5; }
.verb-card .field { padding: 9px 11px; font-size: 16px; }
.verb-card.ok { background: #e8f9ef; border-color: var(--ok); }
.verb-card.ok .field { border-color: var(--ok); }
.verb-card.no { background: #ffeceb; border-color: var(--no); }
.verb-mark { font-family: var(--mono); font-weight: 700; font-size: 18px; width: 18px; text-align: center; }

/* ============================================================
   ACT 3 — Find Someone Who
   ============================================================ */
.fsw-list { display: flex; flex-direction: column; gap: 14px; }
.fsw-row {
  display: grid; grid-template-columns: 44px 1fr 220px; gap: 14px; align-items: center;
  border: var(--bd); border-radius: 8px; background: #fff; padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.fsw-check {
  width: 40px; height: 40px; border: var(--bd); border-radius: var(--r);
  background: var(--paper); cursor: pointer; display: grid; place-items: center;
  font-size: 24px; font-weight: 700; line-height: 1;
}
.fsw-check.done { background: var(--c02); }
.fsw-row.done { background: #f1fbf5; }
.fsw-task b { display: block; font-size: 18px; }
.fsw-task .q { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
@media (max-width: 640px){ .fsw-row { grid-template-columns: 44px 1fr; } .fsw-row .field { grid-column: 1 / -1; } }

/* ============================================================
   ACT 4 — Time Travel
   ============================================================ */
.tt-banner {
  border: var(--bd); border-radius: 8px; background: var(--ink); color: var(--bg);
  padding: 16px 20px; font-weight: 600; font-size: 18px; margin-bottom: 20px;
}
.tt-banner .y { color: var(--c04); font-family: var(--mono); font-weight: 700; }
.chip-rail { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 22px; }
.chip {
  font-family: var(--mono); font-weight: 700; font-size: 14px;
  border: var(--bd); border-radius: 999px; background: var(--c04);
  padding: 7px 14px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s;
}
.chip:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--ink); }
.chip:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ink); }
.tt-prompts { display: grid; gap: 14px; }
.tt-line { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }
.tt-line .n { font-family: var(--mono); font-weight: 700; font-size: 20px; padding-top: 10px; }
.tt-foot { font-family: var(--mono); font-size: 13px; margin-top: 14px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;}

/* ============================================================
   ACT 5 — The Case
   ============================================================ */
.case-story { display: grid; gap: 18px; }
.story-block {
  border-left: 6px solid var(--ink); padding: 4px 0 4px 18px;
}
.story-block h4 {
  font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  margin: 0 0 8px; opacity: .7;
}
.story-block p { margin: 0; max-width: 68ch; text-wrap: pretty; }
.suspects { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: 14px; margin: 6px 0; }
.suspect {
  border: var(--bd); border-radius: 8px; background: #fff; overflow: hidden;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.suspect:hover { transform: translate(-2px,-2px); box-shadow: var(--shadow); }
.suspect .s-name {
  font-weight: 700; font-size: 19px; padding: 10px 14px; border-bottom: var(--bd);
  background: var(--c05); display: flex; justify-content: space-between; align-items: center;
}
.suspect .s-alibi { padding: 12px 14px; font-size: 15px; }
.suspect .pick {
  font-family: var(--mono); font-size: 11px; font-weight: 700; text-transform: uppercase;
  border: 2px solid var(--ink); border-radius: 999px; padding: 2px 8px; background: var(--paper);
}
.suspect.chosen { outline: 4px solid var(--ink); }
.suspect.chosen .pick { background: var(--ink); color: var(--bg); }
.clue-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.clue-list li {
  display: grid; grid-template-columns: 78px 1fr; gap: 12px; align-items: baseline;
  border-bottom: 1px dashed rgba(22,20,18,.25); padding-bottom: 8px;
}
.clue-list .t { font-family: var(--mono); font-weight: 700; font-size: 14px; background: var(--c05); padding: 2px 6px; border-radius: 4px; border: 2px solid var(--ink); text-align: center; }

.q-list { display: grid; gap: 14px; counter-reset: q; }
.q-item { border: var(--bd); border-radius: 8px; background: #fff; padding: 14px 16px; }
.q-item .q-text { font-weight: 700; font-size: 17px; margin: 0 0 10px; display: flex; gap: 10px; }
.q-item .q-text::before {
  counter-increment: q; content: counter(q,decimal-leading-zero);
  font-family: var(--mono); background: var(--ink); color: var(--bg);
  padding: 1px 8px; border-radius: 4px; font-size: 14px; height: fit-content;
}
.reveal-box {
  border: var(--bd-thick); border-radius: 8px; background: var(--ink); color: var(--bg);
  padding: 22px; margin-top: 8px;
}
.reveal-box h4 { margin: 0 0 8px; font-size: 22px; }
.reveal-box .twist { display: none; margin-top: 14px; padding-top: 14px; border-top: 2px dashed var(--bg); }
.reveal-box.open .twist { display: block; }
.reveal-box.open .reveal-btn { display: none; }
.useful-lang {
  background: var(--bg); border: var(--bd); border-radius: 8px; padding: 16px 18px; margin-top: 18px;
}
.useful-lang ul { margin: 8px 0 0; padding-left: 20px; }
.useful-lang li { margin: 4px 0; }
.useful-lang li i { font-style: normal; background: var(--c05); padding: 0 4px; border-radius: 3px; }

/* ---------- footer / reset ---------- */
.foot {
  margin-top: 60px; text-align: center;
  font-family: var(--mono); font-size: 13px; color: var(--ink-soft);
}
.foot .btn { margin-bottom: 18px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: var(--bg); border: var(--bd); border-radius: var(--r);
  padding: 12px 20px; font-family: var(--mono); font-weight: 700; font-size: 14px;
  box-shadow: var(--shadow); z-index: 200; transition: transform .25s ease; max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 720px){
  .bins { grid-template-columns: 1fr; }
  .act-num { width: 64px; font-size: 30px; }
  .hero { padding: 40px 0 24px; }
}
