/*
 * Chumkins game UI
 *
 * This is the signed-in app's final visual layer. The older stylesheet also
 * serves the public site and contains several historical themes, so this file
 * deliberately scopes one readable, playful system to .app-shell.
 */

.app-shell {
  --game-font: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --game-ink: #283149;
  --game-muted: #68768a;
  --game-surface: #fffdf5;
  --game-surface-alt: #eaf9f5;
  --game-primary: #6558df;
  --game-primary-deep: #463ab7;
  --game-accent: #21b697;
  --game-reward: #f5c84c;
  --game-danger: #df536c;
  --game-line: rgba(43, 58, 83, .16);
  --game-type-xs: 12px;
  --game-type-sm: 14px;
  --game-type-md: 16px;
  --game-type-lg: 20px;
  --game-control: 48px;
  --game-control-large: 54px;
  --game-card-radius: 20px;
  --game-panel-radius: 26px;
  --game-shadow-button: 0 4px 0 #303953;
  --game-shadow-panel: 0 16px 36px rgba(42, 55, 76, .18);
  color: var(--game-ink);
  font-family: var(--game-font);
  font-size: var(--game-type-md);
  font-weight: 750;
}

body.market-dialog-open,
body.inventory-detail-open { overflow: hidden; }

.app-shell :is(button, a, input, select, summary):focus-visible {
  outline: 3px solid #22bca0;
  outline-offset: 3px;
}

.app-shell .button {
  min-height: var(--game-control);
  padding: 11px 18px;
  border: 2px solid #303953;
  border-radius: 15px;
  font-size: var(--game-type-sm);
  font-weight: 900;
  line-height: 1.1;
  box-shadow: var(--game-shadow-button);
}

.app-shell .button:hover {
  box-shadow: 0 6px 0 #303953, 0 12px 22px rgba(48, 57, 83, .14);
  transform: translateY(-2px);
}

.app-shell .button:active {
  box-shadow: 0 1px 0 #303953;
  transform: translateY(3px);
}

.app-shell .button:disabled {
  box-shadow: 0 2px 0 rgba(48, 57, 83, .35);
  cursor: not-allowed;
  transform: none;
}

