/* ==========================================================================
   BE THE MENTARIAN — page section + game overlay
   ========================================================================== */

/* ---------- section on the page ---------- */
.game { padding-block: clamp(130px, 22vh, 240px) clamp(110px, 18vh, 200px); }
.game__title em { font-style: normal; color: var(--yellow); }
.game__intro .lede { margin-top: clamp(24px, 4vh, 44px); max-width: 40ch; }
.game__stage { margin-top: clamp(50px, 9vh, 100px); display: grid; grid-template-columns: 1fr minmax(220px, 300px); gap: clamp(24px, 4vw, 64px); align-items: end; }
.game__screen {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #2f6b3a;
  border: 1px solid rgba(255, 210, 31, .5); box-shadow: 0 0 0 6px rgba(255, 210, 31, .06), 0 50px 90px -40px rgba(0, 0, 0, .8);
}
.game__preview { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.game__screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .06) 0 1px, transparent 1px 3px), radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(3, 10, 34, .55)); }
.game__ui { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding: clamp(16px, 3vw, 36px); background: linear-gradient(to top, rgba(3, 10, 34, .88), transparent); }
.game__press { font: 700 clamp(1.4rem, 3vw, 2.8rem)/0.95 var(--f-display); text-transform: uppercase; letter-spacing: -.02em; }
.game__press span { display: block; font: 500 .7rem/1.4 var(--f-label); letter-spacing: .18em; color: var(--yellow); margin-bottom: .6rem; }
.game__press b { animation: blink 1.1s steps(2) infinite; color: var(--yellow); font-weight: inherit; }
.game__btns { display: flex; flex-wrap: wrap; gap: 10px; }
.game__btns .btn--big { padding: 1.3em 2em; }
.game__facts { display: grid; gap: 0; border-top: 1px solid var(--faint); }
.game__facts li { display: flex; align-items: baseline; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--faint); }
.game__facts strong { font-family: var(--f-display); font-weight: 700; font-size: clamp(2.2rem, 3.6vw, 3.6rem); line-height: 1.05; letter-spacing: -.02em; min-width: 2.2ch; color: var(--yellow); }
.game__facts span { color: var(--mist); }
.game__controls { margin-top: 1.6rem; color: var(--mist); line-height: 1.8; }
@media (max-width: 900px) {
  .game__stage { grid-template-columns: 1fr; }
  .game__screen { aspect-ratio: 4 / 5; }
  .game__facts { grid-template-columns: 1fr 1fr; column-gap: 20px; }
}

