@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,800&family=DM+Sans:wght@400;500;700;800&display=swap');

:root {
  --canvas: #F5F1E7;
  --canvas-alt: #EFE9DB;
  --ink: #22201C;
  --forest: #2E5141;
  --forest-light: #3C5C4E;
  --coral: #C8512E;
  --mustard: #F0C24B;
  --rule: #D6D1C4;
  --radius: 4px;
  --radius-lg: 8px;
  --shadow-hard: 3px 3px 0 0 rgba(34,32,28,.20);
  --shadow-hard-lg: 4px 4px 0 0 rgba(34,32,28,.14);
  --f-display: 'Bricolage Grotesque', sans-serif;
  --f-body: 'DM Sans', sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--f-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 14%, rgba(255, 90, 54, 0.14) 0 72px, transparent 73px),
    radial-gradient(circle at 92% 9%, rgba(255, 201, 64, 0.25) 0 88px, transparent 89px),
    linear-gradient(90deg, rgba(26, 26, 26, 0.035) 1px, transparent 1px),
    linear-gradient(var(--canvas), var(--canvas));
  background-size: auto, auto, 48px 48px, auto;
}
button { font: inherit; }
a { color: inherit; }

.mt-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.75rem);
  overflow-x: clip;
}

.mt-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--ink);
  margin-bottom: clamp(1.25rem, 3vw, 2.5rem);
}
.mt-brand { display: flex; align-items: center; gap: 0.8rem; }
.mt-mark { position: relative; width: 38px; height: 38px; flex: none; }
.mt-mark::before,
.mt-mark::after { content: ''; position: absolute; inset: 0; border: 2px solid var(--ink); }
.mt-mark::before { background: var(--mustard); transform: rotate(-12deg); }
.mt-mark::after { background: var(--coral); transform: rotate(10deg) scale(0.8); clip-path: polygon(12% 12%, 88% 12%, 50% 88%); }

.mt-brand h1,
.mt-title,
.mt-card h2,
.mt-reward h2,
.mt-target-number,
.mt-expression { font-family: var(--f-display); font-weight: 800; letter-spacing: -0.02em; line-height: 1.04; margin: 0; }
.mt-brand h1 { font-size: clamp(1.45rem, 4vw, 2rem); }
.mt-brand p,
.mt-kicker {
  margin: 0;
  color: var(--forest);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mt-link,
.mt-btn,
.mt-op-btn,
.mt-slot,
.mt-option,
.mt-bracket {
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-hard);
  transition: 0.15s ease-in-out;
}
.mt-link,
.mt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.78rem 1rem;
}
.mt-link:hover,
.mt-btn:hover,
.mt-op-btn:hover,
.mt-slot:hover,
.mt-option:hover,
.mt-bracket:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-hard-lg); }
.mt-link:focus-visible,
.mt-btn:focus-visible,
.mt-op-btn:focus-visible,
.mt-slot:focus-visible,
.mt-option:focus-visible,
.mt-bracket:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.mt-btn--primary { background: var(--coral); color: var(--ink); }
.mt-btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.mt-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.42fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: stretch;
  margin-bottom: 1.5rem;
}
.mt-title { font-size: clamp(2.45rem, 6vw, 4.6rem); max-width: 8.5ch; }
.mt-title span { background-image: linear-gradient(transparent 65%, var(--mustard) 65%); padding: 0 4px; }
.mt-lede { color: #444; font-size: clamp(1rem, 2.2vw, 1.2rem); font-weight: 500; line-height: 1.65; max-width: 56ch; margin: 1.25rem 0 0; }
.mt-map-card {
  position: relative;
  min-height: 220px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(90deg, rgba(26,26,26,0.06) 1px, transparent 1px),
    linear-gradient(rgba(26,26,26,0.06) 1px, transparent 1px),
    var(--canvas-alt);
  background-size: 34px 34px;
  box-shadow: var(--shadow-hard-lg);
  overflow: hidden;
}
.mt-map-card::before {
  content: '';
  position: absolute;
  width: 148px;
  height: 148px;
  left: 34px;
  top: 34px;
  border: 2px solid var(--ink);
  background: var(--forest);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  box-shadow: var(--shadow-hard);
}
.mt-map-card::after {
  content: '+  ×  ÷  −';
  position: absolute;
  right: 26px;
  top: 54px;
  width: 130px;
  min-height: 96px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--canvas);
  box-shadow: var(--shadow-hard);
  color: var(--forest);
  font-family: var(--f-display);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  transform: rotate(4deg);
}
.mt-stamp { position: absolute; right: 28px; bottom: 26px; z-index: 2; background: var(--mustard); border: 2px solid var(--ink); box-shadow: var(--shadow-hard); padding: 0.45rem 0.7rem; font-weight: 900; text-transform: uppercase; transform: rotate(-5deg); }

