/* PHYSICS LAB - shell chrome. The play field itself is all canvas. */
:root {
  --bg: #070b12;
  --panel: #0f1725;
  --panel-2: #131e2e;
  --line: rgba(63, 224, 207, 0.16);
  --text: #dceaf5;
  --muted: rgba(220, 234, 245, 0.55);
  --accent: #3fe0cf;
  --accent-ink: #04211f;
  --danger: #ff5470;
  --success: #6ee7a8;
  --radius: 14px;
  --hud-h: 52px;
  --ctl-h: 92px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 100vh;
  max-width: 680px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------------- header ---------------- */
.hud {
  flex: 0 0 auto;
  height: var(--hud-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}

.hud__brand {
  font: 800 15px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.14em;
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.hud__brand span {
  color: var(--accent);
  text-shadow: 0 0 14px rgba(63, 224, 207, 0.45);
}

.hud__chip {
  margin-left: auto;
  font: 600 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: rgba(63, 224, 207, 0.1);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
}

.iconbtn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, transform 0.1s;
}
.iconbtn:hover { color: var(--accent); border-color: var(--line); }
.iconbtn:active { transform: scale(0.94); }

/* ---------------- stage ---------------- */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: block;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* pointer events only - never scroll while dragging */
}

/* ---------------- controls ---------------- */
.controls {
  flex: 0 0 auto;
  min-height: var(--ctl-h);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
  background: linear-gradient(0deg, var(--panel-2), var(--panel));
}

.controls__status {
  margin: 0;
  text-align: center;
  font: 500 12px/1.3 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-height: 16px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 15px 20px;
  font: 800 15px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s, opacity 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.995); }
.btn:disabled { opacity: 0.45; cursor: default; }

