/* Keep development cards above the meadow HUD and every close button inside its card. */
#object-panel.object-panel { z-index:220; }
#object-panel #panel-close {
 top:9px; right:9px; z-index:12; display:grid; place-items:center;
 width:38px; height:38px; padding:0; border:2px solid #ffe0a2;
 border-radius:50%; background:linear-gradient(#be6336,#87331f);
 color:#fff8e2; font:28px/1 Arial,sans-serif; box-shadow:0 2px 4px #53301866;
 cursor:pointer; touch-action:manipulation;
}
#object-panel #panel-close:focus-visible { outline:3px solid #3d92ba; outline-offset:3px; }
#object-panel.object-panel[data-view]:is([data-view="tree"],[data-view="house"],[data-view="snegurochka"],[data-view="ded"],[data-view="pet"],[data-view="nursery"],[data-view="post"],[data-development]) {
 position:fixed; top:50%; left:50%; right:auto; bottom:auto; transform:translate(-50%,-50%);
 width:min(410px,calc(100vw - 24px)); height:auto; max-height:calc(100dvh - 24px);
 display:flex; flex-direction:column; gap:0; padding:44px 13px 13px;
 box-sizing:border-box; border:3px solid #be8d47; border-radius:22px;
 background:radial-gradient(ellipse at top,#fff5dd,#f0d3a0);
 box-shadow:0 12px 45px #10233b88,inset 0 0 0 2px #fff0c8; overflow:hidden;
 --game-title:25px; --game-text:14px; --game-label:14px; --game-note:12px;
 animation:none;
}
#object-panel.object-panel[data-view]:is([data-view="tree"],[data-view="house"],[data-view="snegurochka"],[data-view="ded"],[data-view="pet"],[data-view="nursery"],[data-view="post"],[data-development])::after {
 top:0; left:6px; right:56px; height:34px;
 background:url('assets/winter26/garland.png') center / 230px 70px repeat-x;
 pointer-events:none;
}
#object-panel.object-panel[data-view]:is([data-view="tree"],[data-view="house"],[data-view="snegurochka"],[data-view="ded"],[data-view="pet"],[data-view="nursery"],[data-view="post"],[data-development]) .panel-art { display:none; }
#object-panel.object-panel[data-view]:is([data-view="tree"],[data-view="house"],[data-view="snegurochka"],[data-view="ded"],[data-view="pet"],[data-view="nursery"],[data-view="post"],[data-development]) .panel-content {
 min-height:0; max-height:calc(100dvh - 90px); align-self:stretch;
 overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:#b68a4d #eddbb6;
 margin:0; padding:5px 13px 9px; border:0; border-radius:12px; background:none; box-shadow:none;
}
#object-panel .panel-content .panel-kicker { margin:0 0 5px; font-size:10px; letter-spacing:1.2px; color:#9b6e36; }
#object-panel .panel-content h2 { margin:0 0 12px; padding:0 0 10px; border-bottom:1px solid #c8a46d88; }
#object-panel .panel-content>p { margin:0 0 12px; }
#object-panel .panel-stat { margin-top:5px; padding:8px 0; font-size:12px; }
#object-panel .panel-stat b { font-size:14px; }
#object-panel .panel-progress { height:10px; margin:4px 0 0; }
#object-panel .panel-content #panel-progress-text { font-size:12px; margin:6px 0 0; }
#object-panel .panel-content .primary-action { margin:15px 0 0; min-height:41px; padding:9px 11px; border-radius:13px; }
#object-panel .panel-content .secondary-action { margin-top:8px; padding:9px 11px; min-height:38px; border-radius:12px; background:linear-gradient(#f5e5c2,#e3c28b); border:1px solid #c59c61; color:#714723; }
#object-panel .panel-content .panel-feedback { margin:6px 0 0 !important; min-height:0; }
#object-panel .panel-content .panel-feedback:empty { display:none; }
@media(max-height:600px) {
 #object-panel.object-panel[data-view] { --game-title:22px; --game-text:13px; --game-label:13px; }
 #object-panel .panel-content h2 { margin-bottom:8px; padding-bottom:8px; }
 #object-panel .panel-content>p { margin-bottom:8px; }
 #object-panel .panel-content .primary-action { margin-top:11px; min-height:38px; }
 #object-panel .panel-content .secondary-action { min-height:35px; padding:7px 9px; }
}

#game .city-shortcuts {
  position: absolute;
  z-index: 16;
  top: calc(115px + env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}
