.game { background: #0c1629; color: #f5f8ff; min-height: 100vh; }
.game-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem max(1rem, calc((100% - 900px) / 2)); background: #172641; }
.game-bar img { width: min(40vw, 220px); display: block; }
.game-bar label { color: inherit; margin: 0; }
.game-bar input { width: auto; }
.game-audio-controls { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .2rem .9rem; }
.game-audio-controls label { white-space: nowrap; font-size: .9rem; }
.game-main { width: min(900px, calc(100% - 2rem)); margin: 2rem auto; }
.game-main h1 { font-size: clamp(2.5rem, 7vw, 4.5rem); margin: 0 0 1rem; line-height: 1.05; }
.game-main h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
.game-main h3 { margin: 0; }
.game-subject, #phase { color: #8ff6d3; font-weight: 750; }
.game-routes {
  display: flex;
  flex-wrap: nowrap;
  gap: .6rem 1rem;
  margin: 0 0 1.5rem;
  padding: .6rem 1rem;
  background: #172641;
  border: 1px solid #5876a0;
  border-radius: 14px;
}
.game-routes .mira-mascot { width: 56px; height: 72px; flex: none; transform: scaleX(-1); }
.game-routes div { display: flex; flex-wrap: wrap; gap: .35rem 1.2rem; }
.contest-setup { display: flex; align-items: center; gap: clamp(.75rem, 3vw, 2rem); }
.contest-setup .mira-mascot { width: clamp(50px, 15vw, 80px); flex: none; }
.contest-setup button { margin-top: .8rem; text-align: left; }
.theme-control { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .65rem; margin-top: .65rem; }
.theme-control label { margin: 0; }
.theme-control select { width: auto; max-width: 100%; }
#theme-name { color: #d0e8e0; font-size: .83rem; }
.game-district {
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid #45676d;
  border-radius: 18px;
  background: radial-gradient(ellipse at top left, #375f5d, transparent 70%), #162f39;
}
.district-header p { margin: .35rem 0 0; color: #d0e8e0; font-size: .9rem; }
#scene-instructions, #scene-status { font-size: .9rem; color: #d0e8e0; }
#view-3d, #platform-view { display: block; width: 100%; height: auto; border: 1px solid #7ca9a3; border-radius: 12px; background: #112238; }
#platform-view { border: 2px solid #9acff9; box-shadow: 0 6px 0 #0b2137, 0 12px 24px #07152677; }
.platform-stage { position: relative; width: 100%; min-height: 0; }
.platform-touch { display: none; }
.touch-pad { display: flex; align-items: end; gap: clamp(.35rem, 1.8vw, .8rem); }
.touch-pad button {
  display: grid;
  place-items: center;
  width: clamp(49px, 12vw, 66px);
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid #aee9ff;
  border-radius: 50%;
  background: #243a65;
  color: white;
  font-size: clamp(1.15rem, 4vw, 1.6rem);
  font-weight: 850;
  line-height: 1;
  opacity: .6;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.touch-pad .touch-run { background: #006261; }
.touch-pad .touch-jump { width: clamp(61px, 15vw, 83px); background: #923a59; }
.touch-pad button:active, .touch-pad button.is-held { background: #146b8a; border-color: #fff0ae; }

@media (any-pointer: coarse) {
  .platform-touch { display: flex; justify-content: space-between; align-items: end; gap: .5rem; margin-top: .75rem; }
  .platform-desktop-control { display: none; }
}
#platform-status { color: #d0e8e0; }
#mobile-start { margin-block: .65rem; }
#mobile-rotate-hint, #mobile-pause, #mobile-exit { display: none; }

@media (orientation: portrait) {
  .mobile-playing #mobile-rotate-hint { display: block; color: #ffe199; }
}

@media (orientation: landscape) {
  .mobile-playing #platform-scene {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    align-items: center;
    justify-items: center;
    background: #081628;
    padding: max(.16rem, env(safe-area-inset-top)) max(.3rem, env(safe-area-inset-right)) max(.16rem, env(safe-area-inset-bottom)) max(.3rem, env(safe-area-inset-left));
  }
  .mobile-playing #platform-view {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
  }
  .mobile-playing .platform-stage { height: 100%; }
  .mobile-playing .platform-touch {
    position: absolute;
    inset: auto .55rem .3rem;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin: 0;
    pointer-events: none;
  }
  .mobile-playing .touch-pad { pointer-events: auto; }
  .mobile-playing .platform-desktop-control { display: none; }
  .mobile-playing #mobile-start,
  .mobile-playing #platform-instructions { display: none; }
  .mobile-playing #mobile-pause, .mobile-playing #mobile-exit { display: inline-block; }
  .mobile-playing .theme-control, .mobile-playing .scene-controls, .mobile-playing #platform-status { margin: .1rem 0; }
  .mobile-playing .theme-control select { min-height: 0; padding: .12rem .35rem; }
  .mobile-playing .scene-controls { justify-content: center; }
  .mobile-playing .scene-controls button { padding: .25rem .46rem; font-size: .8rem; }
  .mobile-playing #platform-status { font-size: .72rem; text-align: center; }
}
.scene-controls { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .65rem; }
.scene-controls button { min-width: 44px; min-height: 44px; touch-action: none; user-select: none; }
.scene-controls button:disabled { opacity: .55; }
#room-list summary { cursor: pointer; color: #a7ffe8; }
.game-rooms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(.35rem, 2vw, 1.2rem);
  position: relative;
  isolation: isolate;
  margin-top: 1.25rem;
}
.game-rooms::before {
  content: "";
  position: absolute;
  inset: 42px 7% auto;
  height: 75px;
  border-block: 2px solid #c0a67a;
  background: repeating-linear-gradient(90deg, #e6d1a7 0 14px, transparent 14px 26px) center / 100% 2px no-repeat, #5d696e;
  transform: skewY(-5deg);
  z-index: -1;
}
.game .map-location {
  --wall: #cc9169;
  --roof: #ffcb99;
  --side: #80543f;
  background: #173243e8;
  color: #fff;
  border: 1px solid #7ca9a3;
  display: grid;
  grid-template-rows: 94px auto 1fr;
  justify-items: center;
  gap: .4rem;
  padding: .65rem .3rem .8rem;
  min-width: 0;
  text-align: center;
}
.game .map-location:nth-child(2) { --wall: #65ada5; --roof: #a7ebd2; --side: #346a6b; }
.game .map-location:nth-child(3) { --wall: #889bd7; --roof: #ccd6ff; --side: #515b92; }
.game .map-location:hover, .game .map-location[aria-pressed="true"] { background: #215052; border-color: #a1ffde; }
.map-building {
  width: clamp(36px, 8vw, 77px);
  height: 45px;
  align-self: center;
  position: relative;
  margin: .85rem 13px 0 0;
  background: var(--wall);
  box-shadow: 9px 11px 0 #0c233c55;
}
.map-location:nth-child(2) .map-building { height: 33px; }
.map-location:nth-child(3) .map-building { height: 57px; }
.map-building::before, .map-building::after { content: ""; position: absolute; }
.map-building::before { inset: -15px 0 auto; height: 15px; background: var(--roof); transform: skewX(-43deg); transform-origin: bottom left; }
.map-building::after { inset: 0 auto 0 100%; width: 14px; background: var(--side); transform: skewY(-47deg); transform-origin: top left; }
.map-facade {
  position: absolute;
  inset: 8px 5px 7px;
  background: repeating-linear-gradient(90deg, #233957 0 6px, transparent 6px 11px) top center / 100% 9px no-repeat,
    linear-gradient(#25394e, #25394e) bottom center / 9px 12px no-repeat;
}
.map-name { font-size: clamp(.73rem, 2.5vw, 1rem); overflow-wrap: anywhere; }
.map-document { color: #d0e8e0; font-size: clamp(.68rem, 2vw, .86rem); overflow-wrap: anywhere; }
.is-visited .map-document { color: #9dffcf; }
.game-panel { padding: 1.25rem; margin: 1rem 0; background: #172641; border: 1px solid #5876a0; border-radius: 14px; }
.game-options { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; margin-top: .9rem; }
.game-options button { background: #006b63; color: #fff; min-height: 44px; }
.game a { color: #a7ffe8; }
.game-feedback { display: flex; align-items: start; gap: .9rem; }
.game [hidden] { display: none !important; }
.game :focus-visible { outline: 3px solid #ffe078; outline-offset: 3px; }
.game-source { font-size: .9rem; }
.folder-quiz {
  width: min(600px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  margin: auto;
  color: #f5f8ff;
}
.folder-quiz::backdrop { background: #081221b8; }
#folder-quiz[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100dvh - 1rem);
  padding: 0;
}
.folder-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(.65rem, 3vw, 1.25rem);
}
.folder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  border-top: 1px solid #5876a0;
  padding: .55rem clamp(.65rem, 3vw, 1.25rem);
}
.folder-actions button { min-height: 44px; }
#folder-power { color: #ffe08a; font-weight: 750; }
.subject-menu-links { display: grid; gap: .6rem; margin: 1.25rem 0; }
.subject-menu-links a { color: white; }
.character-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin: 1rem 0; }
.character-card {
  display: grid;
  justify-items: center;
  gap: .5rem;
  min-width: 0;
  border: 1px solid #7092b6;
  border-radius: 14px;
  padding: .65rem .45rem;
  background: radial-gradient(ellipse at 50% 30%, #316a8c, #162a48 76%);
  text-decoration: none;
}
.character-card:hover { border-color: #ffe078; background-color: #244a72; }
.character-card img { width: 100%; max-width: 108px; height: clamp(84px, 25vh, 170px); }
.folder-subject-button { background: #29466c; }
.game-routes kbd { margin-left: .35rem; padding: .15rem .35rem; border: 1px solid #a8ead8; border-radius: 4px; font: inherit; }
