/* GrowtopiaTools wide desktop layout — corrected scoped shell.
   ?layout=legacy restores old widths and UI bubbles.
   DO NOT apply normal page widths to embedded World/Set Planners. */
@media (min-width: 1101px) {
  html.gtt-wide-layout {
    --gtt-page-max: 2200px;
    --gtt-page-gutter: clamp(18px, 2vw, 32px);
  }
  html.gtt-wide-layout body.gtt-shell-v1 .main.main-area {
    flex: 1 1 0;
    min-width: 0;
  }
  /* The previous update changed the max-width of an already wide container,
     therefore Home/Clash barely changed. This expands the real content area
     and its internal module roots. It intentionally excludes all iframe
     planner routes, the Art Generator, and existing full-bleed special tools. */
  html.gtt-wide-layout body.gtt-shell-v1:not([data-current-view="world-planner-v2"]):not([data-current-view="planner-v2"]):not([data-current-view="art-generator"]) .main-area > #content.content:not(:has(.gt-planner-v18-stage)):not(:has(iframe.gtt-art-frame)) {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: var(--gtt-page-max) !important;
    min-width: 0 !important;
    margin-inline: auto !important;
    padding-left: var(--gtt-page-gutter) !important;
    padding-right: var(--gtt-page-gutter) !important;
  }
  html.gtt-wide-layout body.gtt-shell-v1:not([data-current-view="world-planner-v2"]):not([data-current-view="planner-v2"]):not([data-current-view="art-generator"]) .main-area > .foot.footer {
    width: 100%;
    max-width: var(--gtt-page-max) !important;
    box-sizing: border-box;
    padding-inline: var(--gtt-page-gutter);
  }
  /* Independently developed modules have different internal width caps.
     These specific app roots are the ones that should share the desktop shell.
     Do not enlarge text inputs or change any internal card/grid geometry. */
  html.gtt-wide-layout body[data-theme="glass"] #content :is(
    .h162-root, .cc-root, .v94-roles, .v89-level, .v96-economy,
    .gpc, .q203, .l208, .w204, .ga-root, .gtorial-v4,
    .gtmarket.gm-v111, .growpedia, .gp-redesign
  ) {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
  }
}

/* Independent World Planner V3 parent-frame repair: the planner must fill
   the website's remaining width, never inherit Home/calculator's centered
   content cap. Keep the existing iframe and its game viewport proportions. */
@media (min-width: 1101px) {
  body[data-theme="glass"][data-current-view="world-planner-v2"].gtt-shell-v1 .app.app-shell {
    display: grid !important;
    grid-template-columns: var(--gtt-shell-side-width,200px) minmax(0,1fr) !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }
  body[data-theme="glass"][data-current-view="world-planner-v2"].gtt-shell-v1.gtt-sidebar-collapsed .app.app-shell {
    grid-template-columns: 0 minmax(0,1fr) !important;
  }
  body[data-theme="glass"][data-current-view="world-planner-v2"].gtt-shell-v1 .app.app-shell > .main.main-area {
    grid-column: 2 !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }
  body[data-theme="glass"][data-current-view="world-planner-v2"].gtt-shell-v1 .main-area > #content.content {
    box-sizing: border-box !important;
    display: flex !important;
    align-items: stretch !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 4px 4px !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }
  body[data-theme="glass"][data-current-view="world-planner-v2"] #content > section[data-world-studio-v3],
  body[data-theme="glass"][data-current-view="world-planner-v2"] #content > section[data-world-studio-v3] > iframe {
    box-sizing: border-box !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
  }
}

/* The Roles calculator is the reference:
   5.9s gentle +/-6px float, independently staggering icons, same capsule glass,
   hover lift and sprite-only scaling. Do not modify the Roles calculator.
   Scope to confirmed decorative *UI* bubbles, not simulator assets/canvases. */
@keyframes gtt-wide-bubble-float {
  0%,100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}
