/* Hootscape shell.css — the integration shell (public/index.html + js/main.js + ui/index.js, modal.js, context.js,
   toasts.js): boot splash, minimap canvas default, modal stacking/drag/bottom sheet, menu keyboard + sheet shade, toast
   stamp, reconnect banner, kicked notice, the stand-in login/chat/hover/dialogue/rail (only while a module is missing).
   Loaded after theme/ui/panels/login/mobile. */

.pixel, img.pixel, canvas.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
[hidden] { display: none !important; }

/* =====================================================================
   Boot splash: night sky, stone wordmark, slow-blink owl, tip
   ===================================================================== */
#boot {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 24px 16px; text-align: center; font-family: var(--font-ui); color: var(--txt-orange);
  background:
    radial-gradient(ellipse 60% 40% at 50% 112%, rgba(140,90,122,.55), transparent 70%),
    linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-horizon) 78%, #2A2546 100%);
  transition: opacity 400ms ease-in;
}
#boot::before { /* pixel stars: a fixed 1px field, two brightnesses */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .9;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #F2EFD8 99%, transparent), radial-gradient(1px 1px at 27% 8%, rgba(242,239,216,.6) 99%, transparent),
    radial-gradient(1px 1px at 41% 22%, #F2EFD8 99%, transparent), radial-gradient(1px 1px at 63% 12%, rgba(242,239,216,.6) 99%, transparent),
    radial-gradient(1px 1px at 78% 26%, #F2EFD8 99%, transparent), radial-gradient(1px 1px at 88% 9%, rgba(242,239,216,.6) 99%, transparent),
    radial-gradient(1px 1px at 6% 44%, rgba(242,239,216,.6) 99%, transparent), radial-gradient(1px 1px at 94% 48%, #F2EFD8 99%, transparent),
    radial-gradient(1px 1px at 18% 64%, rgba(242,239,216,.5) 99%, transparent), radial-gradient(1px 1px at 84% 70%, rgba(242,239,216,.5) 99%, transparent),
    radial-gradient(1px 1px at 52% 4%, #F2EFD8 99%, transparent), radial-gradient(1px 1px at 33% 38%, rgba(242,239,216,.45) 99%, transparent);
}
#boot::after { /* the moon with its slow owl lid */
  content: ""; position: absolute; right: 14%; top: 12%; width: 56px; height: 56px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 34% 60%, #D9D3BA 0 5px, transparent 6px), radial-gradient(circle at 66% 34%, #D9D3BA 0 3px, transparent 4px), var(--moon);
  box-shadow: 0 0 24px 6px rgba(175,195,255,.18);
}
#boot.gone { opacity: 0; pointer-events: none; }
#boot > * { position: relative; z-index: 1; }
.boot-mark { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.boot-wordmark { font-family: var(--font-display); font-weight: 700; font-size: 64px; line-height: 1; letter-spacing: 4px; color: var(--stone-hi); white-space: nowrap; color: #9A8A68; text-shadow: 2px 2px 0 var(--stone-lo), 0 -1px 0 #E0D0A8; min-height: 96px; display: flex; align-items: center; }
.boot-wordmark .o { position: relative; display: inline-block; }
.boot-wordmark .o::after { content: ""; position: absolute; left: 50%; top: 52%; width: .3em; height: .3em; margin: -.15em 0 0 -.15em; border-radius: 50%; background: var(--owl-eye); box-shadow: 0 0 6px 2px rgba(255,180,58,.55); }
.boot-wordmark-img { display: block; image-rendering: pixelated; filter: drop-shadow(0 0 14px rgba(255,180,58,.18)); }
.boot-sub { font-size: 22px; color: var(--txt-orange); text-shadow: 1px 1px 0 var(--outline-ink); letter-spacing: 1px; }

/* the slow-blink owl: a stone medallion, two amber eyes whose lids close for 260 ms every 3.2 s, a feather ring ticking round */
.boot-owl { position: relative; width: 112px; height: 112px; }
.boot-ring { position: absolute; inset: 0; border-radius: 50%; animation: boot-spin 2.4s steps(12) infinite;
  background: conic-gradient(from 0deg, var(--amber) 0 8deg, transparent 8deg 30deg, var(--amber-deep) 30deg 38deg, transparent 38deg 60deg, var(--amber) 60deg 68deg, transparent 68deg 90deg, var(--amber-deep) 90deg 98deg, transparent 98deg 120deg, var(--amber) 120deg 128deg, transparent 128deg 150deg, var(--amber-deep) 150deg 158deg, transparent 158deg 180deg, var(--amber) 180deg 188deg, transparent 188deg 210deg, var(--amber-deep) 210deg 218deg, transparent 218deg 240deg, var(--amber) 240deg 248deg, transparent 248deg 270deg, var(--amber-deep) 270deg 278deg, transparent 278deg 300deg, var(--amber) 300deg 308deg, transparent 308deg 330deg, var(--amber-deep) 330deg 338deg, transparent 338deg);
  -webkit-mask: radial-gradient(circle, transparent 47px, #000 48px, #000 55px, transparent 56px); mask: radial-gradient(circle, transparent 47px, #000 48px, #000 55px, transparent 56px); }
@keyframes boot-spin { to { transform: rotate(360deg); } }
.boot-face { position: absolute; inset: 14px; border-radius: 50%; background-color: var(--stone-fill); background-image: var(--noise);
  border: 3px solid; border-color: var(--stone-hi) var(--stone-lo) var(--stone-lo) var(--stone-hi); box-shadow: 0 0 0 2px var(--outline-ink), 4px 4px 0 rgba(0,0,0,.4); }
.boot-tuft { position: absolute; top: -10px; width: 18px; height: 16px; background: var(--stone-hi); box-shadow: inset -3px -3px 0 var(--stone-base); clip-path: polygon(0 100%, 30% 0, 100% 100%); }
.boot-tuft.l { left: 10px; } .boot-tuft.r { right: 10px; transform: scaleX(-1); }
.boot-eye { position: absolute; top: 24px; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 55%, #141008 0 5px, var(--owl-eye) 6px 10px, var(--iris) 11px); box-shadow: 0 0 0 2px var(--outline-ink), 0 0 10px 2px rgba(255,180,58,.35); }
.boot-eye.l { left: 13px; } .boot-eye.r { right: 13px; }
.boot-eye::after { content: ""; position: absolute; left: 7px; top: 6px; width: 4px; height: 4px; background: #fff; opacity: .85; }
.boot-lid { position: absolute; inset: 0; background: var(--stone-base); box-shadow: inset 0 -2px 0 var(--stone-lo); transform: translateY(-100%); animation: boot-blink 3.2s steps(1) infinite; }
.boot-eye.r .boot-lid { animation-delay: .06s; }
@keyframes boot-blink { 0%, 86% { transform: translateY(-100%); } 87% { transform: translateY(-45%); } 88%, 93% { transform: none; } 94% { transform: translateY(-45%); } 95%, 100% { transform: translateY(-100%); } }
.boot-beak { position: absolute; left: 50%; top: 52px; width: 10px; height: 12px; margin-left: -5px; background: var(--amber-deep); box-shadow: inset 2px 2px 0 var(--amber); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.boot-status { min-height: 22px; font-size: 22px; color: var(--txt-yellow); text-shadow: 1px 1px 0 var(--outline-ink); }
.boot-bar { width: min(320px, 80vw); height: 12px; background: var(--scroll-track); border: 1px solid var(--stone-lo); box-shadow: inset 1px 1px 0 rgba(0,0,0,.5), 0 0 0 1px var(--stone-hi); }
.boot-bar i { display: block; height: 100%; width: 4%; background: repeating-linear-gradient(90deg, var(--amber) 0 6px, var(--amber-deep) 6px 8px); box-shadow: inset 0 1px 0 #FFE08A; transition: width 200ms steps(4); }
.boot-tip { max-width: min(560px, 92vw); font-size: var(--fs-body); font-style: italic; color: var(--chat-paper); text-shadow: 1px 1px 0 var(--outline-ink); line-height: 1.2; }
.boot-tip b { color: var(--txt-yellow); font-weight: normal; }
#boot.failed .boot-status { color: var(--txt-red); }
#boot.failed .boot-lid { animation: none; transform: translateY(-40%); }
#boot.failed .boot-ring { animation: none; filter: grayscale(1) brightness(.6); }
.boot-noscript { color: var(--txt-red); font-size: 22px; }
@media (max-width: 640px) {
  .boot-wordmark { font-size: 40px; letter-spacing: 2px; min-height: 64px; }
  .boot-sub, .boot-status { font-size: 20px; }
  #boot::after { right: 8%; top: 6%; width: 40px; height: 40px; }
}

/* =====================================================================
   Minimap canvas default (main.js creates #minimap in #hud-minimap before game.init; the HUD re-parents/decorates it)
   ===================================================================== */
#hud-minimap > #minimap { position: absolute; left: calc(var(--eye-cx) - var(--eye-disc) / 2 + 11px); top: calc(var(--eye-cy) - var(--eye-disc) / 2 + 11px);
  width: calc(var(--eye-disc) - 22px); height: calc(var(--eye-disc) - 22px); border-radius: 50%; background: var(--grass-night);
  box-shadow: 0 0 0 3px var(--sclera), 0 0 0 9px var(--iris), 0 0 0 11px var(--outline-ink); image-rendering: pixelated; pointer-events: auto; cursor: pointer; }

/* =====================================================================
   Modals: stacked in one grid cell (centred), drag offset via --dx/--dy, the lower one dims
   ===================================================================== */
#modal-root:not(:empty), #modal-root.open { display: grid; place-items: center; }
#modal-root > .hoot-modal { grid-area: 1 / 1; transform: translate(var(--dx, 0px), var(--dy, 0px)); max-width: calc(100cqw - 16px); max-height: calc(100cqh - 16px); }
.hoot-modal .modal-title { cursor: move; user-select: none; touch-action: none; }
.hoot-modal .modal-title .modal-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: calc(100% - 56px); }
.hoot-modal.dragging { box-shadow: 0 0 0 1px var(--stone-lo), 8px 8px 0 rgba(0,0,0,.45); }
.hoot-modal.dragging .modal-title { background-color: var(--bark-grain-hi); }
.hoot-modal.modal-under { filter: brightness(.82) saturate(.9); }
.hoot-modal.modal-under .modal-title { color: var(--txt-grey); }
.hoot-modal .modal-close:hover { color: var(--txt-red); }
.hoot-modal .modal-error { padding: 16px; text-align: center; }

/* =====================================================================
   Right-click menu: keyboard highlight, phone shade
   ===================================================================== */
.hoot-menu { user-select: none; }
.hoot-menu .menu-item.hot { color: var(--txt-yellow); background: rgba(93,84,71,.35); }
.hoot-menu .menu-item .verb { color: inherit; }
.menu-shade { position: absolute; inset: 0; background: rgba(0,0,0,.35); pointer-events: auto; }

/* =====================================================================
   Toasts: stamp bounce + wax seal for achievements/diaries
   ===================================================================== */
.hoot-toast { cursor: pointer; }
.hoot-toast .toast-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; }
.toast.toast-stamp { animation: toast-in var(--t-toast) ease-out, toast-stamp var(--t-stamp) cubic-bezier(.2,1.6,.4,1) 120ms both; }
@keyframes toast-stamp { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
.toast-seal { position: relative; flex: 0 0 22px; width: 22px; height: 22px; margin-left: auto; margin-right: 10px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #B23A2F, var(--parchment-red) 60%, #5E1010); box-shadow: 0 0 0 1px var(--outline-ink), 1px 1px 0 rgba(0,0,0,.5);
  clip-path: polygon(50% 0, 63% 9%, 79% 6%, 84% 21%, 98% 30%, 92% 46%, 100% 60%, 87% 70%, 85% 86%, 69% 88%, 57% 100%, 43% 92%, 28% 99%, 20% 85%, 5% 79%, 8% 63%, 0 48%, 10% 35%, 9% 18%, 25% 14%, 34% 1%);
  animation: seal-stamp 280ms cubic-bezier(.2,1.6,.4,1) 260ms both; }
.toast-seal::after { content: ""; position: absolute; left: 7px; top: 6px; width: 8px; height: 8px; background: var(--gilt); clip-path: polygon(50% 0, 62% 38%, 100% 38%, 69% 60%, 80% 100%, 50% 76%, 20% 100%, 31% 60%, 0 38%, 38% 38%); }
@keyframes seal-stamp { from { transform: scale(2.2) rotate(-20deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.toast-kind { white-space: nowrap; }

/* =====================================================================
   Reconnect banner + kicked notice
   ===================================================================== */
.shell-banner { position: absolute; left: 50%; top: 152px; /* below the 3-toast stack */ transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px;
  color: var(--txt-yellow); font-size: var(--fs-body); text-shadow: 1px 1px 0 var(--outline-ink); white-space: nowrap; }
.shell-banner-owl { width: 22px; height: 14px; flex: none; background: radial-gradient(circle at 25% 50%, var(--owl-eye) 0 3px, transparent 4px), radial-gradient(circle at 75% 50%, var(--owl-eye) 0 3px, transparent 4px); animation: banner-blink 1.6s steps(1) infinite; }
@keyframes banner-blink { 0%, 80% { opacity: 1; } 81%, 88% { opacity: .15; } 89%, 100% { opacity: 1; } }
.shell-banner-retry { display: none; min-height: 26px; }
.shell-banner.can-retry .shell-banner-retry { display: inline-flex; }
.shell-notice { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0,0,0,.55); padding: 16px; font-family: var(--font-ui); }
.shell-notice .modal { width: min(420px, 100%); height: auto; }
.shell-notice .modal-body { padding: 16px; color: var(--txt-orange); text-align: center; line-height: 1.2; }
.shell-notice .modal-foot { padding: 8px; flex-basis: auto; }

/* =====================================================================
   Stand-in login (only when ui/login.js is missing): the theme's .login-box over a starry stage
   ===================================================================== */
#login.leaving { pointer-events: none; }
.shell-login-stage { width: 100vw; height: 100vh; background: radial-gradient(ellipse 70% 30% at 50% 100%, rgba(140,90,122,.5), transparent 70%), linear-gradient(to bottom, var(--sky-top), var(--sky-horizon) 80%, #2A2546); }
.shell-login-stage::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(1px 1px at 12% 18%, #F2EFD8 99%, transparent), radial-gradient(1px 1px at 41% 22%, #F2EFD8 99%, transparent), radial-gradient(1px 1px at 78% 26%, #F2EFD8 99%, transparent), radial-gradient(1px 1px at 63% 12%, rgba(242,239,216,.6) 99%, transparent), radial-gradient(1px 1px at 88% 9%, rgba(242,239,216,.6) 99%, transparent), radial-gradient(1px 1px at 27% 8%, rgba(242,239,216,.6) 99%, transparent); }
.shell-wordmark-wrap { position: absolute; left: 50%; top: 9%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.shell-wordmark { display: block; image-rendering: pixelated; }
.shell-wordmark-wrap .wordmark { position: static; transform: none; }
.shell-wordmark-sub { font-size: 22px; color: var(--txt-orange); text-shadow: 1px 1px 0 var(--outline-ink); white-space: nowrap; }
.shell-login .login-screen, .shell-login .login-form { display: grid; }
.shell-login .login-error.busy { color: var(--txt-yellow); }
.shell-login .login-error:empty { display: block; min-height: 20px; }
.shell-login-tip { top: calc(50% + 140px); }
@media (max-width: 640px) {
  .shell-login-stage { transform: none; left: 0; top: 0; }
  .shell-wordmark-wrap { top: 6%; }
  .shell-login-tip { top: auto; bottom: 80px; }
}

/* =====================================================================
   Stand-ins for the HUD/chat/dialogue/rail (only while those modules are missing)
   ===================================================================== */
.shell-chat { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; height: 100%; }
.shell-chat .chat-tabs .chat-tab { flex: 0 0 auto; padding: 0 12px; }
.shell-chat .chat-paper .scroll-inner { justify-content: flex-end; }
.shell-hover .more { color: var(--txt-white); }
.shell-dialogue { z-index: 8; }
.shell-rail { display: flex; flex-direction: column; height: 100%; }
.shell-rail .panel-title { flex: 0 0 32px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: var(--fs-header); color: var(--txt-orange); text-shadow: 1px 1px 0 var(--outline-ink); background-color: var(--bark); background-image: var(--bark-grain); border-bottom: 2px solid var(--bark-grain-lo); }
.shell-rail-body { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; text-align: center; }
.shell-logout { min-width: 180px; min-height: 52px; font-size: 24px; }

/* =====================================================================
   Phone (≤640): modals become bottom sheets above the tab bar
   ===================================================================== */
@container game (max-width: 640px) {
  #modal-root:not(:empty), #modal-root.open { place-items: end stretch; padding: 0 0 var(--tabbar-h, 56px); align-items: end; }
  #modal-root > .hoot-modal.modal-sheet { width: 100%; max-width: 100%; height: auto; max-height: calc(100cqh - 120px - var(--tabbar-h, 56px)); transform: none; border-width: 2px 0 0; animation: modal-sheet-up 160ms ease-out; }
  #modal-root > .hoot-modal.modal-sheet.modal-second { transform: translateY(-16px); }
  .hoot-modal.modal-sheet .modal-title { cursor: default; flex-basis: 40px; padding-top: 6px; }
  .hoot-modal.modal-sheet .modal-title::before { content: ""; position: absolute; left: 50%; top: 3px; width: 48px; height: 5px; margin-left: -24px; background: var(--bark-grain-hi); border: 1px solid var(--stone-lo); border-radius: 3px; }
  .hoot-modal.modal-sheet .modal-close { width: 40px; height: 40px; top: 2px; }
  .hoot-modal.modal-sheet .modal-body { overflow-y: auto; }
  .shell-banner { top: 140px; width: calc(100cqw - 16px); max-width: calc(100cqw - 16px); height: auto; min-height: 44px; padding: 4px 12px; white-space: normal; line-height: 1.1; font-size: var(--fs-body); }
  .shell-chat .chat-tabs { display: none; }
}
@keyframes modal-sheet-up { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .boot-ring, .boot-lid, .toast-seal, .toast.toast-stamp, #modal-root > .hoot-modal.modal-sheet { animation: none !important; }
}
