:root {
  color-scheme: dark;
  --navy: #14192f;
  --ink: #15182a;
  --panel: #1d2440;
  --line: #374061;
  --paper: #fff7ee;
  --muted: #b8c2e1;
  --orange: #ffb34d;
  --pink: #ff83ba;
  font-family: Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -15%, #252e53, transparent 70%),
    linear-gradient(90deg, #7d91da0b 1px, transparent 1px),
    linear-gradient(#7d91da0b 1px, transparent 1px), var(--navy);
  background-size: auto, 25px 25px, 25px 25px, auto;
  color: var(--paper);
}
button, a { font: inherit; }
button { cursor: pointer; color: inherit; border: 0; }
button:focus-visible, a:focus-visible { outline: 3px dashed #fff; outline-offset: 4px; }
.shell { width: min(1190px, calc(100% - 72px)); margin: 0 auto; padding: 24px 0 18px; }
.brand-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 4px 18px; }
.brands { display: flex; align-items: center; gap: 20px; }
.brands img { display: block; max-width: 100%; height: auto; object-fit: contain; }
.brand-divider { width: 1px; height: 25px; background: #4d5778; }
.motto { display: flex; gap: 10px; align-items: center; color: #ffe09f; font: 700 12px/1.4 "Courier New", monospace; letter-spacing: .14em; }
.spark { display: inline-block; width: 14px; height: 14px; background: #ffc76e; clip-path: polygon(36% 0,64% 0,64% 36%,100% 36%,100% 64%,64% 64%,64% 100%,36% 100%,36% 64%,0 64%,0 36%,36% 36%); }
.arcade { border: 2px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 8px 0 #0d1226, 0 25px 60px #080b1e70; overflow: hidden; }
.toolbar, .below-stage { display: flex; justify-content: space-between; gap: 12px; min-height: 60px; align-items: center; padding: 8px 17px; }
.toolbar { border-bottom: 3px solid var(--ink); }
.game-name { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; }
.pixel-star { display: inline-block; width: 25px; height: 25px; flex: 0 0 auto; background: #ffbf57; clip-path: polygon(40% 0,60% 0,60% 16%,68% 16%,68% 35%,100% 35%,100% 53%,87% 53%,87% 66%,75% 66%,75% 100%,57% 100%,57% 89%,43% 89%,43% 100%,24% 100%,24% 66%,13% 66%,13% 53%,0 53%,0 35%,32% 35%,32% 16%,40% 16%); }
.toolbar-actions { display: flex; gap: 8px; }
.small-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 11px; min-height: 39px; border: 1px solid #4a5575; border-radius: 7px;
  background: #293253; font-size: 14px; font-weight: 700;
}
.small-button:hover { background: #384569; }
.small-button[aria-pressed="false"] { color: var(--muted); }
.sound-icon { display: inline-block; width: 13px; height: 15px; background: currentColor; clip-path: polygon(0 32%,31% 32%,69% 0,81% 0,81% 100%,69% 100%,31% 68%,0 68%); }
#audio[aria-pressed="false"] .sound-icon { opacity: .4; }
.restart-icon { font: bold 23px/.65 Arial, sans-serif; }
.stage { position: relative; height: clamp(455px, 48vw, 550px); isolation: isolate; background: #638ff1; overflow: hidden; direction: ltr; }
.stage, .touch-guide {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.stage:focus { outline: none; }
#world { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.topic-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.topic-label {
  position: absolute; transform: translate(-50%, -100%);
  padding: 4px 9px; white-space: nowrap; direction: rtl;
  color: #fff0c4; background: #202848; border: 2px solid #14182e;
  box-shadow: 2px 2px #2438678c; font-size: clamp(13px, 1.3vw, 17px);
  font-weight: 700; line-height: 1.35;
}
.topic-label::after {
  content: ""; position: absolute; width: 11px; height: 7px; left: 50%; top: 100%;
  transform: translateX(-50%); background: #14182e;
  clip-path: polygon(0 0, 100% 0, 100% 29%, 82% 29%, 82% 57%, 64% 57%, 64% 100%, 36% 100%, 36% 57%, 18% 57%, 18% 29%, 0 29%);
}
.hud { position: absolute; z-index: 1; top: 16px; inset-inline: 16px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; direction: rtl; }
.counter {
  display: flex; align-items: center; gap: 8px; min-height: 39px; padding: 5px 10px;
  border: 2px solid #14182e; background: #202848; box-shadow: 3px 3px 0 #2438678c;
  color: #fcf4e8; font-size: 14px; font-weight: 700;
}
.counter b { font: bold 15px/1 "Courier New",monospace; color: #ffda8b; white-space: nowrap; }
.coin-icon { width: 15px; height: 23px; background: #ffec8c; border: 3px solid #e69620; box-shadow: inset 3px 0 #fff7b6, inset -3px 0 #ffc448; clip-path: polygon(25% 0,75% 0,75% 12%,100% 12%,100% 88%,75% 88%,75% 100%,25% 100%,25% 88%,0 88%,0 12%,25% 12%); }
.block-icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 20px; height: 20px; background: #ffb34d; border: 2px solid #15182a; box-shadow: inset 0 0 0 1px #ffdd84; color: #211a2e; font: 900 15px/1 "Courier New", monospace; }
.intro-screen {
  position: absolute; z-index: 2; inset: 0; overflow: auto; display: flex;
  padding: 13px; direction: rtl; background: #17204a9c;
}
.game-card {
  border: 4px solid #ffb349;
  box-shadow: inset 0 0 0 4px #291c34, 0 6px #151426db;
  text-align: center;
}
.scene-intro {
  width: min(495px, 100%); margin: auto; padding: 12px 20px 16px;
  background: #2f5fbc; color: #fff6f6;
}
.scene-intro h1 { margin: 0 auto 6px; max-width: 100%; }
.scene-intro h1 img {
  display: block; width: min(330px, 100%); height: auto; margin-inline: auto;
  filter: drop-shadow(2px 3px #162e6e9c);
}
.intro-description {
  margin: 0 0 10px; padding: 5px 9px;
  background: #f783b8; color: #321c36; border: 2px solid #2a203c;
  font-size: 15px; font-weight: 700; line-height: 1.6;
}
.card-list { margin: 0; padding: 0; list-style: none; text-align: start; display: grid; gap: 5px; }
.card-list li { border-inline-start: 4px solid #ffdb80; line-height: 1.5; }
.intro-list li {
  display: flex; align-items: center; gap: 8px; background: #204486;
  padding: 4px 8px; font-size: 14px;
}
.instruction-icon {
  display: inline-grid; place-items: center; width: 20px; height: 20px; flex: 0 0 auto;
  background: #b1cefb; color: #1e3562; border: 2px solid #2a203c; font: bold 16px/1 Arial, sans-serif;
}
.flag-icon {
  width: 20px; height: 20px; flex: 0 0 auto; position: relative; border-inline-start: 3px solid #ffdb80;
}
.flag-icon::after {
  content: ""; position: absolute; inset: 1px 0 7px 2px; border: 2px solid #311e42;
  background: repeating-conic-gradient(#ff98c3 0 25%, #fff2d0 0 50%) 0 / 7px 7px;
}
.discovery-card {
  width: min(515px, calc(100% - 30px)); max-height: calc(100dvh - 32px);
  padding: clamp(14px, 4vw, 25px); overflow: auto; overscroll-behavior: contain;
  background: #f37ab3; color: #351c34;
}
.discovery-card::backdrop { background: #101634c7; }
.discovery-card[open] { animation: card-appear 150ms ease-out; }
@keyframes card-appear { from { opacity: .6; transform: translateY(7px); } }
.discovery-header { display: grid; justify-items: center; gap: 5px; margin-bottom: 14px; }
.discovery-icon {
  width: clamp(44px, 11vw, 64px); height: auto; image-rendering: pixelated;
  filter: drop-shadow(3px 3px #54204b51);
}
.discovery-header h2 {
  margin: 0; color: #ffdf83; font-size: clamp(24px, 7vw, 33px);
  text-shadow: 1px 2px #3b2141, 2px 3px #3b2141, -1px 0 #3b2141, 0 -1px #3b2141;
}
.discovery-points { gap: 6px; }
.discovery-points li {
  padding: 8px 10px; background: #ffd2e7; font-size: 16px; line-height: 1.6;
  border-inline-start-color: #753354;
}
.discovery-points strong { color: #612044; }
.caught-card {
  width: min(510px, calc(100% - 30px)); max-height: calc(100dvh - 32px);
  padding: 20px clamp(16px, 5vw, 28px) 24px; overflow: auto;
  color: #fff3fa; background: #552779;
}
.caught-card::backdrop { background: #101634c7; }
.caught-card[open] { animation: card-appear 150ms ease-out; }
.caught-monster {
  display: block; width: 78px; height: 72px; margin: 0 auto 10px;
  image-rendering: pixelated; filter: drop-shadow(3px 4px #28143da0);
}
.caught-card h2 { margin: 0; color: #ffdc88; font-size: clamp(23px, 6vw, 31px); line-height: 1.4; text-shadow: 2px 2px #2b163d; }
.caught-card > p { margin: 8px 0 13px; font-size: 16px; line-height: 1.55; }
.bug-story {
  margin-top: 13px; padding: 10px 12px;
  border: 2px solid #301a44; border-inline-start: 4px solid #ffbe65;
  background: #fbd0e6; color: #3b2244; text-align: start;
}
.bug-story h3 { margin: 0 0 3px; font-size: 18px; color: #65234f; }
.bug-story p { margin: 5px 0; font-size: 14px; line-height: 1.65; }
.bug-story figure { margin: 8px 0 0; }
.bug-story img { display: block; width: 100%; height: auto; border: 2px solid #6e426a; }
.bug-story figcaption { margin-top: 5px; font-size: 12px; line-height: 1.5; }
.bug-story a { color: #602153; font-weight: 700; text-underline-offset: 2px; }
.bug-story a:focus-visible { outline-color: #4d2155; }
@media (prefers-reduced-motion: reduce) { .caught-card[open] { animation: none; } }
.discovery-card .primary-button { margin: 16px 0 2px; min-width: 105px; }
@media (prefers-reduced-motion: reduce) { .discovery-card[open] { animation: none; } }
.primary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 47px; padding: 7px 22px; background: #ffbd58; color: #25172b;
  border: 3px solid #271830; box-shadow: inset 0 3px #ffdc82, 4px 4px #271830;
  font-size: 17px; text-decoration: none; font-weight: 800;
}
.scene-intro .primary-button { min-height: 42px; margin-top: 11px; }
.primary-button:hover { background: #ffd274; }
.primary-button:active { transform: translate(2px, 2px); box-shadow: inset 0 2px #ffdc82, 2px 2px #271830; }
.play-icon { display: inline-block; width: 15px; height: 16px; background: currentColor; clip-path: polygon(0 0,33% 0,33% 20%,58% 20%,58% 37%,83% 37%,83% 45%,100% 45%,100% 55%,83% 55%,83% 63%,58% 63%,58% 80%,33% 80%,33% 100%,0 100%); }
.toast {
  position: absolute; z-index: 2; top: 72px; right: 50%; transform: translateX(50%);
  width: min(425px, calc(100% - 34px)); padding: 9px 13px; display: flex; gap: 10px; align-items: center;
  direction: rtl; color: #291930; background: #ffc1dc; border: 3px solid #28203b; box-shadow: 4px 4px #28203b82;
}
.toast strong { font-size: 16px; }
.toast p { margin: 4px 0 0; font-size: 14px; line-height: 1.5; }
.toast-tile { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; color: #242039; background: #ffbb55; border: 2px solid #242039; font: 900 23px/1 "Courier New", monospace; }
.below-stage { border-top: 3px solid #15182a; }
.keyboard-guide, .keyboard-guide > span, .key-group { display: flex; gap: 8px; align-items: center; }
.keyboard-guide { color: var(--muted); gap: 22px; font-size: 14px; }
.key-group { gap: 3px; }
kbd {
  display: inline-grid; place-items: center; padding: 3px 7px; min-width: 26px; min-height: 24px;
  background: #131a32; border: 1px solid #536083; border-bottom-width: 3px; border-radius: 4px;
  color: #ffefd8; font: 700 13px/1 "Courier New", monospace;
}
.touch-guide { display: none; }
.game-tip { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin: 20px 0 0; line-height: 1.6; }
.details {
  padding: 0; width: min(530px, calc(100% - 26px)); max-height: min(88dvh, 775px);
  overflow: auto; color: var(--paper); border: 3px solid #11182a; background: #222943;
  box-shadow: 7px 7px #090d1e; text-align: center;
}
.details::backdrop { background: #0c1028d6; }
.dialog-inner { position: relative; }
.close-button { position: absolute; top: 10px; left: 10px; width: 35px; height: 35px; border: 2px solid #271830; background: #fba5ce; color: #271830; font: 800 26px/1 Arial, sans-serif; }
.dialog-banner { padding: 17px 41px 14px; background: #f46cae; color: #25182e; border-bottom: 3px solid #12162b; }
.dialog-banner .pixel-star { background: #36233d; width: 28px; height: 28px; }
.dialog-banner p { margin: 6px 0 0; line-height: 1.5; }
.dialog-banner h2 { font-size: clamp(23px, 6vw, 30px); margin: 5px 0 0; }
.workshop-name { font-weight: bold; }
.details-body { padding: 15px 18px 20px; }
.details-body > p { margin: 8px 0 13px; font-size: 16px; line-height: 1.75; }
.result { padding: 7px 11px; border: 1px solid #545d7b; background: #171e37; color: #ffdb8c; font-weight: 700; font-size: 14px; }
.topics, .event-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.topics span { font-size: 14px; font-weight: 700; padding: 7px 3px; color: #252038; background: #ffbd61; border: 2px solid #111628; }
.event-facts { margin: 13px 0; }
.event-facts div { background: #1a213a; border: 1px solid #4a5575; padding: 8px 4px; }
.event-facts dt { color: #c3cce9; font-size: 14px; }
.event-facts dd { margin: 6px 0 0; font-size: 14px; line-height: 1.45; font-weight: 700; }
.registration { margin: 14px 0; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: center; }
.registration img { display: block; background: white; object-fit: contain; }
.secondary-button { background: #343f65; border: 2px solid #8491bd; min-height: 39px; padding: 6px 16px; font-weight: 700; }
.secondary-button:hover { background: #44517e; }

@media (max-width: 760px), (pointer: coarse) {
  .touch-guide { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 15px; touch-action: none; }
  .touch-directions { display: flex; gap: 8px; }
  .touch-guide button {
    min-width: 51px; min-height: 44px; background: #37466f; border: 2px solid #6b7da9;
    box-shadow: 3px 3px #0d1328; border-radius: 6px; font-weight: 800; touch-action: none; user-select: none;
  }
  .touch-guide .touch-jump { min-width: 84px; background: #ffb85a; border-color: #ffe095; color: #221833; }
  .touch-arrow { display: inline-block; width: 15px; height: 15px; vertical-align: middle; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
  [data-input="left"] .touch-arrow { transform: rotate(180deg); }
  .touch-jump .touch-arrow { transform: rotate(-90deg); width: 12px; height: 12px; }
  .touch-jump span { padding-inline-start: 6px; }
  .touch-guide button.held { transform: translate(2px, 2px); box-shadow: 1px 1px #0d1328; }
  .keyboard-guide { display: none; }
  .below-stage { padding: 8px 10px 10px; }
}
@media (max-width: 600px) {
  .shell { width: calc(100% - 20px); padding: 12px 0; }
  .brand-bar { padding: 0 1px 12px; gap: 8px; }
  .brands { gap: 8px; }
  .brands img:first-child { width: 96px; }
  .brands img:last-child { width: 69px; }
  .brand-divider { height: 20px; }
  .motto { font-size: 9px; letter-spacing: .05em; gap: 4px; text-align: left; max-width: 124px; }
  .spark { width: 10px; height: 10px; flex: 0 0 auto; }
  .toolbar { min-height: 48px; padding: 4px 8px; gap: 5px; }
  .toolbar-actions { gap: 5px; }
  .small-button { min-height: 34px; padding: 3px 6px; font-size: 13px; }
  .game-name { font-size: 14px; gap: 4px; }
  .game-name .pixel-star { width: 20px; height: 20px; }
  .stage { height: clamp(345px, 65svh, 465px); }
  .hud { top: 10px; inset-inline: 8px; }
  .counter { min-height: 34px; gap: 5px; padding: 4px 6px; font-size: 13px; }
  .counter b { font-size: 13px; }
  .intro-screen { padding: 8px; }
  .scene-intro { padding: 10px 11px 13px; }
  .scene-intro h1 img { width: min(235px, 100%); }
  .intro-description { font-size: 14px; }
  .intro-list li { font-size: 13px; }
  .primary-button { min-height: 41px; font-size: 16px; }
  .game-tip { font-size: 13px; margin-top: 14px; }
  .toast { top: 55px; }
}
@media (max-height: 600px) and (orientation: landscape) {
  .shell { width: min(930px, calc(100% - 36px)); padding-top: 10px; }
  .brand-bar { padding-bottom: 7px; }
  .toolbar { min-height: 42px; padding-block: 3px; }
  .stage { height: max(240px, calc(100svh - 155px)); }
  .scene-intro { padding: 8px 12px 10px; }
  .scene-intro h1 img { width: min(165px, 43vw); }
  .intro-description { padding-block: 4px; margin-bottom: 6px; }
  .intro-list { grid-template-columns: 1fr 1fr; }
  .scene-intro .primary-button { min-height: 36px; margin-top: 7px; }
}
#choose-role:not([hidden]) { display:block; margin:14px auto 0; background:#b9ef9c; color:#214b35; }
.role-room { width:min(480px,calc(100% - 28px)); max-height:calc(100dvh - 28px); overflow:auto; padding:20px; background:#30264d; color:#fff3dc; text-align:center; }
.role-room::backdrop { background:#101634d9; }
.role-room h2 { color:#ffdf83; margin:0 0 12px; }
#role-scene { width:100%; max-width:320px; image-rendering:pixelated; border:3px solid #15172e; }
#role-options { display:grid; gap:8px; }
#role-options button { background:#c9f0a9; color:#203b2c; border:2px solid #172e26; padding:10px; font:inherit; font-weight:bold; cursor:pointer; }
#role-options button:disabled { opacity:.65; }
#role-feedback { min-height:1.5em; color:#ffe18a; }
#role-prompt:not([hidden]){text-align:center;font-weight:bold;margin:12px 0 0} #choose-role:not([hidden]){animation:rolePulse 1.5s infinite alternate} @keyframes rolePulse{to{box-shadow:0 0 0 4px #fff8}} @media(prefers-reduced-motion:reduce){#choose-role{animation:none!important}} .mini-row{display:flex;flex-wrap:wrap;gap:6px;justify-content:center}.mini-row[hidden]{display:none}.mini-row button{flex:1;min-width:65px}.mini-board{display:grid;grid-template-columns:repeat(3,1fr);max-width:210px;margin:auto;gap:3px;direction:ltr}.mini-board span{background:#51456b;padding:9px;font-size:24px}.mini-animal{font-size:48px}.mini-chart{display:grid;gap:6px}.mini-chart button{background:linear-gradient(to left,#a9d8f5 var(--bar),#eee var(--bar))!important}.chosen{outline:3px solid #ffcb54!important;background:#ffdf83!important}.role-room input{width:80px;padding:8px;margin:4px;color:#222}.role-room label{display:flex;justify-content:space-between;align-items:center}.role-room #role-options button{min-height:44px}

#role-again:not([hidden]){display:block;margin:10px auto;background:#c9f0a9;color:#203b2c;min-height:44px} #role-again[hidden]{display:none} #role-progress{color:#ffdf83;font-weight:bold;margin:10px 0}
