/* Shared Emerald-style pixel UI kit (student app, booth, screen, admin). */
@font-face { font-family: 'Galmuri11'; src: url('../fonts/Galmuri11.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'Galmuri11'; font-weight: bold; src: url('../fonts/Galmuri11-Bold.woff') format('woff'); font-display: swap; }

:root {
  --ink: #303848;          /* text */
  --ink-shadow: #d8d8d0;   /* GBA text shadow */
  --paper: #f8f8f8;        /* textbox fill */
  --frame: #4a6a9a;        /* textbox frame */
  --frame-2: #88a8d8;      /* inner frame line */
  --sky: #78c8f0;
  --grass-1: #88d070;
  --grass-2: #70b858;
  --red: #c83838;
  --red-dark: #a02828;
  --gold: #f8d048;
  --green: #2e8a2e;
  --gray: #a0a8b0;
  --bg: #e8f0d8;
  --px: 4px;               /* chunky border unit */
  /* font sizes snap to the Galmuri11 12px grid in DEVICE pixels — js/ui.js pixelFontScale() overrides on hi-dpi screens */
  --fs-s: 12px; --fs-m: 16px; --fs-l: 20px; --fs-xl: 24px; --fs-xxl: 36px;
  --font: 'Galmuri11', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs-m);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  font-smooth: never;
  -webkit-tap-highlight-color: transparent;
  word-break: keep-all;          /* never split Korean words in the middle */
  overflow-wrap: anywhere;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
img, canvas.sprite { image-rendering: pixelated; image-rendering: crisp-edges; -webkit-touch-callout: none; user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* GBA text shadow */
.gba-text { text-shadow: 1px 1px 0 var(--ink-shadow); }

/* Emerald textbox: rounded double frame */
.box {
  background: var(--paper);
  border: var(--px) solid var(--frame);
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 4px var(--frame-2), 0 3px 0 rgba(0, 0, 0, .18);
  padding: 14px 16px;
  text-shadow: 1px 1px 0 var(--ink-shadow);
}
.box.dark { background: #283048; color: #f8f8f8; --frame: #182030; --frame-2: #586890; --paper: #283048; text-shadow: 1px 1px 0 #101828; }
.box.tight { padding: 10px 12px; }

/* buttons */
.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px;
  background: var(--paper); color: var(--ink);
  border: var(--px) solid var(--ink); border-radius: 8px;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: bold; cursor: pointer; text-shadow: 1px 1px 0 var(--ink-shadow);
  transition: transform .05s;
}
.btn:focus-visible { outline: 3px dashed var(--gold); outline-offset: 2px; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--red); color: #fff; text-shadow: 1px 1px 0 var(--red-dark); }
.btn.go { background: var(--green); color: #fff; text-shadow: 1px 1px 0 #286828; }
.btn.gold { background: var(--gold); }
.btn.big { min-height: 60px; font-size: var(--fs-l); width: 100%; }
.btn.small { min-height: 44px; padding: 4px 12px; font-size: var(--fs-m); box-shadow: 0 3px 0 var(--ink); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }

/* ▶ menu cursor list */
.menu { list-style: none; margin: 0; padding: 0; }
.menu > li > button {
  width: 100%; text-align: left; background: none; border: 0; padding: 12px 8px 12px 30px;
  min-height: 48px; position: relative; cursor: pointer; text-shadow: inherit;
}
.menu > li > button[aria-pressed='true']::before,
.menu > li > button:focus-visible::before { content: '▶'; position: absolute; left: 6px; }

/* chips / badges */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; font-size: var(--fs-s); white-space: nowrap; }
.type { display: inline-block; padding: 1px 10px; border-radius: 6px; font-size: var(--fs-s); text-shadow: 1px 1px 0 rgba(0,0,0,.35); border: 2px solid rgba(0,0,0,.25); }

/* HP-bar style progress */
.bar { height: 12px; background: #505860; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(#70f8a8 0 50%, #58d080 50%); }

/* toasts */
#toast { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 12px); display: grid; gap: 8px; justify-items: center; pointer-events: none; z-index: 1000; }
.toast { background: #283048; color: #fff; padding: 10px 16px; border-radius: 8px; border: 3px solid #182030; max-width: min(92vw, 420px); animation: pop .18s steps(3); text-shadow: 1px 1px 0 #101828; }
.toast.out { opacity: 0; transition: opacity .3s; }

@keyframes pop { from { transform: scale(.85); } to { transform: scale(1); } }
@keyframes blink { 50% { opacity: 0; } }
.blink { animation: blink 1s steps(1) infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