.btn--primary {
  color: var(--accent-ink);
  background: linear-gradient(180deg, #62f0e0, var(--accent));
  box-shadow: 0 6px 22px rgba(63, 224, 207, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn--danger {
  color: #2a0710;
  background: linear-gradient(180deg, #ff7f96, var(--danger));
  box-shadow: 0 6px 22px rgba(255, 84, 112, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn--success {
  color: #042715;
  background: linear-gradient(180deg, #9af3c4, var(--success));
  box-shadow: 0 6px 22px rgba(110, 231, 168, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn--ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

/* ---------------- result overlay ---------------- */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.22s ease;
  z-index: 5;
}
.overlay.is-open { opacity: 1; }
/* The author `display: grid` above beats the UA rule for [hidden], so it has to
   be turned off explicitly - otherwise the invisible panel eats every tap. */
.overlay[hidden] { display: none; }

.overlay__card {
  width: min(320px, 100%);
}

.result {
  text-align: center;
  background: linear-gradient(180deg, rgba(23, 34, 50, 0.96), rgba(14, 22, 34, 0.96));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 20px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: pop 0.26s cubic-bezier(0.2, 1.3, 0.5, 1) both;
}
@keyframes pop {
  from { transform: translateY(14px) scale(0.94); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.result__badge {
  display: inline-block;
  font: 800 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.22em;
  padding: 7px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.result--ok .result__badge {
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 0 26px rgba(63, 224, 207, 0.4);
}
.result--fail .result__badge {
  color: #2a0710;
  background: var(--danger);
  box-shadow: 0 0 26px rgba(255, 84, 112, 0.35);
}

.result h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.result__meta,
.result__note {
  margin: 0 0 4px;
  font: 500 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
}
.result__note { color: rgba(63, 224, 207, 0.75); margin-top: 8px; }

.result__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.result__actions .btn { padding: 13px 10px; font-size: 13px; letter-spacing: 0.12em; }

/* ---------------- toast ---------------- */
.toast {
  position: absolute;
  left: 50%;
  top: 14px; /* over the open sky of the field, never over the tray the player drags from */
  transform: translate(-50%, -12px);
  padding: 9px 16px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  background: rgba(10, 18, 29, 0.92);
  border: 1px solid var(--line);
  color: var(--text);
  font: 600 12px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 6;
  max-width: min(88%, 380px);
  text-align: center;
  line-height: 1.45;
}
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }

/* short screens: give the play field every pixel we can */
@media (max-height: 640px) {
  :root { --hud-h: 44px; --ctl-h: 78px; }
  .btn { padding: 12px 18px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------- level select ---------------- */
.hud__chip {
  appearance: none;
  cursor: pointer;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  transition: border-color 0.15s, background 0.15s;
}
.hud__chip:hover { background: rgba(63, 224, 207, 0.18); }
.hud__chip.has-best::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--success);
  vertical-align: middle;
}

.iconbtn.has-dot { position: relative; }
.iconbtn.has-dot::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%;
  background: #ff7a4d; box-shadow: 0 0 0 2px var(--bg); animation: dotpulse 2.4s ease-in-out infinite;
}
@keyframes dotpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
.drawer__item[data-dot] .drawer__lbl small { color: #ff9d78; }
.drawer__item[data-dot] .drawer__ico { position: relative; }
.drawer__item[data-dot] .drawer__ico::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: #ff7a4d;
}
.iconbtn.is-off { color: rgba(220, 234, 245, 0.28); }

.result--levels { padding: 20px 16px 16px; }
.result__badge--plain {
  color: var(--accent);
  background: rgba(63, 224, 207, 0.12);
  border: 1px solid var(--line);
}

.lvlgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding: 2px;
  -webkit-overflow-scrolling: touch;
}

.lvl {
  appearance: none;
  display: grid;
  gap: 2px;
  padding: 10px 10px 9px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.08s;
}
.lvl:hover:not(:disabled) { border-color: var(--line); background: rgba(63, 224, 207, 0.08); }
.lvl:active:not(:disabled) { transform: scale(0.985); }
.lvl--current { border-color: var(--accent); background: rgba(63, 224, 207, 0.12); }
.lvl--locked { opacity: 0.38; cursor: not-allowed; }
.lvl__no {
  font: 800 10px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.lvl--locked .lvl__no { color: var(--muted); }
.lvl__name { font-size: 12.5px; font-weight: 600; }
.lvl__meta {
  font: 500 10px/1 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
}
.result__actions--single { grid-template-columns: 1fr; }

/* ---------------- player levels ---------------- */
.hud__chip--custom {
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.result__title { word-break: break-word; }
.result__by {
  margin: 0 0 10px;
  font: 500 12px/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
  word-break: break-word;
}
.result__tags { margin: 0 0 10px; }
.tag {
  display: inline-block;
  font: 800 10px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.16em;
  padding: 6px 10px;
  border-radius: 999px;
}
.tag--ok { color: #042715; background: var(--success); }
.tag--warn { color: #2b1c02; background: #ffc15a; }
.result__hint {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}
.result__note--small { font-size: 11px; color: var(--muted); }
.result__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  margin-top: 14px;
}
.linkbtn {
  appearance: none;
  background: none;
  border: 0;
  padding: 6px 2px;
  color: var(--accent);
  font: 600 12px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(63, 224, 207, 0.4);
}
.linkbtn:hover { text-decoration-color: var(--accent); }

/* ---------------- online: rank, leaderboard, report ---------------- */
.online { margin: 12px 0 2px; padding: 10px 12px; border-radius: 14px; background: rgba(63, 224, 207, 0.06); border: 1px solid rgba(63, 224, 207, 0.18); }
.online .result__meta { margin: 0; }
.online__rank { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 2px 8px; }
.online__pos { font: 800 26px/1 ui-monospace, "SF Mono", Menlo, monospace; color: var(--accent); }
.online__of { font: 500 12px/1.3 ui-monospace, "SF Mono", Menlo, monospace; color: var(--muted); }
.online__wr { margin: 6px 0 0; font-size: 12px; color: var(--text); word-break: break-word; }
.online__links { margin: 6px 0 0; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 10px; word-break: break-word; }
.online__err { margin: 0; font-size: 12px; color: var(--muted); }

.lb { list-style: none; margin: 10px 0 6px; padding: 0; display: grid; gap: 4px; max-height: min(46vh, 420px); overflow-y: auto; text-align: left; }
.lb__row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); }
.lb__row--me { background: rgba(63, 224, 207, 0.12); outline: 1px solid rgba(63, 224, 207, 0.35); }
.lb__row--pinned { margin-top: 6px; }
.lb__rank { font: 800 13px/1 ui-monospace, "SF Mono", Menlo, monospace; color: var(--muted); text-align: center; }
.lb__name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb__time { font: 700 13px/1 ui-monospace, "SF Mono", Menlo, monospace; color: var(--accent); }
.lb--mini { margin-top: 8px; }
.lb--mini .lb__row { padding: 6px 10px; }

.gstats { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 10px; font: 600 12px/1 ui-monospace, "SF Mono", Menlo, monospace; color: rgba(220, 234, 245, 0.75); }
.gstats__like { appearance: none; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.04); color: var(--text); border-radius: 999px; padding: 7px 12px; font: inherit; cursor: pointer; }
.gstats__like.is-on { color: #ff7a93; border-color: rgba(255, 122, 147, 0.45); background: rgba(255, 122, 147, 0.1); }
.linkbtn--muted { color: var(--muted); text-decoration-color: rgba(220, 234, 245, 0.25); }

.field__input {
  width: 100%;
  margin-top: 10px;
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 11px;
  outline: none;
  resize: none;
  -webkit-user-select: text;
  user-select: text;
}
.field__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 224, 207, 0.15); }
.report { display: grid; gap: 6px; text-align: left; margin-top: 4px; }
.report__opt { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); font-size: 13px; cursor: pointer; }
.report__opt input { accent-color: var(--danger); width: 16px; height: 16px; }

/* full-width secondary action (level select -> arcade) */
.btn--block { display: flex; width: 100%; justify-content: center; margin-top: 10px; font-size: 12.5px; letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* double-tap on buttons never zooms; pinch zoom stays available */
html { touch-action: manipulation; }

/* ---------------- menu button, language chip, drawer (src/menu.js) ---------------- */
a.hud__brand { color: var(--text); text-decoration: none; align-items: center; }
.hud__word { font: inherit; display: flex; gap: 6px; align-items: baseline; }
.hud__word span { color: var(--accent); text-shadow: 0 0 14px rgba(63, 224, 207, 0.45); }
.hud__mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(140deg, #16283c, #0b1320); border: 1px solid var(--line); font-style: normal; }
a.hud__brand:hover .hud__mark { border-color: var(--accent); }
.hud__lang { width: auto; padding: 0 9px; gap: 5px; display: inline-flex; align-items: center; font: 700 11px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.06em; }
.hud__lang svg { flex: none; }
@media (max-width: 440px) {
  .hud { gap: 7px; padding: 0 10px; }
  .hud__word { display: none; }
  .hud__chip { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
html.menu-lock, html.menu-lock body { overflow: hidden; }

.drawer { position: fixed; inset: 0; z-index: 900; }
.drawer[hidden] { display: none; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(3, 6, 10, 0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.2s ease; }
.drawer__panel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(86vw, 330px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #111b2a, #0a111c);
  border-right: 1px solid var(--line);
  box-shadow: 30px 0 80px -30px rgba(0, 0, 0, 0.9);
  transform: translateX(-104%); transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer.is-open .drawer__panel { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.drawer__brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 800 14px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.14em; }
.drawer__brand b { color: var(--accent); }
.drawer__mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(140deg, #16283c, #0b1320); border: 1px solid var(--line); }
.drawer__x { width: 38px; height: 38px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.04); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.drawer__x:hover { color: var(--text); }
.drawer__body { flex: 1; overflow-y: auto; padding: 6px 10px 16px; overscroll-behavior: contain; }
.drawer__sec { margin: 16px 10px 6px; font: 700 10.5px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(220, 234, 245, 0.4); }
.drawer__item {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 10px;
  border: 0; border-radius: 12px; background: none; color: var(--text); text-align: left;
  font: 600 15px/1.25 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans KR", "Noto Sans JP", sans-serif;
  text-decoration: none; cursor: pointer;
}
.drawer__item:hover, .drawer__item:focus-visible { background: rgba(255, 255, 255, 0.05); outline: none; }
.drawer__item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.drawer__item.is-current { background: rgba(63, 224, 207, 0.1); color: var(--accent); }
.drawer__ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.04); color: var(--accent); }
.drawer__lbl { flex: 1; min-width: 0; display: grid; gap: 2px; }
.drawer__lbl small { font-weight: 500; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer__val { font-size: 13px; color: var(--muted); }
.drawer__chev { color: var(--muted); display: grid; }
.drawer__foot { padding: 12px 20px 16px; font-size: 11.5px; color: rgba(220, 234, 245, 0.35); border-top: 1px solid rgba(255, 255, 255, 0.06); }
.switch { flex: none; width: 42px; height: 24px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); position: relative; transition: background 0.18s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.18s; }
.switch.is-on { background: var(--accent); }
.switch.is-on i { transform: translateX(18px); }

.langsheet { position: fixed; inset: 0; z-index: 950; display: grid; place-items: end center; }
.langsheet[hidden] { display: none; }
.langsheet__scrim { position: absolute; inset: 0; background: rgba(3, 6, 10, 0.6); opacity: 0; transition: opacity 0.18s; }
.langsheet__card {
  position: relative; width: min(100%, 460px); max-height: 86dvh; overflow-y: auto;
  background: linear-gradient(180deg, #131e2e, #0c1420); border: 1px solid var(--line);
  border-radius: 22px 22px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(24px); opacity: 0; transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s;
}
@media (min-width: 600px) { .langsheet { place-items: center; } .langsheet__card { border-radius: 22px; } }
.langsheet.is-open .langsheet__scrim { opacity: 1; }
.langsheet.is-open .langsheet__card { transform: none; opacity: 1; }
.langsheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.langsheet__head h2 { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 17px; color: var(--text); }
.langsheet__head h2 svg { color: var(--accent); }
.langsheet__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.langsheet__opt {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 10px 14px;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.04);
  color: var(--text); font: 600 15px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans KR", "Noto Sans JP", "Noto Sans SC", sans-serif; cursor: pointer; text-align: left;
}
.langsheet__opt:hover { border-color: var(--line); }
.langsheet__opt.is-on { border-color: var(--accent); background: rgba(63, 224, 207, 0.12); color: var(--accent); }
.langsheet__opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .drawer__panel, .drawer__scrim, .langsheet__card, .langsheet__scrim { transition: none; } }

/* ---------------- stars ---------------- */
.stars { display: inline-flex; gap: 4px; }
.star svg { width: 100%; height: 100%; display: block; fill: rgba(255, 255, 255, 0.12); }
.star.is-on svg { fill: #ffcf4a; filter: drop-shadow(0 0 6px rgba(255, 207, 74, 0.55)); }
.stars--big { display: flex; justify-content: center; margin: 14px 0 4px; }
.stars--big .star { width: 34px; height: 34px; }
.stars--big .star:nth-child(2) { transform: translateY(-7px) scale(1.12); }
.star.is-new { animation: starPop 0.55s cubic-bezier(0.2, 1.5, 0.3, 1) both; animation-delay: var(--d); }
@keyframes starPop { from { transform: scale(0.2) rotate(-40deg); opacity: 0; } }
.stars--big .star.is-new:nth-child(2) { animation-name: starPopMid; }
@keyframes starPopMid { from { transform: translateY(-7px) scale(0.2) rotate(-40deg); opacity: 0; } to { transform: translateY(-7px) scale(1.12); } }
.stars--mini { margin-left: 8px; vertical-align: -1px; }
.stars--mini .star { width: 11px; height: 11px; }
.result__star { margin: 0; font-size: 12.5px; color: #ffcf4a; }
.stars-total { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 10px 0 10px; font: 700 13px/1 ui-monospace, "SF Mono", Menlo, monospace; color: rgba(220, 234, 245, 0.7); }
.stars-total svg { width: 15px; height: 15px; fill: #ffcf4a; }
.stars-total b { color: #ffcf4a; }
@media (prefers-reduced-motion: reduce) { .star.is-new, .iconbtn.has-dot::after { animation: none; } }

/* ---------------- typesetting (game, gallery, editor) ---------------- */
:lang(ko) { word-break: keep-all; }
:lang(ja), :lang(zh-Hans), :lang(zh-Hant) { line-break: strict; }
.result h2, .result__title, .gal__empty h2 { text-wrap: balance; }
.result__note, .result__meta, .gal__empty p, .gal__foot, .status { text-wrap: pretty; }

/* ---------------- win card: share + install offer ---------------- */
.linkbtn--share { display: inline-flex; align-items: center; gap: 6px; }
.linkbtn--share svg { flex: none; }
.btn--sm { padding: 9px 14px; font-size: 12px; letter-spacing: 0.12em; }
.result__install {
  display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 10px 12px; border-radius: 12px;
  background: rgba(63, 224, 207, 0.07); border: 1px solid rgba(63, 224, 207, 0.22); text-align: left;
}
.result__install p { flex: 1; margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--text); }
.result__install .btn { flex: none; color: var(--accent); border-color: rgba(63, 224, 207, 0.4); background: none; }

/* ---------------- CJK: tracked mono labels ----------------
 * Wide letter-spacing and a monospace fallback make Hangul / kana / hanzi look
 * spaced out ("에 디 터"). In these languages the translated labels keep the mono
 * face for Latin characters but take a proper CJK face and near-zero tracking. */
:root:lang(ko) { --cjk: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR"; }
:root:lang(ja) { --cjk: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP"; }
:root:lang(zh-Hans) { --cjk: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC"; }
:root:lang(zh-Hant) { --cjk: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Noto Sans CJK TC"; }
html:is(:lang(ko), :lang(ja), :lang(zh-Hans), :lang(zh-Hant)) :is(.hud__chip, .hud__chip--custom, .controls__status, .btn:not(#btnPrimary):not(#btnTest), .result__badge, .result__actions .btn:not(#btnPrimary), .toast, .lvl__no, .tag, .linkbtn, .btn--block, .drawer__sec, .btn--sm, .result__meta, .result__star, .stars-total) {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, var(--cjk, sans-serif), monospace;
  letter-spacing: 0.01em;
}