.mt-progress-wrap { display: grid; gap: 0.6rem; margin-bottom: 1.5rem; }
.mt-progress-row { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.82rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.mt-progress { height: 18px; border: 2px solid var(--ink); background: var(--canvas-alt); border-radius: 999px; overflow: hidden; }
.mt-progress span { display: block; height: 100%; width: var(--pct, 0%); background: linear-gradient(90deg, var(--forest), var(--mustard)); }

.mt-card { border: 2px solid var(--ink); border-radius: var(--radius-lg); background: var(--canvas); box-shadow: var(--shadow-hard-lg); padding: clamp(1rem, 3vw, 2rem); }
.mt-card h2 { font-size: clamp(1.7rem, 4vw, 2.55rem); margin-bottom: 0.75rem; }
.mt-card p { margin: 0; color: #444; font-weight: 500; }
.mt-challenge-card { margin-bottom: 1.5rem; }
.mt-play-grid { display: grid; grid-template-columns: minmax(0, 0.36fr) minmax(0, 0.64fr); gap: clamp(1rem, 3vw, 2rem); align-items: start; }
.mt-target-card { display: grid; gap: 1rem; align-content: start; }
.mt-target-number { display: inline-flex; align-self: start; width: fit-content; background: var(--mustard); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-hard); padding: 0.55rem 0.9rem; font-size: clamp(2.2rem, 6vw, 4rem); }
.mt-mini-label { color: #666; font-size: 0.72rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.35rem; }
.mt-count-pill { border: 2px solid var(--ink); border-radius: 999px; background: var(--mustard); padding: 0.4rem 0.65rem; font-size: 0.8rem; font-weight: 900; white-space: nowrap; }
.mt-work-card { display: grid; gap: 1rem; }
.mt-instruction { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.mt-instruction p { margin: 0.25rem 0 0; }

.mt-expression {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid var(--ink);
  background: #fffaf0;
  border-radius: var(--radius-lg);
  padding: clamp(0.75rem, 2.5vw, 1.1rem);
  font-size: clamp(1.75rem, 5vw, 3.2rem);
  box-shadow: var(--shadow-hard);
}
.mt-expression--fixed { justify-content: center; }
.mt-number,
.mt-equals,
.mt-target-chip { display: inline-flex; align-items: center; min-height: 48px; }
.mt-slot {
  min-width: 54px;
  min-height: 54px;
  padding: 0.25rem 0.55rem;
  background: var(--canvas-alt);
  font-family: var(--f-display);
  font-size: inherit;
}
.mt-slot.is-active { background: var(--mustard); transform: translate(-2px, -2px); box-shadow: var(--shadow-hard-lg); }
.mt-slot--static { display: inline-flex; align-items: center; justify-content: center; cursor: default; }
.mt-target-chip { background: var(--forest); color: var(--canvas); border: 2px solid var(--ink); border-radius: var(--radius); padding: 0.2rem 0.55rem; }
.mt-operator-grid { display: grid; grid-template-columns: repeat(4, minmax(58px, 1fr)); gap: 0.75rem; }
.mt-op-btn { min-height: 58px; background: var(--mustard); font-family: var(--f-display); font-size: 2rem; }
.mt-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.75rem; }
.mt-option { min-height: 64px; background: var(--canvas-alt); font-family: var(--f-display); font-size: clamp(1.45rem, 4vw, 2.4rem); }
.mt-option.is-selected,
.mt-bracket.is-selected { background: var(--mustard); transform: translate(-2px, -2px); box-shadow: var(--shadow-hard-lg); }
.mt-bracket-options { display: grid; gap: 0.75rem; }
.mt-bracket { display: grid; gap: 0.4rem; justify-items: start; min-height: 72px; padding: 0.9rem 1rem; background: var(--canvas-alt); text-align: left; }
.mt-bracket span { font-family: var(--f-display); font-size: clamp(1.35rem, 4vw, 2.1rem); }
.mt-bracket small { color: var(--forest); font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.mt-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: center; }

.mt-feedback,
.mt-success { border: 2px solid var(--ink); border-radius: var(--radius-lg); box-shadow: var(--shadow-hard); padding: 1rem; }
.mt-feedback { background: #fff7dd; }
.mt-success { background: #e1efe5; }
.mt-feedback h3 { margin: 0 0 0.35rem; font-family: var(--f-display); font-size: 1.35rem; }
.mt-feedback p,
.mt-success p { margin: 0; color: #333; font-weight: 600; line-height: 1.55; }
.mt-success strong { display: block; margin-bottom: 0.35rem; font-family: var(--f-display); font-size: 1.35rem; }
.mt-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.mt-compare-panel { border: 2px solid var(--ink); border-radius: var(--radius); background: var(--canvas); padding: 0.8rem; }
.mt-compare-panel p { overflow-wrap: anywhere; }

.mt-reward { min-height: min(720px, calc(100vh - 7rem)); display: grid; place-items: center; align-content: center; gap: 1.25rem; text-align: center; border: 2px solid var(--ink); border-radius: var(--radius-lg); background: var(--canvas-alt); box-shadow: var(--shadow-hard-lg); padding: clamp(1.25rem, 5vw, 3rem); }
.mt-reward h2 { font-size: clamp(2.6rem, 8vw, 5.4rem); }
.mt-reward p { max-width: 58ch; margin: 0 auto; color: #444; font-size: 1.1rem; font-weight: 600; line-height: 1.65; }
.mt-reward-map { width: min(260px, 70vw); aspect-ratio: 1.6; border: 2px solid var(--ink); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--forest) 0 35%, var(--mustard) 35% 58%, var(--coral) 58%); box-shadow: var(--shadow-hard-lg); transform: rotate(-3deg); }

@media (max-width: 860px) {
  .mt-topbar,
  .mt-hero,
  .mt-play-grid { grid-template-columns: 1fr; }
  .mt-topbar { align-items: flex-start; }
  .mt-map-card { min-height: 170px; }
  .mt-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mt-expression { font-size: clamp(1.45rem, 9vw, 2.3rem); }
}

@media (max-width: 520px) {
  .mt-shell { padding: 0.8rem; }
  .mt-topbar { display: grid; gap: 1rem; }
  .mt-link,
  .mt-btn { width: 100%; }
  .mt-title { max-width: 100%; }
  .mt-instruction,
  .mt-progress-row { display: grid; }
  .mt-operator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mt-options,
  .mt-compare { grid-template-columns: 1fr; }
  .mt-expression { gap: 0.4rem; padding: 0.7rem; }
  .mt-slot { min-width: 48px; min-height: 48px; }
  .mt-number,
  .mt-equals,
  .mt-target-chip { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .mt-link:hover,
  .mt-btn:hover,
  .mt-op-btn:hover,
  .mt-slot:hover,
  .mt-option:hover,
  .mt-bracket:hover,
  .mt-slot.is-active,
  .mt-option.is-selected,
  .mt-bracket.is-selected { transform: none; }
}