.app-shell .button-primary {
  color: white;
  background: linear-gradient(135deg, #594bc9, #714bb7 55%, #b83f70);
}

.app-shell .button-quiet {
  color: #40566c;
  background: #fff;
  box-shadow: 0 3px 0 rgba(48, 57, 83, .5);
}

.app-shell .button-big,
.app-shell .market-buy-button {
  min-height: var(--game-control-large);
  font-size: var(--game-type-md);
}

/* Shell and account controls */
.app-shell .topbar {
  min-height: 76px;
  height: 76px;
  padding: 10px max(16px, calc((100vw - 1240px) / 2));
  border-bottom: 2px solid rgba(48, 57, 83, .12);
  background: rgba(255, 253, 245, .96);
  box-shadow: 0 6px 20px rgba(47, 63, 86, .1);
}

.app-shell :is(.topbar, .main-nav, .account-menu, .character-sheet, .room-inventory-drawer, .room-sidebar-panel) {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.app-shell .logo-button {
  min-height: 52px;
  gap: 10px;
  color: #26334d;
  font-size: clamp(24px, 3vw, 31px);
  font-weight: 1000;
  text-shadow: 0 3px 0 #ffcbe0;
}

.app-shell .logo-button img { width: 54px; height: 38px; border-radius: 12px; }
.app-shell .account-pills { gap: 8px; }

.app-shell .mini-pill,
.app-shell .avatar-pill {
  min-height: 50px;
  height: 50px;
  border: 2px solid rgba(48, 57, 83, .72);
  background: white;
  box-shadow: 0 3px 0 rgba(48, 57, 83, .78), 0 8px 16px rgba(48, 57, 83, .08);
}

.app-shell .mini-pill {
  min-width: 94px;
  padding: 6px 13px;
  gap: 9px;
  border-radius: 17px;
}

.app-shell .mini-pill-icon { font-size: 20px; line-height: 1; }
.app-shell .mini-pill-copy { display: grid; min-width: 0; justify-items: start; line-height: 1; }
.app-shell .mini-pill-copy small { color: #718095; font-size: 10px; font-weight: 850; }
.app-shell .mini-pill-copy b { color: #29374f; font-size: 15px; }
.app-shell .token-pill .mini-pill-icon { color: #705ce0; }
.app-shell .coin-pill .mini-pill-icon { color: #e8ad2f; }
.app-shell .envelope-pill .mini-pill-icon { color: #2a9ec2; }
.app-shell .avatar-pill { width: 50px; min-width: 50px; border-radius: 18px; font-size: 16px; }

.app-shell .account-menu {
  top: 70px;
  right: max(14px, calc((100vw - 1240px) / 2));
  width: min(360px, calc(100vw - 28px));
  padding: 18px;
  gap: 7px;
  border: 2px solid rgba(48, 57, 83, .2);
  border-radius: 22px;
  color: var(--game-ink);
  background: #fffdf8;
  box-shadow: var(--game-shadow-panel);
}

.app-shell .account-menu > strong { font-size: 20px; }
.app-shell .account-menu > small { color: var(--game-muted); font-size: 12px; }
.app-shell .account-device-status { min-height: 56px; padding: 10px 12px; }
.app-shell .account-device-status b { font-size: 14px; }
.app-shell .account-menu .account-device-status small { font-size: 12px; }
.app-shell .account-site-links { gap: 5px; }
.app-shell .account-site-links :is(a, button),
.app-shell #logout-button {
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 850;
}

/* Primary game navigation */
.app-shell .main-nav {
  top: 86px;
  bottom: auto;
  display: grid;
  width: min(720px, calc(100vw - 20px));
  min-height: 66px;
  padding: 6px;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 5px;
  overflow: visible;
  border: 2px solid rgba(48, 57, 83, .78);
  border-radius: 22px;
  background: rgba(255, 253, 247, .97);
  box-shadow: 0 6px 0 rgba(48, 57, 83, .14), 0 16px 34px rgba(48, 57, 83, .16);
}

.app-shell .nav-button {
  display: grid;
  min-width: 0;
  min-height: 52px;
  padding: 6px 8px;
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: center;
  gap: 3px;
  border: 0;
  border-radius: 15px;
  color: #637088;
  background: transparent;
  font-size: 13px;
  font-weight: 900;
}

.app-shell .nav-button:hover { color: #3d4962; background: #edf4f5; }
.app-shell .nav-button.active {
  color: white;
  background: linear-gradient(145deg, #594bc9, #2f75a8 58%, #167c6b);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), 0 4px 0 #3b4b75;
}

.app-shell .nav-button .nav-icon,
.app-shell .nav-button.active .nav-icon { color: inherit; }
.app-shell .nav-icon { display: grid; width: 24px; height: 24px; place-items: center; }
.app-shell .nav-icon svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app-shell .nav-button .nav-label { color: inherit; font-size: inherit; }
.app-shell .nav-badge { top: 3px; right: 5px; min-width: 20px; height: 20px; font-size: 10px; }

.app-shell .view:not(#home-view) {
  width: min(1240px, calc(100% - 32px));
  padding-top: 100px;
}

.app-shell .section-heading { min-height: 62px; margin: 4px 0 22px; gap: 16px; }
.app-shell .section-heading h1 {
  color: #25344f;
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 1000;
  letter-spacing: -.055em;
  line-height: .95;
}
.app-shell .section-heading > span,
.app-shell .shop-currency-note { color: var(--game-muted); font-size: 13px; }

/* Room sidebar */
.app-shell .room-sidebar {
  top: 164px;
  left: 16px;
  width: min(284px, calc(100vw - 32px));
  max-height: calc(100dvh - 180px);
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.app-shell .room-sidebar-panel {
  border: 2px solid rgba(48, 57, 83, .72);
  border-radius: 19px;
  color: var(--game-ink);
  background: rgba(255, 253, 245, .97);
  box-shadow: 0 5px 0 rgba(48, 57, 83, .14), 0 14px 28px rgba(44, 61, 83, .13);
}

.app-shell .room-sidebar-toggle {
  min-height: 50px;
  padding: 10px 13px;
  grid-template-columns: minmax(0, 1fr) auto 14px;
  color: #30445b;
  background: linear-gradient(135deg, #fff9e8, #eaf9f5);
  font-size: 14px;
  font-weight: 950;
}
.app-shell .room-sidebar-toggle b { min-width: 26px; height: 26px; color: #594ca8; background: #ece9ff; font-size: 11px; }
.app-shell .room-sidebar-toggle i { width: 9px; height: 9px; border-color: #52647a; border-width: 0 2px 2px 0; }
.app-shell .room-sidebar-panel-body { max-height: min(310px, calc(50dvh - 96px)); border-top-color: var(--game-line); }
.app-shell .room-sidebar .shelf-wrap,
.app-shell .room-sidebar-item-list { padding: 8px; gap: 6px; }
.app-shell .room-sidebar .shelf-pet,
.app-shell .room-sidebar-item { min-height: 68px; padding: 7px 9px; border-radius: 13px; }
.app-shell .room-sidebar .shelf-pet { grid-template-columns: 58px minmax(0, 1fr); }
.app-shell .room-sidebar .shelf-pet .chumkin-still { width: 58px; height: 54px; }
.app-shell .room-sidebar .shelf-pet small { color: #33495d; font-size: 13px; font-weight: 900; }
.app-shell .room-sidebar-item { grid-template-columns: 52px minmax(0, 1fr) 20px; color: #33495d; }
.app-shell .room-sidebar-item-art { width: 50px; height: 50px; }
.app-shell .room-sidebar-item strong { color: #30465a; font-size: 13px; }
.app-shell .room-sidebar-item small { color: #71838f; font-size: 11px; }
.app-shell .room-sidebar-lock { color: #9a762e; font-size: 16px; }
.app-shell .room-sidebar-empty { padding: 18px 14px; color: #6d808c; font-size: 12px; }

.app-shell .world-supplies {
  top: 164px;
  width: 210px;
  padding: 10px;
  gap: 7px;
  border: 2px solid rgba(48, 57, 83, .7);
  border-radius: 21px;
  background: rgba(255, 253, 247, .96);
  box-shadow: 0 5px 0 rgba(48, 57, 83, .13), 0 14px 28px rgba(44, 61, 83, .13);
  backdrop-filter: none;
}
.app-shell .world-supplies-label { color: #65788a; font-family: var(--game-font); font-size: 11px; font-weight: 900; }
.app-shell .supply-tool { min-height: 70px; border: 2px solid var(--game-line); border-radius: 16px; }
.app-shell .supply-tool small { font-size: 12px; font-weight: 900; }

/* Music and room-audio controls */
.app-shell .boombox,
.world-active .app-shell .boombox {
  --audio-level: 0;
  width: 156px;
  height: 360px;
  padding: 11px;
}
.app-shell .boombox-screen { height: 56px; padding: 6px 8px; gap: 3px; }
.app-shell .boombox-screen strong { font-size: 12px; }
.app-shell .boombox-screen > span { font-size: 10px; }
.app-shell .boombox-level { display: flex; height: 10px; align-items: end; gap: 2px; }
.app-shell .boombox-level b {
  width: 100%;
  height: 100%;
  border-radius: 2px 2px 1px 1px;
  background: #5bd2b8;
  opacity: calc(.25 + var(--audio-level) * .75);
  transform: scaleY(clamp(.16, calc(var(--audio-level) * 1.45), 1));
  transform-origin: bottom;
  transition: transform 70ms linear, opacity 100ms linear;
}
.app-shell .boombox-level b:nth-child(2) { transform: scaleY(clamp(.12, calc(var(--audio-level) * 1.08), .92)); }
.app-shell .boombox-level b:nth-child(3) { transform: scaleY(clamp(.18, calc(var(--audio-level) * 1.7), 1)); }
.app-shell .boombox-level b:nth-child(4) { transform: scaleY(clamp(.12, calc(var(--audio-level) * .9), .84)); }
.app-shell .boombox-level b:nth-child(5) { transform: scaleY(clamp(.16, calc(var(--audio-level) * 1.28), .96)); }
.app-shell .boombox-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.app-shell :is(.boombox-power, .boombox-skip, .boombox-sfx) { min-height: 44px; height: 44px; font-size: 11px; }
.app-shell .boombox-sfx { grid-column: 1 / -1; }
.app-shell .boombox-power { font-size: 14px; }
.app-shell .boombox-skip { font-size: 11px; }
.app-shell .boombox-volume input { min-height: 32px; height: 32px; }
.app-shell .boombox-volume:has(input:disabled) { opacity: .48; }
.app-shell .boombox-listen {
  width: 100%;
  min-height: 44px;
  padding: 6px;
  border: 1px solid rgba(91, 210, 184, .42);
  border-radius: 9px;
  color: #8be5d2;
  background: rgba(15, 46, 48, .92);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .05em;
}
.app-shell .boombox-listen[aria-pressed="true"] {
  color: #102e2b;
  background: #64dec4;
  box-shadow: 0 0 13px rgba(100, 222, 196, .4);
}
.app-shell .boombox-listen:disabled { opacity: .48; cursor: not-allowed; }
.app-shell .boombox.listening .boombox-screen > span { color: #70e7cc; }
.app-shell .boombox.listening .boombox-speaker i { animation: speaker-pulse .42s ease-in-out infinite alternate; }

/* Character panel */
.app-shell .character-sheet {
  top: 164px;
  right: 16px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 180px);
  padding: 17px;
  gap: 14px;
  border: 2px solid rgba(48, 57, 83, .76);
  border-radius: var(--game-panel-radius);
  color: var(--game-ink);
  background: linear-gradient(145deg, #fffdf5, #edf9f7 68%, #eef2ff);
  box-shadow: 0 6px 0 rgba(48, 57, 83, .15), var(--game-shadow-panel);
}
.app-shell .character-sheet-heading { min-height: 68px; padding: 2px 2px 12px; border-bottom-color: var(--game-line); }
.app-shell .character-sheet-heading small { color: #9a6b1d; font-size: 11px; }
.app-shell .character-sheet-heading strong { color: #27364f; font-size: 31px; }
.app-shell .character-sheet-heading span { color: #738492; font-size: 11px; }
.app-shell .character-sheet-close,
.app-shell .market-detail-close,
.app-shell .inventory-drawer-close,
.app-shell .owned-item-detail-close,
.app-shell .room-item-editor header button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 2px solid rgba(48, 57, 83, .18);
  border-radius: 14px;
  color: #455b70;
  background: white;
  font-size: 23px;
}
.app-shell .character-sheet-main { min-height: 190px; grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; }
.app-shell .character-portrait { min-height: 190px; border: 2px solid rgba(48, 57, 83, .15); border-radius: 18px; }
.app-shell .character-portrait .chumkin-still { height: 174px; }
.app-shell .character-portrait > span { padding: 5px 8px; border-radius: 8px; font-size: 11px; }
.app-shell .character-equipment { gap: 8px; }
.app-shell .character-equipment-heading { min-height: 34px; color: #7b642d; font-size: 11px; }
.app-shell .character-equipment-heading button {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid rgba(39, 153, 132, .2);
  border-radius: 9px;
  color: #167966;
  background: #e8f8f4;
  font-size: 11px;
}
.app-shell .character-slots { gap: 7px; }
.app-shell .character-slot { min-height: 49px; border-color: rgba(48, 57, 83, .16); border-radius: 12px; color: #718391; background: white; }
.app-shell .character-slot > i { color: #5d7080; font-size: 22px; }
.app-shell .character-slot > span { right: 6px; bottom: 4px; color: #718391; font-size: 9px; }
.app-shell .character-slot.equipped { border-color: rgba(202, 154, 65, .45); background: #fff7df; }
.app-shell .character-vitals { gap: 10px; }
.app-shell .character-vital > i { width: 64px; height: 64px; }
.app-shell .character-vital > i::after { inset: 6px; background: #fff; }
.app-shell .character-vital b { top: 22px; color: #2b3b50; font-size: 16px; }
.app-shell .character-vital small { margin-top: 6px; color: #657784; font-size: 11px; }
.app-shell .character-traits { gap: 7px; }
.app-shell .character-traits span { min-height: 40px; padding: 8px 10px; border-color: var(--game-line); border-radius: 11px; background: white; }
.app-shell .character-traits small { color: #657784; font-size: 11px; }
.app-shell .character-traits b { color: #8d6925; font-size: 14px; }
.app-shell .character-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.app-shell .character-actions .button { min-height: 46px; padding: 9px; border-radius: 13px; font-size: 13px; }
.app-shell .character-record { border-top-color: var(--game-line); }
.app-shell .character-record summary { min-height: 42px; padding: 12px 4px 4px; color: #617583; font-size: 12px; }
.app-shell .character-record .pet-code button { min-height: 38px; padding: 7px 10px; border-radius: 9px; color: #705b29; background: #fff7df; font-size: 12px; }
.app-shell .character-record .pet-code code { color: #738692; font-size: 11px; }
.app-shell .chumkin-delete-zone { padding-top: 12px; }
.app-shell .chumkin-delete-button {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid rgba(194, 77, 97, .2);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 850;
}
.app-shell .chumkin-delete-confirm { padding: 13px; gap: 9px; }
.app-shell .chumkin-delete-confirm > strong { font-size: 15px; }
.app-shell .chumkin-delete-confirm > span { font-size: 12px; line-height: 1.45; }
.app-shell .chumkin-delete-confirm > div { gap: 9px; }
.app-shell .hold-delete-button { min-height: 46px; }
.app-shell .hold-delete-button span { font-size: 13px; }

/* Room inventory drawer and item editor */
.app-shell .room-inventory-drawer {
  top: 164px;
  left: 16px;
  width: min(940px, calc(100vw - 340px));
  max-height: min(480px, calc(100dvh - 180px));
  padding: 16px;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 11px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 2px solid rgba(48, 57, 83, .76);
  border-radius: var(--game-panel-radius);
  color: var(--game-ink);
  background: #fffdf7;
  box-shadow: 0 6px 0 rgba(48, 57, 83, .15), var(--game-shadow-panel);
}
.app-shell .inventory-drawer-heading { min-height: 52px; gap: 12px; }
.app-shell .inventory-drawer-heading > strong { color: #28384f; font-size: 26px; }
.app-shell .inventory-drawer-heading-actions { display: flex; align-items: center; gap: 8px; }
.app-shell .inventory-drawer-heading .inventory-view-all {
  min-width: 92px;
  min-height: 44px;
  padding: 8px 13px;
  border: 2px solid rgba(89, 75, 201, .22);
  border-radius: 13px;
  color: #574bad;
  background: #f0edff;
  font-size: 13px;
  font-weight: 950;
}
.app-shell .inventory-drawer-categories,
.app-shell .owned-category-tabs { gap: 7px; }
.app-shell .inventory-drawer-categories button,
.app-shell .owned-category-tabs button {
  min-width: 82px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--game-line);
  border-radius: 13px;
  color: #526a79;
  background: #f4f8f8;
  font-size: 13px;
}
.app-shell .inventory-drawer-categories button.active,
.app-shell .owned-category-tabs button.active,
.app-shell .market-category-tabs button.active {
  color: white;
  background: linear-gradient(145deg, #168d77, #2e7096);
}
.app-shell .inventory-drawer-rack { min-height: 172px; padding: 4px 2px 12px; gap: 11px; }
.app-shell .inventory-drawer-item {
  width: 142px;
  min-width: 142px;
  min-height: 158px;
  padding: 11px;
  gap: 5px;
  border: 2px solid var(--game-line);
  border-radius: 17px;
  color: #344b5d;
  background: linear-gradient(150deg, white, #eff9f7);
  touch-action: pan-x pan-y;
}
.app-shell .inventory-drag-handle {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 2;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(35, 130, 113, .24);
  border-radius: 10px;
  color: #167966;
  background: #e8f8f4;
  font-size: 16px;
  font-style: normal;
  font-weight: 950;
  cursor: grab;
  touch-action: none;
}
.app-shell .inventory-drag-handle:active { cursor: grabbing; }
.app-shell .inventory-drawer-art { width: 78px; height: 78px; }
.app-shell .inventory-drawer-item strong { color: #304659; font-size: 15px; }
.app-shell .inventory-drawer-item small { color: #748691; font-size: 13px; }
.app-shell .inventory-drawer-item > b { display: flex; align-items: center; gap: 5px; color: #76591e; font-size: 13px; }
.app-shell .inventory-drawer-item > b i { color: #987426; font-size: 13px; font-style: normal; }
.app-shell .inventory-drawer-item.daily-ready::after { display: none; }
.app-shell .inventory-card-reward,
.app-shell .owned-item-reward {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  padding: 5px 8px;
  border: 2px solid rgba(112, 77, 12, .12);
  border-radius: 999px;
  color: #684607;
  background: #ffd86e;
  box-shadow: 0 3px 0 rgba(112, 77, 12, .2);
  font-size: 11px;
  font-style: normal;
  font-weight: 1000;
}
.app-shell .inventory-drawer-empty { color: #687d89; font-size: 14px; }
.app-shell .inventory-drawer-empty button {
  min-height: 44px;
  padding: 9px 12px;
  border: 2px solid #4b9f8e;
  border-radius: 12px;
  color: #174f47;
  background: #dff5ee;
  box-shadow: 0 3px 0 rgba(35, 102, 89, .18);
  font-size: 13px;
  font-weight: 950;
}
.app-shell .inventory-drawer-empty button:hover { color: #103d37; background: #cceee4; }
.app-shell .inventory-drawer-selected { min-height: 76px; padding: 12px 8px 2px; border-top-color: var(--game-line); }
.app-shell .inventory-selected-art { width: 58px; height: 58px; }
.app-shell .inventory-drawer-selected-copy { display: grid; min-width: 150px; margin-right: auto; }
.app-shell .inventory-drawer-selected-copy strong { color: #304659; font-size: 16px; }
.app-shell .inventory-drawer-selected-copy span { color: #6d808b; font-size: 13px; }
.app-shell .inventory-drawer-actions { gap: 8px; }
.app-shell .inventory-drawer-actions button {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid rgba(45, 151, 130, .25);
  border-radius: 12px;
  color: #245e56;
  background: #eaf8f4;
  font-size: 13px;
  font-weight: 950;
}
.app-shell .inventory-drawer-actions .inventory-attach-form { display: flex; min-width: max-content; gap: 7px; }
.app-shell .inventory-drawer-actions .inventory-attach-form select {
  min-width: 112px;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid var(--game-line);
  border-radius: 12px;
  color: #40566c;
  background: white;
  font-size: 13px;
}

.app-shell .room-item-editor {
  top: 164px;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100dvh - 180px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.app-shell .room-item-editor form { padding: 16px; gap: 12px; border: 2px solid var(--game-line); border-radius: 22px; }
.app-shell .room-item-editor header { grid-template-columns: 52px 1fr 44px; gap: 10px; }
.app-shell .room-item-editor header strong { font-size: 17px; }
.app-shell .room-item-editor header small { font-size: 12px; }
.app-shell .room-item-editor label { gap: 6px; font-size: 12px; }
.app-shell .room-item-editor select { min-height: 44px; border-radius: 12px; font-size: 14px; }
.app-shell .room-item-editor .button { min-height: 44px; font-size: 12px; }
.app-shell .room-item-lock-note,
.app-shell .room-item-move-note { padding: 10px; border-radius: 11px; font-size: 12px; }

/* Marketplace */
.app-shell .marketplace-shell { max-width: 1180px; gap: 22px; }
.app-shell .marketplace-currency-tabs { max-width: 620px; padding: 6px; gap: 6px; border: 2px solid var(--game-line); border-radius: 20px; }
.app-shell .marketplace-currency-tabs button { min-height: 70px; padding: 10px 15px; grid-template-columns: 36px 1fr; border-radius: 15px; }
.app-shell .marketplace-currency-tabs button > span { font-size: 23px; }
.app-shell .marketplace-currency-tabs button strong { font-size: 16px; }
.app-shell .marketplace-currency-tabs button small { font-size: 12px; }
.app-shell .marketplace-coin-view,
.app-shell .marketplace-token-view { gap: 20px; }
.app-shell .market-category-tabs { gap: 9px; }
.app-shell .market-category-tabs button {
  min-width: 90px;
  min-height: 46px;
  padding: 9px 15px;
  border: 2px solid var(--game-line);
  border-radius: 15px;
  font-size: 13px;
}
.app-shell .market-shelf-head { min-height: 48px; }
.app-shell .market-shelf-head h2 { font-size: 28px; }
.app-shell .market-shelf-head span { font-size: 12px; }
.app-shell .market-item-grid { grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 16px; }
.app-shell .market-item-card {
  min-height: 202px;
  border: 2px solid var(--game-line);
  border-radius: var(--game-card-radius);
  box-shadow: 0 5px 0 rgba(48, 57, 83, .1), 0 14px 25px rgba(48, 68, 83, .08);
}
.app-shell .market-item-thumb { min-height: 132px; }
.app-shell .market-card-art { transform: scale(1.8); }
.app-shell .market-item-copy { padding: 13px 15px 15px; gap: 4px; }
.app-shell .market-item-copy strong { font-size: 17px; }
.app-shell .market-item-price { color: #946719; font-size: 14px; }
.app-shell .marketplace-coin-tools summary { min-height: 44px; padding: 13px 4px 7px; font-size: 13px; }
.app-shell .marketplace-coin-tools p { max-width: 420px; font-size: 13px; }
.app-shell .marketplace-coin-tools label { font-size: 12px; }
.app-shell .marketplace-coin-tools input,
.app-shell .marketplace-coin-tools .button { min-height: 46px; font-size: 13px; }

.app-shell .market-detail { width: min(720px, calc(100vw - 30px)); max-height: min(680px, calc(100dvh - 34px)); grid-template-columns: 265px minmax(0, 1fr); border: 2px solid rgba(255, 255, 255, .9); border-radius: 28px; overscroll-behavior: contain; }
.app-shell .market-detail-preview { min-height: 330px; }
.app-shell .market-detail-art { transform: scale(2.8); }
.app-shell .market-detail-preview > span:last-child:not(.inventory-art) { font-size: 11px; }
.app-shell .market-detail-copy { padding: 34px 30px 28px; }
.app-shell .market-detail-copy h2 { font-size: clamp(31px, 4vw, 38px); }
.app-shell .market-detail-copy > p { margin-top: 15px; font-size: 15px; line-height: 1.55; }
.app-shell .market-trait-stats { gap: 9px; }
.app-shell .market-trait-stats span { min-height: 58px; padding: 10px 12px; border-radius: 13px; }
.app-shell .market-trait-stats small { font-size: 11px; }
.app-shell .market-trait-stats b { font-size: 17px; }
.app-shell .market-variant-list { gap: 8px; }
.app-shell .market-variant-choice { min-width: 78px; min-height: 72px; padding: 7px; border-radius: 14px; }
.app-shell .market-variant-choice > span { width: 36px; height: 36px; }
.app-shell .market-variant-choice strong { font-size: 11px; }
.app-shell .market-variant-choice small { font-size: 10px; }
.app-shell .market-detail-buy { min-height: 82px; gap: 16px; }
.app-shell .market-detail-buy small,
.app-shell .market-detail-buy span { font-size: 11px; }
.app-shell .market-detail-buy strong { font-size: 22px; }
.app-shell .market-buy-button { min-width: 155px; border-radius: 15px; font-size: 15px; }

.app-shell .marketplace-token-head { min-height: 82px; padding: 15px 18px; border-radius: 19px; }
.app-shell .marketplace-token-head strong { font-size: 22px; }
.app-shell .marketplace-token-head span,
.app-shell .marketplace-token-head small { font-size: 12px; }
.app-shell .marketplace-spend-card { min-height: 168px; padding: 18px; border: 2px solid var(--game-line); border-radius: 22px; }
.app-shell .marketplace-spend-card small { font-size: 11px; }
.app-shell .marketplace-spend-card h3 { font-size: 24px; }
.app-shell .marketplace-spend-card p { font-size: 13px; }
.app-shell .marketplace-spend-card > strong { font-size: 15px; }
.app-shell .marketplace-spend-card > .button { min-height: 48px; border-radius: 14px; font-size: 13px; }
.app-shell .marketplace-section-title { min-height: 48px; }
.app-shell .marketplace-section-title h2 { font-size: 28px; }
.app-shell .marketplace-section-title span { font-size: 12px; }
.app-shell .shop-pack-amount span,
.app-shell .shop-pack-perks span { font-size: 12px; }
.app-shell .shop-pack > .button,
.app-shell .shop-mega-action > .button { min-height: 48px; font-size: 13px; }
.app-shell .shop-nanny-copy p { font-size: 13px; }
.app-shell .shop-nanny-option { min-height: 70px; }
.app-shell .shop-nanny-option > span,
.app-shell .shop-nanny-option small { font-size: 11px; }
.app-shell .shop-price-option { min-height: 84px; padding: 12px 14px; border-radius: 14px; }
.app-shell .shop-price-option > span { font-size: 12px; }
.app-shell .shop-price-option strong { font-size: 21px; }
.app-shell .shop-price-option small { font-size: 12px; }
.app-shell .shop-mega-items span { min-height: 32px; font-size: 12px; }

/* Collection, Inventory, Send, and Settings */
.app-shell .chumkins-tabs { width: min(620px, 100%); padding: 6px; gap: 6px; border: 2px solid var(--game-line); border-radius: 20px; }
.app-shell .chumkins-tabs button { min-height: 52px; padding: 10px 14px; border-radius: 14px; font-size: 14px; }
.app-shell .chumkins-tabs button b { min-width: 26px; height: 26px; font-size: 11px; }
.app-shell .chumkins-tab-intro h2 { font-size: 34px; }
.app-shell .chumkins-tab-intro p { font-size: 14px; }
.app-shell .chumkins-tab-intro > span { font-size: 12px; }
.app-shell .owned-chumkin-list { display: grid; gap: 14px; border: 0; }
.app-shell .owned-chumkin-row {
  min-height: 180px;
  padding: 16px 18px;
  grid-template-columns: 158px minmax(0, 1fr) minmax(150px, auto);
  gap: 20px;
  border: 2px solid var(--game-line);
  border-radius: var(--game-card-radius);
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 5px 0 rgba(48, 57, 83, .08);
}
.app-shell .owned-chumkin-state { font-size: 11px; }
.app-shell .owned-chumkin-copy h2 { font-size: 31px; }
.app-shell .owned-chumkin-copy > p { font-size: 13px; }
.app-shell .owned-chumkin-location { grid-template-columns: 11px minmax(0, 1fr); gap: 10px; }
.app-shell .owned-chumkin-location > i { width: 10px; height: 10px; }
.app-shell .owned-chumkin-location strong { font-size: 14px; }
.app-shell .owned-chumkin-location small { font-size: 12px; }
.app-shell .owned-chumkin-action .button { min-height: 48px; font-size: 14px; }
.app-shell .collection-empty strong { font-size: 23px; }
.app-shell .collection-empty p { font-size: 14px; }

.app-shell .inventory-owned-page { max-width: 1180px; gap: 18px; }
.app-shell .inventory-page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-shell .inventory-page-toolbar .owned-category-tabs { flex: 1; padding: 2px 1px 5px; }
.app-shell .inventory-room-button { min-width: 142px; min-height: 48px; margin: 0; border-radius: 14px; font-size: 14px; }
.app-shell .owned-item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.app-shell .owned-item-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 244px;
  padding: 12px;
  grid-template-rows: minmax(132px, 1fr) auto auto;
  justify-items: stretch;
  gap: 9px;
  overflow: hidden;
  border: 2px solid var(--game-line);
  border-radius: 22px;
  color: #31485b;
  background: linear-gradient(155deg, #fffefb, #eaf8f5);
  box-shadow: 0 5px 0 rgba(48, 57, 83, .12), 0 12px 24px rgba(48, 68, 83, .08);
  text-align: left;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.app-shell .owned-item-card:hover { border-color: #4ba994; transform: translateY(-2px); }
.app-shell .owned-item-card:active { box-shadow: 0 2px 0 rgba(48, 57, 83, .18); transform: translateY(3px); }
.app-shell .owned-item-card.selected { border-color: #594bc9; box-shadow: 0 5px 0 rgba(69, 57, 151, .28), 0 0 0 4px rgba(89, 75, 201, .1); }
.app-shell .owned-item-card-visual {
  position: relative;
  display: grid;
  min-height: 132px;
  place-items: center;
  border-radius: 17px;
  background: radial-gradient(circle at 50% 36%, white, #eaf4ff 70%, #e5f2ee);
}
.app-shell .owned-item-card-art { width: 108px; height: 108px; }
.app-shell .owned-item-card-copy { display: grid; min-width: 0; gap: 2px; }
.app-shell .owned-item-card-copy strong,
.app-shell .owned-item-card-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-shell .owned-item-card-copy strong { color: #293e53; font-size: 18px; font-weight: 1000; }
.app-shell .owned-item-card-copy span { color: #6f818d; font-size: 13px; font-weight: 800; }
.app-shell .owned-item-state {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 9px;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  color: #2f6b62;
  background: #ddf4ed;
  font-size: 12px;
  font-weight: 950;
}
.app-shell .owned-item-state i { color: #278f7b; font-size: 14px; font-style: normal; }
.app-shell .owned-item-reward { top: 7px; right: 7px; }
.app-shell .owned-item-grid > .inventory-empty { grid-column: 1 / -1; }
.app-shell .inventory-empty { min-height: 190px; gap: 12px; font-size: 14px; }
.app-shell .inventory-empty strong { font-size: 24px; }

.app-shell .owned-item-detail-layer { position: fixed; z-index: 90; inset: 0; display: grid; padding: 20px; place-items: center; }
.app-shell .owned-item-detail-scrim { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(31, 38, 58, .52); backdrop-filter: blur(4px); }
.app-shell .owned-item-detail {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(720px, calc(100vw - 30px));
  max-height: min(620px, calc(100dvh - 34px));
  grid-template-columns: 260px minmax(0, 1fr);
  overflow: auto;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 28px;
  color: var(--game-ink);
  background: #fffdf7;
  box-shadow: 0 28px 70px rgba(27, 34, 54, .32);
}
.app-shell .owned-item-detail-close { position: absolute; z-index: 3; top: 14px; right: 14px; }
.app-shell .owned-item-detail-preview {
  display: grid;
  min-height: 330px;
  padding: 28px;
  place-items: center;
  align-content: center;
  gap: 20px;
  background: radial-gradient(circle at 50% 38%, white, #dff2ff 62%, #dff3eb);
}
.app-shell .owned-item-detail-art { width: 170px; height: 170px; }
.app-shell .owned-item-detail-copy { display: grid; padding: 40px 30px 30px; align-content: center; gap: 13px; }
.app-shell .owned-item-detail-variant { color: #337f71; font-size: 14px; font-weight: 950; }
.app-shell .owned-item-detail-copy h2 { margin: 0; color: #26384f; font-size: clamp(31px, 4vw, 39px); line-height: 1; }
.app-shell .owned-item-detail-note { margin: 2px 0; padding: 12px 14px; border-radius: 14px; color: #725312; background: #fff2c8; font-size: 13px; font-weight: 850; line-height: 1.4; }
.app-shell .owned-item-detail-actions { display: flex; margin-top: 5px; flex-wrap: wrap; gap: 10px; }
.app-shell .owned-item-detail-actions .button { min-height: 48px; margin: 0; padding: 10px 15px; border-radius: 14px; font-size: 14px; }
.app-shell .owned-item-detail-actions .inventory-attach-form { display: flex; width: 100%; gap: 8px; }
.app-shell .owned-item-detail-actions .inventory-attach-form select { flex: 1; min-width: 0; min-height: 48px; border: 2px solid var(--game-line); border-radius: 13px; color: #3d5268; background: white; font-size: 14px; }

.app-shell .send-form label { font-size: 14px; }
.app-shell .send-selected-preview small { font-size: 11px; }
.app-shell .send-selected-preview strong { font-size: 27px; }
.app-shell .send-selected-preview em { font-size: 13px; }
.app-shell .send-consequence strong { font-size: 14px; }
.app-shell .send-consequence span,
.app-shell .send-empty span { font-size: 13px; }

.app-shell .room-settings { max-width: 820px; gap: 18px; }
.app-shell .room-settings > section { padding: 20px; border: 2px solid var(--game-line); border-radius: 20px; background: rgba(255, 255, 255, .66); }
.app-shell .settings-switch-row strong { font-size: 19px; }
.app-shell .settings-switch-row small { margin-top: 3px; font-size: 13px; }
.app-shell .toggle-switch { width: 64px; height: 44px; }
.app-shell .toggle-switch span::after { width: 38px; height: 38px; }
.app-shell .toggle-switch input:checked + span::after { transform: translateX(20px); }
.app-shell .toggle-switch input:focus-visible + span { outline: 3px solid #22bca0; outline-offset: 3px; }
.app-shell .settings-mode-picker { gap: 10px; }
.app-shell .settings-mode-picker legend { font-size: 12px; }
.app-shell .settings-mode-picker span { min-height: 84px; padding: 14px; border: 2px solid var(--game-line); border-radius: 16px; }
.app-shell .settings-mode-picker b { font-size: 16px; }
.app-shell .settings-mode-picker small { font-size: 12px; }
.app-shell .settings-mode-fields label { font-size: 12px; }
.app-shell .settings-mode-fields input { min-height: 48px; font-size: 16px; }
.app-shell .settings-mode-fields .button,
.app-shell .room-settings > .button { min-height: 48px; font-size: 14px; }
.app-shell .settings-status { font-size: 12px; }
.app-shell .sound-reaction-settings { gap: 16px; background: linear-gradient(145deg, #fff9e8, #e9faf6 62%, #eef1ff); }
.app-shell .sound-source-picker {
  display: grid;
  padding: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border: 0;
}
.app-shell .sound-source-picker legend { margin-bottom: 8px; color: #66798b; font-size: 12px; font-weight: 900; }
.app-shell .sound-source-picker label { position: relative; }
.app-shell .sound-source-picker input { position: absolute; opacity: 0; }
.app-shell .sound-source-picker span {
  display: grid;
  min-height: 78px;
  padding: 14px 15px;
  align-content: center;
  gap: 4px;
  border: 2px solid var(--game-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .8);
  cursor: pointer;
}
.app-shell .sound-source-picker b { color: #30465b; font-size: 16px; }
.app-shell .sound-source-picker small { color: #6c7f8d; font-size: 12px; line-height: 1.35; }
.app-shell .sound-source-picker input:checked + span { border-color: #168d77; background: #e8faf5; box-shadow: inset 0 0 0 1px #168d77; }
.app-shell .sound-source-picker input:focus-visible + span { outline: 3px solid #22bca0; outline-offset: 3px; }
.app-shell .sound-source-picker input:disabled + span { opacity: .5; cursor: not-allowed; }
.app-shell .sound-sensitivity { display: grid; gap: 8px; }
.app-shell .sound-sensitivity > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-shell .sound-sensitivity b { color: #344b5d; font-size: 14px; }
.app-shell .sound-sensitivity small { color: #7059b8; font-size: 12px; font-weight: 900; }
.app-shell .sound-sensitivity input { width: 100%; min-height: 44px; accent-color: #168d77; }
.app-shell .sound-listen-row { display: grid; grid-template-columns: minmax(170px, auto) minmax(120px, 1fr); align-items: center; gap: 14px; }
.app-shell .sound-listen-row .button { margin: 0; }
.app-shell .sound-listen-row:has(.button[hidden]) { grid-template-columns: 1fr; }
.app-shell .sound-meter-wrap { display: grid; gap: 5px; }
.app-shell .sound-meter-wrap > small { color: #66798a; font-size: 11px; font-weight: 850; }
.app-shell .sound-input-meter { height: 18px; overflow: hidden; border: 2px solid rgba(48, 57, 83, .16); border-radius: 99px; background: rgba(255, 255, 255, .8); }
.app-shell .sound-input-meter i { display: block; width: calc(var(--audio-level, 0) * 100%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, #35b79c, #6b67d8 64%, #d84f7e); transition: width 70ms linear; }
.app-shell .sound-input-status { min-height: 20px; }
.app-shell .sound-input-status[data-kind="error"] { color: #a7334b; }
.app-shell .sound-input-status[data-kind="listening"] { color: #126f5f; font-weight: 850; }
.app-shell .sound-privacy-note { color: #66798a; font-size: 12px; line-height: 1.5; }

/* Small utility and native companion controls */
.app-shell .toast { font-size: 14px; }
.desktop-companion-menu-toggle { width: 48px; height: 48px; border-radius: 15px; font-size: 22px; }
.desktop-companion-menu-panel { width: 190px; padding: 9px; gap: 7px; border-radius: 18px; }
.desktop-companion-menu-panel button,
.desktop-companion-menu-panel a { min-height: 46px; padding: 10px 12px; border-radius: 12px; font-size: 13px; }

html[data-native-client="android"] .app-shell .android-app-action { min-height: 56px; padding: 12px 13px; border-radius: 14px; }
html[data-native-client="android"] .app-shell .android-app-action span { font-size: 14px; }
html[data-native-client="android"] .app-shell .android-app-action small { font-size: 12px; }
html[data-native-client="android"] .app-shell .character-actions { grid-template-columns: 1fr; }

.inventory-drawer-open .app-shell .character-sheet {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 1280px) {
  body.care-panel-open .app-shell .world-supplies {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

/* Tablet and phone layouts */
@media (max-width: 800px) {
  .app-shell .topbar {
    min-height: 64px;
    height: 64px;
    padding: 7px 8px;
  }
  .app-shell .logo-button { min-height: 48px; font-size: 21px; }
  .app-shell .logo-button img { width: 43px; height: 31px; }
  .app-shell .account-pills { gap: 5px; }
  .app-shell .mini-pill,
  .app-shell .avatar-pill { min-height: 46px; height: 46px; }
  .app-shell .mini-pill { min-width: 54px; padding: 5px 9px; gap: 5px; }
  .app-shell .mini-pill-icon,
  .app-shell .mini-pill-copy { display: grid; }
  .app-shell .mini-pill-copy small { display: none; }
  .app-shell .mini-pill-copy b { font-size: 13px; }
  .app-shell .mini-pill-icon { font-size: 17px; }
  .app-shell .avatar-pill { width: 46px; min-width: 46px; }
  .app-shell .account-menu { top: 60px; right: 8px; width: min(350px, calc(100vw - 16px)); max-height: calc(100dvh - 68px - env(safe-area-inset-bottom)); }

  .app-shell .main-nav {
    top: 72px;
    width: calc(100vw - 12px);
    min-height: 62px;
    padding: 5px;
    gap: 2px;
    border-radius: 18px;
  }
  .app-shell .nav-button { min-height: 50px; padding: 5px 2px; gap: 2px; border-radius: 12px; font-size: 11px; letter-spacing: -.02em; }
  .app-shell .nav-icon,
  .app-shell .nav-icon svg { width: 21px; height: 21px; }
  .app-shell .nav-badge { top: 1px; right: 2px; min-width: 18px; height: 18px; font-size: 9px; }
  .app-shell .view:not(#home-view) { width: calc(100% - 16px); padding-top: 82px; }
  .app-shell .section-heading { min-height: 52px; margin-bottom: 16px; }
  .app-shell .section-heading h1 { font-size: clamp(32px, 10vw, 42px); }

  .app-shell .room-sidebar { top: 146px; left: 8px; width: min(276px, calc(100vw - 16px)); max-height: calc(100dvh - 158px - env(safe-area-inset-bottom)); }
  .app-shell .room-sidebar-panel-body { max-height: min(240px, 34dvh); }
  .app-shell .world-supplies { top: 146px; width: 172px; padding: 8px; }
  .app-shell .world-supplies-label { font-size: 10px; }
  .app-shell .supply-tool { min-height: 62px; }
  .app-shell .supply-tool small { font-size: 11px; }

  .app-shell .character-sheet { top: 146px; right: 8px; width: calc(100vw - 16px); max-height: calc(100dvh - 158px - env(safe-area-inset-bottom)); padding: 14px; }
  .app-shell .character-sheet-main { grid-template-columns: minmax(0, 1fr) 88px; }
  .app-shell .character-vital > i { width: 56px; height: 56px; }
  .app-shell .character-vital b { top: 20px; font-size: 14px; }

  .app-shell .room-inventory-drawer {
    top: auto;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    max-height: calc(100dvh - 154px - env(safe-area-inset-bottom));
    padding: 13px;
    border-radius: 24px;
  }
  .app-shell .inventory-drawer-categories { display: flex; grid-template-columns: none; overflow-x: auto; }
  .app-shell .inventory-drawer-categories button { min-width: 82px; min-height: 44px; margin: 0; padding: 7px 9px; }
  .app-shell .inventory-drawer-rack { min-height: 158px; }
  .app-shell .inventory-drawer-item { width: 132px; min-width: 132px; min-height: 146px; }
  .app-shell .inventory-drawer-art { width: 68px; height: 68px; }
  .app-shell .inventory-drawer-actions { width: 100%; max-width: none; }

  .app-shell .room-item-editor { top: auto; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); left: 8px; width: auto; max-height: calc(100dvh - 154px - env(safe-area-inset-bottom)); }

  .app-shell .market-category-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .app-shell .market-category-tabs button { min-width: 0; width: 100%; }
  .app-shell .market-item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .app-shell .market-item-card { min-height: 186px; }
  .app-shell .market-item-thumb { min-height: 116px; }
  .app-shell .market-card-art { transform: scale(1.58); }
  .app-shell .market-item-copy { padding: 11px 12px 13px; }
  .app-shell .market-item-copy strong { font-size: 15px; }
  .app-shell .market-item-price { font-size: 12px; }
  .app-shell .market-detail { width: 100%; max-height: min(90dvh, 780px); grid-template-columns: 1fr; border-radius: 26px 26px 0 0; }
  .app-shell .market-detail-preview { min-height: 190px; }
  .app-shell .market-detail-art { transform: scale(2.35); }
  .app-shell .market-detail-copy { padding: 24px 18px max(24px, calc(env(safe-area-inset-bottom) + 16px)); }
  .app-shell .market-detail-buy { position: sticky; bottom: calc(-1 * max(24px, calc(env(safe-area-inset-bottom) + 16px))); z-index: 2; padding-bottom: max(16px, env(safe-area-inset-bottom)); background: #f8fcfd; }

  .app-shell .marketplace-spend-grid { grid-template-columns: 1fr; }
  .app-shell .owned-chumkin-row { grid-template-columns: 116px minmax(0, 1fr); padding: 14px; gap: 12px; }
  .app-shell .owned-chumkin-action { grid-column: 1 / -1; }
  .app-shell .inventory-page-toolbar { align-items: stretch; flex-direction: column; }
  .app-shell .inventory-room-button { width: 100%; }
  .app-shell .owned-item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .app-shell .owned-item-card { min-height: 224px; }
  .app-shell .owned-item-card-art { width: 96px; height: 96px; }
  .app-shell .owned-item-detail-layer { padding: 0; place-items: end center; }
  .app-shell .owned-item-detail { width: 100%; max-height: min(90dvh, 760px); grid-template-columns: 1fr; border-radius: 26px 26px 0 0; }
  .app-shell .owned-item-detail-preview { min-height: 205px; padding: 22px; }
  .app-shell .owned-item-detail-art { width: 138px; height: 138px; }
  .app-shell .owned-item-detail-copy { padding: 24px 18px max(24px, calc(env(safe-area-inset-bottom) + 16px)); }
  .app-shell .owned-item-detail-actions > .button { flex: 1; }
  .app-shell .settings-mode-picker { grid-template-columns: 1fr; }
  .app-shell .sound-source-picker { grid-template-columns: 1fr; }
  .app-shell .sound-source-picker span { min-height: 70px; }

  body.room-sidebar-expanded .app-shell :is(.world-supplies, .boombox),
  body.care-panel-open .app-shell :is(.room-sidebar, .world-supplies, .boombox) {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 460px) {
  .app-shell .logo-button span { display: none; }
  .app-shell .logo-button img { width: 45px; height: 33px; }
  .app-shell .mini-pill { min-width: 48px; padding-inline: 7px; }
  .app-shell .nav-button { font-size: 10px; }
  .app-shell .nav-icon,
  .app-shell .nav-icon svg { width: 20px; height: 20px; }
  .app-shell .shop-heading { align-items: flex-start; flex-direction: column; }
  .app-shell .marketplace-currency-tabs button { min-height: 64px; padding: 8px 9px; }
  .app-shell .marketplace-currency-tabs button strong { font-size: 14px; }
  .app-shell .marketplace-currency-tabs button small { font-size: 11px; }
  .app-shell .market-item-card { min-height: 176px; }
  .app-shell .market-item-thumb { min-height: 108px; }
  .app-shell .market-item-copy strong { font-size: 14px; }
  .app-shell .market-item-price { font-size: 11px; }
  .app-shell .market-detail-buy { align-items: stretch; flex-direction: column; }
  .app-shell .market-buy-button { width: 100%; }
  .app-shell .character-sheet-heading strong { font-size: 27px; }
  .app-shell .character-sheet-main { min-height: 160px; grid-template-columns: minmax(0, 1fr) 78px; }
  .app-shell .character-portrait { min-height: 160px; }
  .app-shell .character-portrait .chumkin-still { height: 148px; }
  .app-shell .character-vital > i { width: 49px; height: 49px; }
  .app-shell .character-vital b { top: 17px; font-size: 13px; }
  .app-shell .character-vital small { font-size: 10px; }
  .app-shell .character-traits { grid-template-columns: repeat(2, 1fr); }
  .app-shell .inventory-drawer-heading > strong { font-size: 23px; }
  .app-shell .inventory-drawer-heading .inventory-view-all { min-width: 82px; padding-inline: 9px; }
  .app-shell .inventory-drawer-categories { display: flex; grid-template-columns: none; }
  .app-shell .owned-item-card { min-height: 212px; padding: 9px; grid-template-rows: minmax(114px, 1fr) auto auto; gap: 7px; border-radius: 18px; }
  .app-shell .owned-item-card-visual { min-height: 114px; border-radius: 14px; }
  .app-shell .owned-item-card-art { width: 86px; height: 86px; }
  .app-shell .owned-item-card-copy strong { font-size: 16px; }
  .app-shell .owned-item-card-copy span { font-size: 12px; }
  .app-shell .owned-item-state { min-height: 28px; padding: 4px 7px; font-size: 11px; }
  .app-shell .owned-item-detail-preview { min-height: 180px; }
  .app-shell .owned-item-detail-art { width: 120px; height: 120px; }
  .app-shell .owned-item-detail-copy h2 { font-size: 31px; }
  .app-shell .owned-item-detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell .owned-item-detail-actions .inventory-attach-form { grid-column: 1 / -1; }
  .app-shell .owned-item-detail-actions .button { width: 100%; }
  .app-shell .chumkins-tabs button { padding-inline: 5px; font-size: 12px; }
  .app-shell .chumkins-tab-intro { align-items: flex-start; flex-direction: column; }
  .app-shell .owned-chumkin-row { grid-template-columns: 94px minmax(0, 1fr); }
  .app-shell .owned-chumkin-copy h2 { font-size: 24px; }
  .app-shell .owned-chumkin-copy > p { font-size: 11px; }
  body:not(.room-sidebar-expanded) .app-shell .room-sidebar {
    top: 138px;
    width: calc(100vw - 16px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .app-shell .world-supplies { top: 260px; }
  .app-shell .shop-mega-items span { min-height: 28px; font-size: 11px; }
  .app-shell .boombox,
  .world-active .app-shell .boombox { width: 144px; height: 326px; padding: 8px; }
  .app-shell .boombox-screen { height: 50px; }
  .app-shell :is(.boombox-power, .boombox-skip, .boombox-sfx) { min-height: 44px; height: 44px; }
  .app-shell .boombox-listen { min-height: 44px; }
  .app-shell .sound-listen-row { grid-template-columns: 1fr; }
}

html[data-native-client="android"]:not([data-android-overlay="true"]) .app-shell .topbar {
  min-height: calc(64px + env(safe-area-inset-top));
  height: calc(64px + env(safe-area-inset-top));
  padding-top: max(7px, env(safe-area-inset-top));
}
html[data-native-client="android"]:not([data-android-overlay="true"]) .app-shell .account-menu {
  top: calc(68px + env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  max-height: calc(100dvh - 76px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
html[data-native-client="android"]:not([data-android-overlay="true"]) .app-shell :is(.mini-pill, .avatar-pill) {
  min-height: 48px;
  height: 48px;
}
html[data-native-client="android"]:not([data-android-overlay="true"]) .app-shell .main-nav { top: calc(72px + env(safe-area-inset-top)); }
html[data-native-client="android"]:not([data-android-overlay="true"]) .app-shell .room-sidebar,
html[data-native-client="android"]:not([data-android-overlay="true"]) .app-shell .character-sheet {
  top: calc(146px + env(safe-area-inset-top));
  max-height: calc(100dvh - 158px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
html[data-native-client="android"]:not([data-android-overlay="true"]) .app-shell .world-supplies { top: calc(146px + env(safe-area-inset-top)); }
html[data-native-client="android"]:not([data-android-overlay="true"]) .app-shell .room-inventory-drawer,
html[data-native-client="android"]:not([data-android-overlay="true"]) .app-shell .room-item-editor { max-height: calc(100dvh - 162px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }

@media (prefers-reduced-motion: reduce) {
  .app-shell .button,
  .app-shell .market-item-card,
  .app-shell .owned-item-card,
  .app-shell .room-inventory-drawer { transition: none; animation: none; }
}

/* First-run Hatchery and final production states. */
.app-shell .avatar-pill {
  color: white;
  background: linear-gradient(145deg, #725de2, #3c86ba 62%, #20a78b);
  text-shadow: 0 2px 0 rgba(38, 45, 81, .35);
}

.app-shell .hatch-heading > span {
  display: inline-flex;
  min-height: 36px;
  padding: 8px 12px;
  align-items: center;
  border: 1px solid rgba(101, 88, 223, .18);
  border-radius: 999px;
  color: #584cae;
  background: #f0edff;
  font-size: 13px;
  font-weight: 950;
}

.app-shell .welcome-hatchery {
  display: grid;
  max-width: 1180px;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .7fr);
  align-items: stretch;
  gap: 20px;
}

.app-shell .hatchery-main-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 560px;
  padding: clamp(24px, 4vw, 48px);
  overflow: hidden;
  border: 2px solid rgba(48, 57, 83, .2);
  border-radius: 34px;
  background:
    radial-gradient(circle at 82% 14%, rgba(255, 239, 155, .68), transparent 29%),
    radial-gradient(circle at 10% 90%, rgba(95, 215, 184, .3), transparent 33%),
    linear-gradient(145deg, #fffdf6 0%, #eff8ff 54%, #f0ebff 100%);
  box-shadow: 0 7px 0 rgba(48, 57, 83, .12), 0 22px 54px rgba(48, 68, 93, .16);
}

.app-shell .hatchery-copy { position: relative; z-index: 2; max-width: 690px; }
.app-shell .hatchery-kicker {
  color: #168b75;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.app-shell .hatchery-copy h2,
.app-shell .hatchery-complete h2 {
  max-width: 720px;
  margin: 10px 0 0;
  color: #27354e;
  font-size: clamp(38px, 5vw, 62px);
  font-weight: 1000;
  letter-spacing: -.06em;
  line-height: .92;
}
.app-shell .hatchery-copy p,
.app-shell .hatchery-complete p {
  max-width: 650px;
  margin: 20px 0 0;
  color: #5e7181;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.55;
}

.app-shell .hatchery-egg-stage {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 230px;
  margin: 18px 0 6px;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 3vw, 36px);
}
.app-shell .hatchery-egg-stage::after {
  content: "";
  position: absolute;
  right: 8%;
  bottom: 19px;
  left: 8%;
  height: 24px;
  border-radius: 50%;
  background: rgba(62, 75, 105, .1);
  filter: blur(12px);
}
.app-shell .hatchery-egg {
  position: relative;
  z-index: 1;
  display: grid;
  width: 104px;
  height: 138px;
  place-items: center;
  transform-origin: 50% 100%;
  animation: hatchery-egg-float 2.8s ease-in-out infinite;
}
.app-shell .hatchery-egg .chumkin-egg-art { position: relative; transform: scale(1.55); }
.app-shell .hatchery-egg.egg-1 { transform: rotate(-7deg); animation-delay: -.8s; }
.app-shell .hatchery-egg.egg-2 { transform: translateY(-10px); animation-delay: -1.6s; }
.app-shell .hatchery-egg.egg-3 { transform: rotate(7deg); animation-delay: -2.2s; }
@keyframes hatchery-egg-float { 50% { translate: 0 -7px; } }
.app-shell .hatchery-extra-eggs { position: relative; z-index: 2; color: #594ca8; font-size: 24px; }

.app-shell .hatchery-action {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 86px;
  padding-top: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 2px solid rgba(48, 57, 83, .1);
}
.app-shell .hatchery-action > div { display: grid; gap: 3px; }
.app-shell .hatchery-action strong { color: #354760; font-size: 18px; }
.app-shell .hatchery-action span { color: #6c7c8b; font-size: 13px; }
.app-shell .hatch-free-button { min-width: 220px; min-height: 58px; font-size: 16px; }

.app-shell .hatchery-guide {
  display: grid;
  min-width: 0;
  padding: 28px;
  align-content: start;
  gap: 20px;
  border: 2px solid rgba(48, 57, 83, .17);
  border-radius: 30px;
  background: #fffdf7;
  box-shadow: 0 6px 0 rgba(48, 57, 83, .1), 0 18px 40px rgba(48, 68, 93, .11);
}
.app-shell .hatchery-guide ol { display: grid; margin: 0; padding: 0; gap: 10px; list-style: none; }
.app-shell .hatchery-guide li {
  display: grid;
  min-width: 0;
  padding: 14px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  border: 1px solid rgba(48, 57, 83, .12);
  border-radius: 16px;
  background: #f4f9f7;
}
.app-shell .hatchery-guide li > b {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: linear-gradient(145deg, #6558df, #2d9b87);
  font-size: 14px;
}
.app-shell .hatchery-guide li > span { display: grid; min-width: 0; gap: 4px; }
.app-shell .hatchery-guide strong { color: #34485c; font-size: 14px; line-height: 1.2; }
.app-shell .hatchery-guide small { color: #70818d; font-size: 12px; font-weight: 750; line-height: 1.4; }

.app-shell .hatchery-complete {
  display: grid;
  min-height: 450px;
  max-width: 900px;
  padding: clamp(32px, 6vw, 70px);
  place-content: center;
  justify-items: start;
  border: 2px solid rgba(48, 57, 83, .18);
  border-radius: 34px;
  background: linear-gradient(145deg, #fffdf5, #eaf9f5 62%, #eeefff);
  box-shadow: 0 7px 0 rgba(48, 57, 83, .11), 0 22px 54px rgba(48, 68, 93, .14);
}
.app-shell .hatchery-complete-mark { display: grid; width: 62px; height: 62px; margin-bottom: 22px; place-items: center; border-radius: 21px; color: white; background: #20ad8f; font-size: 30px; box-shadow: 0 5px 0 #176e64; }
.app-shell .hatchery-complete-actions { display: flex; margin-top: 28px; flex-wrap: wrap; gap: 12px; }

.app-shell .marketplace-welcome-eggs {
  display: grid;
  min-height: 142px;
  padding: 18px 22px;
  grid-template-columns: 184px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border: 2px solid rgba(41, 164, 137, .35);
  border-radius: 25px;
  background: linear-gradient(125deg, #edfff8, #f4f2ff 70%, #fff8dd);
  box-shadow: 0 5px 0 rgba(48, 57, 83, .08);
}
.app-shell .marketplace-welcome-art { display: flex; min-height: 96px; align-items: center; justify-content: center; gap: 0; }
.app-shell .marketplace-welcome-art .hatchery-egg { width: 58px; height: 90px; animation: none; transform: none; }
.app-shell .marketplace-welcome-art .hatchery-egg .chumkin-egg-art { transform: scale(.86); }
.app-shell .marketplace-welcome-eggs > div:nth-child(2) { display: grid; gap: 3px; }
.app-shell .marketplace-welcome-eggs span { color: #168b75; font-size: 11px; font-weight: 1000; letter-spacing: .11em; text-transform: uppercase; }
.app-shell .marketplace-welcome-eggs strong { color: #2e4057; font-size: 25px; letter-spacing: -.03em; }
.app-shell .marketplace-welcome-eggs p { margin: 0; color: #687b89; font-size: 13px; }
.app-shell .marketplace-welcome-eggs > .button { min-width: 160px; margin: 0; }

.app-load-error {
  position: fixed;
  z-index: 220;
  inset: 0;
  display: grid;
  padding: 24px;
  place-content: center;
  justify-items: center;
  color: #2d3b52;
  text-align: center;
  background: rgba(235, 246, 247, .96);
}
.app-load-error[hidden] { display: none; }
.app-load-error-art { display: grid; width: 76px; height: 76px; place-items: center; border: 3px solid #303953; border-radius: 25px; color: white; background: linear-gradient(145deg, #e25a71, #7357ca); font-size: 39px; font-weight: 1000; box-shadow: 0 6px 0 #303953; }
.app-load-error h2 { max-width: 560px; margin: 28px 0 0; font-size: clamp(34px, 6vw, 58px); line-height: .95; letter-spacing: -.05em; }
.app-load-error p { max-width: 520px; margin: 16px 0 24px; color: #617284; font-size: 16px; line-height: 1.5; }

.hatch-reveal {
  position: absolute;
  z-index: 8;
  top: calc(var(--event-ground) - 210px);
  left: var(--event-x);
  display: grid;
  width: min(330px, calc(100vw - 28px));
  padding: 17px 22px;
  justify-items: center;
  border: 2px solid rgba(48, 57, 83, .22);
  border-radius: 23px;
  opacity: 0;
  color: #28364f;
  text-align: center;
  background: rgba(255, 253, 246, .96);
  box-shadow: 0 6px 0 rgba(48, 57, 83, .14), 0 20px 42px rgba(40, 59, 81, .2);
  transform: translate(-50%, 12px) scale(.96);
  transition: opacity .28s ease, transform .28s ease;
}
.hatch-reveal span { color: #168b75; font-size: 11px; font-weight: 1000; letter-spacing: .14em; text-transform: uppercase; }
.hatch-reveal strong { margin-top: 2px; font-size: 34px; letter-spacing: -.05em; line-height: 1; }
.hatch-reveal small { margin-top: 6px; color: #687b89; font-size: 12px; font-weight: 800; }
.hatch-sequence.settled .hatch-reveal { opacity: 1; transform: translate(-50%, 0) scale(1); }

@media (max-width: 820px) {
  body.welcome-eggs-ready .app-shell .main-nav .nav-button[data-view="shop"] { display: none; }
  .app-shell .welcome-hatchery { grid-template-columns: 1fr; }
  .app-shell .hatchery-main-card { min-height: 0; }
  .app-shell .hatchery-guide { padding: 20px; }
  .app-shell .hatchery-guide ol { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-shell .hatchery-guide li { grid-template-columns: 1fr; }
  .app-shell .marketplace-welcome-eggs { grid-template-columns: 140px minmax(0, 1fr); }
  .app-shell .marketplace-welcome-eggs > .button { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 560px) {
  .app-shell .hatch-heading { min-height: 46px; margin-bottom: 10px; align-items: center; flex-direction: row; }
  .app-shell .hatch-heading h1 { font-size: clamp(31px, 9vw, 38px); }
  .app-shell .hatch-heading > span { min-height: 32px; padding: 6px 9px; font-size: 11px; }
  .app-shell .hatchery-main-card { padding: 18px 17px; border-radius: 25px; }
  .app-shell .hatchery-copy h2,
  .app-shell .hatchery-complete h2 { font-size: clamp(32px, 10vw, 41px); }
  .app-shell .hatchery-copy p,
  .app-shell .hatchery-complete p { margin-top: 13px; font-size: 13px; }
  .app-shell .hatchery-egg-stage { min-height: 148px; margin: 7px 0 2px; gap: 0; }
  .app-shell .hatchery-egg { width: 76px; height: 101px; transform: scale(.76); }
  .app-shell .hatchery-egg.egg-1 { transform: scale(.76) rotate(-7deg); }
  .app-shell .hatchery-egg.egg-2 { transform: scale(.76) translateY(-7px); }
  .app-shell .hatchery-egg.egg-3 { transform: scale(.76) rotate(7deg); }
  .app-shell .hatchery-action { min-height: 0; padding-top: 12px; align-items: stretch; flex-direction: column; gap: 10px; }
  .app-shell .hatchery-action strong { font-size: 16px; }
  .app-shell .hatchery-action span { font-size: 12px; }
  .app-shell .hatch-free-button { width: 100%; min-width: 0; }
  .app-shell .hatchery-guide { border-radius: 24px; }
  .app-shell .hatchery-guide ol { grid-template-columns: 1fr; }
  .app-shell .hatchery-guide li { grid-template-columns: 34px minmax(0, 1fr); }
  .app-shell .hatchery-complete { min-height: 380px; padding: 32px 20px; border-radius: 25px; }
  .app-shell .hatchery-complete-actions { width: 100%; }
  .app-shell .hatchery-complete-actions .button { width: 100%; }
  .app-shell .marketplace-welcome-eggs { padding: 16px; grid-template-columns: 1fr; text-align: center; }
  .app-shell .marketplace-welcome-art { display: none; }
  .app-shell .marketplace-welcome-eggs strong { font-size: 22px; }
  .hatch-reveal { top: calc(var(--event-ground) - 190px); padding: 14px 18px; }
  .hatch-reveal strong { font-size: 29px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell .hatchery-egg { animation: none; }
  .hatch-reveal { transition: none; }
}
