/* Browser layout follows the available viewport independently of the native wrapper. */
html.stickyword-web {
  --web-header-height: 76px;
  --web-header-top: 16px;
  --web-header-side: 12px;
  --web-header-hit: 44px;
  --web-header-plate: 30.8px;
  --web-header-glyph: 22px;
  --web-title-size: clamp(25px, 8vw, 34px);
  --sw-keyboard-outline: 2px solid #254f77;
  --sw-keyboard-outline-offset: -3px;
}
@media (min-width: 700px) and (orientation: portrait) {
  html.stickyword-web {
    --web-header-height: 128px;
    --web-header-top: 36px;
    --web-header-side: 32px;
    --web-header-hit: 56px;
    --web-header-plate: 39.2px;
    --web-header-glyph: 30px;
    --web-title-size: 46px;
  }
}
@media (min-width: 700px) and (orientation: landscape) {
  html.stickyword-web {
    --web-header-height: 104px;
    --web-header-top: 24px;
    --web-header-side: 32px;
    --web-header-hit: 56px;
    --web-header-plate: 39.2px;
    --web-header-glyph: 30px;
    --web-title-size: 40px;
  }
}

/* Position actionable controls by their role on the page, outside scaled artwork. */
html.stickyword-web body #screen-sight-words .sw-shell {
  width: 100%;
  max-height: none;
  border: 0;
  box-shadow: none;
}
html.stickyword-web body #screen-sight-words #sw-body {
  width: 100%;
  margin: 0;
  padding-inline: max(16px, calc((100% - 540px) / 2));
}
html.stickyword-web body #screen-sight-words #sw-back,
html.stickyword-web body #screen-album .album-top .album-back,
html.stickyword-web body #screen-theme-editor .worlds-header #learning-world-back,
html.stickyword-web body #screen-game[data-learning-mode] > .game-back {
  position: absolute !important;
  inset: var(--web-header-top) auto auto var(--web-header-side) !important;
}
html.stickyword-web body #screen-album .album-top .album-profile,
html.stickyword-web body #screen-theme-editor .worlds-header #navigation-theme-world-home,
html.stickyword-web body #screen-game[data-learning-mode] > #btn-pause {
  position: absolute !important;
  inset: var(--web-header-top) var(--web-header-side) auto auto !important;
}
html.stickyword-web body #screen-theme-editor .worlds-header,
html.stickyword-web body #screen-sight-words .sw-header,
html.stickyword-web body #screen-album .album-top {
  height: var(--web-header-height) !important;
  min-height: var(--web-header-height) !important;
  width: 100% !important;
}
html.stickyword-web body #screen-theme-editor .worlds-header {
  position: absolute !important;
  inset: 0 0 auto !important;
  display: block;
}
html.stickyword-web body #screen-theme-editor .worlds-header :is(#learning-world-back,#navigation-theme-world-home),
html.stickyword-web body #screen-game[data-learning-mode] > :is(.game-back,#btn-pause) {
  width: var(--web-header-hit) !important;
  height: var(--web-header-hit) !important;
  min-width: var(--web-header-hit) !important;
  min-height: var(--web-header-hit) !important;
  max-width: var(--web-header-hit) !important;
  max-height: var(--web-header-hit) !important;
  margin: 0 !important;
  translate: none !important;
  transform: none !important;
}
html.stickyword-web body #screen-game[data-learning-mode] > :is(.game-back,#btn-pause) {
  z-index: 20;
}
html.stickyword-web body :is(#screen-sight-words .sw-header,#screen-album .album-top,#screen-theme-editor .worlds-header,#screen-game[data-learning-mode]) :is(#sw-back,.album-nav-control,#learning-world-back,#navigation-theme-world-home,.game-back,#btn-pause) {
  display: inline-grid !important;
  place-items: center;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #326b8d !important;
  isolation: isolate;
}
html.stickyword-web body :is(#screen-sight-words .sw-header,#screen-album .album-top,#screen-theme-editor .worlds-header,#screen-game[data-learning-mode]) :is(#sw-back,.album-nav-control,#learning-world-back,#navigation-theme-world-home,.game-back,#btn-pause)::before {
  content: "" !important;
  display: block !important;
  box-sizing: border-box;
  position: absolute !important;
  inset: 50% auto auto 50% !important;
  width: var(--web-header-plate) !important;
  height: var(--web-header-plate) !important;
  border: 1px solid #c4e1ee !important;
  border-radius: calc(var(--web-header-plate) / 3) !important;
  background: linear-gradient(150deg,#fff,#e8f8ff 55%,#b6e7fc) !important;
  box-shadow: inset 0 2px #fff,0 2px 2px #add4df28 !important;
  transform: translate(-50%, -50%) !important;
  opacity: 1 !important;
  pointer-events: none;
  z-index: -1;
}
html.stickyword-web body #screen-game[data-learning-mode] > :is(.game-back,#btn-pause)::after {
  display: none !important;
  content: none !important;
}
html.stickyword-web body :is(#screen-sight-words .sw-header,#screen-album .album-top,#screen-theme-editor .worlds-header,#screen-game[data-learning-mode]) :is(#sw-back,.album-nav-control,#learning-world-back,#navigation-theme-world-home,.game-back,#btn-pause) > [data-header-glyph] {
  width: var(--web-header-glyph) !important;
  min-width: var(--web-header-glyph) !important;
  max-width: var(--web-header-glyph) !important;
  height: var(--web-header-glyph) !important;
  min-height: var(--web-header-glyph) !important;
  max-height: var(--web-header-glyph) !important;
  opacity: 1 !important;
}
html.stickyword-web body #screen-theme-editor .worlds-header #learning-world-title {
  position: absolute;
  top: calc(var(--web-header-height) / 2);
  left: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  min-width: 0;
  max-width: calc(100% - (var(--web-header-side) + var(--web-header-hit) + 8px) * 2);
  justify-content: center;
  padding: 5px 14px;
  font-size: clamp(17px, 3.8vw, 27px);
  text-align: center;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
