:root {
  color-scheme: dark;
  --navy: #06152f;
  --gold: #ffd56a;
  --safe-top: max(8px, env(safe-area-inset-top));
  --safe-right: max(8px, env(safe-area-inset-right));
  --safe-bottom: max(8px, env(safe-area-inset-bottom));
  --safe-left: max(8px, env(safe-area-inset-left));
  font-family: Inter, ui-rounded, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: #020817; }
html { height: -webkit-fill-available; }
body { min-height: 100vh; min-height: 100dvh; min-height: -webkit-fill-available; overflow: hidden; overscroll-behavior: none; }
#app { position: fixed; inset: 0; width: 100%; height: 100%; }
button { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.app-shell {
  --backdrop-left: #03112b;
  --backdrop-right: #061a3c;
  --backdrop-top: #082456;
  --backdrop-bottom: #020817;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 0 50%, var(--backdrop-left) 0, transparent 62%),
    radial-gradient(circle at 100% 50%, var(--backdrop-right) 0, transparent 62%),
    linear-gradient(180deg, var(--backdrop-top), var(--backdrop-bottom));
  isolation: isolate;
}
.app-shell::before { display: none; }
.app-shell::after { display: none; }
.art-stage {
  --art-ratio: 3 / 2;
  --art-ratio-num: 1.5;
  --art-ratio-inv: .666667;
  position: relative;
  z-index: 2;
  width: min(100vw, calc(100dvh * var(--art-ratio-num)));
  height: min(100dvh, calc(100vw * var(--art-ratio-inv)));
  aspect-ratio: var(--art-ratio);
  overflow: hidden;
  background: var(--navy);
  box-shadow: 0 0 70px rgba(29, 124, 255, .28);
  isolation: isolate;
}
.art-stage > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}
.art-stage > .art-main-image {
  position: relative;
  z-index: 2;
  opacity: 1;
  transition: opacity .22s ease;
}
.art-stage.is-loading > .art-main-image { opacity: 0; }
.art-stage > .previous-frame {
  position: absolute;
  z-index: 1;
  inset: 0;
  opacity: .74;
  filter: brightness(.46) saturate(.7) blur(1.5px);
  transform: scale(1.012);
  transition: opacity .22s ease;
}
.art-stage.is-ready > .previous-frame { opacity: 0; }
.art-stage.is-loading::after {
  content: '';
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 50%;
  width: clamp(28px, 4vw, 54px);
  aspect-ratio: 1;
  border: 3px solid rgba(255, 213, 106, .25);
  border-top-color: #ffd56a;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: image-loader .8s linear infinite;
}
@keyframes image-loader { to { transform: translate(-50%, -50%) rotate(360deg); } }
.art-stage.image-error::after {
  content: 'Image could not be loaded. Check the connection and refresh the content.';
  position: absolute;
  z-index: 24;
  inset: 40% 12% auto;
  padding: 18px;
  color: white;
  border: 1px solid rgba(255, 213, 106, .78);
  border-radius: 18px;
  background: rgba(3, 20, 49, .94);
  text-align: center;
  font-weight: 800;
}
.hotspot {
  position: absolute;
  z-index: 8;
  padding: 0;
  border: 0;
  border-radius: clamp(10px, 1.4vw, 22px);
  background: transparent;
  color: transparent;
  cursor: pointer;
  transition: background-color .16s ease, box-shadow .16s ease, transform .12s ease;
}
.hotspot:hover, .hotspot:focus-visible {
  background: rgba(4, 30, 67, .08);
  outline: 0;
  box-shadow:
    inset 0 0 0 clamp(2px, .18vw, 3px) rgba(255, 239, 186, .98),
    inset 0 0 0 clamp(5px, .46vw, 8px) rgba(8, 56, 118, .64),
    inset 0 0 24px rgba(255, 226, 137, .18),
    0 0 18px rgba(44, 157, 255, .24);
}
.hotspot:active { background: rgba(255, 255, 255, .18); transform: scale(.995); }
.art-stage:not([data-ready="true"]) .hotspot { pointer-events: none; }
.lesson-card-hotspot { border-radius: clamp(9px, 1.15vw, 18px); }
.hotspot-debug {
  background: rgba(3, 24, 58, .13);
  outline: 2px solid rgba(255, 213, 106, .96);
  outline-offset: -2px;
}
.hotspot-debug::after {
  content: attr(data-hotspot);
  display: grid;
  place-items: center;
  height: 100%;
  color: white;
  font-size: clamp(8px, 1.2vw, 18px);
  font-weight: 900;
  text-shadow: 0 1px 3px #000;
}
.top-actions {
  position: absolute;
  z-index: 20;
  top: var(--safe-top);
  left: var(--safe-left);
  display: flex;
  gap: clamp(5px, .7vw, 10px);
}
.round-action, .slide-action, .compact-action {
  border: 1px solid rgba(255, 213, 106, .82);
  color: white;
  background: rgba(5, 33, 75, .88);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .32);
  cursor: pointer;
  font-weight: 900;
  backdrop-filter: blur(8px);
}
.round-action {
  width: clamp(34px, 4.3vw, 58px);
  height: clamp(34px, 4.3vw, 58px);
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0;
  border: clamp(1px, .15vw, 2px) solid rgba(255, 219, 126, .92);
  background: linear-gradient(145deg, rgba(13, 73, 137, .96), rgba(3, 27, 66, .96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 5px 16px rgba(0,0,0,.38), 0 0 0 2px rgba(4,28,68,.45);
}
/* Keep toolbar icons at their display size while the achievements stylesheet loads. */
#app .trophy407-toolbar svg { width: 28px; height: 28px; display: block; flex-shrink: 0; }

.icon-action svg { width: 58%; height: 58%; overflow: visible; }
.icon-action path {
  fill: none;
  stroke: #fff8dc;
  stroke-width: 3.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.45));
}
.round-action:hover, .round-action:focus-visible,
.slide-action:hover, .slide-action:focus-visible,
.compact-action:hover, .compact-action:focus-visible { background: #0d4d99; outline: 2px solid white; }
.round-action:hover, .round-action:focus-visible { transform: translateY(-1px); box-shadow: inset 0 1px 0 #fff8, 0 7px 20px #0008, 0 0 0 2px #ffd56a; }
.fallback-art > img { filter: brightness(.34) saturate(.72) blur(1px); transform: scale(1.01); }
.module-placeholder {
  position: absolute;
  z-index: 10;
  inset: 14% 8% 9%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: clamp(7px, 1.4vw, 18px);
  padding: clamp(15px, 3vw, 40px);
  color: white;
  border: 1px solid rgba(255, 213, 106, .72);
  border-radius: clamp(18px, 3vw, 38px);
  background: linear-gradient(145deg, rgba(8, 43, 88, .96), rgba(3, 20, 49, .97));
  box-shadow: 0 18px 60px rgba(0, 0, 0, .48);
  backdrop-filter: blur(14px);
  overflow: auto;
}
.module-placeholder h1 {
  margin: 0;
  color: var(--gold);
  font: 800 clamp(1.4rem, 4vw, 3.3rem) Georgia, serif;
  text-align: center;
}
.module-placeholder p {
  margin: 0 0 clamp(5px, 1.2vw, 16px);
  color: #c8edff;
  text-align: center;
  font-size: clamp(.78rem, 1.5vw, 1.25rem);
  font-weight: 750;
}
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(7px, 1.2vw, 16px);
}
.lesson-button {
  min-height: clamp(54px, 9vh, 96px);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: clamp(12px, 2vw, 24px);
  color: white;
  background: linear-gradient(145deg, rgba(25, 153, 216, .92), rgba(95, 37, 177, .94));
  box-shadow: inset 0 1px rgba(255, 255, 255, .28), 0 7px 18px rgba(0, 0, 0, .25);
  cursor: pointer;
  font-weight: 900;
  font-size: clamp(.72rem, 1.6vw, 1.15rem);
}
.lesson-button:hover, .lesson-button:focus-visible { outline: 3px solid white; transform: translateY(-2px); }
.lesson-controls {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  position: absolute;
  z-index: 22;
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px;
  border-radius: 999px;
  color: white;
  background: rgba(3, 22, 53, .80);
  backdrop-filter: blur(8px);
}
.slide-action {
  width: clamp(36px, 4vw, 56px);
  height: clamp(36px, 4vw, 56px);
  padding: 0;
  border-radius: 999px;
  font-size: clamp(20px, 2.5vw, 34px);
}
.slide-action:disabled, .compact-action:disabled { opacity: .35; cursor: default; }
.lesson-controls span { min-width: 3.4em; text-align: center; font-weight: 850; }
.cross-navigation {
  position: absolute;
  z-index: 21;
  left: 50%;
  bottom: var(--safe-bottom);
  display: flex;
  gap: clamp(4px, .6vw, 8px);
  transform: translateX(-50%);
}
.compact-action {
  min-height: clamp(34px, 4vw, 52px);
  padding: 0 clamp(8px, 1.4vw, 18px);
  border-radius: 999px;
  font-size: clamp(.68rem, 1.2vw, 1rem);
}
.slide-text {
  position: absolute;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: clamp(5px, 1vw, 14px);
  overflow: hidden;
  color: #081f46;
  border: 1px solid rgba(255, 213, 106, .78);
  border-radius: clamp(9px, 1.5vw, 20px);
  background: rgba(255, 250, 235, .92);
  box-shadow: 0 5px 18px rgba(0, 0, 0, .28);
  font-size: clamp(.7rem, 1.7vw, 1.4rem);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}
.orientation-guard {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: none;
  place-items: center;
  padding: 28px;
  color: white;
  background: radial-gradient(circle at 50% 28%, #15529a, #06152f 52%, #020817);
  text-align: center;
}
.orientation-card {
  width: min(440px, 100%);
  padding: 30px 22px;
  border: 1px solid var(--gold);
  border-radius: 28px;
  background: rgba(6, 28, 66, .92);
  box-shadow: 0 20px 70px #0009;
}
.rotate-device {
  display: block;
  margin-bottom: 15px;
  font-size: 64px;
  line-height: 1;
  animation: turn-device 1.8s ease-in-out infinite;
}
.orientation-card strong { display: block; color: var(--gold); font-size: clamp(1.3rem, 6vw, 2rem); }
.orientation-card p { margin: 10px 0 0; color: #d6efff; line-height: 1.5; }
@keyframes turn-device { 0%, 25% { transform: rotate(0); } 70%, 100% { transform: rotate(90deg); } }

@media (orientation: portrait) {
  .orientation-guard { display: grid; }
  #app { visibility: hidden; }
}
@media (max-height: 520px) {
  .round-action { width: 34px; height: 34px; font-size: 19px; }
  .module-placeholder { inset: 11% 7% 8%; }
  .lesson-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) and (orientation: landscape) {
  .top-actions { top: 5px; left: 5px; }
  .round-action { width: 32px; height: 32px; font-size: 18px; }
  .module-placeholder { inset: 10% 5% 8%; padding: 12px; }
  .lesson-button { min-height: 45px; }
  .cross-navigation { left: var(--safe-left); transform: none; }
  .compact-action { min-height: 32px; padding-inline: 8px; }
  .slide-action { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

.lesson-empty-state { position:absolute; z-index:12; left:50%; top:50%; transform:translate(-50%,-50%); width:min(78%,720px); padding:clamp(20px,4vw,48px); display:flex; flex-direction:column; gap:10px; text-align:center; color:#fff; background:rgba(3,24,58,.92); border:1px solid rgba(255,213,106,.78); border-radius:24px; box-shadow:0 18px 60px rgba(0,0,0,.35); backdrop-filter:blur(10px); }
.lesson-empty-state strong { color:#ffd56a; font:800 clamp(1.3rem,3vw,2.5rem) Georgia,serif; }
.lesson-empty-state span { font-weight:800; font-size:clamp(.95rem,1.6vw,1.25rem); }
.lesson-empty-state small { color:#c9e8ff; font-size:clamp(.72rem,1.2vw,1rem); }