html.gtt-wide-layout body[data-theme="glass"] #content :is(
  .h162-float-bubble,
  .h164-market-pick,
  .h193-icon-orb,
  .gm-collection-bubble,
  .gtmarket.gm-v111 .gm-hero-orbs .gm-orb,
  .gp-redesign .gp-hero-floats .v157-bubble,
  .v89-farm-icon-glass,
  .v89-hero-orb,
  .v89-buff-icon,
  .v89-totem-thumb,
  .v87-farm-item-icon,
  .v90-community-orb,
  .possible-item .v3-icon-capsule,
  .v5-challenge-card .v3-icon-capsule,
  .v5-history-identity > .v3-icon-capsule,
  .cycle-list .cycle-completed .v3-icon-capsule,
  .records-metric-symbol
) {
  position: relative;
  isolation: isolate;
  border-color: rgba(195,229,255,.48) !important;
  background: radial-gradient(circle at 28% 4%,rgba(247,254,255,.30),transparent 48%),
              linear-gradient(145deg,rgba(129,181,239,.34),rgba(43,83,155,.23)) !important;
  box-shadow: inset 0 2px 1px rgba(255,255,255,.27),
              inset 0 -1px rgba(0,20,50,.5),
              0 8px 21px rgba(2,15,40,.23) !important;
  transition: transform .26s cubic-bezier(.2,.7,.2,1),
              box-shadow .26s ease, border-color .26s ease !important;
}
html.gtt-wide-layout body[data-theme="glass"] #content :is(
  .h162-float-bubble,
  .h164-market-pick,
  .h193-icon-orb,
  .gm-collection-bubble,
  .gtmarket.gm-v111 .gm-hero-orbs .gm-orb,
  .gp-redesign .gp-hero-floats .v157-bubble,
  .v89-farm-icon-glass,
  .v89-hero-orb,
  .v89-buff-icon,
  .v89-totem-thumb,
  .v87-farm-item-icon,
  .v90-community-orb,
  .possible-item .v3-icon-capsule,
  .v5-challenge-card .v3-icon-capsule,
  .v5-history-identity > .v3-icon-capsule,
  .cycle-list .cycle-completed .v3-icon-capsule,
  .records-metric-symbol
)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(145deg,rgba(255,255,255,.21),transparent 44%);
}
html.gtt-wide-layout body[data-theme="glass"] #content :is(
  .h162-float-bubble,.h164-market-pick,.h193-icon-orb,
  .gm-collection-bubble,.gm-orb,
  .gp-redesign .gp-hero-floats .v157-bubble,
  .v89-farm-icon-glass,.v89-hero-orb,.v89-buff-icon,
  .v89-totem-thumb,.v87-farm-item-icon,.v90-community-orb,
  .possible-item .v3-icon-capsule,.v5-challenge-card .v3-icon-capsule,
  .v5-history-identity > .v3-icon-capsule,
  .cycle-list .cycle-completed .v3-icon-capsule,.records-metric-symbol
) img {
  object-fit: contain;
  image-rendering: pixelated;
}

/* Translate rather than transform: hover transform can now work while the
   bubble floats. The older transform animations suppressed hover on some pages.
   For market hero, float the existing outer wrapper; not the inner glass. */