html.stickyword-web body #screen-theme-editor #learning-world-title img {
  flex: 0 0 auto;
  width: clamp(22px, 4.5vw, 34px);
  height: auto;
}
html.stickyword-web body #screen-theme-editor #learning-world-title small {
  font-size: 11px;
}

/* Keep the title at the same optical center across branded and colored headings. */
html.stickyword-web body :is(#screen-word-study,#screen-word-library,#screen-themes) .worlds-header h1,
html.stickyword-web body #screen-sight-words .sw-header #sw-title,
html.stickyword-web body #game-category-dialog .game-category-header > .page-section-subtitle {
  position: absolute !important;
  inset: 50% calc(var(--web-header-side) + var(--web-header-hit) + 5px) auto !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: translateY(-50%) !important;
  display: block;
  text-align: center;
  font: 700 var(--web-title-size)/1.1 Fredoka, Nunito, sans-serif !important;
  letter-spacing: -.025em !important;
}
html.stickyword-web body #game-category-dialog .page-section-subtitle {
  font-size: min(var(--web-title-size), 7.7vw) !important;
}
html.stickyword-web .app-title-letter {
  filter: brightness(.76) saturate(1.12);
}
html.stickyword-web #screen-sight-words[data-category="bee-book"] .sw-library-hero .sw-library-title-art {
  display: none;
}

