/* 3DMap Studio · Rev C-132 */
@font-face { font-family: 'Baloo 2'; font-weight: 700; font-display: swap; src: url(../fonts/baloo-2-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Baloo 2'; font-weight: 800; font-display: swap; src: url(../fonts/baloo-2-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 400; font-display: swap; src: url(../fonts/nunito-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 600; font-display: swap; src: url(../fonts/nunito-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-display: swap; src: url(../fonts/nunito-latin-800-normal.woff2) format('woff2'); }

:root {
  --bg: #12132B; --panel: #1E2047; --raised: #2A2D5E; --line: #3A3D74;
  --ink: #F6F4FF; --muted: #B9B8E0; --canvas: #050616;
  --pink: #FF5FA2; --yellow: #FFC93C; --cyan: #3ED2FF; --mint: #6EF0B0;
  --display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --text: 'Nunito', system-ui, sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--text); overscroll-behavior: none; }
body { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; overflow: hidden; }
input, textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .38; cursor: default; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; margin: 0; line-height: 1.05; }
svg.i { flex: none; display: block; }

#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; }

/* ---------- buttons ---------- */
.icon-btn { width: 46px; height: 46px; border-radius: 16px; background: var(--panel); display: grid; place-items: center; flex: none; }
.icon-btn.small { width: 40px; height: 40px; border-radius: 14px; }
.btn { height: 56px; padding: 0 18px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--display); font-weight: 800; font-size: 20px; background: var(--raised); white-space: nowrap; }
.btn.primary { background: var(--pink); color: var(--bg); }
.btn.quiet { background: var(--raised); color: var(--ink); }
.btn.magic { background: transparent; border: 2px solid var(--mint); color: var(--mint); font-size: 18px; }
.btn.big { height: 64px; width: 100%; font-size: 23px; border-radius: 20px; }
.btn.small { height: 40px; font-size: 16px; padding: 0 14px; border-radius: 14px; }
.grow { flex: 1; }
.saying { animation: saying .9s ease-out; }
@keyframes saying { 0% { box-shadow: 0 0 0 0 rgba(255, 201, 60, .9); } 100% { box-shadow: 0 0 0 16px rgba(255, 201, 60, 0); } }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- home ---------- */
.home { display: flex; flex-direction: column; gap: 16px; padding: calc(22px + var(--st)) calc(20px + var(--sr)) calc(12px + var(--sb)) calc(20px + var(--sl)); overflow-y: auto; }
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 27px; }
.ver-chip { font-size: 13px; font-weight: 800; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.tagline { margin: -6px 0 0; font-size: 17px; color: var(--muted); }
.home-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; grid-template-rows: minmax(150px, 1.35fr) minmax(120px, 1fr) auto auto; max-height: 1000px; grid-template-areas: "make make" "myart tv" "wall wall" "recent recent"; }
.home-grid > button { border-radius: 24px; color: var(--bg); text-align: left; display: flex; flex-direction: column; justify-content: space-between; padding: 18px; }
.home-grid > button > span { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1; }
.tile-make { grid-area: make; background: var(--pink); border-radius: 28px !important; padding: 22px !important; }
.tile-make > span { font-size: 42px !important; }
.tile-myart { grid-area: myart; background: var(--yellow); }
.tile-tv { grid-area: tv; background: var(--cyan); }
.tile-wall { grid-area: wall; background: var(--panel) !important; border: 2px solid var(--line); color: var(--ink) !important; flex-direction: row !important; align-items: center; justify-content: flex-start !important; gap: 14px; padding: 16px 18px !important; border-radius: 22px !important; }
.wall-text { display: flex; flex-direction: column; gap: 2px; font-family: var(--text) !important; font-size: 14px !important; }
.wall-text b { font-family: var(--display); font-size: 21px; }
.wall-text small { color: var(--muted); font-size: 14px; font-weight: 600; }
.recent-wrap { grid-area: recent; display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.recent-label { font-weight: 800; font-size: 15px; color: var(--muted); }
.recent-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.recent-art { aspect-ratio: 16/9; border-radius: 16px; overflow: hidden; background: var(--canvas); }
.recent-art img, .art-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noimg { display: grid; place-items: center; width: 100%; height: 100%; font-weight: 800; font-size: 13px; color: var(--muted); }
.grownups { align-self: center; display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; color: var(--muted); padding: 10px 14px; border-radius: 14px; }
.warn { background: #3a1430; border: 1px solid var(--pink); border-radius: 14px; padding: 12px; font-weight: 600; }

@media (orientation: landscape) {
  .home { gap: 12px; }
  .home-grid { grid-template-columns: 1.25fr 1fr 1fr; grid-template-rows: minmax(110px, 1fr) auto auto; grid-template-areas: "make myart tv" "make wall wall" "recent recent recent"; }
  .recent-row { grid-template-columns: repeat(3, minmax(0, 240px)); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .home { padding-top: calc(12px + var(--st)); gap: 10px; }
  .tagline { display: none; }
  .home-grid { grid-template-rows: minmax(0, 1fr) auto; }
  .tile-make > span { font-size: 36px !important; }
  .tile-make svg { width: 52px; height: 52px; }
  .home-grid > button > span { font-size: 24px; }
  .recent-wrap { display: none !important; }
  .grownups { position: absolute; right: calc(8px + var(--sr)); top: calc(8px + var(--st)); margin: 0; }
  .ver-chip { margin-right: 120px; }
}
@media (min-width: 700px) and (min-height: 700px) {
  .home { padding-left: calc(28px + var(--sl)); padding-right: calc(28px + var(--sr)); }
  .home-grid > button > span { font-size: 34px; }
  .tile-make > span { font-size: 54px !important; }
  .wall-text b { font-size: 26px; }
  .wall-text small { font-size: 16px; }
}

/* ---------- my art ---------- */
.myart { display: flex; flex-direction: column; padding: var(--st) var(--sr) 0 var(--sl); }
.bar { display: flex; align-items: center; gap: 12px; padding: 16px; }
.bar h1 { flex: 1; font-size: 30px; }
.art-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; padding: 4px 16px 16px; align-content: start; }
.art-open { display: block; width: 100%; aspect-ratio: 16/9; border-radius: 16px; overflow: hidden; background: var(--canvas); }
.art-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 2px 0; }
.art-meta b { display: block; font-family: var(--display); font-size: 17px; line-height: 1.1; }
.art-meta small { color: var(--muted); font-size: 13px; }
.myart-foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--sb)); border-top: 1px solid var(--line); }
.myart-foot .btn { flex: 1; font-size: 17px; height: 52px; }
.empty-note { color: var(--muted); font-size: 15px; grid-column: 1 / -1; }
.empty-note.big { font-size: 18px; text-align: center; padding: 40px 0; }

