.market {
  --ink: #3b3523;
  --green: #36633d;
  max-width: 740px;
  margin-inline: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #decaa4;
  border-radius: 22px;
  background: #fff8e9;
  color: var(--ink);
}
.market h2 { margin: 0; color: var(--ink); font-size: clamp(19px, 3vw, 28px); line-height: 1.2; }
.market button { font: inherit; cursor: pointer; touch-action: manipulation; }
.market [data-market-drag]:not(:disabled) { cursor: grab; touch-action: none; user-select: none; -webkit-touch-callout: none; }
.market .market-held { opacity: .45; cursor: grabbing; }
.market .market-drop-hover { outline: 3px solid #35724b; outline-offset: -3px; }
.market-gesture-hint { margin: 8px 12px; color: #5e4c33; font-size: 14px; }
.market-drag-ghost {
  position: fixed; z-index: 9999; pointer-events: none; width: 52px; height: 52px;
  transform: translate(-50%, -70%); filter: drop-shadow(0 3px 3px #62432466);
}
.market-drag-ghost > img, .market-drag-ghost > .fair-token {
  --paint: var(--drag-paint); display: block; width: 100%; height: 100%; object-fit: contain;
}
.market button:focus-visible { outline: 3px solid #235994; outline-offset: 2px; }
.market-intro { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
.market-cover { display: block; width: 100%; height: 100%; max-height: 360px; object-fit: cover; }
.market-panel { padding: clamp(18px, 4vw, 38px); text-align: left; }
.market-panel p { margin: 10px 0 20px; line-height: 1.5; }
.market .market-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 7px 23px;
  border: 1px solid #305636;
  border-radius: 16px;
  background: var(--green);
  box-shadow: 0 3px 0 #244429;
  color: white;
  font-weight: 800;
}
.market-primary:active { transform: translateY(2px); }
.market-order { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 14px; }
.market-customer { width: 45px; height: 54px; object-fit: contain; }
.market .market-listen {
  padding: 7px 12px;
  min-height: 44px;
  border: 1px solid #c5a679;
  border-radius: 14px;
  background: #fffdf7;
  color: #5d4629;
  font-weight: 700;
}
.market-garden {
  position: relative;
  display: grid;
  place-items: end center;
  background: #c3e9d8 url('../game-fruit/background-juice-3d-v1.webp') center 56% / cover;
}
.market-tree { position: relative; width: min(72%, 300px); aspect-ratio: 319 / 336; }
.market-leaves { display: block; width: 100%; height: 100%; }
.market-squirrel { position: absolute; bottom: 0; left: 9%; width: min(18%, 95px); pointer-events: none; }
.market-fruit { padding: 0; border: 0; background: transparent; }
.market-fruit img { display: block; width: 100%; height: 100%; object-fit: contain; }
.market-on-tree {
  position: absolute;
  width: max(21%, 44px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 3px 1px #53361966);
}
.market-on-tree[hidden] { display: none; }
.market-on-tree[data-kg-value="0"] { left: 25%; top: 32%; }
.market-on-tree[data-kg-value="1"] { left: 51%; top: 17%; }
.market-on-tree[data-kg-value="2"] { left: 76%; top: 32%; }
.market-on-tree[data-kg-value="3"] { left: 39%; top: 53%; }
.market-on-tree[data-kg-value="4"] { left: 64%; top: 52%; }
.market-counter { padding: 11px 10px 17px; border-top: 5px solid #b77a42; }
.market-counter h3 { margin: 0 0 5px; font-size: 17px; color: var(--ink); }
.market-shelf, .market-overflow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px; }
.market-overflow[hidden] { display: none; }
.market-overflow { padding: 3px; }
.market-tray {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
  width: fit-content;
  min-width: min(160px, 100%);
  min-height: 56px;
  padding: 3px 8px;
  border: 2px solid #c49864;
  border-bottom-width: 5px;
  border-radius: 12px 12px 25px 25px;
  background: #efcf99;
}
.market-in-basket, .market-extra, .market-empty { box-sizing: border-box; width: 44px; height: 44px; border-radius: 50%; }
.market-comparing .market-in-basket, .market-empty { border: 2px dashed #865422; background: #fff2cd; }
.market-extra { border: 2px dotted #914d38; background: #ffeadb; }
.market-feedback { margin: 6px auto 8px; min-height: 1.5em; line-height: 1.4; font-weight: 650; }
.market-deliver img { width: 29px; height: 35px; object-fit: contain; }
.market-deliver { margin-top: 12px; }
.market-map { text-align: left; }
.market-map-head, .market-district-title {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.market-map-head { padding: 16px 20px; flex-wrap: wrap; background: #fff5df; }
.market-map-head p, .market-district-title h3 { margin: 0; }
.market-map-head p { margin-top: 3px; color: #65563c; }
.market-district { border-top: 1px solid #d9bd92; }
.market-district-title { padding: 8px 18px; background: #fffaf0; }
.market-district-title h3 { color: var(--green); font-size: clamp(16px, 3vw, 20px); }
.market-district-title span { font-size: 14px; white-space: nowrap; }
.market-path {
  position: relative; isolation: isolate; display: grid; grid-template-columns: repeat(4,minmax(0,1fr));
  align-items: center; gap: 6px; padding: 14px 12px; min-height: 153px; overflow: hidden;
}
.market-landscape { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 51%; }
.market-path::before {
  content: ''; position: absolute; z-index: -1; left: 8%; right: 8%; bottom: 43%; height: 20%;
  border-bottom: 6px dashed #fff4c9; border-radius: 40%; filter: drop-shadow(0 1px 2px #623e1d);
}
.market .market-stop {
  justify-self: center; display: grid; justify-items: center; align-content: start; gap: 2px;
  width: 100%; max-width: 132px; padding: 6px 3px; border: 2px solid #caa672;
  border-radius: 12px; color: #433521; background: #fffaebf5; text-align: center;
  box-shadow: 0 3px 0 #70523488; line-height: 1.15;
}
.market-stop:nth-of-type(odd) { margin-top: 25px; }
.market-stop:nth-of-type(even) { margin-bottom: 25px; }
.market-stop:disabled { color: #605345; background: #f5ecdaf2; cursor: default; }
.market-stop small { font-size: 11px; }
.market-stop-name { font-size: clamp(12px,2vw,15px); font-weight: 800; }
.market-pin {
  display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%;
  background: #e4d2af; color: #433521; font-weight: 900;
}
.market .market-current { border-color: #82450c; background: #fff4ca; }
.market-current .market-pin { background: #9c4e14; color: #fff; }
.market .market-done { border-color: #50734d; }
.market-done .market-pin { background: var(--green); color: #fff; }
.market-map > .market-feedback { text-align: center; }
.market-board > .market-feedback { padding: 0 12px; }
.market-feedback:empty { display: none; }
.market-back { display: block; margin: 10px auto 0; min-height: 44px; padding: 4px 15px; color: #355c39; background: transparent; border: 0; text-decoration: underline; }
.market-table, .market-seats, .market-supply { padding: 16px 12px; }
.market-table, .market-seats { background: linear-gradient(#faebcd, #f4d6a6); border-block: 3px solid #ceab75; }
.market-object { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.market-sample { width: 86px; height: 86px; margin: 0 auto 16px; padding: 8px; background: #fffbef; border-radius: 50%; }
.market-bins, .market-seats, .market-supply, .market-count-row, .market-tags, .market-glasses {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px;
}
.market-bin, .market-seat {
  display: grid; justify-items: center; align-content: center; gap: 5px; padding: 8px;
  border: 2px solid #b48a55; border-bottom-width: 5px; border-radius: 17px; background: #fff8e7; color: var(--ink);
}
.market-bin {
  width: min(46%, 164px); padding: 16px 9px 13px; border: 0;
  background: transparent url('./picnic-tray.webp') center / 100% 100% no-repeat;
}
.market-bin > img { width: 58px; height: 58px; }
.market-contents { display: flex; min-height: 22px; align-items: center; justify-content: center; }
.market-contents img { width: 22px; height: 22px; }
.market-supply img { width: 44px; height: 44px; }
.market-seat { width: min(39%,126px); }
.market-seat:disabled { opacity: 1; border-color: #6d8953; background: #f4f6df; cursor: default; }
.market-guest { width: 76px; height: 70px; object-fit: contain; }
.market-place { position: relative; width: 64px; height: 46px; border: 2px dashed #ac8c66; border-radius: 50%; }
.market-place img + img { position: absolute; inset: 0; width: 68%; margin: auto; height: 80%; }
.market-glasses { gap: 2px; }
.market-on-shelf, .market-count-piece { width: clamp(44px, 10vw, 76px); height: clamp(44px, 10vw, 76px); }
.market-on-shelf:disabled { visibility: hidden; }
.market-order-index { margin: 0 0 10px; font-weight: 700; }
.market-count-row { min-height: 76px; gap: 2px; }
.market-count-piece { position: relative; background: transparent; border: 0; padding: 0; }
.market-count-piece:disabled { opacity: 1; }
.market-count-piece span {
  position: absolute; bottom: 0; right: 0; border-radius: 50%; background: #355f3c; color: white;
  padding: 1px 6px; font-weight: 800;
}
.market-tags { margin: 14px auto 0; }
.market .market-number { min-width: 52px; min-height: 52px; border: 2px solid #ba975e; border-radius: 10px; background: #fffdf4; color: #493b25; font-size: 26px; font-weight: 800; }
.fair-board { background: linear-gradient(#fff4da, #f5dfb7); }
.fair-choices, .fair-banquet, .fair-example { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; }
.fair-choices { margin: 14px auto 4px; }
.market .fair-choice {
  display: grid; place-items: center; gap: 3px; min-width: 46px; min-height: 46px; padding: 6px 10px;
  border: 2px solid #b28d57; border-bottom-width: 4px; border-radius: 13px;
  background: #fffcf2; color: #463922; font-weight: 750;
}
.fair-board .market-primary { margin-top: 10px; }
.fair-choice:disabled { opacity: .5; }
.fair-banquet { align-items: end; flex-wrap: nowrap; gap: 2px; margin: 14px auto; }
.fair-diner { display: grid; flex: 0 1 74px; min-width: 0; justify-items: center; }
.fair-guest { width: 100%; height: clamp(42px, 9vw, 68px); object-fit: contain; }
.fair-plate, .fair-spare { position: relative; display: block; width: 100%; max-width: 62px; aspect-ratio: 1.25; }
.fair-plate img + img { position: absolute; left: 17%; bottom: 18%; width: 66%; height: 72%; }
.fair-spare { width: 75%; }
.market .fair-cake-tray {
  grid-template-columns: repeat(2, 1fr); align-content: center; padding: 14px; min-height: 90px;
  background: transparent url('./picnic-tray.webp') center / 100% 100% no-repeat; border: 0;
}
.fair-cake-tray img { width: clamp(25px, 7vw, 44px); height: auto; aspect-ratio: 1; }
.fair-example { gap: 0; }
.fair-example .fair-plate { width: 24px; }
.fair-example > img { width: 16px; height: 19px; }
.fair-token { --paint: #bf552c; display: block; width: 36px; height: 36px; object-fit: contain; }
.fair-square, .fair-circle { background: var(--paint); }
.fair-circle { border-radius: 50%; }
.fair-triangle { background: var(--paint); clip-path: polygon(50% 2%, 99% 95%, 1% 95%); }
.fair-leaf { background: #487744; border-radius: 80% 4% 80% 4%; transform: scale(.85); }
.fair-sign-mold {
  display: grid; place-items: center; width: 98px; height: 85px; margin: 14px auto;
  background: #d5af79; border: 4px solid #a57a48; border-radius: 13px;
}
.fair-sign-mold .fair-token { --paint: #725439; width: 54px; height: 54px; }
.fair-garland { display: flex; align-items: flex-start; justify-content: center; margin: 14px auto; width: min(100%, 520px); }
.fair-flag {
  flex: 1 1 0; max-width: 48px; min-width: 0; min-height: 35px; display: grid; justify-items: center;
  border-top: 3px solid #886236; padding: 4px 1px 0;
}
.fair-flag .fair-token { width: min(100%, 35px); height: auto; aspect-ratio: 1; }
.fair-flag .fair-square { --paint: #396f86; }
.fair-board:has(.fair-garland) .fair-choice .fair-square { --paint: #396f86; }
.fair-gap { font-size: 21px; font-weight: 850; color: #574326; outline: 2px dashed #ac8750; outline-offset: -2px; }
.fair-gap[data-market-drop] { min-width: 44px; min-height: 44px; }
.fair-delivery { width: 54px; height: 54px; margin: auto; }
.fair-prop { max-width: 100%; height: 100%; object-fit: contain; }
.fair-stall {
  position: relative; width: min(100%, 540px); min-height: 175px; aspect-ratio: 2; margin: 0 auto;
  background: #f7f3da url('./flower-stall.webp') center / 100% 100% no-repeat; border-radius: 16px;
}
.fair-spot {
  position: absolute; box-sizing: border-box; display: grid; place-items: center; padding: 3px;
  width: 56px; height: 51px; border: 2px dashed #795c32; border-radius: 50%; background: #fff9e9da; color: #654b28;
}
.fair-spot:has(img) { background: transparent; border-color: transparent; }
.fair-cross { font-size: 24px; }
.fair-above { left: 37.5%; bottom: 52%; transform: translateX(-50%); }
.fair-below { left: 37.5%; bottom: 11%; transform: translateX(-50%); }
.fair-beside { right: 8%; bottom: 11%; }
.market-intro > :is(.fair-garland,.fair-stall) { grid-column: 1 / -1; margin-block: 10px; }
.order-board { background: linear-gradient(#fff6df, #f4dfb5); }
.order-baskets {
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px;
  margin: 12px auto 16px; max-width: 630px;
}
.order-basket {
  min-width: 0; border-radius: 14px;
}
.order-basket h3 { display: inline-block; margin: 0 0 2px; padding: 2px 9px; font-size: 16px; color: #513618; }
.order-asked h3 { border-radius: 9px; background: #36633d; color: white; }
.order-goods {
  display: grid; grid-template-columns: repeat(5, minmax(0, 48px)); grid-auto-rows: 46px;
  justify-content: center; align-content: center; min-height: 125px; padding: 23px 5% 14px; column-gap: 1px;
  background: transparent url('./market-crate.webp') center / 100% 100% no-repeat;
}
.order-basket:nth-child(2) .order-goods { padding-block: 15px; background-image: url('./picnic-tray.webp'); }
.order-piece { display: block; width: 100%; height: 46px; padding: 1px; border: 0; background: transparent; }
.order-piece img { pointer-events: none; }
.order-ticket { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border: 1px dashed #95683d; border-radius: 8px; background: #fffdf2; }
.order-ticket strong { color: #754119; font-size: 24px; }
.order-ticket img { width: 28px; height: 28px; }
.order-street { display: flex; justify-content: center; gap: 12px; margin: 15px auto 22px; }
.order-sign {
  display: grid; place-content: center; width: clamp(52px, 16vw, 82px); height: 69px;
  background: linear-gradient(180deg, #c9653f 0 17%, #fff9e6 17% 92%, #b98b56 92%);
  border: 2px solid #a57248; border-radius: 8px; font-size: 27px; font-weight: 800; color: #56341d;
}
.order-fruit-basket {
  margin: 12px auto; padding: 12px; min-height: 105px; width: min(100%, 220px);
  background: transparent url('./picnic-tray.webp') center / 100% 100% no-repeat; box-sizing: border-box;
}
@media (max-width: 680px) {
  .order-baskets { grid-template-columns: 1fr; max-width: 340px; gap: 6px; }
  .order-goods { min-height: 92px; }
}
@media (max-width: 560px) {
  .market-intro { grid-template-columns: 1fr; }
  .market-cover { max-height: 220px; }
  .market-panel { text-align: center; }
  .market-order { gap: 7px; padding: 7px; }
  .market-customer { width: 31px; height: 43px; }
  .market .market-listen { padding: 5px; flex-shrink: 0; font-size: 14px; }
  .market-tree { max-width: 220px; }
  .market-squirrel { left: 2%; }
  .market-map-head { padding: 12px; }
  .market-path { gap: 3px; padding: 6px 4px; min-height: 137px; }
  .market-seat { width: min(39%, 98px); }
  .market-order h2 { font-size: 17px; }
}