/* Full-width scroll view with independent, centered page content. */
html.stickyword-web body #screen-word-library #study-library-body {
  max-width: none;
  margin-inline: 0;
  scrollbar-width: thin;
}
html.stickyword-web body #screen-word-library #study-word-grid {
  max-width: 1052px;
  margin-inline: auto;
}
html.stickyword-web body #screen-album .album-stage,
html.stickyword-web body #screen-album .album-page-scroll {
  width: 100% !important;
  max-width: none !important;
}
html.stickyword-web body #screen-album .album-top {
  position: absolute !important;
  inset: 0 0 auto !important;
  background: transparent;
}
html.stickyword-web body #screen-album .album-page-scroll {
  inset: var(--web-header-height) 0 0 !important;
  padding-top: 0 !important;
  scrollbar-width: thin;
}
html.stickyword-web body #screen-album .album-page-scroll::-webkit-scrollbar {
  display: block;
  width: 7px;
}
html.stickyword-web #screen-album .web-album-pages {
  width: min(100%, 620px);
  margin: 0 auto;
  container-type: inline-size;
}
html.stickyword-web body #screen-album .album-rail {
  margin-top: 0 !important;
}
html.stickyword-web body #screen-album .album-tabs {
  top: 0 !important;
}
html.stickyword-web body #screen-album .album-progress-wrap {
  width: min(100%, 620px);
  margin-inline: auto;
}
html.stickyword-web body #screen-album .album-progress-wrap .album-meadow {
  width: 100%;
}
@media (min-width: 700px) {
  html.stickyword-web body #screen-album .album-rail {
    height: 96px !important;
  }
  html.stickyword-web body #screen-album .album-tab { height: 69px !important; }
  html.stickyword-web body #screen-album .album-tab.active { height: 75px !important; }
}

/* Web keyboard input needs a visible focus indicator, including within a game. */
html.stickyword-web body :is(button,[role="button"],a[href],summary,input,select,textarea):focus-visible,
html.stickyword-web body #screen-game :is(.app-header-control,#btn-speak,#learning-next,#btn-resume):focus-visible {
  outline: var(--sw-keyboard-outline) !important;
  outline-offset: var(--sw-keyboard-outline-offset) !important;
}

/* Use the prepared tablet environments while retaining the original core art and game coordinates. */
@media (min-width: 700px) and (orientation: portrait) {
  html.stickyword-web body #screen-my-buddy {
    --buddy-meadow: url("ui-assets/my-buddy-habitat-20261118/my-buddy-portrait.png");
    --buddy-meadow-height: max(100%, calc(100vw * 1448 / 1086));
    --buddy-header-space: var(--web-header-height);
    background-position: center top !important;
  }
  html.stickyword-web body #screen-my-buddy .buddy-stage.buddy-growth-enabled.has-worlds-board {
    --buddy-floor: clamp(234px, 31dvh, 320px);
  }
  html.stickyword-web body #screen-result {
    --web-result-art: url("images/result_locked/result-ipad-portrait-v1.png");
  }
}
@media (min-width: 700px) and (min-height: 600px) and (orientation: landscape) {
  html.stickyword-web body #screen-my-buddy {
    --buddy-meadow: url("ui-assets/my-buddy-habitat-20261118/my-buddy-landscape.png");
    --buddy-meadow-height: max(100%, calc(100vw * 1024 / 1536));
    --buddy-header-space: var(--web-header-height);
    background-position: center top !important;
  }
  html.stickyword-web body #screen-result {
    --web-result-art: url("images/result_locked/result-ipad-landscape-v1.png");
  }
  html.stickyword-web body #game-category-dialog.has-sight-entry[data-step="modes"] .game-category-options {
    width: min(100%, 1000px);
    margin-inline: auto;
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    grid-auto-rows: minmax(180px,1fr) !important;
  }
  html.stickyword-web body #game-category-dialog.has-sight-entry[data-step="modes"] .learning-mode-copy strong {
    max-width: none !important;
    white-space: nowrap;
  }
}
@media (min-width: 700px) and (min-height: 600px) {
  html.stickyword-web body #screen-result {
    background: #fff7e4 var(--web-result-art) center / cover no-repeat !important;
  }
  html.stickyword-web body #screen-result .result-background { display: none !important; }
}
html.stickyword-web body #screen-profile #profile-canva-stage .profile-details {
  justify-content: start;
  gap: 2px;
}
html.stickyword-web body #screen-profile #profile-canva-stage #profile-name {
  font-size: calc(var(--pc-name) * .74) !important;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: visible;
  text-overflow: clip;
}
html.stickyword-web body #screen-profile #profile-canva-stage .profile-details p {
  flex: 0 0 24%;
  min-height: 0;
}