#game .city-shortcuts button {
  padding: 7px 10px;
  border: 1px solid #c69b57;
  border-radius: 9px;
  background: linear-gradient(#fff3d5, #e4c28c);
  color: #56351f;
  font: 700 12px/1.2 system-ui, sans-serif;
  cursor: pointer;
}
@media (orientation: landscape) and (max-height: 520px) {
  #game .city-shortcuts { top: calc(62px + env(safe-area-inset-top)); }
}

#game .city-shortcuts {
  right: auto;
  left: max(12px, env(safe-area-inset-left));
  justify-content: flex-start;
}
#modal:has(.city-dialog-body) .modal {
  width: min(680px, 94vw);
  max-height: 88dvh;
  overflow-y: auto;
}
#modal:has(.city-dialog-body) .panel-kicker,
#modal:has(.city-dialog-body) #modal-copy:empty,
#modal:has(.city-dialog-body) #modal-action {
  display: none;
}
#modal .city-dialog-body {
  display: grid;
  gap: 8px;
}

#game .ref-rail { max-height: calc(100dvh - 115px); overflow-y: auto; scrollbar-width: thin; }
#game .ref-rail button { flex-shrink: 0; }
#modal:has(.city-dialog-body) .modal { box-sizing: border-box; overflow-x: hidden; }
#modal:has(.city-dialog-body) #modal-close { top: 8px; right: 8px; z-index: 3; }
#modal .city-gifts { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 4px; padding-block: 12px 4px; }
#modal .city-gift {
  --box: #a92636;
  position: relative;
  height: clamp(54px, 10vw, 106px);
  border: 0;
  background: none;
  cursor: pointer;
}
#modal .city-gift:nth-child(2) { --box: #256763; }
#modal .city-gift:nth-child(3) { --box: #395e97; }
#modal .city-gift:nth-child(4) { --box: #7b3979; }
#modal .city-gift:nth-child(5) { --box: #8d501e; }
.city-gift-base,.city-gift-lid {
  position: absolute;
  border: 1px solid #73481d;
  background: linear-gradient(90deg,transparent 42%,#ffc96b 43% 57%,transparent 58%),
              linear-gradient(145deg,var(--box) 55%,#401d26);
  box-shadow: 0 4px 5px #4d28163d,inset 0 2px #fff4c967;
}
.city-gift-base { inset: 36% 13% 5%; border-radius: 5px 5px 9px 9px; }
.city-gift-lid { inset: 25% 8% 53%; border-radius: 6px; z-index: 1; }
.city-gift-lid::before,.city-gift-lid::after {
  content: ""; position: absolute; bottom: 90%; width: 23%; height: 65%;
  border: 2px solid #a45e24; background: #ffd278; border-radius: 65% 75% 35% 65%;
}
.city-gift-lid::before { right: 48%; transform: rotate(22deg); }
.city-gift-lid::after { left: 48%; transform: scaleX(-1) rotate(22deg); }
.city-gift-sparks { position: absolute; inset: 28% 0 auto; opacity: 0; color: #fff2a7; text-shadow: 0 0 8px #aa5326; font-size: clamp(14px,3vw,29px); }
.city-gift:not(:disabled):hover .city-gift-lid { transform: translateY(-4px); }
.city-gift.is-opening .city-gift-lid { animation: city-lid .55s ease-out both; }
.city-gift.is-opening .city-gift-sparks { animation: city-sparks .8s ease-out both; }
.city-lottery-result { text-align: center; color: #72401e; font-size: 22px; }
@keyframes city-lid { to { transform: translateY(-90%) rotate(-16deg); } }
@keyframes city-sparks {
  25% { opacity: 1; }
  85% { opacity: .8; }
  to { opacity: 0; transform: translateY(-36px) scale(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  .city-gift.is-opening .city-gift-lid { animation: none; transform: translateY(-90%) rotate(-16deg); }
  .city-gift.is-opening .city-gift-sparks { animation: none; opacity: 1; }
}

#modal:has(.city-rewards) .modal {
  width: min(1040px, 94vw);
  border: 4px solid #bd792f;
  background: radial-gradient(ellipse at top,#fff0ce,#e7bd82);
  box-shadow: 0 0 0 2px #603b20, inset 0 0 0 2px #ffdf94, 0 12px 35px #110d19a8;
}
#modal:has(.city-rewards) #modal-title {
  width: fit-content;
  max-width: 90%;
  margin: 10px auto 16px;
  padding: 6px clamp(12px,4vw,40px);
  border: 2px solid #dca24c;
  border-radius: 16px;
  background: linear-gradient(#8a3824,#56251c);
  color: #ffe4a6;
  text-align: center;
}
#modal .city-rewards {
  grid-template-columns: repeat(auto-fill,minmax(min(205px,100%),1fr));
  align-items: stretch;
  gap: 12px;
  padding-bottom: 5px;
}
.city-rewards article {
  min-width: 0;
  width: 100%;
  max-width: 340px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  text-align: center;
  border: 2px solid #cb934c;
  border-radius: 14px;
  background: linear-gradient(#fff1d4,#f7d49d);
  box-shadow: inset 0 0 0 2px #ffe7b8;
}
.city-reward-art {
  display: grid;
  place-items: center;
  height: clamp(76px,17vh,150px);
  border-radius: 9px;
  background: radial-gradient(ellipse at 50% 90%,#d0af86,#354875 57%,#202443);
  overflow: hidden;
}
.city-reward-art img { width: 90%; height: 100%; min-height: 0; object-fit: contain; }
.city-rewards h3 {
  margin: 0;
  padding: 4px;
  border-radius: 8px;
  background: linear-gradient(#ffe9b8,#e7b56f);
  color: #5b2e18;
  font: bold 18px Georgia,serif;
}
#modal .city-rewards p { margin: 0; color: #644020; }
.city-reward-amounts {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 6px;
  color: #67351d;
  font-weight: 700;
}
#modal .city-rewards button { margin: 0; }

#modal:has(.city-rewards) .modal {
  --reward-frame-side: clamp(16px, 5vw, 64px);
  --reward-frame-top: clamp(36px, 10dvh, 87px);
  --reward-frame-bottom: clamp(23px, 5dvh, 46px);
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  max-height: 96dvh;
  padding: var(--reward-frame-top) var(--reward-frame-side) var(--reward-frame-bottom);
  overflow: visible;
  border: 0;
  border-radius: 30px;
  background: radial-gradient(ellipse at 50% 25%, #fff1d0, #db9e59);
  box-shadow: 0 14px 42px #110b17aa;
}
#modal:has(.city-rewards) .modal::after {
  inset: 0;
  z-index: 2;
  height: auto;
  border: solid transparent;
  border-width: var(--reward-frame-top) var(--reward-frame-side) var(--reward-frame-bottom);
  border-image: url('assets/quests/story-frame-v1.png') 145 110 75 / var(--reward-frame-top) var(--reward-frame-side) var(--reward-frame-bottom) stretch;
  background: none;
}
#modal:has(.city-rewards) #modal-title {
  margin: 0 auto 12px;
  border: 3px double #ffd386;
  box-shadow: 0 3px 0 #69391d, inset 0 0 8px #34140c;
  text-shadow: 0 2px #4a2118;
}
#modal:has(.city-rewards) #modal-close { top: 12px; right: 12px; }
#modal .city-rewards {
  min-height: 0;
  max-height: none;
  overflow: auto;
  grid-template-columns: repeat(auto-fill, minmax(min(200px,100%),1fr));
  scrollbar-color: #b47c3e #f5dba9;
  scrollbar-width: thin;
}
#modal .city-rewards article {
  padding: 7px;
  border: 3px double #bf823b;
  box-shadow: inset 0 0 0 2px #ffe9b9, 0 2px 3px #82461955;
}
#modal .city-reward-art {
  height: clamp(72px, 18dvh, 175px);
  background: linear-gradient(#13244633,#2e1b3b4d), url('assets/winter26/landscape.webp') center 57% / cover;
  box-shadow: inset 0 0 0 1px #9f713e;
}
#modal .city-reward-art img { filter: drop-shadow(0 4px 6px #110c23bb); }
#modal .city-rewards h3 { border: 1px solid #c38846; box-shadow: 0 1px 2px #75421955; }
#modal .city-reward-amounts { border: 1px solid #d7a263; border-radius: 10px; background: #fff4da8c; gap: 3px 8px; }
.city-reward-amounts span { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; }
.city-reward-amounts img { width: 22px; height: 22px; object-fit: contain; }
#modal .city-rewards button { border: 3px double #ffe19b; min-height: 38px; }

#modal:has(.city-rewards) .modal {
  --reward-frame-side: clamp(26px, 7vw, 88px);
  --reward-frame-bottom: clamp(32px, 7dvh, 58px);
  background: transparent;
  box-shadow: none;
}
#modal:has(.city-rewards) .modal::before {
  content: "";
  position: absolute;
  inset: calc(var(--reward-frame-top) * .72) calc(var(--reward-frame-side) * .57) calc(var(--reward-frame-bottom) * .58);
  z-index: -1;
  border-radius: 16px;
  background: radial-gradient(ellipse at 50% 25%, #fff1d0, #db9e59);
}
#modal .city-rewards {
  grid-template-columns: repeat(auto-fit, minmax(min(180px,100%), 250px));
  justify-content: center;
  padding: 4px 4px 9px;
}
#modal:has(.city-rewards) #modal-close {
  top: clamp(12px,4dvh,28px);
  right: clamp(12px,3vw,35px);
}


#game .ref-rail .meadow-support {
  flex-shrink: 0;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px 2px;
  border: 1px solid #c79556;
  border-radius: 10px;
  background: linear-gradient(#fff5dd,#ebcd9e);
  color: #5c381d;
  font: 700 clamp(7px,1vw,11px)/1.1 system-ui,sans-serif;
  text-decoration: none;
}
.meadow-support span { font: 700 17px/1 Georgia,serif; }
#game-loading .support-contact { color: #ffe59f; }
.settings-support a { color: #75441f; overflow-wrap: anywhere; }

@media (orientation: landscape) and (max-height: 460px) {
  #game .ref-rail { gap: 3px; max-height: calc(100dvh - 116px); }
  #game .ref-rail button { height: 39px; min-height: 0; padding: 1px 2px; }
  #game .ref-rail button img { width: 24px; height: 24px; }
  #game .ref-rail .meadow-support { padding-block: 2px; }
  #modal:has(.city-rewards) .modal { --reward-frame-top: 35px; --reward-frame-bottom: 26px; }
  #modal:has(.city-rewards) #modal-title { margin-bottom: 6px; padding-block: 3px; font-size: 21px; }
  #modal .city-rewards { gap: 6px; padding-bottom: 4px; }
  #modal .city-rewards article { gap: 4px; padding: 5px; }
  #modal .city-reward-art { height: 61px; }
  #modal .city-rewards h3 { font-size: 15px; }
  #modal .city-reward-amounts { padding: 3px; }
  #modal .city-rewards button { min-height: 30px; padding-block: 4px; }
}

#game > #meadow-development {
  position:absolute;
  z-index:49;
  right:calc(9px + env(safe-area-inset-right));
  bottom:calc(8px + env(safe-area-inset-bottom));
  display:grid;
  place-items:center;
  width:clamp(180px,17vw,300px);
  min-height:44px;
  padding:0;
  border:0;
  border-radius:18px;
  background:transparent;
  cursor:pointer;
  touch-action:manipulation;
}
#meadow-development .development-sprite {
  position:relative;
  display:block;
  width:100%;
  aspect-ratio:1380 / 412;
  overflow:hidden;
}
#meadow-development img {
  position:absolute;
  top:-42.5%;
  left:-21.9%;
  width:143.7%;
  max-width:none;
  height:auto;
  pointer-events:none;
}
#meadow-development[aria-pressed="true"] .development-sprite {
  filter:brightness(1.2) drop-shadow(0 0 5px #ffdf76);
}
#meadow-development:active { translate:0 2px; }
#meadow-development:focus-visible { outline:3px solid #ffec89; outline-offset:2px; }
:is(.ed-active,.house-position-editing,.events-hunting) #game > #meadow-development { visibility:hidden; }
:root[data-window-layout="compact"] #game > #meadow-development {
  right:calc(var(--window-right, env(safe-area-inset-right)) + 7px);
  bottom:calc(var(--window-bottom, env(safe-area-inset-bottom)) + 4px);
  width:clamp(120px,20vw,168px);
}
@media (orientation:portrait) and (max-width:700px), (orientation:landscape) and (max-width:510px) {
  #game > #meadow-development,
  :root[data-window-layout="compact"] #game > #meadow-development {
    bottom:calc(var(--window-bottom, env(safe-area-inset-bottom)) + 68px);
    width:clamp(120px,20vw,168px);
  }
}
#scene[data-development] :is([data-magic-object],[data-object="workshop"])::after {
  content:"";
  position:absolute;
  inset:15% 14%;
  border-radius:50%;
  box-shadow:0 0 16px #ffda7180, inset 0 0 12px #ffda7150;
  pointer-events:none;
}
#object-panel[data-development] #panel-balance { margin-block:6px; }
#object-panel[data-development] :is(#panel-action,#panel-bulk):not([hidden]) { min-height:44px; }
#object-panel[data-development] #panel-bulk:disabled { opacity:.65; cursor:not-allowed; }

