
:root {
  color-scheme: light;
  --ink: #244538;
  --muted: #4f6658;
  --leaf: #234b3b;
  --cream: #f8f5e8;
  --lime: #e5ebd9;
  --gold: #f1bc57;
  --line: #c3cbb3;
  --display: Georgia, 'Times New Roman', serif;
  --body: 'Segoe UI', Arial, sans-serif;
  --edge: clamp(10px, 2.4vw, 36px);
}
* { box-sizing: border-box; }
body { margin: 0; background: #e3ead9; color: var(--ink); font: 16px/1.45 var(--body); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #9b5215; outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.world {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1.5vh, 18px);
  height: 100vh;
  height: 100dvh;
  min-height: 275px;
  padding: max(9px, env(safe-area-inset-top)) max(var(--edge), env(safe-area-inset-right))
    max(9px, env(safe-area-inset-bottom)) max(var(--edge), env(safe-area-inset-left));
  background: radial-gradient(ellipse at 50% 35%, #f9f7e9, #e2ead8 75%);
}
.world-brand, .scene-footer {
  max-width: 1800px;
  width: 100%;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  color: #536b51;
  font-size: clamp(10px, 1.15vw, 13px);
  font-weight: 700;
  letter-spacing: .14em;
  margin-bottom: 1px;
}
.brand span { margin-inline: .5em; color: #866322; }
.world-brand h1 {
  font: 500 clamp(28px, 5vw, 62px)/1 var(--display);
  letter-spacing: -.045em;
  text-wrap: balance;
}
.view-controls, .upload-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.view-controls { justify-content: flex-end; }
.view-controls button, .scene-footer .plain {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f7ec;
  padding: 8px 12px;
  font-size: 14px;
  min-height: 40px;
}
.view-controls button[aria-pressed="true"] { color: #fffbee; background: var(--leaf); border-color: var(--leaf); }
.scene-shell {
  display: grid;
  place-items: center;
  min-height: 0;
  container-type: size;
}
.scene {
  width: min(100%, 177.77cqh, 1800px);
  aspect-ratio: 16 / 9;
  position: relative;
  isolation: isolate;
  max-height: 100%;
  container-type: size;
  border-radius: clamp(14px, 2.4vw, 28px);
  background: #e8edce;
  box-shadow: 0 1px 2px #213b3126, 0 14px 42px #36584222;
}
.forest-art { position: absolute; width: 100%; height: 100%; object-fit: fill; border-radius: inherit; }
.scene-footer { align-items: flex-end; }
.scene-info { display: grid; gap: 6px; justify-items: start; max-width: 540px; }
.scene-info p, .upload-copy p { color: var(--muted); }
.world-upload { display: flex; align-items: center; gap: 10px; }
#qr-link, .qr-popup a { display: block; flex: none; background: white; border-radius: 9px; overflow: hidden; }
#qr-link img, .qr-popup img { display: block; image-rendering: pixelated; }
#qr-link img { width: 72px; height: 72px; }
#upload-link {
  display: block;
  text-align: center;
  padding: 9px 13px;
  min-height: 40px;
  border-radius: 12px;
  background: var(--leaf);
  color: #ffffef;
  text-decoration: none;
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
}
@media (max-width: 700px) and (orientation: portrait) {
  .world { padding-top: max(14px, env(safe-area-inset-top)); }
  .world-brand { flex-wrap: wrap; align-items: flex-start; }
  .world-brand h1 { font-size: clamp(34px, 8.5vw, 50px); }
  .view-controls { justify-content: start; }
  .world-brand button, .scene-footer .plain { font-size: 13px; min-height: 38px; }
  .scene-shell { position: relative; isolation: isolate; overflow: clip; border-radius: 24px; background: #d9e8d3; }
  .scene-shell::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: -16px;
    background: center / cover no-repeat url('/adastra-lake.webp');
    filter: blur(20px);
    opacity: .44;
  }
  .scene-footer { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .scene-info { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
  .scene-info p { font-size: 13px; }
  .scene-info .plain { flex: none; padding-inline: 7px; max-width: 115px; }
  .world-upload { padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: #f4f6e9; }
  #qr-link img { width: 58px; height: 58px; }
  #upload-link { font-size: 13px; padding-inline: 8px; min-height: 38px; }
}
@media (max-height: 465px) and (orientation: landscape) {
  .world { gap: 5px; }
  .world-brand h1 { font-size: clamp(22px, 4.6vh, 36px); }
  .scene-footer .plain, .world-brand button, #upload-link { min-height: 34px; padding-block: 5px; font-size: 12px; }
  #qr-link img { width: 45px; height: 45px; }
  .scene-info p { font-size: 12px; }
}
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { border-radius: 10px; border: 1px solid var(--line); background: #f1f5e9; padding: 7px 11px; }
.tabs button[aria-pressed="true"] { background: var(--leaf); color: #fffbee; }
#drawing { width: 100%; height: auto; touch-action: none; border: 1px solid var(--line); background: #fffdf4; border-radius: 12px; }

.popup{color-scheme:light;width:min(calc(100vw - 24px),540px);max-height:92dvh;overflow:auto;border:1px solid #afbcaa;border-radius:22px;padding:22px;background:#f9f7ec;color:#244538;box-shadow:0 16px 80px #1c362988}.popup::backdrop{background:#142d24a0;backdrop-filter:blur(5px)}.dialog-top{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:16px}.popup h2{font:500 29px/1.12 var(--display)}.dialog-note{font-size:13px;color:#4c6254;margin:12px 0;line-height:1.6}.eyebrow{font-size:9px;letter-spacing:.18em;color:#526a53;margin-bottom:6px}.quiet{background:transparent;border:1px solid #8fa599;border-radius:50%;width:35px;height:35px;font-size:25px;flex:none}.primary{background:#e9c473;border:0;border-radius:11px;color:#21392c;font-weight:700;padding:13px 15px;min-height:48px;width:100%}.primary:disabled{opacity:.45}.plain{background:#ecf1e4;border:1px solid #afbdac;border-radius:8px;padding:7px 10px;font-size:13px;min-height:38px}.plain:hover{background:#e1eadb}.plain[aria-pressed=true]{border-color:#80521b;color:#80521b}.danger{color:#982b37}.qr-popup{text-align:center}.qr-popup a{width:min(100%,360px);margin:0 auto 18px}.qr-popup img{display:block;width:100%;aspect-ratio:1}.photo-area{display:grid;place-items:center;width:100%;aspect-ratio:560/400;border:1px solid #9cae9b;border-radius:12px;background-color:#eaeedf;background-image:linear-gradient(45deg,#9bb09c2c 25%,transparent 25%),linear-gradient(-45deg,#9bb09c2c 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#9bb09c2c 75%),linear-gradient(-45deg,transparent 75%,#9bb09c2c 75%);background-size:24px 24px;background-position:0 0,0 12px,12px -12px,-12px 0;font-size:14px;color:#486452}.photo-area canvas{width:100%;height:auto;border-radius:12px;touch-action:none}#photo[data-cropping],#photo[data-outlining]{cursor:crosshair}.edit-tools{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin-top:8px}.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 #80521b}.brush-size{display:flex;gap:5px;align-items:center;font-size:12px}.brush-size input{width:75px}.edit-status{font-size:13px;min-height:20px;color:#744626;margin:12px 0}.report-link{display:block;text-align:center;background:none;border:0;font-size:12px;color:#395748;padding:8px;margin:8px auto 0;text-decoration:underline;text-underline-offset:3px}.parts-list{display:grid;gap:8px}.parts-list:empty::after{content:'В альбоме пока нет снимков';color:#4c6254}.part-row{display:flex;gap:8px;align-items:center;padding:8px;border:1px solid #aab9aa;border-radius:11px;flex-wrap:wrap}.part-row figure{display:grid;place-items:center;width:48px;height:48px;margin:0;background:#e6ebdc;border-radius:8px}.part-row img{max-width:44px;max-height:44px}.part-title{flex:1;min-width:90px;font-size:13px}.part-row button{font-size:12px}.host-actions{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0}.toast{position:fixed;z-index:10;left:50%;top:46%;transform:translate(-50%,-50%);max-width:calc(100% - 32px);width:max-content;text-align:center;background:#214536f2;color:#fff0c4;padding:15px 22px;border:1px solid #dbc88d80;border-radius:15px;box-shadow:0 10px 45px #020a1e;font-weight:600}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

.popup .dialog-note,.popup .plain,.popup .part-title,.popup .report-link{font-size:14px}
.world { background: radial-gradient(ellipse at 50% 26%, #1e3b40, #0b1b25 72%); color: #f5e5bc; }
.brand, .scene-info p, .upload-copy p { color: #e5e1c8; }
.brand span { color: #ecd089; }
.scene { overflow: hidden; background: #163637; box-shadow: 0 18px 52px #0006; }
.forest-art { object-fit: cover; }
.scene-footer .plain, .view-controls button { background: #152d35; border-color: #57746e; color: #f5e9c7; }
.view-controls button[aria-pressed="true"] { background: #e9ca80; color: #142d32; }
.scene-footer .plain.album-ready { box-shadow: 0 0 16px #ffdc77; }
#upload-link { background: #e9ca80; color: #142d32; }
:focus-visible { outline-color: #f3be54; }
.lake-shimmer {
  position: absolute; inset: 46% 10% 19% 18%; pointer-events: none;
  background: radial-gradient(ellipse at center, #b2f2ff59, transparent 68%);
  mask-image: repeating-linear-gradient(180deg, transparent 0 6%, #000 10%, transparent 13%);
  opacity: .25; animation: shimmer 8s ease-in-out infinite alternate;
}
@keyframes shimmer { to { opacity: .63; transform: translateX(9%) scaleY(.93); } }
.moss-button {
  position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%);
  border: 1px solid #dbed9799; border-radius: 999px; padding: 8px 16px;
  font-size: clamp(13px, 2.25cqw, 17px); font-weight: 650; min-height: 40px;
  white-space: nowrap; color: #fff8d7; background: #19352ae8; box-shadow: 0 2px 18px #080d11;
}
.moss-button:hover, [data-moss] .moss-button { color: #162921; background: #e0ef9e; }
.moss-light {
  position: absolute; inset: 70% 6% 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at 16% 82%, #8fef72cc, transparent 37%),
              radial-gradient(ellipse at 55% 58%, #df8df6b0, transparent 38%),
              radial-gradient(ellipse at 85% 50%, #77e6ffcc, transparent 39%);
  mix-blend-mode: screen;
}
[data-moss] .moss-light { animation: moss-colors 4.45s ease-in-out both; }
@keyframes moss-colors {
  0%, 100% { opacity: 0; filter: hue-rotate(0deg); }
  22% { opacity: .76; }
  70% { opacity: .88; filter: hue-rotate(145deg); }
}
#parts-dialog { width: min(calc(100vw - 24px), 750px); position: fixed; }
.album-pages { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(137px,100%),1fr)); gap: clamp(10px, 2vw, 17px); }
.album-card { min-width: 0; border-radius: 8px; background: #fff8de; border: 1px solid #d8c790; box-shadow: 0 0 15px #ffce715c; padding: 7px; }
.album-card[data-active], .album-card:focus-within { box-shadow: 0 0 21px #e9aa3d; border-color: #af7322; }
.portal-card {
  width: 100%; display: grid; gap: 5px; place-items: center;
  color: #294332; border: 0; border-radius: 5px; padding: 6px; font-size: 13px; font-weight: 650;
  background: radial-gradient(ellipse at 50% 29%, #fbdf8a, #f6ebc8 70%);
}
.portal-card:hover { background: #f9e4a1; }
.portal-card img { display: block; width: 100%; height: 96px; object-fit: contain; }
.card-report { display: block; margin-inline: auto; min-height: 30px; background: transparent; border: 0; color: #586258; font-size: 11px; text-decoration: underline; }
.album-arrival {
  position: fixed; inset: 0; z-index: 3; display: grid; place-items: center;
  pointer-events: none; background: radial-gradient(circle, #ffdb8adf, #2d423a65 52%, transparent 76%);
  animation: album-glow 3.3s ease-in-out both;
}
.album-arrival img {
  width: min(42vw, 265px); height: min(42vh, 245px); object-fit: contain;
  filter: drop-shadow(0 9px 23px #473e277a); animation: album-reveal 3.3s ease-in-out both;
}
@keyframes album-glow { 0%, 71% { opacity: 1; } 100% { opacity: 0; } }
@keyframes album-reveal { 0%, 30% { transform: scale(1.16); } 100% { transform: scale(.47); } }
.portal-popup {
  color-scheme: dark; color: #ffedc8; width: min(94vw, 1020px); max-height: 95dvh;
  padding: clamp(11px, 2.5vw, 22px); border: 1px solid #8693ba; border-radius: 20px;
  background: #111c3b; overflow: auto;
}
.portal-popup::backdrop { background: #0a162ae8; }
.sky-header, .sky-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sky-header h2 { font: 500 clamp(28px, 5vw, 48px)/1 var(--display); }
.sky-kicker { font-size: 10px; letter-spacing: .21em; color: #efe3b7; }
.sky-back { border: 1px solid #818eaf; background: #252f52; color: #ffedc8; border-radius: 10px; padding: 8px 12px; min-height: 40px; white-space: nowrap; }
#sky-hint { font-size: 14px; color: #e5decc; margin-block: 9px; }
.sky {
  position: relative; isolation: isolate; overflow: hidden; border-radius: 16px; height: clamp(250px, 56dvh, 530px);
  background: radial-gradient(ellipse at 65% 76%, #5d62a2, transparent 66%),
              radial-gradient(ellipse at 38% 95%, #ad8eaa, transparent 70%),
              linear-gradient(150deg, #111731, #202b56 61%, #302d57);
}
.cloud-layer, .star-field { position: absolute; inset: 0; }
.cloud-layer {
  opacity: .82; transform: scale(1.15); animation: cloud-drift 13s ease-in-out alternate infinite;
  background: radial-gradient(ellipse at 6% 87%, #e1c8e3 0 3%, #b3a4cd 12%, transparent 19%),
              radial-gradient(ellipse at 29% 98%, #fce4ef 4%, #cec1dc 15%, transparent 22%),
              radial-gradient(ellipse at 88% 86%, #e5d8f8 3%, #9c97c3 14%, transparent 22%),
              radial-gradient(ellipse at 72% 107%, #f4d9eb 8%, #c4afcf 23%, transparent 30%);
}
@keyframes cloud-drift { to { transform: scale(1.15) translateX(6%); } }
.cloud-ride {
  position: absolute; left: 38%; bottom: 7%; width: 24%; height: 24%; display: grid; place-content: center; pointer-events: none;
  background: radial-gradient(ellipse at 50% 85%, #ffe8ef 3%, #ccbee4 33%, transparent 70%);
  animation: cloud-ride 8s ease-in-out alternate infinite;
}
.cloud-ride img { width: min(16vw, 92px); height: min(18dvh, 100px); object-fit: contain; filter: drop-shadow(0 0 10px #fff1cf); }
@keyframes cloud-ride { to { transform: translate(32%, -32%); } }
.memory-star {
  position: absolute; z-index: 1; left: var(--x); top: var(--y); transform: translate(-50%,-50%);
  display: grid; place-content: center; width: 47px; height: 47px; padding: 0;
  background: #1b244da8; border: 1px solid #fff2bb59; border-radius: 50%;
  font: 32px/1 Georgia,serif; color: #fff3af; text-shadow: 0 0 15px #ffd166;
  animation: twinkle 2.2s ease-in-out var(--phase) infinite alternate;
}
.memory-star:hover, .memory-star:focus-visible { background: #41436b; color: #fff; }
.memory-star.caught { opacity: 0; animation: none; transform: translate(-50%,-50%) scale(.45); transition: transform .26s, opacity .26s; }
@keyframes twinkle { to { text-shadow: 0 0 5px #ffe478, 0 0 21px #ffc152; } }
.sky-footer { min-height: 49px; padding-top: 9px; font-size: 14px; }
#star-count { flex: none; white-space: nowrap; padding: 5px 10px; border-radius: 8px; background: #303456; }
#star-count::before { content: '✦ '; color: #ffe293; }
#world[data-calm] .lake-shimmer, [data-calm] .cloud-layer, [data-calm] .cloud-ride, [data-calm] .memory-star { animation: none; }
#world[data-calm][data-moss] .moss-light { animation: none; opacity: .85; }
@media (max-width: 700px) and (orientation: portrait) {
  .scene-shell { background: #142e38; }
  .world-upload { background: #142932; border-color: #55716b; }
}
@media (max-height: 465px) and (orientation: landscape) {
  .sky { height: 51dvh; min-height: 150px; }
  .moss-button { min-height: 32px; padding: 4px 12px; }
}