/* Scene controls sit outside the play canvas and remain available when the tool group is closed. */
html.stickyword-web body #screen-theme-editor {
  --web-theme-footer: 145px;
}
html.stickyword-web body #screen-theme-editor .learning-world-main {
  inset: 0 0 var(--web-theme-footer);
  overflow: clip;
  background-color: #f8e7d8;
}
html.stickyword-web body #screen-theme-editor .learning-world-main::before {
  content: "";
  position: absolute;
  inset: -38px;
  background: var(--web-scene-image) center / cover no-repeat;
  filter: blur(30px) saturate(.75);
  opacity: .82;
  pointer-events: none;
}
html.stickyword-web body #screen-theme-editor #learning-world-canvas {
  position: relative;
  isolation: isolate;
}
html.stickyword-web body #screen-theme-editor .learning-world-controls {
  width: auto;
  height: auto;
  max-width: none;
  min-height: var(--web-theme-footer);
  inset: auto 0 0;
  padding: 8px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  background: #fff8ecfa;
}
html.stickyword-web .web-theme-toolbar {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1vw, 9px);
  margin-bottom: 6px;
}
html.stickyword-web .web-theme-toolbar > button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 clamp(5px, 1.4vw, 12px);
  font-size: clamp(12px, 3.4vw, 15px);
  flex: 0 1 auto;
}
html.stickyword-web .web-theme-toolbar .scene-lock-button { margin-inline-start: auto; }
html.stickyword-web .web-theme-toolbar #learning-remove:disabled { display: none !important; }
html.stickyword-web .web-theme-toolbar #learning-world-lock > svg { display: none !important; }
html.stickyword-web .web-theme-toolbar #learning-world-lock::before { background-image: none !important; }
html.stickyword-web .web-theme-toolbar #learning-world-lock::after {
  content: "" !important;
  display: block !important;
  position: static !important;
  width: 22px !important;
  height: 22px !important;
  margin: 0 !important;
  background: url("navigation-icons/unlock.svg") center / contain no-repeat !important;
}
html.stickyword-web .web-theme-toolbar #learning-world-lock[aria-pressed="true"]::after {
  background-image: url("navigation-icons/lock.svg") !important;
}
html.stickyword-web .web-theme-toolbar #learning-remove {
  margin-inline-start: auto;
}
html.stickyword-web .web-theme-toolbar #learning-remove:not(:disabled) + #learning-world-lock {
  margin-inline-start: 0;
}
html.stickyword-web #screen-theme-editor .learning-world-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-bottom: 6px;
  white-space: normal;
}
html.stickyword-web #screen-theme-editor .learning-world-tools[hidden] { display: none !important; }
html.stickyword-web #screen-theme-editor .learning-world-tools > button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
}
html.stickyword-web #screen-worlds-editor[data-fill-axis="ends"] .worlds-canvas::before,
html.stickyword-web #screen-worlds-editor[data-fill-axis="ends"] .worlds-canvas::after,
html.stickyword-web #screen-worlds-editor[data-fill-axis="sides"] .worlds-canvas:not(.has-scene-outpaint)::before,
html.stickyword-web #screen-worlds-editor[data-fill-axis="sides"] .worlds-canvas:not(.has-scene-outpaint)::after {
  content: none;
}
html.stickyword-web :is(#screen-worlds-editor[data-fill-axis="sides"] .has-scene-outpaint,#learning-world-canvas.has-scene-outpaint)::before {
  mask-image: linear-gradient(to right, transparent, #000 30%);
}
html.stickyword-web :is(#screen-worlds-editor[data-fill-axis="sides"] .has-scene-outpaint,#learning-world-canvas.has-scene-outpaint)::after {
  mask-image: linear-gradient(to left, transparent, #000 30%);
}
