/* The game is one viewport. Only an explicitly opened panel may scroll. */
html, body {
  width: 100%; height: 100%; min-width: 0;
  margin: 0; overflow: hidden; overscroll-behavior: none;
}
body { position: fixed; inset: 0; }
.app-shell {
  width: min(100%, 1100px); max-width: none; height: 100%;
  height: 100dvh; min-height: 0; margin: 0 auto;
  padding: env(safe-area-inset-top) 24px 0;
  display: flex; flex-direction: column; position: relative;
  overflow: hidden;
}
.masthead { height: 66px; min-height: 66px; flex: 0 0 auto; }
.brand { font-size: 22px; gap: 10px; }
.brand-mark { width: 30px; height: 37px; font-size: 22px; line-height: 36px; }
.brand small { font-size: 7px; letter-spacing: 2px; }
.edition { font-size: 12px; }
.icon-button { width: 44px; height: 44px; border: 0; }
main {
  flex: 1; width: 100%; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 0; padding: 0;
}
.story-pane {
  flex: 0 0 auto; width: 100%; padding: 10px 0 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.day-heading { margin: 0; display: flex; gap: 12px; align-items: center; }
.day-heading > span { font-size: 44px; letter-spacing: -2px; }
.day-heading div > span { font-size: 9px; letter-spacing: 2px; }
h1 { font-size: 21px; margin: 0; }
.timeline { gap: 7px; margin: 0; padding: 0; align-self: center; }
.timeline span { width: 16px; }
.story-pane .eyebrow, .story-pane .story, .story-pane .weather,
.story-pane .community, .story-pane .story-foot { display: none; }
.shelter-pane {
  width: 100%; flex: 1; min-height: 0; position: relative;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 0; overflow: hidden;
}
.resources { min-height: 0; background: #26352d80; }
.resource { padding: 7px 4px; }
.resource-name { font-size: 10px; }
.resource-value { font-size: 23px; }
.resource small { font-size: 10px; }
.scene-head { margin: 10px 0 0; min-height: 18px; font-size: 11px; }
.scene-head > span { font-size: 10px; }
.scene-wrap {
  min-width: 0; min-height: 0; margin: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#house {
  display: block; width: 100%; height: 100%; min-height: 0;
  overflow: hidden; touch-action: manipulation;
}
.city { inset: 10% 8% 6%; }
.scene-caption {
  position: absolute; bottom: 5px; left: 0; right: 0; margin: 0;
  font-size: 9px; pointer-events: none;
}
.warning {
  padding: 9px 12px; gap: 10px; min-width: 0; cursor: pointer;
  border-right: 1px solid #b9954d15; touch-action: manipulation;
}
.warning strong { font-size: 10px; }
.warning p { margin-top: 1px; font-size: 11px; line-height: 1.6; }
.warning > div { min-width: 0; }
.day-end { margin: 0; padding: 10px 0; min-height: 64px; flex-wrap: nowrap; }
.day-end > div { font-size: 11px; }
.day-end small { font-size: 10px; }
.day-end .primary { min-height: 44px; padding: 10px 22px; flex: 0 0 auto; }
.game-dock {
  flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid #c3b38630; background: #182621;
  padding: 5px 0 calc(6px + env(safe-area-inset-bottom));
}
.game-dock button {
  display: flex; flex-direction: column; gap: 2px; align-items: center;
  justify-content: center; min-height: 55px; padding: 3px 5px;
  border: 0; border-right: 1px solid #ffffff0a; color: #ccceb9; font-size: 11px;
}
.game-dock button:last-child { border-right: 0; }
.game-dock button > span { font: 23px/1.1 Georgia; color: var(--gold); }
.game-dock button:hover { color: #f5dfb8; }
.selection {
  grid-row: 4 / 6; margin: 0 0 8px; padding: 10px 12px;
  background: #2a3b30; border: 1px solid #b7a16a; z-index: 3;
}
.selection .selection-copy { font-size: 11px; line-height: 1.65; margin: 5px 0; }
.selection .selection-controls { display: flex; gap: 7px; justify-content: flex-end; }
.selection button { margin: 0; padding: 7px 13px; min-height: 44px; }
.selection h3 { font-size: 13px; }
.placing .warning, .placing .day-end { display: none; }
.placing .game-dock { opacity: .55; }
.game-drawer {
  width: min(560px, 100vw); max-width: 100vw;
  max-height: calc(100dvh - 80px); height: min(620px, 78dvh);
  padding: 0; margin: auto auto 0;
  border: 1px solid #80927b70; border-bottom: 0;
  border-radius: 15px 15px 0 0; overflow: hidden;
  overscroll-behavior: contain;
}
.game-drawer::backdrop { background: #07130fb8; backdrop-filter: blur(3px); }
.game-drawer[open] { display: flex; animation: panel-in .18s ease-out; }
.game-drawer .control-pane {
  padding: 0; border: 0; width: 100%; min-height: 0;
  display: flex; flex-direction: column; max-height: calc(100dvh - 80px);
}
.drawer-heading {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 16px 20px 6px; flex: 0 0 auto;
}
.drawer-heading > div:last-child { display: flex; align-items: center; gap: 8px; }
.drawer-heading .dialog-eyebrow { margin: 0 0 3px; font-size: 9px; }
.drawer-heading h2 { font: 21px var(--serif); }
#budget { font-size: 12px; color: var(--gold); }
.game-drawer .tabs {
  flex: 0 0 auto; display: flex; justify-content: space-between;
  margin: 0 20px; padding: 0; gap: 14px;
}
.game-drawer .tabs button { flex: 1; min-height: 44px; font-size: 12px; }
.drawer-scroll {
  min-height: 0; overflow: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
}
.game-drawer .shop-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.game-drawer .shop-card { min-height: 122px; padding: 8px; }
.game-drawer .shop-card svg { height: 58px; }
.game-drawer .shop-card strong { font-size: 11px; }
.game-drawer .shop-card small { font-size: 9px; }
.game-drawer .action-card { min-height: 82px; }
.game-drawer .latest { margin-top: 15px; padding-top: 12px; }
.game-drawer .latest p { margin: 8px 0; }
.game-drawer .panel-hint { margin-bottom: 0; }
#dialog { overscroll-behavior: contain; max-height: calc(100dvh - 24px); }
#toast { bottom: calc(85px + env(safe-area-inset-bottom)); }
.bulletin p { font-size: 13px; line-height: 1.9; margin-top: 14px; color: #c8d0bc; }
@keyframes panel-in { from { transform: translateY(24px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
@media (max-width: 620px) {
  .app-shell { padding-inline: 15px; }
  .masthead { height: 53px; min-height: 53px; }
  .brand { font-size: 19px; letter-spacing: 2px; gap: 8px; }
  .brand-mark { height: 29px; width: 25px; line-height: 28px; font-size: 19px; }
  .brand small, .edition { display: none; }
  .tools { gap: 0; }
  .icon-button { width: 44px; height: 44px; }
  .story-pane { padding: 8px 0; gap: 8px; }
  .day-heading { gap: 10px; }
  .day-heading > span { font-size: 36px; }
  h1 { font-size: 18px; }
  .day-heading div > span { font-size: 9px; letter-spacing: 1px; }
  .timeline { gap: 4px; }
  .timeline span { width: 9px; }
  .resource { padding: 5px 2px; }
  .resource-value { font-size: 21px; }
  .resource small { display: none; }
  .scene-head { margin-top: 7px; }
  .scene-wrap { margin: 0 -12px; }
  .scene-caption { left: 12px; right: 12px; bottom: 4px; font-size: 8px; }
  .warning { padding: 7px 10px; }
  .warning p { font-size: 10px; line-height: 1.6; }
  .day-end { min-height: 61px; padding-block: 8px; gap: 6px; }
  .day-end .primary { padding: 10px 14px; font-size: 12px; }
  .day-end > div { font-size: 10px; }
  .day-end small { font-size: 9px; }
  .game-dock { margin-inline: -15px; }
  .game-dock button { min-height: 51px; font-size: 10px; }
  .game-dock button > span { font-size: 21px; }
  .selection { padding: 8px 10px; }
  .selection h3 { font-size: 12px; }
  .selection .selection-copy { font-size: 10px; }
  .selection button { font-size: 11px; padding: 7px 12px; }
}
@media (max-height: 640px) {
  .masthead { height: 46px; min-height: 46px; }
  .story-pane { padding-block: 5px; }
  .day-heading > span { font-size: 30px; }
  .resource { padding: 3px 1px; }
  .resource-value { font-size: 19px; }
  .warning strong { display: none; }
  .warning p { font-size: 10px; }
  .day-end { min-height: 56px; padding-block: 5px; }
  .game-dock { padding-top: 2px; }
  .game-dock button { min-height: 46px; }
  .scene-caption { display: none; }
  .game-drawer { max-height: calc(100dvh - 36px); }
  .game-drawer .control-pane { max-height: calc(100dvh - 36px); }
  .welcome .intro-art { display: none; }
  .dialog-body { padding: 22px; }
}
@media (max-height: 480px) and (min-width: 620px) {
  .app-shell { max-width: 100%; }
  .masthead { height: 44px; min-height: 44px; }
  main { position: relative; }
  .story-pane { width: 210px; padding-top: 10px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .day-heading { width: 100%; }
  .day-heading > div { min-width: 0; }
  .day-heading h1 { font-size: 18px; white-space: nowrap; }
  .timeline { align-self: flex-start; }
  .timeline span { width: 13px; }
  .shelter-pane { position: absolute; inset: 0 0 0 225px; width: auto; }
  .shelter-pane .warning { position: fixed; top: 148px; left: 24px; width: 195px; }
  .shelter-pane .day-end { position: fixed; bottom: 75px; left: 24px; width: 195px; flex-wrap: wrap; }
  .shelter-pane .day-end .primary { width: 100%; }
  .shelter-pane { grid-template-rows: auto auto minmax(0, 1fr); }
  .selection { position: fixed; bottom: 75px; left: 24px; width: 195px; }
  .selection .selection-controls { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .game-drawer[open] { animation: none; } }
