/* Shared portrait composition. Keep the scene flexible, the controls touchable. */
.game-shell {
  /* Bound the grid track itself: WebKit can expand an auto track past the 480 px shell. */
  grid-template-columns: minmax(0, 1fr);
  --home-rail-inset: 8px;
  --home-resource-height: clamp(44px, 12vw, 58px);
  --home-nav-scale: 1.05;
  --tap-art-width: min(229px, 60vw);
  --tap-row: calc(var(--tap-art-width) * 501 / 1600 + 8px);
  --fan-card-width: min(248px, 62.5cqw);
  --fan-card-height: calc(var(--fan-card-width) * 150 / 248);
}
.game-shell:not(.has-modal) {
  height: 100dvh;
  min-height: 0;
  grid-template-rows: calc(var(--home-resource-height) + 8px) max-content minmax(0, 1fr) var(--tap-row) var(--mobile-skills-height);
}
.game-shell > .hud {
  padding: 4px var(--home-rail-inset);
  gap: 4px;
}
.hud .hud-main { align-items: stretch; }
.hud .resource-bar {
  height: var(--home-resource-height);
  aspect-ratio: auto;
}
.hud .xp-resource .resource-copy {
  inset: 17% 9% 28% 27%;
  gap: 2px;
}
.hud .gold-resource .resource-copy { inset-block: 14%; }
.hud .xp-resource .xp-track { bottom: 17%; }
.hud .gear {
  flex: 0 0 var(--home-resource-height);
  width: var(--home-resource-height);
  height: var(--home-resource-height);
}
.hud .tier-button {
  flex: 0 0 var(--home-resource-height);
  width: var(--home-resource-height);
  height: calc(var(--home-resource-height) + 8px);
  min-height: 44px;
}
.hud .tier-art {
  width: 100%;
  height: calc(100% - 7px);
}
.hud .tier-count {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  min-width: 0;
  padding: 2px 6px;
  font-size: 10px;
  line-height: 11px;
  white-space: nowrap;
  text-align: center;
}
.game-shell > .order-board {
  width: calc(100% - 2 * var(--home-rail-inset));
  max-width: none;
  margin: 10px 0 25px;
}
.order-board > .order-picker-toggle {
  bottom: -33px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background-size: 30px 30px;
}
.order-board > .order-picker-toggle img { width: 16px; height: 16px; }
.game-shell > .tap-zone {
  align-content: end;
  padding: 0 12px 2px;
}
.game-shell > .tap-zone .tap-button { min-height: 44px; }
/* One 248 × 150 master, based on screen 08. Every visible detail shares its scale. */
.skill-fan .oak-card {
  --skill-unit: calc(100cqw / 248);
  width: var(--fan-card-width);
  height: var(--fan-card-height);
  top: calc((var(--mobile-skills-height) - var(--fan-card-height) - 2px) / 2);
}
.skill-fan .oak-card::before {
  border-width: calc(1 * var(--skill-unit));
  border-image-width: calc(25 * var(--skill-unit)) calc(18 * var(--skill-unit)) calc(18 * var(--skill-unit)) calc(20 * var(--skill-unit));
}
.skill-fan .oak-content {
  grid-template-columns: minmax(0, 33fr) minmax(0, 67fr);
  grid-template-rows: calc(74 * var(--skill-unit)) calc(44 * var(--skill-unit));
  grid-template-areas: 'medallion copy' 'upgrade upgrade';
  align-content: start;
  min-height: 0;
  padding: calc(20 * var(--skill-unit)) calc(15 * var(--skill-unit)) calc(11 * var(--skill-unit));
  gap: calc(1 * var(--skill-unit)) calc(7 * var(--skill-unit));
}
.skill-fan .oak-copy {
  grid-area: copy;
  display: flex;
  flex-direction: column;
  align-self: center;
  min-width: 0;
}
.skill-fan .oak-title {
  margin: 0 0 calc(5 * var(--skill-unit));
  font-size: calc(18 * var(--skill-unit));
  line-height: calc(23 * var(--skill-unit));
  text-align: left;
  white-space: nowrap;
  overflow-wrap: normal;
}
.skill-fan .oak-label {
  margin: 0 0 calc(1 * var(--skill-unit));
  font-size: calc(13 * var(--skill-unit));
  line-height: 1.12;
  align-self: auto;
}
.skill-fan .oak-effect {
  margin: 0;
  font-size: calc(18 * var(--skill-unit));
  line-height: 1;
  flex-wrap: nowrap;
  gap: calc(3 * var(--skill-unit));
  align-self: auto;
}
.skill-fan .oak-medallion {
  width: 100%;
  filter: drop-shadow(0 calc(2 * var(--skill-unit)) calc(2 * var(--skill-unit)) #02070a80);
}
.skill-fan .oak-marker {
  box-shadow: inset 0 calc(1 * var(--skill-unit)) calc(2 * var(--skill-unit)) #000d, 0 calc(1 * var(--skill-unit)) calc(1 * var(--skill-unit)) #9eacb2;
}
/* The transparent hit area stays 44 px high while the artwork scales with the card. */
.skill-fan .oak-upgrade:is(:enabled, :disabled) {
  height: 44px;
  min-height: 44px;
  align-self: center;
  text-shadow: 0 calc(1 * var(--skill-unit)) calc(2 * var(--skill-unit)) #172e20;
}
.skill-fan .oak-upgrade-face {
  width: calc(100% - 12 * var(--skill-unit));
  height: calc(34 * var(--skill-unit));
  min-height: 0;
  justify-self: center;
  align-self: center;
  padding: calc(2 * var(--skill-unit)) calc(5 * var(--skill-unit));
  gap: .35em;
  font-size: calc(18 * var(--skill-unit));
  line-height: 1;
}
.skill-fan .oak-upgrade-face::before {
  border-width: calc(1 * var(--skill-unit));
  border-image-width: calc(11 * var(--skill-unit)) calc(16 * var(--skill-unit));
  filter: drop-shadow(0 calc(2 * var(--skill-unit)) calc(1 * var(--skill-unit)) #04090e8c);
}
.skill-fan .oak-upgrade-face img {
  width: calc(16 * var(--skill-unit));
  height: calc(16 * var(--skill-unit));
}
.game-shell > .dock.oak-nav {
  --oak-panel-height: calc(clamp(78px, 21.54cqw, 88px) * var(--home-nav-scale));
}
.oak-nav .oak-nav__buttons {
  grid-template-columns: repeat(3, calc(64px * var(--home-nav-scale)));
  gap: calc(10px * var(--home-nav-scale));
}
.oak-nav .oak-nav__assembly {
  width: calc(clamp(48px, 13.333cqw, 56px) * var(--home-nav-scale));
  height: calc(clamp(48px, 13.333cqw, 56px) * var(--home-nav-scale));
}

/* The same short-height layout covers small phones and visible browser bars. */
@media (max-height: 760px) {
  .game-shell {
    --home-nav-scale: 1.1;
    --tap-art-width: min(205px, 59vw);
    --mobile-skills-height: 148px;
    --fan-card-width: min(228px, 62.5cqw);
  }
  .order-board > .order-picker-toggle { background-size: 26px 26px; }
  .order-board > .order-picker-toggle img { width: 14px; height: 14px; }
}
@media (max-width: 359px) {
  .game-shell { --home-rail-inset: 6px; }
}
@media (max-height: 600px) {
  .game-shell { --mobile-skills-height: 144px; }
  .order-board > .order-picker-toggle { background-size: 24px 24px; }
  .order-board > .order-picker-toggle img { width: 12px; height: 12px; }
}
/* On tall screens the character keeps breathing room instead of filling it all. */
@media (min-height: 980px) {
  .game-shell > .hero-zone .shaman-figure.is-grounded { height: 92%; max-height: 480px; }
}
/* The large desktop composition was already approved. */
@media (min-width: 1600px) {
  .game-shell { --home-nav-scale: 1; --tap-art-width: 218px; }
}
@media (min-height: 980px), (min-width: 1024px) {
  .game-shell { --tap-art-width: 240px; }
}

/* Expanded artwork keeps the original scene region at the same figure-linked scale. */
.game-shell.scene-linked {
  --scene-art: url('./assets/environment-outpaint-v1/environment-1.webp');
}
.game-shell.scene-linked.env-2 { --scene-art: url('./assets/environment-outpaint-v1/environment-2.webp'); }
.game-shell.scene-linked.env-3 { --scene-art: url('./assets/environment-outpaint-v1/environment-3.webp'); }
.game-shell.scene-linked .forest {
  inset: 0;
  background-image: var(--scene-art), url('./assets/slate-oak-backdrop-v1/stone-left.webp');
  background-size: var(--scene-outpaint-width) var(--scene-outpaint-height), auto 100%;
  background-position: var(--scene-outpaint-left) var(--scene-outpaint-top), center;
  background-repeat: no-repeat, repeat-x;
}

/* Mobile tabs cannot all lock the operating system's orientation. */
.portrait-guard { display: none; }
@media (orientation: landscape) {
  html.shaman-mobile-device body { overflow: hidden; }
  .shaman-mobile-device #app { visibility: hidden; }
  .shaman-mobile-device .portrait-guard {
    position: fixed;
    z-index: 10000;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    text-align: center;
    color: #fff0d9;
    background: #14222c url('./assets/slate-oak-backdrop-v1/stone-left.webp') center / cover;
  }
  .portrait-guard__phone {
    width: 32px;
    height: 52px;
    border: 3px solid #d6c79f;
    border-radius: 6px;
    box-shadow: 0 3px 8px #050d14;
  }
  .portrait-guard h1 { margin: 0; font: 30px var(--font-display); }
  .portrait-guard p { margin: 0; font-size: 16px; }
}
