:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #302520;
  background: #fcf5e8;
  font-synthesis: none;
  --ink: #302520;
  --muted: #655750;
  --paper: #fffaf0;
  --line: #e6d6c0;
  --orange: #b3422d;
  --fruit-atlas: url("frutas-e-carrinho.png");
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; }
button:not(:disabled) { cursor: pointer; }
a { color: inherit; text-underline-offset: .22em; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #174584; outline-offset: 3px; }
[hidden] { display: none !important; }

.page { width: min(1380px, 100% - 64px); margin-inline: auto; padding: 36px 0 48px; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: #755d4d; font-size: .71rem; font-weight: 800; letter-spacing: .12em; }
.eyebrow span { color: var(--orange); }
.intro h1 { margin: 0; font-family: "Bricolage Grotesque", Inter, system-ui, sans-serif; font-size: clamp(2.5rem, 6vw, 4.4rem); letter-spacing: -.07em; line-height: .98; }
.intro h1 span { color: #d45036; }
.intro p:not(.eyebrow) { margin: 10px 0 0; color: var(--muted); font-size: .96rem; }
.study-link { flex-shrink: 0; padding: 9px 0; color: #79513f; font-size: .79rem; font-weight: 740; }
.intro-links { display: grid; justify-items: end; flex-shrink: 0; gap: 4px; }
.intro-links .study-link { padding: 0; }
.art-link { padding: 9px 13px; border: 1px solid #c88d74; border-radius: 9px; background: #ffe6cd; color: #743b27; font-size: .78rem; font-weight: 800; text-decoration: none; }
.art-link:hover { background: #ffd9b6; }

.models { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-bottom: 16px; }
.model { min-width: 0; display: flex; align-items: center; gap: 11px; padding: 11px 14px; text-align: left; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fffaf1; }
.model:hover { border-color: #c99880; }
.model[aria-pressed="true"] { border-color: #ac4e35; background: #fff0db; box-shadow: inset 0 -3px #bc6043; }
.model strong, .model small { display: block; }
.model strong { font-size: .91rem; line-height: 1.16; }
.model small { margin-top: 3px; color: var(--muted); font-size: .73rem; line-height: 1.25; }
.model-symbol { width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; box-shadow: inset 0 2px #ffffff68, inset 0 -4px #00000024; }
.symbol-feira { background: repeating-linear-gradient(90deg, #f37d57 0 6px, #ffc482 6px 12px); }
.symbol-entreposto { background: repeating-linear-gradient(90deg, #9278cf 0 6px, #c0a7e8 6px 12px); }
.symbol-cais { background: repeating-linear-gradient(90deg, #329f99 0 6px, #87d5b9 6px 12px); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(266px, 326px); align-items: start; gap: 17px; }
.game {
  --scene-dark: #57382d;
  --scene-light: #7a4d38;
  --floor-light: #e3b786;
  --floor-dark: #bb8358;
  --floor-detail: #fff0ca33;
  --awning-a: #f18464;
  --awning-b: #ffe3a9;
  --bay: #5834232e;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 14px 33px #56372212;
}
.game[data-theme="entreposto"] { --scene-dark: #3c315c; --scene-light: #534274; --floor-light: #afa3ce; --floor-dark: #7c729e; --floor-detail: #eee3ff38; --awning-a: #a488dc; --awning-b: #f3d5ad; --bay: #2c204331; }
.game[data-theme="cais"] { --scene-dark: #21494d; --scene-light: #356568; --floor-light: #92c9bf; --floor-dark: #679c93; --floor-detail: #ecfff033; --awning-a: #53c5ad; --awning-b: #fbe094; --bay: #194d4a31; }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; background: #fff9ed; }
.game-head h2 { margin: 0; font-size: 1.02rem; letter-spacing: -.025em; }
.trip { flex-shrink: 0; font-size: .76rem; font-weight: 750; color: #6e5b51; }
.scene { position: relative; padding: 20px clamp(9px, 2.5vw, 32px) 16px; background: linear-gradient(155deg, var(--scene-light), var(--scene-dark) 43%); }
.canopy { position: absolute; inset: 0 0 auto; height: 11px; background: repeating-linear-gradient(90deg, var(--awning-a) 0 36px, var(--awning-b) 36px 72px); border-bottom: 2px solid #fff4d651; }

#loading { overflow: hidden; container-type: inline-size; }
.dispatch { display: grid; grid-template-columns: minmax(0, 1fr) minmax(98px, .49fr); align-items: stretch; gap: 11px; padding: 8px 9px 7px 8px; border-radius: 13px; color: #39291e; background: linear-gradient(0deg, #3a281f5c, #3a281f1c); border: 1px solid #ffe6c442; }
.order { position: relative; z-index: 1; min-width: 0; padding: 9px 14px 13px; background: linear-gradient(117deg, #fff8e5, #ffedc7); border-radius: 2px 0 0 0; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 97%, 96% 100%, 92% 97%, 88% 100%, 84% 97%, 80% 100%, 76% 97%, 72% 100%, 68% 97%, 64% 100%, 60% 97%, 56% 100%, 52% 97%, 48% 100%, 44% 97%, 40% 100%, 36% 97%, 32% 100%, 28% 97%, 24% 100%, 20% 97%, 16% 100%, 12% 97%, 8% 100%, 4% 97%, 0 100%); }
.order::after { content: ""; position: absolute; top: 0; right: 0; width: 12px; height: 12px; background: linear-gradient(45deg, #d3ac77, #fbe3ac); pointer-events: none; }
.order-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 1px 7px; margin-bottom: 5px; }
.order-head strong { font-size: .81rem; }
.order-head small { color: #6d5140; font-size: .69rem; font-weight: 680; }
.tickets { display: flex; gap: 5px; }
.ticket { position: relative; display: grid; place-items: center; width: clamp(34px, 5vw, 51px); height: clamp(33px, 4.3vw, 44px); border-radius: 9px; border: 1px solid #dec7a7; background: #fffae9; }
.ticket .sprite { width: 94%; max-width: 42px; }
.ticket.current { box-shadow: inset 0 0 0 2px #aa4b28; border-color: #aa4b28; }
.ticket.done { background: #e1efd2; border-color: #98b179; }
.ticket.done .sprite { opacity: .56; }
.ticket b { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; min-width: 15px; height: 15px; padding: 0 2px; border-radius: 4px; background: #654332; color: white; font-size: .63rem; line-height: 1; }
.ticket.done b { background: #365b3a; }
.cart { display: grid; justify-items: center; align-content: center; padding: 0 5px 5px; border: 1px dashed #fff0c557; border-radius: 10px; background: #fff6e012; color: #fff3d7; font-weight: 780; font-size: .72rem; line-height: 1.1; }
.pickup { position: relative; display: block; width: clamp(88px, 17vw, 186px); max-width: 100%; aspect-ratio: 1.92; }
.pickup > img { position: absolute; display: block; width: 100%; top: -14%; left: 0; pointer-events: none; }
.pickup[data-coat="1"] > img { filter: hue-rotate(166deg); }
.pickup[data-coat="2"] > img { filter: hue-rotate(39deg); }
.pickup-bed { position: absolute; inset: auto 48% 51% 7%; height: 32%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; align-items: end; }
.cargo-crate { min-width: 0; height: 100%; display: grid; place-items: center; background: linear-gradient(var(--rim) 0 21%, var(--front) 22% 76%, var(--side) 77%); border: 1px solid #442a2d9c; border-radius: 3px; box-shadow: 0 2px 2px #28192465; }
.cargo-crate .sprite { width: 89%; }
.cart small { font-size: .65rem; font-weight: 680; margin-top: 2px; }
.cart.ready { background: #fff1b32a; border-color: #ffec96; }
.cart.drag-over, .cart.ready:hover { outline: 2px solid #fff6bb; outline-offset: -1px; }
.complete { padding: 12px 14px; color: #fff3d9; }
.complete p { margin: 4px 0 0; font-size: .78rem; }

.stock-bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 12px 1px 6px; color: #fff4df; }
.stock-bar strong { font-size: .76rem; }
.stock-bar small { font-size: .69rem; font-weight: 640; color: #fff4d9; }
.board-shell { padding: 10px clamp(6px, 1.5vw, 15px) 7px; border-radius: 13px; border: 1px solid #f9edce72; border-bottom: 4px solid #462f2b78; background: repeating-linear-gradient(0deg, transparent 0 30px, var(--floor-detail) 30px 32px), linear-gradient(165deg, var(--floor-light), var(--floor-dark)); }
.piles { --columns: 3; display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); align-items: end; gap: clamp(5px, 1.35vw, 13px); }
.pile { min-width: 0; border-radius: 9px; }
.rack { display: flex; flex-direction: column-reverse; justify-content: flex-start; max-width: 195px; margin-inline: auto; padding: 3px 7px 0; border-radius: 9px 9px 6px 6px; background: var(--bay); border: 1px solid #fff5d534; }
.cell { position: relative; width: 100%; min-height: 24px; height: clamp(25px, 4vw, 41px); flex-shrink: 0; }
.cell:has(.crate.top) { z-index: 1; }
.base { position: relative; display: grid; place-items: center; max-width: 195px; margin-inline: auto; min-height: 19px; border-radius: 4px 4px 7px 7px; background: linear-gradient(#75503b, #493025); border-top: 2px solid #aa7754; color: #ffedd5; font-size: .63rem; font-weight: 740; letter-spacing: .02em; }
.base-target { width: 100%; padding: 0; border: 0; touch-action: manipulation; }
.base-target:hover, .pile.drag-over .base { filter: brightness(1.18); }
.game[data-theme="entreposto"] .base { background: linear-gradient(#5e5179, #372d4b); border-color: #9b89b0; }
.game[data-theme="cais"] .base { background: linear-gradient(#3f6c66, #244848); border-color: #73a79a; }
.bench { display: flex; align-items: center; gap: 8px; padding: 7px 7px 0; margin-top: 7px; border-top: 1px solid #4d365449; }
.bench-label { flex: 1; min-width: 65px; }
.bench-label strong, .bench-label small { display: block; color: #241934; }
.bench-label strong { font-size: .77rem; }
.bench-label small { font-size: .67rem; font-weight: 640; }
.bench .pile { flex: 0 1 102px; width: 23%; }
.bench .rack { padding-top: 2px; }
.bench .cell { height: 49px; }

.sprite { display: block; aspect-ratio: 1; background-image: var(--fruit-atlas); background-size: 300% 200%; background-position: var(--sx) var(--sy); background-repeat: no-repeat; pointer-events: none; }
.kind-G { --sx: 0%; --sy: 0%; --front: #a45bd7; --front-deep: #8040ae; --side: #683e9c; --rim: #e9aeff; --inside: #74388e; --board: #eed7fa; }
.kind-A { --sx: 50%; --sy: 0%; --front: #75b64e; --front-deep: #52953a; --side: #41803a; --rim: #c4e981; --inside: #517b33; --board: #dfedab; }
.kind-M { --sx: 100%; --sy: 0%; --front: #e76865; --front-deep: #c94452; --side: #ab3a4c; --rim: #ffb6a0; --inside: #943740; --board: #ffe0cb; }
.kind-B { --sx: 0%; --sy: 100%; --front: #e7b335; --front-deep: #c79525; --side: #a67620; --rim: #ffe788; --inside: #ac7924; --board: #fff0ab; }
.kind-L { --sx: 50%; --sy: 100%; --front: #ed9653; --front-deep: #d16e34; --side: #a95833; --rim: #ffd3a0; --inside: #a2562e; --board: #ffe2ba; }
.crate { --front-width: 91%; position: absolute; inset: 0; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #2f2320; isolation: isolate; container-type: inline-size; touch-action: manipulation; }
.crate:disabled { opacity: 1; }
.crate[draggable="true"] { cursor: grab; }
.crate-face, .crate-side, .crate-rim, .crate-label { position: absolute; display: block; pointer-events: none; }
.crate-face { z-index: 2; inset: 23% auto 0 1%; width: var(--front-width); border-radius: 1px 1px 4px 4px; border-block: 2px solid var(--side); background: repeating-linear-gradient(0deg, transparent 0 5px, #2b172a21 5px 6.5px), linear-gradient(110deg, var(--front), var(--front-deep)); box-shadow: inset 0 3px #2d1a272a, inset 0 -3px #30202340; }
.crate-face::after { content: ""; position: absolute; inset: -17% 3% -2%; border-inline: 7px solid var(--front-deep); border-top: 2px solid var(--rim); border-radius: 4px; box-shadow: inset 0 2px #fff0db45; }
.crate-side { z-index: 1; top: 0; right: 0; bottom: 0; width: 13%; background: linear-gradient(var(--front-deep), var(--side)); clip-path: polygon(0 24%, 100% 0, 100% 74%, 0 100%); }
.crate-rim { z-index: 3; inset: -1px 0 auto; height: 27%; background: linear-gradient(var(--rim), var(--front)); clip-path: polygon(10% 0, 100% 0, 92% 100%, 0 100%); }
.crate.top .crate-rim::after, .move-ghost .crate-rim::after { content: ""; position: absolute; inset: 15% 9% 20% 9%; background: var(--inside); clip-path: polygon(8% 0, 100% 0, 94% 100%, 0 100%); }
.crate-label { z-index: 5; left: 45%; bottom: 7%; transform: translateX(-50%); border-radius: 4px; width: min(48%, 27px); height: 58%; display: grid; place-items: center; background: var(--board); border: 1px solid #3d26203c; box-shadow: 0 1px #3526245e; }
.crate-label .sprite { width: 21px; max-width: 100%; position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
.crate.selected { z-index: 3; transform: translateY(-3px); }
.crate.top::after { content: ""; position: absolute; inset: -7px 0; }
.move-ghost { position: fixed; margin: 0; pointer-events: none; z-index: 5; transition: transform 170ms ease, opacity 170ms ease; }

.controls { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 65px; padding: 9px 13px; }
.controls p { margin: 0; font-size: .77rem; line-height: 1.35; color: #654b3c; }
.controls p[data-tone="warning"] { color: #a33323; }
.controls p[data-tone="success"] { color: #276137; }
.actions { display: flex; flex-shrink: 0; gap: 6px; }
.action { min-height: 37px; padding: 6px 9px; border: 1px solid #e0cdb6; border-radius: 8px; background: #fff5e2; color: #583a2a; font-size: .73rem; font-weight: 730; }
.action:disabled { opacity: .46; }
.action:not(:disabled):hover { background: #f8e4c9; }

.guide { display: grid; gap: 11px; }
.how, .model-guide, .design { padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.guide h2, .design h2 { margin: 0 0 8px; font-size: .99rem; letter-spacing: -.02em; }
.how ol { margin: 0; padding-left: 17px; color: #5c4e46; font-size: .81rem; line-height: 1.45; }
.how li + li { margin-top: 4px; }
.drag-note { margin: 7px 0 0; color: #735e50; font-size: .72rem; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 0 0 9px; }
.stats div { min-width: 0; padding: 6px 7px; border-radius: 6px; background: #f7ebda; }
.stats dt { color: #705647; font-size: .65rem; font-weight: 720; }
.stats dd { margin: 0; color: #3e2a21; font-size: .79rem; font-weight: 770; }
.description, .model-guide details p, .design p { margin: 0; color: #59483e; font-size: .8rem; line-height: 1.48; }
.model-guide details { border-top: 1px solid #ebdece; margin-top: 8px; padding-top: 7px; }
.model-guide summary { cursor: pointer; color: #604232; font-size: .78rem; font-weight: 770; }
.model-guide details p { margin-top: 5px; }
.design { grid-column: 1 / -1; }
.design-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.design h3 { margin: 0 0 5px; color: #6f4431; font-size: .8rem; }

@media (max-width: 910px) {
  .page { width: calc(100% - 40px); padding-top: 26px; }
  .layout { grid-template-columns: minmax(0, 1fr) minmax(224px, 270px); gap: 11px; }
  .scene { padding-inline: 12px; }
}

@media (max-width: 740px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .intro { margin-bottom: 15px; }
  .guide { grid-template-columns: minmax(0, .78fr) minmax(0, 1fr); }
  .cell { height: clamp(27px, 6.6vw, 38px); }
}

@media (max-width: 520px) {
  .page { width: calc(100% - 18px); padding-top: 17px; }
  .intro { gap: 8px; align-items: flex-start; }
  .intro h1 { font-size: clamp(2.1rem, 10.4vw, 2.75rem); }
  .eyebrow { font-size: .6rem; letter-spacing: .08em; }
  .intro p:not(.eyebrow) { font-size: .79rem; margin-top: 6px; }
  .intro-links { flex-shrink: 1; justify-items: end; text-align: right; }
  .art-link { padding: 5px 6px; font-size: .66rem; }
  .study-link { font-size: .63rem; }
  .models { gap: 5px; margin-bottom: 9px; }
  .model { padding: 8px 6px 9px; gap: 5px; border-radius: 9px; min-height: 47px; }
  .model-symbol { width: 13px; height: 17px; border-radius: 4px; }
  .model strong { font-size: .72rem; }
  .model small { display: none; }
  .game { border-radius: 12px; }
  .game-head { padding: 8px 9px; }
  .game-head h2 { font-size: .84rem; }
  .trip { font-size: .66rem; }
  .scene { padding: 14px 7px 8px; }
  .canopy { height: 8px; }
  .order { padding-left: 7px; padding-right: 6px; }
  .dispatch { gap: 5px; padding: 5px; }
  .pickup { width: 104px; }
  .board-shell { padding: 7px 5px 4px; }
  .rack { padding: 3px 4px 0; }
  .base { font-size: .59rem; min-height: 17px; }
  .controls { padding: 6px 7px; min-height: 52px; }
  .controls p { font-size: .7rem; }
  .action { padding: 4px 6px; min-height: 34px; font-size: .65rem; }
  .guide, .design-grid { grid-template-columns: minmax(0, 1fr); }
  .design-grid { gap: 12px; }
}

@media (max-width: 365px) {
  .pile .rack { padding-inline: 2px; }
  .piles { gap: 4px; }
  .cell { min-height: 26px; height: 26px; }
  .model-symbol { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .move-ghost { transition: none; }
}
