
:root {
 color-scheme: light;
 --sand: #faf1df; --cream: #fffaf0; --ink: #302619; --dim: #655641;
 --green: #285744; --green-light: #e1eddb; --line: #decfb6;
 --display: Georgia, "Times New Roman", serif;
 --body: "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--sand); font: 16px/1.45 var(--body); }
h1, h2, p { margin: 0; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #217d9c; outline-offset: 3px; }
[hidden] { display: none !important; }
.desert { width: min(100%, 1480px); padding: clamp(12px, 2.3vw, 28px); margin: auto; }
.masthead { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin: 0 0 16px; }
.brand { color: var(--green); font-weight: 750; font-size: 13px; }
h1 { font: 700 clamp(30px, 4.25vw, 61px)/1.04 var(--display); letter-spacing: -.045em; }
.view-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.view-controls button, .plain { background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; min-height: 39px; }
.view-controls button[aria-pressed="true"], .plain[aria-pressed="true"] { color: var(--green); background: var(--green-light); border-color: #74946a; }
.scene {
 position: relative; isolation: isolate; width: 100%; aspect-ratio: 625/356;
 max-width: max(680px, calc((100svh - 250px) * 625 / 356));
 margin: auto; overflow: hidden; border-radius: clamp(13px, 2vw, 25px);
 background: #e7a94c; box-shadow: 0 10px 30px #a96f4329;
}
.masthead, .world-dock { width: 100%; max-width: max(680px, calc((100svh - 250px) * 625 / 356)); margin-inline: auto; }
#desert-art, #world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#world { pointer-events: none; }
.cactus { position: absolute; display: grid; place-items: end center; background: transparent; padding: 0; border: 0; border-radius: 20px; min-width: 22px; touch-action: manipulation; }
.cactus-west { left: 11.2%; top: 2.5%; width: 16.1%; height: 77%; }
.cactus-small { left: 60.7%; top: 41%; width: 5.7%; height: 36%; }
.cactus-east { left: 66.5%; top: 28.8%; width: 10%; height: 43%; }
.cactus span {
 display: grid; place-items: center; width: clamp(25px, 3.3vw, 38px); aspect-ratio: 1;
 border: 2px solid #fff7df; border-radius: 50%; background: #fff7df; color: #2c513d;
 box-shadow: 0 2px 9px #4f321e65; font-size: 14px; line-height: 1; font-weight: 800;
 transition: background .18s ease, color .18s ease; transform: translateY(45%);
}
.cactus:not(:disabled):hover span, .cactus[aria-pressed="true"] span { color: #fff; background: var(--green); }
.cactus[aria-pressed="true"] span { font-size: clamp(15px, 2vw, 21px); }
.world-dock { display: grid; grid-template-columns: minmax(230px,1fr) minmax(235px,auto); gap: 12px 20px; padding-top: 14px; }
.challenge, .world-upload { display: flex; align-items: center; gap: 12px; min-width: 0; }
.challenge h2 { font-size: 17px; }
.challenge p, .world-upload p { font-size: 13px; color: var(--dim); }
.bloom-progress { display: flex; gap: 4px; }
.bloom-progress span { width: 9px; height: 9px; border: 1px solid #ad633e; border-radius: 50%; }
.bloom-progress span.is-open { background: #ad633e; }
#replay { min-width: max-content; margin-left: auto; }
.world-upload { justify-self: end; }
#qr-link, .qr-popup a { display: block; background: white; border-radius: 9px; overflow: hidden; flex: none; }
#qr { display: block; }
.primary { display: inline-grid; place-items: center; border: 0; border-radius: 10px; background: var(--green); color: white; font-weight: 700; min-height: 42px; padding: 8px 13px; text-decoration: none; }
.primary:hover { background: #1b4634; }
.primary:disabled { opacity: .5; }
.upload-copy p { margin-top: 3px; }
.report-link { background: none; border: 0; color: var(--green); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; padding: 4px 0; }
.popup { width: min(calc(100vw - 22px), 540px); max-height: calc(100dvh - 22px); overflow: auto; border: 1px solid var(--line); border-radius: 20px; padding: clamp(14px, 4vw, 24px); background: var(--cream); color: var(--ink); box-shadow: 0 18px 85px #3c291e60; }
.popup::backdrop { background: #2e261a92; backdrop-filter: blur(3px); }
.dialog-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.popup h2 { font: 700 clamp(23px, 5vw, 30px)/1.12 var(--display); }
.dialog-note { font-size: 14px; color: var(--dim); margin: 10px 0; }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 750; letter-spacing: .06em; margin-bottom: 4px; }
.quiet { background: transparent; border: 1px solid var(--line); border-radius: 50%; width: 40px; height: 40px; font-size: 24px; flex: none; line-height: 1; }
.qr-popup { text-align: center; }
.qr-popup a { width: min(100%, 350px); margin: 0 auto 12px; }
.qr-popup img { width: 100%; display: block; aspect-ratio: 1; }
.photo-area { display: grid; place-items: center; width: 100%; aspect-ratio: 560/400; border: 1px solid var(--line); border-radius: 12px; background: repeating-conic-gradient(#f1e8d8 0% 25%,#fffdf7 0% 50%) 0/20px 20px; font-size: 14px; color: var(--dim); text-align: center; }
.photo-area canvas, #drawing { display: block; width: 100%; height: auto; touch-action: none; border-radius: 12px; }
#drawing { background: white; border: 1px solid var(--line); }
#photo[data-cropping], #photo[data-outlining] { cursor: crosshair; }
.tabs, .edit-tools, .host-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin: 9px 0; }
.tabs button { background: transparent; border: 1px solid var(--line); padding: 7px 11px; border-radius: 8px; }
.tabs button[aria-pressed="true"] { background: var(--green-light); font-weight: 700; }
.upload-label { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.upload-label input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.upload-label:focus-within { outline: 3px solid #217d9c; }
.brush-size { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.brush-size input { width: 80px; }
.edit-status { font-size: 13px; min-height: 20px; margin: 8px 0; }
#send { width: 100%; }
#open-parts { display: block; margin: 6px auto 0; }
.part-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.part-row figure { margin: 0; display: grid; place-items: center; width: 48px; height: 48px; background: var(--sand); border-radius: 7px; }
.part-row img { max-width: 44px; max-height: 44px; }
.part-title { flex: 1; font-size: 13px; }
.parts-list:empty::after { content: "В пустыне пока нет рисунков."; display: block; padding-block: 9px; color: var(--dim); }
.danger { color: #9a2f27; }
.toast { position: fixed; z-index: 5; top: 35%; left: 50%; transform: translateX(-50%); max-width: calc(100% - 30px); width: max-content; background: var(--green); color: #fff; border: 1px solid #cbe1c5; border-radius: 12px; padding: 12px 18px; text-align: center; font-weight: 650; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 670px) {
 .masthead { align-items: start; flex-direction: column; gap: 9px; margin-bottom: 12px; }
 .view-controls button { min-height: 36px; }
 .world-dock { grid-template-columns: 1fr; gap: 14px; padding-top: 12px; }
 .world-upload { justify-self: start; }
 .challenge { flex-wrap: wrap; }
 #replay { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
