/* World-First Fullscreen Game Shell Styles (`styles/world.css`)
 * 100vw x 100dvh Living Watercolor Island · Minimal Corner HUD · Slim 1-Row Decor Tray · Unified Frosted Glass Sheets
 */

html,
body.world-app-body {
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #89c8d2;
}

.world-root {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.world-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.world-island-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.world-island-canvas:active {
  cursor: grabbing;
}

/* Smooth warm house zoom-in transition overlay */

.world-zoom-fade {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, rgba(255, 240, 206, 0.72), rgba(46, 30, 18, 0.92));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.34s ease;
  z-index: 30;
}

.world-zoom-fade.is-active {
  opacity: 1;
}

/* ==================== TOP-LEFT CORNER HUD ==================== */

/* ==================== TOP-RIGHT 3 CIRCULAR GAME ICONS ==================== */

.island-confirm-btn[hidden] {
  display: none !important;
}

/* ==================== CAMERA RESET BUTTON ==================== */

/* ==================== COMPACT EDIT BANNER ==================== */

.world-edit-banner {
  position: fixed;
  top: calc(74px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 21;
  max-width: min(360px, 86vw);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(34, 26, 18, 0.78);
  backdrop-filter: blur(8px);
  color: #fff9f0;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.world-edit-banner.is-invalid {
  background: rgba(176, 38, 32, 0.9);
}

.world-edit-banner[hidden] {
  display: none;
}

/* ==================== BOTTOM-CENTER HERO FOCUS CTA ==================== */

.hud-bottom-hero {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hud-bottom-hero[hidden] {
  display: none;
}

/* Quick Focus Popover (right above [25분 ▾ | 집중 시작]) */

.focus-quick-popover {
  width: min(336px, 92vw);
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 251, 244, 0.95);
  backdrop-filter: blur(16px);
  border: 0.5px solid rgba(112, 82, 52, 0.24);
  box-shadow: 0 16px 38px rgba(24, 34, 42, 0.28);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.focus-quick-popover[hidden] {
  display: none;
}

/* ==================== SLIM 1-ROW HORIZONTAL DECOR TRAY (~148px) ==================== */

.world-decor-tray {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(760px, 100vw);
  z-index: 25;
  background: rgba(255, 251, 244, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 0.5px solid rgba(112, 82, 52, 0.22);
  border-radius: 20px 20px 0 0;
  padding: 10px 12px calc(10px + var(--safe-b));
  box-shadow: 0 -10px 30px rgba(24, 34, 42, 0.2);
}

.world-decor-tray[hidden] {
  display: none;
}

.decor-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.decor-tray-tabs {
  display: inline-flex;
  gap: 6px;
}

.decor-tab-pill {
  border: 0.5px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}

.decor-tab-pill.is-active {
  background: #3d2b1c;
  border-color: #3d2b1c;
  color: #fff;
}

.decor-tray-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.decor-snap-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
}

.decor-done-btn {
  border: 0;
  background: #2f9a53;
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
}

.decor-tray-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.decor-tray-empty {
  padding: 20px 10px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.tray-item-card {
  flex: 0 0 auto;
  width: 86px;
  border: 0.5px solid var(--border);
  background: #fff;
  border-radius: 14px;
  padding: 7px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.tray-item-card img {
  object-fit: contain;
}

.tray-item-card strong {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tray-item-card span {
  font-size: 12px;
  font-weight: 700;
  color: #2f7d49;
  white-space: nowrap;
}

.tray-item-card.is-selected {
  border-color: #2f9a53;
  background: #eaf8ee;
}

.tray-item-card.is-shop .tray-price-tag {
  color: #b45a28;
}

.tray-item-card.is-locked {
  opacity: 0.6;
}

/* ==================== UNIFIED FROSTED GLASS BOTTOM SHEET / CENTER MODAL ==================== */

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
}

.sheet-root.is-open {
  pointer-events: auto;
}

.glass-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 34, 42, 0.34);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: sheetFadeIn 0.18s ease;
}

@keyframes sheetFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.glass-sheet-panel {
  width: 100%;
  max-height: 85dvh;
  background: rgba(251, 246, 237, 0.96);
  border-top: 0.5px solid rgba(112, 82, 52, 0.24);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -16px 46px rgba(18, 28, 36, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheetSlideUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheetSlideUp {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.glass-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(112, 82, 52, 0.24);
  margin: 8px auto 2px;
  flex-shrink: 0;
}

.glass-sheet-head {
  padding: 8px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.glass-sheet-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.glass-sheet-head span {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 1px;
}

.glass-sheet-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.glass-sheet-content {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px calc(22px + var(--safe-b));
  -webkit-overflow-scrolling: touch;
}

/* Desktop centered frosted modal card */

@media (min-width: 860px) {
  .glass-sheet-backdrop {
    align-items: center;
    padding: 24px;
  }

  .glass-sheet-panel {
    width: min(880px, 92vw);
    max-height: 86dvh;
    border: 0.5px solid rgba(112, 82, 52, 0.22);
    border-radius: 20px;
  }

  .glass-sheet-handle {
    display: none;
  }

  .glass-sheet-content {
    padding: 18px 22px 24px;
  }
}

/* Family Sheet internals */

.family-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Quiet corner ?demo=1 bar so it NEVER collides with bottom-center Hero CTA */

.demo-bar {
  position: fixed;
  left: calc(10px + env(safe-area-inset-left, 0px));
  right: auto;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
}

/* Landscape compact mobile tweaks (e.g. 844x390) */

@media (max-height: 460px) and (orientation: landscape) {
  .hud-bottom-hero {
    bottom: calc(10px + var(--safe-b));
  }

  .world-decor-tray {
    padding: 8px 12px calc(8px + var(--safe-b));
  }
}

/* ==================== 8TH UPGRADE: HOUSE GROWTH, PATHS, INDOOR DECOR, TACTILE LETTERS & SERRATED STAMPS ==================== */

/* House Growth Card inside Focus Popover */

/* Path Swatch inside Decor Tray */

.tray-path-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0.5px solid #bfa072;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.45);
}

.tray-path-swatch.is-erase {
  background: #eef6e4;
  border-color: #7ca35a;
}

/* Indoor 4-Spot Free Decor Drawer inside Focus Stage */

/* ==================== REAL WATERCOLOR STATIONERY & SERRATED POSTAGE STAMPS ==================== */

.is-watercolor-paper {
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.po-st-swatch.is-paper-thumb {
  width: 48px;
  height: 58px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 6px rgba(42, 28, 16, 0.14);
}

.po-style-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(140, 108, 72, 0.14);
  color: #6f4e2d;
  vertical-align: middle;
  margin-left: 4px;
}

.po-letter-sender-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.po-stamp-caption {
  display: block;
  font-size: 12px;
  opacity: 0.78;
}

.po-stamp-chip-img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 3px;
  border: 0.5px solid #fffdf8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.po-saved-stamp-thumb {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 3px;
  border: 0.5px solid #fffdf8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.po-saved-author {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Genuine Perforated Serrated Watercolor Postage Stamp */

.wc-serrated-stamp {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: #fdfbf5;
  box-shadow: 0 3px 9px rgba(48, 32, 18, 0.22);
  /* Classic perforated scalloped postage stamp edge */
  background-image:
    radial-gradient(circle at 0 50%, transparent 3.2px, #fdfbf5 3.6px),
    radial-gradient(circle at 100% 50%, transparent 3.2px, #fdfbf5 3.6px),
    radial-gradient(circle at 50% 0, transparent 3.2px, #fdfbf5 3.6px),
    radial-gradient(circle at 50% 100%, transparent 3.2px, #fdfbf5 3.6px);
  border: 1px dashed rgba(176, 152, 120, 0.52);
  border-radius: 3px;
}

.wc-serrated-stamp img {
  display: block;
  object-fit: cover;
  border-radius: 2px;
}

.wc-serrated-stamp.is-album {
  width: 102px;
  height: 112px;
  flex-direction: column;
  gap: 3px;
  padding: 6px 6px 5px;
  margin: 0 auto 8px;
}

.wc-serrated-stamp.is-album img {
  width: 86px;
  height: 82px;
}

.wc-serrated-stamp.is-mini {
  width: 66px;
  height: 66px;
  padding: 5px;
}

.wc-serrated-stamp.is-mini img {
  width: 52px;
  height: 52px;
}

.wc-serrated-stamp.is-tiny {
  width: 44px;
  height: 44px;
  padding: 4px;
}

.wc-serrated-stamp.is-tiny img {
  width: 34px;
  height: 34px;
}

.wc-stamp-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #6d5540;
}

/* Circular Vintage Ink Postmark */

.wc-postmark-ring {
  position: absolute;
  right: -14px;
  bottom: -10px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0.5px solid rgba(84, 58, 42, 0.5);
  box-shadow: inset 0 0 0 3px rgba(84, 58, 42, 0.15);
  color: rgba(84, 58, 42, 0.62);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transform: rotate(-16deg);
  pointer-events: none;
}

.wc-postmark-ring.is-subtle {
  right: -10px;
  bottom: -6px;
  width: 36px;
  height: 36px;
  opacity: 0.55;
}

/* Vintage Empty Dashed Collector Stamp Album Slot! */

.stamp-album-page {
  background: linear-gradient(180deg, #fcf8f0 0%, #f7efe0 100%);
}

.stamp-card.is-empty-slot {
  background: rgba(255, 252, 245, 0.72);
  border-style: dashed;
  border-color: rgba(168, 144, 114, 0.45);
}

.wc-empty-album-slot {
  width: 102px;
  height: 112px;
  margin: 0 auto 8px;
  border-radius: 4px;
  border: 1px dashed rgba(154, 132, 102, 0.52);
  background: repeating-linear-gradient(
    -45deg,
    rgba(218, 202, 178, 0.16),
    rgba(218, 202, 178, 0.16) 6px,
    rgba(255, 252, 246, 0.35) 6px,
    rgba(255, 252, 246, 0.35) 12px
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #8c765c;
  text-align: center;
  padding: 6px;
}

.empty-slot-code {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(154, 132, 102, 0.16);
}

.empty-slot-mark {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  opacity: 0.78;
}

/* ==================== TACTILE ANALOG LETTER OPENING (ENVELOPE & PARCHMENT SCROLL) ==================== */

.tactile-letter-backdrop {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(26, 20, 14, 0.56);
}

.tactile-letter-stage {
  width: min(92vw, 430px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}

.tactile-paper-sheet {
  position: relative;
  width: 100%;
  min-height: 290px;
  border-radius: 10px;
  padding: 24px 22px 20px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 14px 36px rgba(32, 20, 10, 0.28);
  border: 1px solid rgba(156, 128, 90, 0.45);
}

.tactile-paper-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tactile-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tactile-stamp-wrap {
  position: relative;
  flex-shrink: 0;
}

/* --- Mode A: Rolled Antique Parchment Scroll --- */

.scroll-shell {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.scroll-rod {
  width: 104%;
  height: 22px;
  border-radius: 14px;
  background: linear-gradient(180deg, #b88a55 0%, #e4c592 38%, #a67844 82%, #7a522a 100%);
  box-shadow: 0 4px 10px rgba(32, 18, 8, 0.38), inset 0 2px 3px rgba(255, 245, 224, 0.45);
  z-index: 3;
  position: relative;
}

.scroll-rod::before,
.scroll-rod::after {
  content: '';
  position: absolute;
  top: -2px;
  width: 14px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(180deg, #7d522c, #c2935c, #5c3a1c);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.scroll-rod::before {
  left: -4px;
}

.scroll-rod::after {
  right: -4px;
}

.scroll-body-clip {
  width: 96%;
  max-height: 76px;
  overflow: hidden;
  transition: max-height 0.78s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: inset 0 12px 18px -10px rgba(68, 42, 16, 0.45), inset 0 -12px 18px -10px rgba(68, 42, 16, 0.45);
}

.tactile-letter-stage.is-opened .scroll-body-clip {
  max-height: 520px;
}

.scroll-body-clip .tactile-paper-sheet {
  border-radius: 2px;
  box-shadow: none;
  border-left: 1px solid rgba(154, 122, 78, 0.45);
  border-right: 1px solid rgba(154, 122, 78, 0.45);
  border-top: 0;
  border-bottom: 0;
}

.scroll-ribbon-trigger {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 5;
  cursor: pointer;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.scroll-ribbon-band {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(90deg, #7a2626, #a83c3c, #7a2626);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.32);
}

.tactile-letter-stage.is-opened .scroll-ribbon-trigger {
  opacity: 0;
  transform: scale(1.18);
  pointer-events: none;
}

/* --- Mode B: Folded Wax-Sealed Analog Envelope --- */

.envelope-shell {
  position: relative;
  width: 100%;
  min-height: 244px;
  perspective: 1100px;
  cursor: pointer;
  transition: min-height 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.tactile-letter-stage.is-opened .envelope-shell {
  min-height: 360px;
}

.env-back {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 236px;
  border-radius: 14px;
  border: 0.5px solid #bfa072;
  box-shadow: 0 16px 36px rgba(24, 14, 8, 0.38);
  transition: opacity 0.45s ease 0.25s;
}

.env-letter-slide {
  position: relative;
  z-index: 2;
  width: 94%;
  margin: 0 auto;
  transform: translateY(34px) scale(0.94);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.68s cubic-bezier(0.22, 1, 0.36, 1) 0.24s, opacity 0.4s ease 0.24s;
}

.tactile-letter-stage.is-opened .env-letter-slide {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
  z-index: 6;
}

.env-front-pocket {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 236px;
  border-radius: 14px;
  border: 0.5px solid #bfa072;
  z-index: 3;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.55s ease 0.2s, opacity 0.45s ease 0.22s;
}

.tactile-letter-stage.is-opened .env-front-pocket,
.tactile-letter-stage.is-opened .env-back {
  opacity: 0.14;
  transform: translateY(26px);
  pointer-events: none;
}

.env-front-stamp {
  position: absolute;
  top: 16px;
  right: 16px;
}

.env-front-address {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #463220;
  font-size: 12px;
}

.env-front-address strong {
  font-size: 13.5px;
}

.env-top-flap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 108px;
  height: 128px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  z-index: 4;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  box-shadow: 0 6px 14px rgba(42, 24, 12, 0.18);
  transition: transform 0.52s cubic-bezier(0.32, 0.9, 0.36, 1), opacity 0.35s ease 0.3s;
}

.tactile-letter-stage.is-opened .env-top-flap {
  transform: rotateX(-176deg);
  opacity: 0.1;
}

.env-wax-trigger {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  z-index: 5;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.28s ease, transform 0.32s ease;
}

.tactile-letter-stage.is-opened .env-wax-trigger {
  opacity: 0;
  transform: translateX(-50%) scale(1.28);
  pointer-events: none;
}

.wax-seal-medallion {
  position: relative;
  z-index: 2;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: #fff6e6;
  font-size: 20px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: waxPulse 2.1s ease-in-out infinite;
}

@keyframes waxPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.07);
  }
}

.unseal-prompt-pill {
  position: relative;
  z-index: 2;
  background: rgba(46, 32, 20, 0.86);
  color: #fff9ef;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.26);
  white-space: nowrap;
}

.tactile-letter-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

/* Scoped Focus Stage Top HUD Pill Reset (prevents World Shell circular .hud-icon-btn bleed!) */

/* ==================== 9TH UPGRADE: ISLAND SHAPES, NEIGHBOR VISIT, HOUSE PEEK & P0 FIXES ==================== */

/* Fix Popover clipping on 844x390 landscape & 375px portrait */

.focus-quick-popover {
  max-height: calc(100dvh - 128px);
  overflow-y: auto;
}

/* Fix 375px Toast overlapping the bottom Decor Tray */

body:has(.world-decor-tray:not([hidden])) .nr-toast,
body:has(.world-visit-bar:not([hidden])) .nr-toast {
  bottom: auto !important;
  top: calc(18px + env(safe-area-inset-top, 0px)) !important;
}

/* Camera reset pill clears the bottom Decor Tray cleanly */

/* Opaque Parchment Scroll Outer Cover while sealed (zero text peeking behind ribbon!) + Scrollable 400-char body */

.scroll-body-clip {
  position: relative;
}

.scroll-outer-cover {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: linear-gradient(180deg, #e7d1a7 0%, #f3e4c3 50%, #dec392 100%);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 22px;
  color: #5b4024;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: opacity 0.36s ease;
  pointer-events: none;
}

.tactile-letter-stage.is-opened .scroll-outer-cover {
  opacity: 0;
}

.tactile-letter-stage.is-opened .scroll-body-clip {
  max-height: min(68dvh, 560px);
  overflow-y: auto;
}

/* Top-Left Code + Neighbor Visit Row */

/* Ephemeral Shape Preview Top Banner */

.world-preview-banner {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 28;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 16px;
  border-radius: 999px;
  background: rgba(42, 30, 18, 0.88);
  color: #fff8eb;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  max-width: 92vw;
}

.preview-exit-btn {
  border: 0;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e2864b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Neighbor Visit Mode Top Banner & Bottom Action Bar */

.world-visit-banner {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 12px;
  right: 12px;
  z-index: 26;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid rgba(186, 154, 110, 0.45);
  box-shadow: 0 8px 24px rgba(32, 48, 56, 0.2);
}

.visit-back-btn {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: #3d2b1c;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.visit-host-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.visit-host-txt strong {
  font-size: 13px;
  color: #362415;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.visit-host-txt span {
  font-size: 12px;
  color: #776048;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.world-visit-bar {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.94);
  backdrop-filter: blur(12px);
  border: 0.5px solid rgba(186, 154, 110, 0.45);
  box-shadow: 0 10px 28px rgba(24, 42, 52, 0.24);
  max-width: 94vw;
}

.visit-act-btn {
  border: 0.5px solid rgba(168, 140, 104, 0.42);
  background: #fff;
  color: #3d2b1c;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.visit-act-btn.is-primary {
  background: #c96436;
  border-color: transparent;
  color: #fff;
}

/* Visit Hub Sheet & 3 Island Shapes Picker */

.visit-code-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.visit-code-form input {
  flex: 1;
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 13px;
  background: #fff;
}

.shape-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 10px;
}

.shape-card {
  border-radius: 14px;
  overflow: hidden;
  border: 0.5px solid rgba(180, 152, 114, 0.34);
  background: #fffdf8;
  display: flex;
  flex-direction: column;
}

.shape-card.is-selected {
  border-color: #2f9a53;
  box-shadow: 0 4px 14px rgba(47, 154, 83, 0.18);
}

.shape-card img {
  width: 100%;
  height: 136px;
  object-fit: cover;
  background: #89c8d2;
}

.shape-card-body {
  padding: 10px 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.shape-card-body strong {
  font-size: 13.5px;
  color: #3a2717;
}

.shape-card-body p {
  margin: 0;
  font-size: 12px;
  color: #6f5b46;
  line-height: 1.4;
  flex: 1;
}

.shape-btn-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* Read-Only Friend House Interior Peek Modal */

.house-peek-modal {
  width: min(94vw, 680px);
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: 20px;
  background: #fdf9f1;
  border: 0.5px solid rgba(186, 154, 114, 0.45);
  box-shadow: 0 22px 60px rgba(18, 12, 8, 0.45);
  display: flex;
  flex-direction: column;
}

.house-peek-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
}

.house-peek-eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #a45425;
}

.house-peek-head h3 {
  margin: 2px 0 0;
  font-size: 17px;
  color: #352416;
}

.house-peek-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 240px;
  max-height: 54dvh;
  background: #231d17;
  overflow: hidden;
}

.house-peek-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.house-peek-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(24, 18, 12, 0.68);
  color: #fff7ea;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.house-peek-meta {
  padding: 12px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.house-peek-props-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.peek-prop-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3eadb;
  color: #5a442d;
  font-size: 12px;
  font-weight: 700;
}

.house-peek-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.house-peek-note-form {
  display: flex;
  flex: 1;
  min-width: 220px;
  gap: 6px;
}

.house-peek-note-form input {
  flex: 1;
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 7px 11px;
  font-size: 12.5px;
  background: #fff;
}

/* Ensure hidden HUD corners stay strictly hidden in Neighbor Visit Mode & toast clears top visit banner */

.hud-bottom-hero[hidden],
.world-visit-banner[hidden],
.world-visit-bar[hidden],
.world-preview-banner[hidden] {
  display: none !important;
}

body:has(.world-visit-bar:not([hidden])) .nr-toast {
  top: calc(74px + env(safe-area-inset-top, 0px)) !important;
}

/* ==================== 10TH UPGRADE: FIRST-FOCUS LV.2 GATE & 5-STAGE LIVING PRESTIGE STATUES ==================== */

/* ==================== 11TH UPGRADE: COASTAL RECLAMATION & LUXURY SHOP TAGS ==================== */

/* ==================== 13TH UPGRADE: LIVE TIME-OF-DAY (DAY / DUSK / STARRY NIGHT) TOGGLE ==================== */

/* ==================== MAIN ISLAND PHOTO / VIDEO RECORDING MODE ==================== */

.world-stage.is-photo-mode .hud-bottom-hero,
.world-stage.is-photo-mode .world-preview-banner,
.world-stage.is-photo-mode .world-visit-banner,
.world-stage.is-photo-mode .world-visit-bar,
.world-stage.is-photo-mode .world-edit-banner,
.world-stage.is-photo-mode .world-decor-tray {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.photo-mode-bar {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 28;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(26, 22, 18, 0.56);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 248, 236, 0.28);
  box-shadow: 0 10px 26px rgba(14, 18, 22, 0.28);
}

.photo-mode-bar[hidden] {
  display: none;
}

.photo-mode-snap-btn {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  background: rgba(255, 251, 244, 0.94);
  color: #362415;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.photo-mode-exit-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 248, 236, 0.34);
  background: rgba(255, 255, 255, 0.16);
  color: #fffdf8;
  font-size: 14px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
}
