html:has(#gamification[open]) { overflow: hidden; }
#gamification {
  --gm-ink: #202e29;
  --gm-green: #245c47;
  --gm-line: #d8dfd8;
  position: fixed;
  inset: 0;
  width: min(850px, calc(100% - 28px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d5dcd5;
  border-radius: 22px;
  background: #fffefb;
  color: var(--gm-ink);
  text-align: start;
  box-shadow: 0 22px 85px #19251e50;
}
#gamification[open] { display: flex; flex-direction: column; }
#gamification [hidden] { display: none !important; }
#gamification::backdrop { background: #202924ba; backdrop-filter: blur(5px); }
#gamification button { font: inherit; cursor: pointer; }
#gamification :focus-visible { outline: 3px solid #9c2e52; outline-offset: 2px; }
#gamification .gm-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px 14px 24px;
  border-bottom: 1px solid var(--gm-line);
}
#gamification .gm-format { color: #873454; font-size: 12px; font-weight: 800; }
#gamification h2, #gamification h3 { margin: 0; color: var(--gm-ink); font-weight: 800; letter-spacing: -.04em; line-height: 1.18; }
#gamification h2 { font-size: clamp(20px, 3vw, 27px); }
#gamification h3 { font-size: clamp(19px, 2.7vw, 25px); }
#gamification [data-game-close] {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--gm-line); border-radius: 50%; background: white; color: var(--gm-ink); font: 25px/1 Arial,sans-serif;
}
#gamification [data-game-close]:hover { background: #edf3eb; }
#gamification .gm-body {
  display: grid;
  grid-template-columns: minmax(190px, 32%) minmax(0, 1fr);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#gamification .gm-board { min-width: 0; background: #eaf0e4; border-right: 1px solid var(--gm-line); }
#gamification .gm-art { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
#gamification .gm-route { margin: 0; padding: 24px clamp(12px, 2vw, 25px); list-style: none; }
#gamification .gm-route li { position: relative; padding: 0 0 24px 28px; color: #59685f; font-size: 14px; font-weight: 650; line-height: 1.3; }
#gamification .gm-route li:last-child { padding-bottom: 0; }
#gamification .gm-route li::before {
  content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; box-sizing: border-box;
  border: 2px solid #829687; border-radius: 50%; background: #eaf0e4; z-index: 1;
}
#gamification .gm-route li:not(:last-child)::after { content: ''; position: absolute; width: 2px; top: 12px; left: 7px; bottom: -6px; background: #c2cdbd; }
#gamification .gm-route li[data-state="current"]::before { border-color: #a13955; background: #cc5576; box-shadow: 0 0 0 4px #dcb4bd; }
#gamification .gm-route li[data-state="done"]::before { border-color: var(--gm-green); background: var(--gm-green); }
#gamification .gm-route time { display: block; margin-bottom: 3px; font-size: 12px; font-variant-numeric: tabular-nums; color: #476151; }
#gamification .gm-route li[data-state="current"] { color: var(--gm-ink); }
#gamification .gm-panel { min-width: 0; padding: clamp(17px, 3vw, 31px); }
#gamification .gm-status { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 18px; color: #536158; font-size: 13px; font-weight: 700; }
#gamification .gm-points { display: inline-flex; align-items: baseline; gap: 5px; padding: 5px 11px; border: 1px solid #cddccb; border-radius: 20px; color: #284b37; background: #eff5ea; font-variant-numeric: tabular-nums; white-space: nowrap; }
#gamification .gm-kicker { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 10px; color: #4b6354; font-size: 13px; font-weight: 750; }
#gamification .gm-kicker time { border-left: 3px solid #be4a69; padding-left: 7px; color: #8b304d; font-variant-numeric: tabular-nums; }
#gamification .gm-scenario, #gamification .gm-outcome { margin: 9px 0 16px; color: #43534a; font-size: 15px; line-height: 1.5; }
#gamification .gm-options { display: grid; gap: 7px; margin-top: 12px; }
#gamification .gm-options button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 11px;
  border: 1px solid #cad3ca; border-radius: 11px; background: white; color: var(--gm-ink); text-align: start; font-size: 14px; line-height: 1.4; font-weight: 650;
}
#gamification .gm-options button:hover:not([aria-disabled]) { border-color: #6b8b76; background: #f3f7ef; }
#gamification .gm-marker { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #edf0e9; color: #4b6052; font-size: 12px; }
#gamification .gm-options button[aria-disabled] { cursor: default; }
#gamification .gm-options button[data-state="best"] { border-color: #6f967a; background: #eaf4eb; }
#gamification .gm-options button[data-state="best"] .gm-marker { color: white; background: var(--gm-green); }
#gamification .gm-options button[data-state="missed"] { border-color: #ba8892; background: #fbf1f2; }
#gamification .gm-options button[data-state="missed"] .gm-marker { color: white; background: #894355; }
#gamification .gm-feedback { margin-top: 14px; border-left: 3px solid #497e5b; padding: 0 0 0 11px; color: #304d3a; font-size: 14px; line-height: 1.45; }
#gamification .gm-feedback[data-correct="false"] { border-color: #aa6678; color: #69384a; }
#gamification .gm-feedback strong { display: block; font-weight: 800; }
#gamification .gm-feedback p { margin: 3px 0 0; color: inherit; font: inherit; }
#gamification .gm-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; margin-top: 15px; padding: 9px 18px;
  border: 1px solid var(--gm-green); border-radius: 24px; background: var(--gm-green); color: white; font-size: 14px; font-weight: 750;
}
#gamification .gm-action:hover { background: #173e2f; }
#gamification .gm-review { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--gm-line); }
#gamification .gm-review li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gm-line); font-size: 14px; }
#gamification .gm-review strong { color: var(--gm-green); font-variant-numeric: tabular-nums; }
@media (max-width: 670px), (max-height: 480px) {
  #gamification { width: min(650px, calc(100% - 14px)); max-height: calc(100dvh - 12px); border-radius: 16px; }
  #gamification .gm-header { padding: 9px 12px 9px 16px; }
  #gamification .gm-body { display: block; }
  #gamification .gm-board { display: none; }
  #gamification .gm-panel { padding: 16px; }
  #gamification .gm-status { margin-bottom: 13px; }
}
@media (max-width: 670px) and (min-height: 630px) {
  #gamification .gm-board { display: block; height: 75px; overflow: hidden; border: 0; }
  #gamification .gm-art { height: 100%; aspect-ratio: auto; object-position: 50% 48%; }
  #gamification .gm-route { display: none; }
}
