/* v1.4.3.25: starter conversations and merchants over their shop backdrops. */
#starterDialog {
  z-index: 50; left: calc(50% + (var(--safe-left, 0px) - var(--safe-right, 0px)) / 2);
  top: calc(50% - 24px + (var(--safe-top, 0px) - var(--safe-bottom, 0px)) / 2);
  transform: translate(-50%, -50%); width: min(820px, calc(100% - 24px - var(--safe-left, 0px) - var(--safe-right, 0px)));
  max-height: calc(100% - 88px - var(--safe-top, 0px) - var(--safe-bottom, 0px));
  overflow: auto; overscroll-behavior: contain; padding: 16px; border-radius: 10px;
}
#starterDialog header { display: flex; align-items: start; gap: 16px; justify-content: space-between; position: sticky; top: -16px; padding-block: 10px; background: #382319; z-index: 2; }
#starterDialog h2 { font-size: clamp(21px, 3vw, 30px); }
#starterDialog h3 { color: #ffd86b; font-size: 20px; }
#starterDialog button { min-height: 44px; line-height: 1.25; }
#starterDialog header button { flex: none; }
.starter-scene-art { display: block; width: min(280px, 55%); height: 150px; object-fit: contain; margin: 10px auto; image-rendering: pixelated; }
.starter-letter { display: block; width: min(460px, 100%); max-height: 240px; object-fit: contain; margin: 10px auto; image-rendering: pixelated; }
.starter-speaker { display: grid; grid-template-columns: minmax(90px, 24%) minmax(0, 1fr); gap: 16px; align-items: center; }
.starter-portrait { width: 100%; height: 230px; object-fit: contain; image-rendering: pixelated; }
.speech-bubble { padding: 14px; border: 2px solid #d1a264; border-radius: 12px; background: #fff0cf; color: #392517; line-height: 1.5; }
.starter-countdown { text-align: center; font-size: 22px; color: #ffd86b; font-weight: bold; }
.intro-discount { color: #284d23; background: #e4f5bf; padding: 8px; border-radius: 5px; }
.shopkeeper-portrait { position: absolute; z-index: 1; top: 0; left: 3%; width: 24%; height: 43%; margin: 0; border: 0; pointer-events: none; text-align: left; }
.shopkeeper-portrait img { display: block; margin: 0; width: 100%; height: 100%; object-fit: contain; object-position: left bottom; transform: scale(var(--keeper-scale, 1)); transform-origin: left bottom; image-rendering: pixelated; filter: drop-shadow(0 3px 3px #0009); }
.shopkeeper-portrait figcaption { position: absolute; bottom: 2px; left: 0; transform: none; padding: 3px 8px; border-radius: 5px; background: #2b1a10e8; color: #fff0c2; font-size: 12px; white-space: nowrap; }
.shop-scene-scroll { position: relative; z-index: 2; }
@media (orientation: landscape) and (max-height: 650px) and (max-width: 1200px) {
  #starterDialog { padding: 10px 14px; }
  #starterDialog header { top: -10px; padding: 6px 0; }
  #starterDialog p { font-size: 14px; }
  .starter-portrait { height: 155px; }
  .starter-letter { max-height: 155px; }
  .starter-scene-art { height: 110px; }
  .shopkeeper-portrait { height: 22%; }
}
@media (max-width: 460px) and (orientation: portrait) {
  .starter-speaker { grid-template-columns: 85px minmax(0, 1fr); gap: 8px; }
  .starter-portrait { height: 160px; }
  .speech-bubble { padding: 8px; font-size: 13px; }
}

/* Rockee is 20% smaller, with his feet anchored to the same display area. */
.shopkeeper-portrait[data-shopkeeper="rock"] { --keeper-scale: .8; }

/* Renewal confirmation is separate from village creation and Phoenix Rebirth. */
.renewal-panel { z-index: 55; }
.renewal-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.renewal-choices select { width: 100%; min-height: 44px; padding: 10px; color: #29170f; background: #fff0cf; border-radius: 7px; font: 16px ui-monospace,monospace; }
.renewal-consent { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px; border: 2px solid #d8a95e; border-radius: 8px; line-height: 1.4; }
.renewal-consent input { width: 22px; height: 22px; flex: none; }

/* The tutorial never raises a world sprite above the character or pet. */
#starterGuide {
  position: absolute; z-index: 25; top: calc(12px + var(--safe-top, 0px));
  right: calc(76px + var(--safe-right, 0px));
  width: min(540px, calc(100% - 340px - var(--safe-left, 0px) - var(--safe-right, 0px)));
  max-height: calc(42% - var(--safe-top, 0px)); overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 16px; border: 2px solid #d1a264; border-radius: 10px;
  background: #382319f5; color: #fff0cf; box-shadow: 0 4px 16px #0006;
}
#starterGuide small { color: #ffd86b; }
#starterGuide h3 { margin: 4px 0; font-size: 18px; }
#starterGuide p { margin: 6px 0 10px; line-height: 1.4; font-size: 14px; }
#starterGuide button { min-height: 44px; width: 100%; padding: 8px 12px; font-size: 14px; }
#realmScene [data-tutorial-target]::after {
  content: '▼'; position: absolute; top: -24px; left: 50%; transform: translateX(-50%);
  color: #ffdf82; font-size: 22px; text-shadow: 0 2px 3px #382319; pointer-events: none;
}
body:has(#starterDialog:not([hidden])) [data-tutorial-target]::after { display: none; }
.starter-welcome { font-size: clamp(16px, 2vw, 20px); line-height: 1.65; }
@media (orientation: landscape) and (max-height: 650px) and (max-width: 1200px) {
  #starterGuide { top: calc(6px + var(--safe-top, 0px)); padding: 8px 12px; max-height: 42%; }
  #starterGuide h3 { font-size: 15px; }
  #starterGuide p { font-size: 12px; line-height: 1.3; margin: 4px 0 6px; }
  #starterGuide small { font-size: 11px; }
  .starter-welcome { font-size: 16px; }
}
@media (max-width: 600px) {
  #starterGuide { top: auto; bottom: calc(12px + var(--safe-bottom, 0px)); left: calc(76px + var(--safe-left, 0px)); right: calc(12px + var(--safe-right, 0px)); width: auto; max-height: 32%; }
}
