:root {
  color-scheme: dark;
  --ink:#21150f;
  --panel:#2d1d15;
  --sand:#f9e7ca;
  --muted:#cfb89c;
  --line:#a67b555d;
  --gold:#ffc681;
  --mint:#aad3b2;
  --display:Georgia,"Times New Roman",serif;
  --body:"Segoe UI",Arial,sans-serif;
}
* { box-sizing:border-box; }
[hidden] { display:none!important; }
body { margin:0; background:#20140e; color:var(--sand); font:16px/1.4 var(--body); }
a,button { -webkit-tap-highlight-color:transparent; }
a { color:inherit; }
button,input,select { font:inherit; }
button { color:inherit; cursor:pointer; }
button:disabled { cursor:default; }
button:focus-visible,a:focus-visible,select:focus-visible,input:focus-visible { outline:3px solid #ffce93; outline-offset:4px; }
h1,h2,p,figure { margin:0; }
.shell {
  width:min(100%, 1680px, max(920px, calc((100svh - 164px) * 2.23)));
  height:100svh;
  margin:auto;
  padding:clamp(10px,1.35vw,24px) clamp(14px,2.2vw,36px) max(11px,env(safe-area-inset-bottom));
  display:grid;
  grid-template-rows:auto minmax(170px,1fr) auto;
  gap:clamp(10px,1.1vw,18px);
}
.masthead { display:grid; grid-template-columns:1fr minmax(0,auto) 1fr; align-items:center; gap:14px; }
.identity { display:flex; align-items:center; gap:10px; color:#e7c49e; font-weight:700; letter-spacing:.105em; font-size:14px; text-transform:uppercase; }
.seal { width:33px;height:33px;display:grid;place-items:center;background:#f0b67714;border:1px solid #eac29682;border-radius:50%;font:700 20px/1 var(--display);letter-spacing:0;color:#ffd3a0; }
.title-block { text-align:center; }
h1 { font:700 clamp(27px,3.2vw,53px)/1.08 var(--display); letter-spacing:-.035em; color:#ffebcc; text-wrap:balance; }
.title-block p { color:var(--muted); margin-top:6px; font-size:14px; }
.view-tools { justify-self:end; display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; }
.plain,.tag,.quiet { background:#38251a; color:var(--sand); border:1px solid var(--line); border-radius:9px; padding:7px 11px; display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:41px; font-weight:600; text-decoration:none; }
.plain:hover,.tag:hover,.quiet:hover { background:#4a3324; }
.plain[aria-pressed=true] { border-color:var(--mint); color:var(--mint); }
.small { padding:7px 9px; min-height:37px; font-size:14px; white-space:nowrap; }
#fullscreen { width:39px; font-size:21px; }
#calm > span:first-child { font-size:20px; line-height:1; }
.stage {
  width:100%;
  min-height:0;
  position:relative;
  overflow:hidden;
  isolation:isolate;
  background:#301b11 url("/shelf.webp") center 63%/cover no-repeat;
  border:1px solid #d89e6178;
  border-radius:17px;
  box-shadow:0 15px 45px #110a05a1, inset 0 0 0 1px #160b06;
}
.stage.ready { cursor:pointer; }
.stage canvas,.film,.film video { position:absolute; inset:0; width:100%; height:100%; display:block; }
.stage canvas { touch-action:manipulation; }
.stage::after { position:absolute; inset:0; content:""; pointer-events:none; background:linear-gradient(0deg,#20110aaa,transparent 17%); }
.film { background:#201109; z-index:5; }
.film video { object-fit:cover; }
.film-controls { position:absolute; display:flex; gap:8px; right:12px;bottom:12px; }
.film-controls button { background:#291b14ec; }
.scene-caption { position:absolute; bottom:13px;left:14px; z-index:2; }
.tag { background:#24160de8; font-size:14px; border-radius:999px; min-height:33px; padding:5px 10px; }
.presence { width:7px;height:7px;border-radius:50%;background:var(--mint); }
.waltz-progress { position:absolute; z-index:3; top:14px;left:50%;transform:translateX(-50%); padding:8px 13px 6px; background:#2a1810ed;border:1px solid #e8b8849c;border-radius:12px;display:grid;grid-template-columns:1fr auto;align-items:center;gap:2px 12px;font-size:14px;font-weight:600;white-space:nowrap; }
#waltz-time { color:#ffd29b; font-variant-numeric:tabular-nums; }
progress { grid-column:1/-1; width:100%; height:4px; accent-color:var(--gold); }
.dock { display:flex; align-items:center;justify-content:space-between; gap:18px; }
.play-controls { display:flex; align-items:center; gap:14px; }
.play-controls p,.upload-card p { color:var(--muted); font-size:14px; }
.primary { min-height:46px;padding:10px 17px;font-weight:750;color:#2c190d;background:#ffc98a;border:1px solid #fbd6a888;border-radius:10px; }
.primary:hover:not(:disabled) { background:#ffdbab; }
.primary:disabled { opacity:.55; }
.jump { display:flex;align-items:center;gap:9px;white-space:nowrap; }
.jump span { font-size:20px; }
.upload-card { display:flex;align-items:center;gap:12px;padding:6px 13px 6px 6px;border:1px solid var(--line);border-radius:13px;background:#2b1c14; flex:none; }
#qr-link { display:block;flex:none;background:#fff;border-radius:7px;overflow:hidden;width:70px;height:70px; }
#qr { width:100%;height:100%;display:block; }
.upload-title { color:#ffe6be; font-weight:750; font-size:16px; text-decoration:none; }
.upload-title:hover,.text-button:hover { text-decoration:underline; }
.upload-card p { font-size:13px; margin:2px 0; }
.text-button { border:0;background:none;color:#f6ba7b;text-align:left;padding:0;min-height:23px;font-size:14px;font-weight:650; }
.sr-only { position:absolute; width:1px;height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.popup,.join-panel { width:min(calc(100% - 24px),540px); padding:22px;border:1px solid #b0845fa6;border-radius:18px;color:var(--sand);background:#2b1c14;box-shadow:0 22px 70px #140a06c2; }
.popup { max-height:91dvh; overflow:auto; }
.popup::backdrop { background:#15100dc4; backdrop-filter:blur(3px); }
.dialog-top { display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px; }
.popup h2 { font:700 clamp(23px,4vw,31px)/1.1 var(--display); }
.dialog-note { color:var(--muted); font-size:14px;line-height:1.45;margin:9px 0; }
.eyebrow { color:var(--gold); font-size:12px;letter-spacing:.125em;font-weight:700;margin-bottom:5px; }
.quiet { width:36px;height:36px;min-height:36px; border-radius:50%;font-size:23px;padding:0;flex:none; }
.danger { color:#ffc1ad; }
.qr-popup { text-align:center; }
.qr-popup a { display:block;width:min(100%,360px);margin:0 auto 13px;border-radius:12px;background:white;overflow:hidden; }
.qr-popup img { display:block;width:100%;aspect-ratio:1; }
.symbol-picker { display:grid; gap:4px; font-weight:650; }
select { padding:9px 12px; border:1px solid #a6896d; border-radius:8px; background:#3e2a1f; color:#fff0d3; font-size:16px; min-width:0; }
.photo-area { display:grid;place-items:center;aspect-ratio:560/400;border:1px solid var(--line);border-radius:10px;color:#dfc5a5;background:#402f22 repeating-conic-gradient(#e7c19712 0% 25%,transparent 0% 50%) 50%/20px 20px;overflow:hidden; }
.photo-area canvas { width:100%;height:auto;touch-action:none; }
#photo[data-cropping],#photo[data-outlining] { cursor:crosshair; }
.edit-tools,.host-actions { display:flex; gap:7px;flex-wrap:wrap;align-items:center;margin-top:10px; }
.edit-tools .plain { font-size:14px; min-height:37px; }
.upload-label { position:relative; cursor:pointer; }
.upload-label input { position:absolute; inset:0; width:100%; opacity:0; cursor:pointer; }
.upload-label:focus-within { outline:3px solid var(--gold);outline-offset:3px; }
.brush-size { display:flex;align-items:center;gap:4px;font-size:14px; }
.brush-size input { width:70px; }
.edit-status { color:#ffcf8e;font-size:14px; margin:8px 0; min-height:11px; }
.editor .primary { width:100%; }
.report-link { color:var(--muted); text-decoration:underline; background:none; border:0; padding:9px; margin:4px auto 0; display:block; font-size:14px; }
.parts-list { display:grid;gap:7px;margin-top:12px; }
.parts-list:empty::after { content:"Здесь пока нет поделок."; color:var(--muted); }
.part-row { display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:7px 8px;border:1px solid var(--line);border-radius:10px; }
.part-row figure { display:grid;place-items:center;width:48px;height:48px;background:#4a3427;border-radius:8px; }
.part-row img { max-width:44px;max-height:44px; }
.part-row span { flex:1; min-width:120px; }
.part-row .plain { font-size:14px;min-height:35px; }
.toast { position:fixed; left:50%; bottom:max(12px,env(safe-area-inset-bottom)); transform:translateX(-50%); max-width:calc(100vw - 24px); width:max-content; z-index:20; background:#482f1f;border:1px solid #ba8c63;border-radius:12px;box-shadow:0 8px 26px #180c06b0;padding:9px 15px;font-weight:650; }
.upload-landing { min-height:100svh; display:grid;place-items:center;padding:10px;background:linear-gradient(#1c1009b0,#1d1008aa),url("/shelf.webp") center/cover; }
.join-panel { display:grid;gap:13px; }
.join-panel h1 { font-size:clamp(32px,7vw,50px); }
.join-panel p { color:var(--muted); }
#stage:fullscreen { width:100vw;height:100vh;border:0;border-radius:0; }
@media (max-width:1150px) { .long-label { display:none; } }
@media (max-width:740px) and (orientation:portrait) {
  .shell { align-content:start; height:auto;min-height:100svh;grid-template-rows:auto auto auto;padding:14px 12px 15px;gap:12px; }
  .masthead { grid-template-columns:1fr auto;gap:11px 4px; }
  .identity { font-size:12px; gap:7px; }
  .seal { width:28px;height:28px;font-size:17px; }
  .title-block { order:3;grid-column:1/-1; justify-self:start;text-align:left; }
  h1 { font-size:clamp(30px,8vw,43px); line-height:1.02; text-wrap:wrap; }
  .title-block p { margin-top:5px; }
  .view-tools { flex-wrap:nowrap; gap:4px; }
  .small { min-height:34px; padding:5px 7px; font-size:13px; }
  #fullscreen { width:32px; font-size:19px; }
  .stage { aspect-ratio:1.04; height:auto; max-height:44svh; min-height:211px;border-radius:13px; }
  .stage::after { background:linear-gradient(0deg,#20110abb,transparent 23%); }
  .film video { object-fit:contain; }
  .scene-caption { bottom:7px; left:7px; }
  .tag { font-size:13px; min-height:30px; }
  .dock { flex-direction:column; align-items:stretch; gap:10px; }
  .play-controls { gap:8px; justify-content:space-between; }
  .play-controls p { font-size:13px; max-width:143px; }
  .jump { padding:8px 10px;gap:6px; }
  .upload-card { gap:10px; }
  #qr-link { width:60px;height:60px; }
  .popup { padding:15px; }
}
@media (max-height:510px) and (orientation:landscape) {
  .shell { padding:7px 12px; gap:6px; }
  .masthead h1 { font-size:27px; }
  .title-block p { font-size:12px;margin-top:1px; }
  .upload-card { padding:4px 9px 4px 5px; }
  #qr-link { height:47px;width:47px; }
  .upload-card p { display:none; }
  .play-controls p { max-width:190px;font-size:13px; }
  .jump { min-height:40px;padding:4px 9px; }
}
@media (max-width:360px) {
  .shell { padding:10px 10px 13px;gap:9px; }
  .jump { font-size:15px; }
  .view-tools { gap:3px; }
}
@media (prefers-reduced-motion:reduce) { * { scroll-behavior:auto; } }