@media (min-width: 801px) and (prefers-reduced-motion: no-preference) {
  html.gtt-wide-layout body[data-theme="glass"] #content :is(
    .h162-float-bubble,.h164-market-pick,.h193-icon-orb,
    .gm-collection-bubble,.gtmarket.gm-v111 .gm-hero-orbs .gm-orb-float,
    .gp-redesign .gp-hero-floats .v157-bubble,
    .v89-farm-bubble-wrap,.v89-level-bubble-wrap,.v89-buff-icon,
    .v89-totem-thumb,.v87-farm-item-icon,.v90-community-orb,
    .possible-item .v3-icon-capsule,.v5-challenge-card .v3-icon-capsule,
    .v5-history-identity > .v3-icon-capsule,
    .cycle-list .cycle-completed .v3-icon-capsule,.records-metric-symbol
  ) {
    animation: gtt-wide-bubble-float 5.9s ease-in-out infinite !important;
    animation-delay: calc(var(--i,0) * -1.05s) !important;
  }
  html.gtt-wide-layout body[data-theme="glass"] #content :is(
    .h162-float-bubble,.h164-market-pick,.h193-icon-orb,
    .gm-collection-bubble,.gtmarket.gm-v111 .gm-hero-orbs .gm-orb-float,
    .gp-redesign .gp-hero-floats .v157-bubble,
    .v89-farm-bubble-wrap,.v89-level-bubble-wrap,.v89-buff-icon,
    .v89-totem-thumb,.v87-farm-item-icon,.v90-community-orb,
    .possible-item .v3-icon-capsule,.v5-challenge-card .v3-icon-capsule,
    .v5-history-identity > .v3-icon-capsule,
    .cycle-list .cycle-completed .v3-icon-capsule,.records-metric-symbol
  ):nth-child(3n + 2) {
    animation-delay: -2.2s !important;
  }
  html.gtt-wide-layout body[data-theme="glass"] #content :is(
    .h162-float-bubble,.h164-market-pick,.h193-icon-orb,
    .gm-collection-bubble,.gtmarket.gm-v111 .gm-hero-orbs .gm-orb-float,
    .gp-redesign .gp-hero-floats .v157-bubble,
    .v89-farm-bubble-wrap,.v89-level-bubble-wrap,.v89-buff-icon,
    .v89-totem-thumb,.v87-farm-item-icon,.v90-community-orb,
    .possible-item .v3-icon-capsule,.v5-challenge-card .v3-icon-capsule,
    .v5-history-identity > .v3-icon-capsule,
    .cycle-list .cycle-completed .v3-icon-capsule,.records-metric-symbol
  ):nth-child(3n + 3) {
    animation-delay: -3.5s !important;
  }
}
html.gtt-wide-layout body[data-theme="glass"] #content :is(
  .h162-float-bubble,.h164-market-pick,.h193-icon-orb,
  .gm-collection-bubble,.gtmarket.gm-v111 .gm-hero-orbs .gm-orb,
  .gp-redesign .gp-hero-floats .v157-bubble,
  .v89-farm-icon-glass,.v89-hero-orb,.v89-buff-icon,
  .v89-totem-thumb,.v87-farm-item-icon,.v90-community-orb,
  .possible-item .v3-icon-capsule,.v5-challenge-card .v3-icon-capsule,
  .v5-history-identity > .v3-icon-capsule,
  .cycle-list .cycle-completed .v3-icon-capsule,.records-metric-symbol
):hover {
  transform: translateY(-5px) scale(1.06) !important;
  border-color: rgba(235,246,255,.87) !important;
  box-shadow: inset 0 2px 1px rgba(255,255,255,.38),
              0 15px 25px rgba(5,24,61,.35),
              0 0 20px rgba(109,186,255,.14) !important;
}
@media (prefers-reduced-motion: reduce) {
  html.gtt-wide-layout body[data-theme="glass"] #content :is(
    .h162-float-bubble,.h164-market-pick,.h193-icon-orb,.gm-collection-bubble,
    .gm-orb-float,.gp-redesign .gp-hero-floats .v157-bubble,
    .v89-farm-bubble-wrap,.v89-level-bubble-wrap,.v89-buff-icon,
    .v89-totem-thumb,.v87-farm-item-icon,.v90-community-orb,
    .possible-item .v3-icon-capsule,.v5-challenge-card .v3-icon-capsule,
    .v5-history-identity > .v3-icon-capsule,
    .cycle-list .cycle-completed .v3-icon-capsule,.records-metric-symbol
  ) { animation: none !important; transition: none !important; }
}
