.mobile-stage-hud, .mobile-stage-menu, .mobile-brief-copy, .mobile-brief-open { display: none; }

.mobile-stage {
  --mobile-left: max(10px, env(safe-area-inset-left));
  --mobile-right: max(10px, env(safe-area-inset-right));
  --mobile-bottom: max(4px, env(safe-area-inset-bottom));
  --mobile-stage-end: var(--mobile-stage-bottom, 0px);
  background: #142337;
}
.mobile-stage.mobile-lower {
  --mobile-stage-end: calc(var(--mobile-stage-bottom, 0px) + var(--mobile-bottom) - 4px);
}
.mobile-stage #stage {
  inset: 0 0 var(--mobile-stage-end) 0;
  overflow: hidden;
}
.mobile-stage [data-mobile-source] {
  visibility: hidden !important;
  pointer-events: none !important;
}
.mobile-stage[data-look-locked] .tools :is(#motion,#recenter), .mobile-stage .hint { display: none; }

.mobile-stage .mobile-stage-hud:not([hidden]) {
  position: fixed;
  z-index: 14;
  inset: max(9px, env(safe-area-inset-top)) var(--mobile-right) auto var(--mobile-left);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}
.mobile-stage-hud > :not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 6px 9px;
  border: 1px solid #abc2ec45;
  border-radius: 11px;
  color: #f4f7ff;
  background: #142337eb;
  font: 850 15px/1 Nunito, sans-serif;
  pointer-events: auto;
}
.mobile-stage-hud .brand svg { width: 20px; height: 20px; }
.mobile-stage-hud .brand small { display: none; }
.mobile-stage-hud .mobile-stage-clock {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.mobile-stage-clock::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 1.5px solid #c7d3ff;
  border-radius: 50%;
  background: linear-gradient(#c7d3ff, #c7d3ff) center 2px / 1px 4px no-repeat,
    linear-gradient(#c7d3ff, #c7d3ff) 50% 50% / 4px 1px no-repeat;
}
.mobile-stage-hud .mobile-stage-more {
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  margin-left: auto;
  letter-spacing: .14em;
}
.mobile-stage-more[aria-expanded='true'] { background: #354c77; }
.mobile-stage .mobile-stage-menu:not([hidden]) {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  z-index: 36;
  padding: 6px var(--mobile-right) 6px var(--mobile-left);
  max-height: min(130px, 42dvh);
  overflow: auto;
  background: #142337;
  border-top: 1px solid #6f8ab15c;
}
.mobile-stage-menu button, .mobile-brief-open {
  padding: 5px 9px;
  border: 1px solid #97acd453;
  border-radius: 9px;
  color: #edf3ff;
  background: #25364d;
  font: 800 13px/1.2 Nunito, sans-serif;
}
.mobile-stage-menu button[aria-pressed='true'] { background: #344c87; }
.mobile-stage-menu button:disabled { opacity: .56; }

.mobile-stage [data-mobile-dock='lower'] {
  box-sizing: border-box;
  position: fixed !important;
  inset: auto 0 calc(var(--mobile-bottom) + var(--mobile-slot, 0px) + var(--mobile-keyboard, 0px)) 0 !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  height: auto !important;
  margin: 0 !important;
  transform: none !important;
  translate: none !important;
  border-radius: 0;
}
.mobile-stage [data-mobile-dock='lower']:not(:is(.playback-timeline, .tour-caption, #back, #notice, .preparation-skip-card, .mobile-stage-menu)) {
  max-height: var(--mobile-reading-limit, 40dvh) !important;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px var(--mobile-right) 8px var(--mobile-left);
  border-radius: 0;
}
.mobile-stage [data-mobile-dock='lower'] :is(h1,h2) { margin: 0 0 5px; font-size: clamp(1.06rem, 3.6vw, 1.3rem); line-height: 1.18; }
.mobile-stage [data-mobile-dock='lower'] p { margin: 0 0 5px; line-height: 1.38; }
.mobile-stage [data-mobile-dock='lower'] :is(p,button) { font-size: .88rem; }
.mobile-stage [data-mobile-dock='lower'] button { min-height: 40px; white-space: normal; }
.mobile-stage [data-mobile-dock='lower'] input:not([type='range']) { font-size: 16px; }
.mobile-stage.mobile-keyboard-answer .arcade-answer[data-mobile-dock] {
  max-height: none !important;
  padding-block: 5px;
}
.mobile-stage.mobile-keyboard-answer .arcade-answer label { margin-bottom: 4px; font-size: .8rem; line-height: 1.25; }
.mobile-stage.mobile-inline-answer .arcade-answer[data-mobile-dock] { left: 52% !important; }
.mobile-stage.mobile-inline-answer .arcade-prompt[data-mobile-dock] { right: 48% !important; text-align: left; }
.mobile-stage.mobile-inline-answer .arcade-prompt[data-mobile-dock] p { margin: 0; font-size: .82rem; line-height: 1.3; }
.mobile-stage [data-mobile-dock='lower'] .prototype-instruction { max-width: 68ch; }
.mobile-stage [data-mobile-dock='lower'] .scenic-concept-pair {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 6px;
  margin-block: 8px;
  text-align: left;
}
.mobile-stage [data-mobile-dock='lower'] .scenic-concept-pair section { padding: 7px 9px; }
.mobile-stage [data-mobile-dock='lower'] .scenic-concept-pair small { margin-bottom: 3px; }
.mobile-stage [data-mobile-dock='lower'] .scenic-concept-pair strong { font-size: 1rem; overflow-wrap: break-word; }
.mobile-stage :is(.prototype-actions, .classroom-actions) { gap: 6px; }
.mobile-stage .classroom-case-summary { gap: 4px; margin-block: 5px; }
.mobile-stage .classroom-case-summary > div { padding: 5px 8px; }

.mobile-stage #phaseGate[data-mobile-dock] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'title title' 'text text' 'rules start';
  align-items: center;
  gap: 5px 9px;
  padding: 9px var(--mobile-right) 9px var(--mobile-left);
  border: 0;
  border-top: 1px solid #7189ad68;
  border-radius: 0;
  background: #15263e;
  text-align: left;
}
.mobile-stage #phaseGate[data-mobile-dock] > span { display: none; }
.mobile-stage #phaseGate[data-mobile-dock] h2 {
  grid-area: title;
  font-size: clamp(1.13rem, 4.6vw, 1.38rem);
  margin: 0;
}
.mobile-stage #phaseGate[data-mobile-dock] p {
  grid-area: text;
  margin: 0;
  color: #d7e2f4;
  font: 450 .85rem/1.38 Inter, sans-serif;
  white-space: normal;
}
.mobile-stage #phaseGate[data-mobile-brief] #phaseText { display: none; }
.mobile-stage #phaseGate[data-mobile-brief] :is(.mobile-brief-copy,.mobile-brief-open) { display: block; }
.mobile-stage #phaseGate .mobile-brief-open { grid-area: rules; justify-self: start; }
.mobile-stage #phaseGate[data-mobile-dock] #confirmPhase {
  grid-area: start;
  position: sticky;
  bottom: 0;
  width: auto;
  margin: 0;
  padding: 7px 11px;
  min-height: 42px;
  background: #b2baff;
  color: #17244b;
  justify-self: end;
}
.mobile-stage #phaseGate[data-mobile-brief] #confirmPhase { font-size: 0; white-space: nowrap; }
.mobile-stage #phaseGate[data-mobile-brief] #confirmPhase::after { content: 'Prepararme · 30 s'; font: 900 .88rem/1.2 Nunito, sans-serif; }
@media (min-width: 600px) {
  .mobile-stage #phaseGate[data-mobile-dock] { grid-template-areas: 'title rules start' 'text rules start'; grid-template-columns: minmax(0, 1fr) auto auto; }
}
.mobile-brief-rules {
  width: min(91vw, 570px);
  max-height: 88dvh;
  overflow: auto;
  padding: 18px 20px;
  border: 1px solid #88a1c3;
  border-radius: 16px;
  background: #142337;
  color: #f4f7ff;
}
.mobile-brief-rules::backdrop { background: #081323ba; }
.mobile-brief-rules h2 { margin: 0 0 9px; line-height: 1.17; }
.mobile-brief-rules p { white-space: pre-line; color: #e0e9f8; }
.mobile-brief-rules button { margin-top: 6px; min-height: 44px; }

.mobile-stage :is(.classroom-hands,.hen-input) { position: fixed; inset: 0 0 var(--mobile-stage-end) 0; }
.mobile-stage .hen-footer[data-mobile-dock] {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding-block: 4px !important;
  background: #142337;
  border-top: 1px solid #7d95bf40;
  color: #f5f7ff;
}
.mobile-stage .hen-footer :is(.hen-current,.hen-score) { background: transparent; border: 0; margin: 0; padding: 4px 2px; }
.mobile-stage .hen-footer .hen-current { display: inline-flex; gap: 6px; align-items: center; text-align: left; }
.mobile-stage .hen-current::before {
  content: '';
  width: 10px;
  height: 14px;
  flex: none;
  border-radius: 52% 52% 49% 49% / 65% 65% 41% 41%;
  background: #ffda95;
  box-shadow: inset -2px -1px #dab17b;
}
.mobile-stage .genie-panel { transform: none; }
.mobile-stage .invention-bubble[data-mobile-dock]::after { display: none; }
.mobile-stage .puzzle-pickup h2 { top: max(10px, env(safe-area-inset-top)); }

.mobile-stage .tour-overlay :is(.tour-top,.tour-progress) { display: none; }
.mobile-stage .tour-overlay .entrance-wash { inset: 0 0 var(--mobile-stage-end) 0; }
.mobile-stage .tour-caption[data-mobile-dock] {
  padding: 5px var(--mobile-right) 5px var(--mobile-left);
  border-radius: 0;
  border: 0;
  background: #142337;
  text-align: left;
}
.mobile-stage .tour-caption[data-mobile-dock] > span { display: none; }
.mobile-stage .tour-caption[data-mobile-dock] p {
  margin: 0;
  color: #f5f7ff;
  font: 650 .88rem/1.28 Nunito, sans-serif;
  text-wrap: pretty;
}
.mobile-stage .tour-caption.is-lyric p { font-weight: 850; }
.mobile-stage .playback-timeline[data-mobile-dock] { font-size: .82rem; padding: 3px var(--mobile-right) 3px var(--mobile-left); }
.mobile-stage .playback-timeline[data-mobile-dock] .playback-chip {
  justify-content: flex-end;
  overflow: visible;
  gap: 5px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.mobile-stage .playback-timeline[data-mobile-dock] .playback-chip button {
  min-height: 38px;
  padding: 3px 10px;
  border: 1px solid #8aa5cc66;
  border-radius: 9px;
  background: #25364d;
}
.mobile-stage .playback-timeline[data-mobile-dock] .playback-chip [data-skip] { background: #142337; }
.mobile-stage .playback-timeline[data-mobile-dock] .playback-progress { display: none; }
.mobile-stage .playback-timeline[data-mobile-dock] .playback-details:not([hidden]) {
  position: static;
  width: auto;
  margin-top: 4px;
  padding: 5px 8px;
  border-radius: 10px;
  transform: none;
  box-shadow: none;
}
.mobile-stage .playback-timeline[data-mobile-dock] .playback-actions button { padding-inline: 4px; font-size: .78rem; min-height: 36px; }
@media (min-width: 600px) {
  .mobile-stage.mobile-tour-inline .tour-overlay > .playback-timeline[data-mobile-dock] { left: auto !important; }
  .mobile-stage.mobile-tour-inline .tour-caption[data-mobile-dock] {
    right: calc(var(--mobile-tour-controls, 0px) + 4px) !important;
    display: flex;
    min-height: 44px;
    align-items: center;
  }
  .mobile-stage .playback-timeline[data-mobile-dock] .playback-details:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(110px, 1fr) minmax(156px, auto);
    gap: 8px;
    align-items: center;
  }
  .mobile-stage .playback-timeline[data-mobile-dock] .playback-details input { margin: 0; }
}