/* ---------- studio ---------- */
.studio { display: grid; padding: var(--st) var(--sr) 0 var(--sl); }
.st-top { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 12px 16px 10px; }
.st-title { flex: 1; min-width: 0; font-family: var(--display); font-weight: 800; font-size: 22px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; visibility: hidden; }
.btn-show { height: 46px; padding: 0 18px; border-radius: 16px; background: var(--pink); color: var(--bg); font-family: var(--display); font-weight: 800; font-size: 21px; display: flex; align-items: center; gap: 8px; flex: none; }
.st-wrap { grid-area: stage; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.st-stage { position: relative; border-radius: 22px; overflow: hidden; background: var(--canvas); flex: none; transition: box-shadow .2s; }
canvas.art { position: absolute; left: 0; top: 0; display: block; }
.st-over { position: absolute; inset: 0; touch-action: none; }
.st-chip { position: absolute; left: 12px; bottom: 12px; font-weight: 800; font-size: 13px; background: rgba(18, 19, 43, .8); border-radius: 999px; padding: 6px 12px; pointer-events: none; }
.sel { position: absolute; border: 2px dashed var(--yellow); border-radius: 8px; pointer-events: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.sel-handle { position: absolute; right: -15px; bottom: -15px; width: 30px; height: 30px; border-radius: 50%; background: var(--yellow); border: 4px solid var(--bg); pointer-events: auto; touch-action: none; }
.sel-handle::before { content: ''; position: absolute; inset: -12px; }
.drop-ring { position: absolute; border: 3px solid var(--yellow); border-radius: 16px; pointer-events: none; box-shadow: 0 0 0 5px rgba(255, 201, 60, .25), 0 0 30px rgba(255, 201, 60, .5); }
.drop-ring::after { content: 'Let go to fill'; position: absolute; left: 50%; top: 100%; transform: translate(-50%, 8px); white-space: nowrap; background: var(--yellow); color: var(--bg); font-weight: 800; font-size: 13px; border-radius: 999px; padding: 4px 10px; }
.fitting .st-stage { background: #000; box-shadow: 0 0 0 6px var(--raised); }
.fitting .st-stage::after { content: 'On the TV'; position: absolute; right: 10px; top: 10px; font-weight: 800; font-size: 12px; background: rgba(18, 19, 43, .8); border-radius: 999px; padding: 4px 10px; pointer-events: none; }
.fitting .st-chip { background: var(--yellow); color: var(--bg); left: auto; right: 10px; }

.st-under { grid-area: under; display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 6px 16px; }
.turn-hint { margin: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; font-size: 14px; }

.tools-pop { background: var(--ink); color: var(--bg); border-radius: 22px; padding: 6px; display: flex; gap: 4px; z-index: 3; box-shadow: 0 8px 28px rgba(0, 0, 0, .45); }
.tools-pop button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; border-radius: 16px; font-weight: 800; font-size: 13px; min-width: 64px; }
.tools-pop button:active { background: #E2DFF5; }
.tools-pop .danger { color: #A3123F; }
.tools-pop.row { flex-direction: row; }
.tools-pop.row:not(.floating) { width: 100%; justify-content: space-between; }
.tools-pop.row:not(.floating) button { flex: 1; min-width: 0; }
.tools-pop.col { flex-direction: column; }
.tools-pop.col button { width: 76px; }
.tools-pop.floating { position: absolute; }

.st-panel { grid-area: panel; background: var(--panel); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.st-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px 14px 4px; }
.tab-btn, .rail-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 14px; font-weight: 800; font-size: 13px; }
.tab-btn.on, .rail-btn.on { background: var(--yellow); color: var(--bg); }
.st-phead { display: none; align-items: center; justify-content: space-between; padding: 14px 16px 2px; }
.st-phead h2 { font-size: 26px; }
.st-pbody { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 16px calc(16px + var(--sb)); }
.st-rail, .st-side, .st-tucked { display: none; }

/* phone upright */
.studio[data-layout="portrait"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); grid-template-areas: "top" "stage" "under" "panel"; }
.studio[data-layout="portrait"] .st-wrap { padding: 0 16px; }
.studio[data-layout="portrait"] .st-panel { border-radius: 28px 28px 0 0; }

/* phone sideways: rail | canvas | panel | buttons */
.studio[data-layout="wide"] { grid-template-columns: 64px minmax(0, 1fr) auto 76px; grid-template-rows: minmax(0, 1fr); grid-template-areas: "rail stage panel side"; gap: 8px; padding: calc(8px + var(--st)) calc(8px + var(--sr)) calc(8px + var(--sb)) calc(8px + var(--sl)); }
.studio[data-layout="wide"] .st-top, .studio[data-layout="wide"] .st-under, .studio[data-layout="wide"] .st-tabs { display: none; }
.studio[data-layout="wide"] .st-rail { grid-area: rail; display: flex; flex-direction: column; gap: 6px; }
.studio[data-layout="wide"] .rail-btn { background: var(--panel); padding: 8px 0; font-size: 11px; }
.studio[data-layout="wide"] .rail-btn.on { background: var(--yellow); }
.studio[data-layout="wide"] .st-side { grid-area: side; display: flex; flex-direction: column; gap: 6px; }
.studio[data-layout="wide"] .st-side .icon-btn { width: 100%; height: 50px; border-radius: 14px; }
.st-side .grow { flex: 1; }
.btn-show.tall { height: 96px; flex-direction: column; justify-content: center; gap: 4px; font-size: 18px; padding: 0; border-radius: 16px; width: 100%; }
.studio[data-layout="wide"] .st-panel { width: 0; border-radius: 20px; }
.studio[data-layout="wide"].panel-open .st-panel { width: min(330px, 44vw); }
.studio[data-layout="wide"] .st-phead { display: flex; padding-top: 10px; }
.studio[data-layout="wide"] .st-phead h2 { font-size: 22px; }
.studio[data-layout="wide"] .st-pbody { padding-bottom: 12px; }
.studio[data-layout="wide"] .st-stage { border-radius: 18px; }

/* tablet: header, rail | canvas | panel that tucks away */
.studio[data-layout="tablet"] { grid-template-columns: 84px minmax(0, 1fr) auto; grid-template-rows: 70px minmax(0, 1fr); grid-template-areas: "top top top" "rail stage panel"; column-gap: 16px; padding: var(--st) calc(16px + var(--sr)) calc(16px + var(--sb)) calc(16px + var(--sl)); }
.studio[data-layout="tablet"] .st-top { padding: 0; }
.studio[data-layout="tablet"] .st-title { visibility: visible; }
.studio[data-layout="tablet"] .icon-btn { width: 50px; height: 50px; }
.studio[data-layout="tablet"] .btn-show { height: 50px; font-size: 22px; padding: 0 22px; }
.studio[data-layout="tablet"] .st-under, .studio[data-layout="tablet"] .st-tabs { display: none; }
.studio[data-layout="tablet"] .st-rail { grid-area: rail; display: flex; flex-direction: column; gap: 8px; }
.studio[data-layout="tablet"] .rail-btn { background: var(--panel); padding: 12px 0; font-size: 14px; border-radius: 18px; }
.studio[data-layout="tablet"] .rail-btn.on { background: var(--yellow); }
.studio[data-layout="tablet"] .st-panel { width: 340px; border-radius: 24px; }
.studio[data-layout="tablet"]:not(.panel-open) .st-panel { display: none; }
.studio[data-layout="tablet"] .st-phead { display: flex; }
.studio[data-layout="tablet"] .st-tucked:not([hidden]) { grid-area: panel; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 64px; border-radius: 20px; background: var(--panel); font-weight: 800; font-size: 14px; }
.st-tucked span { writing-mode: vertical-rl; transform: rotate(180deg); }

/* ---------- panel contents ---------- */
.target { display: flex; align-items: center; gap: 10px; background: var(--raised); border-radius: 16px; padding: 8px 10px; }
.target b { display: block; font-family: var(--display); font-size: 18px; line-height: 1.1; }
.target small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.target-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; color: var(--yellow); flex: none; }
.target.muted .target-ic { color: var(--muted); }
.sub-label { font-weight: 800; font-size: 13px; color: var(--muted); margin: 14px 0 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg); border-radius: 16px; padding: 4px; margin-top: 12px; }
.seg button { height: 46px; border-radius: 12px; font-family: var(--display); font-weight: 800; font-size: 19px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.seg button.on { background: var(--yellow); color: var(--bg); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 42px; padding: 0 14px; border-radius: 999px; background: var(--raised); font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.chip svg.shp { fill: var(--yellow); }
.chip.on { background: var(--ink); color: var(--bg); }
.chip.on svg.shp path { fill: var(--pink); }
.chips.small .chip { height: 38px; font-size: 14px; }

.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pick-note { color: var(--muted); font-size: 14px; font-weight: 600; }
.count { flex: none; font-weight: 800; font-size: 16px; background: var(--pink); color: var(--bg); border-radius: 999px; padding: 7px 14px; }
.count.full { background: var(--yellow); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; margin-top: 12px; }
.pick { position: relative; aspect-ratio: 1; border-radius: 20px; background: var(--raised); display: grid; place-items: center; }
.pick svg.shp path { fill: var(--ink); }
.pick.on { background: var(--line); box-shadow: 0 0 0 4px var(--pink); }
.pick.on svg.shp path { fill: var(--pink); }
.badge { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: var(--pink); color: var(--bg); font-weight: 800; font-size: 15px; display: grid; place-items: center; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.actions.sticky { flex-wrap: nowrap; position: sticky; bottom: -16px; margin: 14px -16px -16px; padding: 12px 16px 16px; background: linear-gradient(to bottom, rgba(30, 32, 71, 0), var(--panel) 30%); }

.recent { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.recent .tile, .recent .sw { flex: none; width: 66px; }
.recent .tile-name { display: none; }
.recent .tile-img { aspect-ratio: 1; }
.recent .sw { height: 66px; }
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 9px; margin-top: 12px; }
.sw { aspect-ratio: 1; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.sw.on, .tile.on .tile-img, .opt.on.sw { outline: 3px solid var(--yellow); outline-offset: 2px; }
.sw-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.sw.small { width: 38px; height: 38px; border-radius: 50%; aspect-ratio: auto; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.tile-grid.four { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); margin-top: 0; }
.tile { display: flex; flex-direction: column; gap: 5px; text-align: left; }
.tile-img { display: block; width: 100%; aspect-ratio: 16/10; border-radius: 14px; background-size: cover; background-position: center; background-color: var(--canvas); }
.tile.photo .tile-img { aspect-ratio: 1; }
.tile-name { font-weight: 800; font-size: 12.5px; line-height: 1.15; }
.photo-actions { display: flex; gap: 10px; margin-top: 12px; }
.big-choice { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--raised); border-radius: 18px; padding: 16px 8px; font-weight: 800; font-size: 15px; }
.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; background: var(--bg); border-radius: 16px; padding: 12px 14px; margin-top: 14px; }
.sliders label { display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: 14px; }
input[type="range"] { width: 100%; height: 32px; accent-color: var(--yellow); touch-action: pan-x; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; flex: 1; min-width: 180px; }
.check input { width: 24px; height: 24px; accent-color: var(--pink); flex: none; }
.check.boxed { background: var(--raised); border-radius: 16px; padding: 12px; min-width: 0; }
.check.boxed span { display: flex; align-items: center; gap: 6px; }

.opt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opt-grid.four { grid-template-columns: repeat(4, 1fr); margin-top: 12px; }
.opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 16px; background: var(--raised); font-weight: 800; font-size: 13px; }
.opt.on { background: var(--yellow); color: var(--bg); }
.mini { width: 36px; height: 36px; display: grid; place-items: center; }
.mini svg.shp path { fill: var(--yellow); }
.opt.on .mini svg.shp path { fill: var(--bg); }
.m-pulse svg { animation: m-pulse 1s ease-in-out infinite; }
.m-spin svg { animation: m-spin 2.4s linear infinite; }
.m-float svg { animation: m-float 2s ease-in-out infinite; }
.m-wobble svg { animation: m-wobble .9s ease-in-out infinite; }
.m-bounce svg { animation: m-bounce .8s ease-in-out infinite; }
@keyframes m-pulse { 50% { transform: scale(1.18); } }
@keyframes m-spin { to { transform: rotate(360deg); } }
@keyframes m-float { 50% { transform: translateY(-5px); } }
@keyframes m-wobble { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@keyframes m-bounce { 50% { transform: translateY(-7px); } }
.e-glow svg { filter: drop-shadow(0 0 5px #fff) drop-shadow(0 0 2px #fff); }
.e-outline svg path { stroke: var(--ink); stroke-width: 10; }
.opt.on .e-outline svg path { stroke: var(--bg); }

.fit-tip { display: flex; align-items: center; gap: 12px; background: var(--raised); border-radius: 18px; padding: 12px 14px; font-weight: 600; font-size: 15px; line-height: 1.35; }
.fit-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-top: 12px; }
.nudge-pad { display: grid; grid-template-columns: repeat(3, 38px); grid-template-rows: repeat(2, 38px); gap: 4px; }
.nudge { border-radius: 10px; background: var(--raised); display: grid; place-items: center; }
.size-read { font-weight: 800; font-size: 15px; color: var(--muted); margin: 12px 0 0; }

.actions.sticky .btn { font-size: 18px; padding: 0 14px; }

/* ---------- drag ghost ---------- */
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; width: 84px; opacity: .95; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .55)); }
.drag-ghost.sw { width: 60px; height: 60px; }
.drag-ghost .tile-name { display: none; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(5, 6, 22, .62); opacity: 0; transition: opacity .2s; }
.scrim.in { opacity: 1; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--panel); border-radius: 28px 28px 0 0; padding: 18px 16px calc(18px + var(--sb)); transform: translateY(100%); transition: transform .22s ease-out; }
.scrim.in .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { flex: 1; font-size: 28px; }
.sheet-head .icon-btn { background: var(--raised); }
@media (orientation: landscape) {
  .sheet { left: auto; top: 0; width: min(440px, 92vw); max-height: none; border-radius: 28px 0 0 28px; transform: translateX(100%); padding: calc(16px + var(--st)) calc(16px + var(--sr)) calc(16px + var(--sb)) 18px; }
  .sheet.wide { width: min(760px, 96vw); }
}
.sheet-q { font-size: 26px; margin: 0 0 12px; }
.place-big { width: 100%; display: flex; align-items: center; gap: 14px; border-radius: 22px; padding: 16px; text-align: left; margin-bottom: 10px; color: var(--bg); }
.place-big > span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.place-big b { font-family: var(--display); font-size: 25px; line-height: 1; }
.place-big small { font-size: 14px; font-weight: 700; }
.place-big.tv { background: var(--cyan); }
.place-big.phone { background: var(--yellow); }
.place-big.proj, .place-big.projector { background: var(--raised); border: 2px solid var(--mint); color: var(--ink); }
.place-big.proj small, .place-big.projector small { color: var(--muted); }
.place-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-bottom: 14px; }
.place-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: 16px; background: var(--raised); font-weight: 800; font-size: 13px; text-align: center; }
.guide .seg { margin: 0 0 14px; }
.guide .seg button { font-size: 16px; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { position: relative; padding: 2px 0 0 46px; margin-bottom: 14px; font-size: 16px; line-height: 1.4; counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); color: var(--bg); font-weight: 800; display: grid; place-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field span { font-weight: 800; font-size: 14px; color: var(--muted); }
.field input { height: 54px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); padding: 0 14px; font: 700 18px var(--text); }
.field input:focus { border-color: var(--yellow); outline: none; }
.fine { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 8px 0; }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; height: 58px; border-radius: 16px; padding: 0 16px; background: var(--raised); font-weight: 800; font-size: 18px; margin-bottom: 8px; }
.menu .danger { color: #FF8AAA; }
.settings h3 { font-size: 21px; margin: 20px 0 4px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle b { display: block; font-size: 17px; }
.toggle small { display: block; color: var(--muted); font-size: 14px; }
.toggle input { appearance: none; -webkit-appearance: none; flex: none; width: 54px; height: 32px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.toggle input::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.toggle input:checked { background: var(--pink); }
.toggle input:checked::after { transform: translateX(22px); }
.name-form .btn { margin-top: 6px; }

/* camera */
.cam-view { position: relative; background: #000; border-radius: 18px; overflow: hidden; aspect-ratio: 4/3; max-height: 62dvh; margin: 0 auto; }
.cam-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam.flash .cam-flash { animation: flash .3s; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }
.cam-msg { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: rgba(0, 0, 0, .7); font-weight: 700; line-height: 1.4; }
.cam-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 0; }
.icon-btn.ghost { background: none; }
.shutter { width: 78px; height: 78px; border-radius: 50%; background: var(--ink); box-shadow: inset 0 0 0 6px var(--pink), 0 0 0 4px var(--panel); }
@media (orientation: landscape) { .cam-view { aspect-ratio: 16/9; max-height: 70dvh; } }

/* ---------- toast & update ---------- */
.toast { position: fixed; left: 50%; bottom: calc(18px + var(--sb)); z-index: 60; transform: translate(-50%, 20px); opacity: 0; transition: opacity .2s, transform .2s; display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--bg); border-radius: 999px; padding: 8px 8px 8px 20px; font-weight: 800; font-size: 16px; max-width: calc(100vw - 24px); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.toast.in { opacity: 1; transform: translate(-50%, 0); }
.toast > span { padding: 6px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast:not(:has(button)) { padding-right: 20px; }
.toast-undo { height: 40px; padding: 0 14px; border-radius: 999px; background: var(--bg); color: var(--ink); display: flex; align-items: center; gap: 6px; font-weight: 800; flex: none; }
.update-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 70; display: flex; align-items: center; justify-content: center; gap: 14px; padding: calc(8px + var(--st)) 12px 8px; background: var(--cyan); color: var(--bg); font-weight: 800; }
.update-bar .btn { background: var(--bg); color: var(--ink); }

/* ---------- show ---------- */
.show-layer { position: fixed; inset: 0; z-index: 80; background: #000; cursor: none; touch-action: none; }
.show-layer canvas.art { width: 100% !important; height: 100% !important; }
.show-hint { position: absolute; left: 50%; bottom: calc(22px + var(--sb)); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: rgba(18, 19, 43, .88); border-radius: 999px; padding: 8px 8px 8px 18px; font-weight: 800; opacity: 0; transition: opacity .3s; pointer-events: none; max-width: calc(100vw - 24px); cursor: default; }
.show-hint > span { white-space: normal; line-height: 1.25; }
.show-hint.in { opacity: 1; pointer-events: auto; }
body.showing #app, body.showing #toast { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
.guide > .actions { position: sticky; bottom: calc(-18px - var(--sb)); margin: 6px -16px calc(-18px - var(--sb)); padding: 12px 16px calc(14px + var(--sb)); background: var(--panel); box-shadow: 0 -10px 20px var(--panel); }