/* ---------- full-screen game ---------- */
.mg { position: fixed; inset: 0; z-index: 80; background: #10301a; overflow: hidden; outline: none; user-select: none; -webkit-user-select: none; touch-action: none; font-family: var(--f-label); }
html.mg-open .nav, html.mg-open .journey { visibility: hidden; }
.mg-canvas { position: absolute; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; }
.mg kbd { font: 500 .62rem/1 var(--f-label); padding: .25em .45em; border: 1px solid currentColor; border-radius: 4px; opacity: .7; }

.mg-hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px; pointer-events: none; }
.mg-hud > * { pointer-events: auto; }
.mg-obj { display: grid; gap: 4px; max-width: min(380px, 56vw); padding: 12px 16px 13px; background: rgba(7, 21, 66, .9); border: 1px solid rgba(255, 210, 31, .6); border-radius: 10px; color: #fff; }
.mg-obj .micro { color: var(--yellow); font-size: .6rem; }
.mg-obj .micro b { color: #fff; font-weight: 500; }
.mg-obj strong { font-family: var(--f-display); font-weight: 700; font-size: clamp(.9rem, 1.2vw, 1.05rem); line-height: 1.2; }
.mg-obj small { color: var(--yellow); font: 500 .72rem/1 var(--f-label); }
.mg-obj small:empty { display: none; }
.mg-top { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.mg-chip { display: inline-flex; align-items: center; gap: .5em; padding: .7em 1em; border-radius: 999px; background: rgba(7, 21, 66, .9); border: 1px solid rgba(255, 255, 255, .22); color: #fff; font: 500 .72rem/1 var(--f-label); letter-spacing: .08em; text-transform: uppercase; }
.mg-mp { color: var(--yellow); }
.mg-mp b { color: #fff; font-weight: 500; }
.mg-mp.pulse { animation: mgPulse .6s var(--ease); }
@keyframes mgPulse { 40% { transform: scale(1.15); border-color: var(--yellow); } }
.mg-btn { cursor: pointer; transition: border-color .3s, background .3s; }
.mg-btn:hover { border-color: var(--yellow); }
.mg-pe { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); padding: .8em 1.3em; border-radius: 999px; background: var(--yellow); color: var(--navy-950); font: 500 .8rem/1 var(--f-label); letter-spacing: .1em; text-transform: uppercase; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6); }
.mg-loc { position: absolute; left: 50%; top: 22%; transform: translate(-50%, -10px); opacity: 0; transition: opacity .6s, transform .8s var(--ease); pointer-events: none; padding: .7em 1.4em; background: rgba(7, 21, 66, .85); color: #fff; border-radius: 999px; font: 500 .8rem/1 var(--f-label); letter-spacing: .22em; text-transform: uppercase; white-space: nowrap; }
.mg-loc.on { opacity: 1; transform: translate(-50%, 0); }
.mg-toasts { position: absolute; right: 14px; top: 70px; display: grid; gap: 6px; justify-items: end; pointer-events: none; }
.mg-toast { padding: .65em 1em; background: #fff; color: var(--ink); border-radius: 8px; font: 600 .82rem/1.2 var(--f-label); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .6); border-left: 4px solid var(--yellow); animation: toastIn .45s var(--ease) both; transition: opacity .4s, transform .4s; }
.mg-toast.out { opacity: 0; transform: translateX(14px); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }

/* dialog box */
.mg-dialog {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(760px, calc(100% - 28px)); min-height: 120px;
  padding: 22px 26px 26px; background: #f7f4ec; color: var(--ink); border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 0 0 3px var(--yellow), 0 24px 50px -20px rgba(0, 0, 0, .7); cursor: pointer; animation: dlgIn .3s var(--ease);
}
@keyframes dlgIn { from { opacity: 0; transform: translate(-50%, 16px); } }
.mg-dialog__who { position: absolute; left: 20px; top: -16px; padding: .45em .9em; background: var(--ink); color: var(--yellow); border-radius: 6px; font: 500 .7rem/1 var(--f-label); letter-spacing: .14em; text-transform: uppercase; }
.mg-dialog__text { font-size: clamp(1rem, 1.5vw, 1.18rem); line-height: 1.5; font-weight: 500; min-height: 3em; }
.mg-dialog__next { position: absolute; right: 18px; bottom: 10px; color: var(--blue-600); display: none; animation: blink 1s steps(2) infinite; }
.mg-dialog.is-full:not(.has-choices) .mg-dialog__next { display: block; }
.mg-dialog__choices { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.mg-dialog__choices:empty { display: none; }
.mg-dialog__choices button { padding: .8em 1.3em; border-radius: 8px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font: 700 .9rem/1 var(--f-label); cursor: pointer; transition: background .2s, color .2s; }
.mg-dialog__choices button:hover, .mg-dialog__choices button:focus-visible { background: var(--ink); color: var(--yellow); outline: none; }

/* ---------- panels: minigames, journal, pause, certificate ---------- */
.mg-panel { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: rgba(3, 10, 34, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); overflow-y: auto; }
.mg-card { width: min(640px, 100%); max-height: calc(100% - 8px); overflow-y: auto; background: #f7f4ec; color: var(--ink); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 0 0 3px var(--yellow), 0 40px 80px -30px rgba(0, 0, 0, .8); animation: cardIn .45s var(--ease) both; }
.mg-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 24px 16px; border-bottom: 2px solid rgba(7, 21, 66, .12); }
.mg-card__head .micro { color: var(--blue-600); }
.mg-card__head h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: -.02em; font-size: clamp(1.4rem, 2.6vw, 2rem); line-height: 1; margin-top: .4rem; }
.mg-x { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 2px solid var(--ink); background: #fff; color: var(--ink); font-size: 1rem; cursor: pointer; }
.mg-x:hover { background: var(--ink); color: var(--yellow); }
.mg-card__body { padding: 20px 24px 24px; }
.mg-meta { display: flex; justify-content: space-between; gap: 12px; font: 500 .7rem/1 var(--f-label); letter-spacing: .12em; text-transform: uppercase; color: rgba(7, 21, 66, .6); margin-bottom: 14px; }
.mg-hint { color: rgba(7, 21, 66, .5); margin-top: 16px; text-align: center; }
.mg-say { min-height: 1.4em; margin-top: 14px; text-align: center; font-weight: 600; color: var(--blue-600); }
.mg-timer { height: 6px; background: rgba(7, 21, 66, .1); border-radius: 3px; overflow: hidden; }
.mg-timer i { display: block; height: 100%; background: var(--yellow); transform-origin: left; }
.mg-q { text-align: center; font-family: var(--f-display); font-weight: 700; font-size: clamp(2.4rem, 7vw, 4rem); letter-spacing: -.02em; margin: 22px 0; }
.mg-choices { display: grid; gap: 10px; }
.mg-choices--4 { grid-template-columns: repeat(2, 1fr); }
.mg-choice { position: relative; display: grid; place-items: center; gap: 4px; min-height: 64px; padding: 12px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink); font: 800 1.4rem/1 var(--f-display); cursor: pointer; transition: transform .15s, background .2s, color .2s; }
.mg-choice kbd { position: absolute; left: 8px; top: 8px; }
.mg-choice:hover { transform: translateY(-2px); background: #fffbe6; }
.mg-choice.is-right { background: #3ecf8e; color: #fff; border-color: #2a9d68; }
.mg-choice.is-wrong { background: #ff6f6f; color: #fff; border-color: #c94b4b; animation: shake .35s; }
.mg-go, .mg-ghost { display: inline-flex; align-items: center; justify-content: center; gap: .5em; padding: .95em 1.5em; border-radius: 999px; font: 700 .95rem/1 var(--f-label); cursor: pointer; border: 2px solid var(--ink); transition: background .2s, color .2s, transform .2s; }
.mg-go { background: var(--ink); color: var(--yellow); }
.mg-go:hover { transform: translateY(-2px); }
.mg-ghost { background: transparent; color: var(--ink); }
.mg-ghost:hover { background: var(--ink); color: #fff; }
.mg-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.mg-menu { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.mg-result { text-align: center; display: grid; justify-items: center; gap: 10px; padding: 10px 0; }
.mg-result__big { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; font-size: 2.2rem; font-weight: 900; background: #3ecf8e; color: #fff; }
.mg-result.is-no .mg-result__big { background: var(--yellow); color: var(--ink); }
.mg-result h4 { font-family: var(--f-display); font-weight: 700; font-size: 1.5rem; }
.mg-result p { max-width: 36ch; color: rgba(7, 21, 66, .75); }
.mg-result .mg-go { margin-top: 8px; }

/* science flasks */
.mg-flasks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.mg-flask { position: relative; height: 130px; border: 2px solid var(--ink); border-radius: 12px 12px 30px 30px; background: #fff; cursor: pointer; overflow: hidden; }
.mg-flask span { position: absolute; left: 0; right: 0; bottom: 0; height: 45%; background: var(--c); opacity: .45; transition: opacity .15s, height .2s; }
.mg-flask kbd { position: absolute; left: 8px; top: 8px; }
.mg-flask.is-on { box-shadow: 0 0 0 4px var(--c), 0 0 34px var(--c); }
.mg-flask.is-on span { opacity: 1; height: 85%; }
/* english tiles */
.mg-clue { text-align: center; font-size: 1.05rem; font-weight: 600; margin-bottom: 18px; }
.mg-slots { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.mg-slot { width: 42px; height: 50px; display: grid; place-items: center; border-bottom: 3px solid var(--ink); font: 900 1.6rem/1 var(--f-display); }
.mg-slots.is-ok .mg-slot { color: #2a9d68; border-color: #3ecf8e; }
.mg-tiles { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.mg-tile { width: 48px; height: 52px; border: 2px solid var(--ink); border-radius: 8px; background: var(--yellow); color: var(--ink); font: 900 1.5rem/1 var(--f-display); cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform .12s, opacity .2s; }
.mg-tile:hover { transform: translateY(-2px); }
.mg-tile:disabled { opacity: .18; box-shadow: none; cursor: default; transform: none; }
/* art grids */
.mg-art { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mg-art .micro { color: rgba(7, 21, 66, .6); margin-bottom: 8px; }
.mg-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; padding: 6px; background: var(--ink); border-radius: 8px; aspect-ratio: 1; }
.mg-grid > * { background: var(--c); border-radius: 3px; border: 0; padding: 0; }
.mg-grid--mine button { cursor: crosshair; touch-action: none; }
.mg-grid--mine .is-wrong { outline: 3px solid #ff3b3b; outline-offset: -3px; animation: shake .35s; }
.mg-pal { align-items: center; }
.mg-sw { position: relative; width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--ink); background: var(--c); cursor: pointer; }
.mg-sw kbd { position: absolute; right: -6px; bottom: -6px; background: #fff; color: var(--ink); opacity: 1; }
.mg-sw.is-on { box-shadow: 0 0 0 4px var(--yellow); transform: scale(1.08); }
/* sorting */
.mg-item { display: grid; justify-items: center; gap: 10px; margin: 6px 0 20px; }
.mg-item canvas { width: 96px; height: 96px; image-rendering: pixelated; background: #e9e4d6; border-radius: 12px; }
.mg-item strong { font-weight: 800; font-size: 1.3rem; }
.mg-bins { grid-template-columns: repeat(3, 1fr); }
.mg-bin { min-height: 96px; background: var(--c); color: #fff; border-color: var(--ink); }
.mg-bin[data-t="paper"] { color: var(--ink); }
.mg-bin b { font-size: 1.05rem; font-weight: 800; }
.mg-bin small { font: 500 .62rem/1 var(--f-label); letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
/* journal */
.mg-journal { width: min(860px, 100%); }
.mg-journal__body { display: grid; grid-template-columns: 1fr auto; gap: 24px; }
.mg-tasks { display: grid; gap: 4px; }
.mg-tasks li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-weight: 600; }
.mg-tasks li.is-done { color: rgba(7, 21, 66, .45); text-decoration: line-through; }
.mg-tasks li.is-next { background: #fff3b8; }
.mg-tasks em { font: 500 .72rem/1 var(--f-label); font-style: normal; color: var(--blue-600); }
.mg-check { width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 6px; font-size: .8rem; }
.is-done .mg-check { background: #3ecf8e; border-color: #3ecf8e; color: #fff; }
.mg-map canvas { width: 288px; max-width: 100%; height: auto; image-rendering: pixelated; border: 3px solid var(--ink); border-radius: 8px; display: block; }
.mg-map p { margin-top: 8px; color: rgba(7, 21, 66, .6); display: flex; gap: 10px; align-items: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.dot--you { background: var(--yellow); outline: 2px solid var(--ink); }
.dot--goal { background: #ff6fa8; }
/* pause */
.mg-keys { display: grid; gap: 8px; margin-top: 22px; }
.mg-keys div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid rgba(7, 21, 66, .12); }
.mg-keys dt { font-weight: 700; }
.mg-keys dd { margin: 0; font: 500 .75rem/1.4 var(--f-label); color: rgba(7, 21, 66, .7); text-align: right; }
/* new game */
.mg-field { display: grid; gap: 8px; }
.mg-field .micro, .mg-field-label { color: rgba(7, 21, 66, .6); }
.mg-field input { padding: .8em 1em; border: 2px solid var(--ink); border-radius: 10px; font: 700 1.2rem/1 var(--f-label); color: var(--ink); background: #fff; outline: none; }
.mg-field input:focus { box-shadow: 0 0 0 3px var(--yellow); }
.mg-field-label { margin: 20px 0 8px; }
.mg-looks { display: flex; gap: 12px; margin-bottom: 22px; }
.mg-look { width: 84px; height: 84px; border: 2px solid var(--ink); border-radius: 12px; background: #9fd27f; cursor: pointer; display: grid; place-items: center; }
.mg-look canvas { width: 64px; height: 64px; image-rendering: pixelated; }
.mg-look.is-on { box-shadow: 0 0 0 4px var(--yellow); }
/* certificate */
.mg-cert { width: min(620px, 100%); text-align: center; padding: 34px 30px; display: grid; justify-items: center; gap: 10px; background: #fffdf6; outline: 2px solid var(--ink); outline-offset: -14px; }
.mg-cert .micro { color: var(--blue-600); }
.mg-cert h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: -.02em; font-size: clamp(1.5rem, 3.4vw, 2.4rem); line-height: 1; margin-bottom: 6px; }
.mg-cert__name { font-family: var(--f-display); font-weight: 700; font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1; color: var(--blue-600); border-bottom: 3px solid var(--yellow); padding: 0 .3em .1em; }
.mg-cert p:not(.micro):not(.mg-cert__name):not(.mg-cert__rank) { max-width: 40ch; color: rgba(7, 21, 66, .75); }
.mg-cert__rank { padding: .5em 1.2em; background: var(--ink); color: var(--yellow); border-radius: 999px; font: 500 .85rem/1 var(--f-label); letter-spacing: .16em; text-transform: uppercase; }
.mg-cert__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin: 10px 0; }
.mg-cert__stats div { padding: 12px; border: 2px solid rgba(7, 21, 66, .14); border-radius: 10px; }
.mg-cert__stats dt { font: 500 .6rem/1.2 var(--f-label); letter-spacing: .1em; text-transform: uppercase; color: rgba(7, 21, 66, .55); }
.mg-cert__stats dd { margin: 6px 0 0; font-weight: 900; font-size: 1.5rem; }
.mg-cert__line { font-family: var(--f-display); font-weight: 700; font-size: 1.2rem; color: var(--ink) !important; }

/* ---------- touch controls ---------- */
.mg-pad { display: none; }
.mg.is-touch .mg-pad { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); pointer-events: none; }
.mg.is-touch .mg-dialog { bottom: 170px; }
.mg-pad button { pointer-events: auto; touch-action: none; border: 2px solid rgba(255, 255, 255, .5); background: rgba(7, 21, 66, .7); color: #fff; font: 700 1rem/1 var(--f-label); }
.mg-pad button:active { background: var(--yellow); color: var(--ink); }
.mg-dpad { display: grid; grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(3, 50px); gap: 2px; }
.mg-dpad button { border-radius: 10px; }
.mg-dpad [data-d="3"] { grid-area: 1 / 2; } .mg-dpad [data-d="1"] { grid-area: 2 / 1; } .mg-dpad [data-d="2"] { grid-area: 2 / 3; } .mg-dpad [data-d="0"] { grid-area: 3 / 2; }
.mg-ab { display: flex; gap: 14px; align-items: flex-end; }
.mg-ab button { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; align-content: center; gap: 2px; font-size: 1.3rem; }
.mg-ab [data-k="a"] { background: rgba(255, 210, 31, .9); color: var(--ink); margin-bottom: 30px; }
.mg-ab small { font: 500 .5rem/1 var(--f-label); letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 640px) {
  .mg-hud { flex-direction: column; padding: 10px; gap: 8px; }
  .mg-obj { max-width: calc(100% - 4px); padding: 9px 12px; }
  .mg-top { justify-content: flex-start; }
  .mg-chip { padding: .6em .8em; font-size: .62rem; }
  .mg-chip kbd { display: none; }
  .mg-toasts { top: auto; bottom: 240px; right: 10px; }
  .mg-journal__body { grid-template-columns: 1fr; }
  .mg-art { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mg-flask { height: 100px; }
  .mg-card__head, .mg-card__body { padding-inline: 16px; }
  .mg-cert__stats { grid-template-columns: 1fr; }
}
.reduce .mg-dialog, .reduce .mg-card, .reduce .mg-toast { animation: none; }
