@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --ink: #17312d;
  --muted: #6d7e79;
  --cream: #fffaf0;
  --panel: #fffdf8;
  --line: #e8e8df;
  --shadow: 0 14px 40px rgba(39, 57, 51, .1);
  --throat: #58c7b8;
  --tongue: #ff7b3d;
  --lips: #d023b0;
  --airflow: #13a5df;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { display: grid; place-items: center; padding: 10px; font-family: Nunito, system-ui, sans-serif; color: var(--ink); background-color: #dfe6e2; background-image: linear-gradient(45deg, rgba(255,255,255,.35) 25%, transparent 25%), linear-gradient(-45deg, rgba(255,255,255,.35) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(255,255,255,.35) 75%), linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.35) 75%); background-position: 0 0, 0 6px, 6px -6px, -6px 0; background-size: 12px 12px; }
button { font: inherit; color: inherit; }
.app-shell { position: relative; width: min(calc(100vw - 20px), calc(56.25dvh - 11.25px), 440px); height: min(calc(177.7778vw - 35.5556px), calc(100dvh - 20px), 782.222px); aspect-ratio: 9 / 16; display: flex; flex-direction: column; overflow: hidden; border: 6px solid #0b0d0d; outline: 2px solid #8c9290; border-radius: 55px; background: var(--cream); box-shadow: 0 3px 0 #d9dddc inset, 0 24px 80px rgba(23,49,45,.28), 0 0 0 3px rgba(255,255,255,.8); }
.app-shell::before { content: ''; position: absolute; z-index: 100; left: 50%; top: 10px; width: 112px; height: 31px; transform: translateX(-50%); border-radius: 20px; background: #050606; box-shadow: inset -8px -2px 10px rgba(41,48,57,.4), 0 1px 2px rgba(0,0,0,.3); pointer-events: none; }
.app-shell::after { content: ''; position: absolute; z-index: 100; left: 50%; bottom: 7px; width: 124px; height: 5px; transform: translateX(-50%); border-radius: 6px; background: rgba(8,13,12,.9); pointer-events: none; }
.topbar { height: 76px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,253,248,.96); border-bottom: 1px solid var(--line); z-index: 10; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { display: block; width: 48px; height: 48px; border-radius: 14px; object-fit: cover; object-position: center; box-shadow: 0 3px 9px rgba(78, 30, 83, .16); }
.brand strong, .brand small { display: block; line-height: 1.05; }
.brand strong { font-size: 22px; }
.brand small { color: var(--muted); font-size: 13px; margin-top: 5px; letter-spacing: .05em; text-transform: uppercase; }
.top-actions { display: flex; gap: 10px; }
.quiet-button, .primary-button { border: 0; border-radius: 12px; padding: 11px 17px; font-weight: 800; cursor: pointer; }
.quiet-button { background: #eef1ed; }
.primary-button { background: var(--ink); color: white; box-shadow: 0 5px 0 #0b1f1c; }
.primary-button:active { transform: translateY(3px); box-shadow: 0 2px 0 #0b1f1c; }
.case-drawer-toggle { position: absolute; z-index: 60; left: 0; top: calc(128px + env(safe-area-inset-top, 0px)); width: 48px; height: 54px; display: grid; place-items: center; align-content: center; gap: 1px; padding: 0; border: 0; border-radius: 0 15px 15px 0; background: var(--ink); color: white; box-shadow: 0 5px 16px rgba(23,49,45,.2); cursor: pointer; transition: opacity .18s ease, transform .18s ease; }
.case-drawer-toggle span { font-size: 23px; line-height: 1; }
.case-drawer-toggle small { font-size: 8px; font-weight: 900; line-height: 1; text-transform: uppercase; }
.case-drawer-backdrop { position: absolute; z-index: 70; inset: calc(82px + env(safe-area-inset-top, 0px)) 0 0; border: 0; background: rgba(15,29,26,.36); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility .22s; }
.case-drawer { position: absolute; z-index: 80; left: 0; top: calc(82px + env(safe-area-inset-top, 0px)); bottom: 0; width: min(88%, 370px); display: grid; grid-template-rows: auto auto auto minmax(0,1fr); gap: 12px; padding: 18px 14px max(28px, env(safe-area-inset-bottom, 0px)); overflow: hidden; border-radius: 0 22px 0 0; background: var(--panel); box-shadow: 14px 0 36px rgba(23,49,45,.22); transform: translateX(calc(-100% - 18px)); visibility: hidden; pointer-events: none; transition: transform .26s cubic-bezier(.22,.75,.25,1), visibility .26s; }
.app-shell.case-library-open .case-drawer { transform: translateX(0); visibility: visible; pointer-events: auto; }
.app-shell.case-library-open .case-drawer-backdrop { opacity: 1; visibility: visible; pointer-events: auto; }
.app-shell.case-library-open .case-drawer-toggle { opacity: 0; transform: translateX(-100%); pointer-events: none; }
.case-drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.case-drawer-header h2 { margin: 0; font-size: 22px; line-height: 1.1; }
.case-drawer-header p:last-child { margin: 4px 0 0; color: var(--muted); font-size: 13px; font-weight: 800; }
.case-drawer-close { width: 42px; height: 42px; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 13px; background: #edf0ec; font-size: 25px; font-weight: 900; cursor: pointer; }
.case-search { height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.case-search > span { color: var(--muted); font-size: 21px; }
.case-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; }
.case-filters { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-inline: contain; }
.case-filters::-webkit-scrollbar { display: none; }
.case-filter { flex: none; min-height: 36px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 18px; background: white; font-size: 12px; font-weight: 900; white-space: nowrap; cursor: pointer; }
.case-filter.active { border-color: var(--ink); background: var(--ink); color: white; }
.case-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 8px; padding-right: 2px; }
.case-list-empty { margin: 26px 10px; color: var(--muted); font-size: 14px; font-weight: 800; text-align: center; }
.case-list-item { width: 100%; min-height: 68px; display: grid; grid-template-columns: 40px minmax(0,1fr) 20px; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.case-list-item:hover, .case-list-item:focus-visible { border-color: #58c7b8; background: #f1fbf8; outline: none; }
.case-list-item.active { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--ink); }
.case-list-number { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: #e9f5f2; color: #147d6d; font-size: 11px; font-weight: 900; }
.case-list-copy { min-width: 0; }
.case-list-copy strong, .case-list-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-list-copy strong { font-size: 15px; text-align: right; }
.case-list-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 700; }
.case-list-arrow { font-size: 24px; font-weight: 900; }
.workspace-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 318px 1fr; transition: grid-template-columns .25s ease; }
.palette { min-height: 0; width: 318px; overflow-y: auto; padding: 26px 20px; background: var(--panel); border-right: 1px solid var(--line); z-index: 3; transition: opacity .18s ease, transform .25s ease; }
.palette-close { position: absolute; right: 10px; top: 10px; z-index: 2; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px; background: #e9eeeb; color: var(--ink); font-size: 20px; font-weight: 900; cursor: pointer; }
.app-shell.sidebar-closed .workspace-layout { grid-template-columns: 0 1fr; }
.app-shell.sidebar-closed .palette { opacity: 0; transform: translateX(-100%); pointer-events: none; }
.eyebrow { margin: 0 0 5px; font-size: 12px; font-weight: 900; letter-spacing: .16em; color: #80908b; }
.palette-heading h1 { margin: 0; font-size: 27px; letter-spacing: -.03em; }
.palette-heading > p:last-child { color: var(--muted); font-size: 15px; margin: 6px 0 20px; }
.palette-group { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: white; }
.group-toggle { width: 100%; padding: 12px; background: white; border: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left; }
.group-swatch { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: white; font-size: 17px; }
.group-toggle strong { flex: 1; font-size: 16px; }
.chevron { transition: transform .2s; }
.palette-group.open .chevron { transform: rotate(180deg); }
.group-content { display: none; padding: 0 10px 11px; }
.palette-group.open .group-content { display: grid; gap: 8px; }
.palette-item { min-height: 72px; border: 1px solid rgba(0,0,0,.06); border-radius: 13px; padding: 8px; display: flex; gap: 10px; align-items: center; cursor: grab; background: #fafafa; transition: transform .15s, box-shadow .15s; }
.palette-item:hover { transform: translateY(-2px); box-shadow: 0 7px 16px rgba(30,45,40,.09); }
.palette-item:active { cursor: grabbing; }
.item-preview { width: 88px; height: 54px; flex: none; border-radius: 11px; background-repeat: no-repeat; background-position: center; background-size: cover; }
.item-preview.die-preview { background-size: 600% 100%; background-position: 0 center; }
.item-preview.five { background-size: 500% 100%; }
.item-preview.single-face-preview { background-size: cover; background-position: center; }
.item-preview.subbase-preview { position: relative; background: #ffdf58; border: 2px solid #e4bd31; }
.item-preview.subbase-preview::before { content: ''; position: absolute; inset: 8px; border-radius: 7px; background: linear-gradient(90deg, #c5a943 0 30%, transparent 30% 35%, #ff7b3d 35% 65%, transparent 65% 70%, #ff7b3d 70% 100%); }
.palette-item span { font-size: 14px; font-weight: 800; line-height: 1.1; }
.palette-item small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); font-weight: 700; }
.palette-tip { margin-top: 18px; padding: 13px; border-radius: 14px; background: #f2efe4; display: flex; gap: 9px; color: #6c6656; }
.palette-tip p { margin: 0; font-size: 13px; line-height: 1.45; }
.board-wrap { min-width: 0; position: relative; display: flex; flex-direction: column; background: #f4f4ee; }
.board-toolbar { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: rgba(255,255,255,.75); border-bottom: 1px solid var(--line); z-index: 2; backdrop-filter: blur(10px); }
.board-toolbar-left { display: flex; align-items: center; gap: 11px; }
.sidebar-toggle { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; font-weight: 900; }
.sidebar-toggle:hover { background: #edf0ec; }
.sidebar-toggle span { transition: transform .2s ease; }
.app-shell.sidebar-closed .sidebar-toggle span { transform: rotate(90deg); }
.board-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 900; }
.board-title small { color: var(--muted); font-weight: 700; border-left: 1px solid #ccd3cf; padding-left: 8px; }
.status-dot { width: 8px; height: 8px; background: #5bc88a; border-radius: 50%; box-shadow: 0 0 0 4px rgba(91,200,138,.15); }
.zoom-controls { display: flex; align-items: center; gap: 5px; padding: 4px; background: white; border: 1px solid var(--line); border-radius: 11px; }
.zoom-controls button { border: 0; background: transparent; height: 27px; min-width: 28px; border-radius: 7px; cursor: pointer; font-weight: 900; }
.zoom-controls button:hover { background: #edf0ec; }
.zoom-controls span { width: 46px; text-align: center; font-size: 11px; font-weight: 800; }
.zoom-controls .fit-button { width: 38px; color: var(--muted); font-size: 10px; }
.viewport { flex: 1; min-height: 0; position: relative; overflow: hidden; cursor: grab; touch-action: none; background-color: #f8f8f4; background-image: radial-gradient(#cfd8d3 1.2px, transparent 1.2px); background-size: 24px 24px; }
.viewport.panning { cursor: grabbing; }
.board { width: 5400px; height: 1800px; position: absolute; transform-origin: 0 0; }
.timeline-grid { position: absolute; inset: 0; z-index: 0; display: grid; grid-template-columns: repeat(5, 1fr); pointer-events: none; }
.timeline-grid::before { content: ''; position: absolute; left: 48px; right: 48px; top: 63px; height: 3px; border-radius: 3px; background: #b9c9c2; }
.timeline-grid::after { content: ''; position: absolute; left: 38px; top: 56px; width: 0; height: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-right: 13px solid #b9c9c2; }
.timeline-part { position: relative; min-width: 0; border-right: 2px dashed rgba(93,118,108,.2); background: rgba(255,255,255,.12); }
.timeline-part:nth-child(even) { background: rgba(221,230,225,.16); }
.timeline-part:last-child { border-right: 0; }
.timeline-part > span { position: absolute; z-index: 1; left: 50%; top: 43px; width: 42px; height: 42px; transform: translateX(-50%); display: grid; place-items: center; border: 5px solid #f8f8f4; border-radius: 50%; background: #17312d; color: white; font-size: 16px; font-weight: 900; box-shadow: 0 3px 8px rgba(23,49,45,.15); }
.empty-state { position: absolute; left: 50%; top: 38%; width: 240px; transform: translate(-50%, -50%); text-align: center; pointer-events: none; color: #83908c; }
.empty-icon { width: 62px; height: 62px; display: grid; place-items: center; border: 2px dashed #bac6c0; border-radius: 18px; margin: auto; padding: 0; color: inherit; background: transparent; font-size: 32px; cursor: pointer; pointer-events: auto; }
.empty-state h2 { margin: 12px 0 3px; color: #62716c; font-size: 21px; }
.empty-state p { margin: 0; font-size: 14px; }
.canvas-hint { position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%); background: rgba(23,49,45,.86); color: white; border-radius: 20px; padding: 7px 13px; font-size: 10px; pointer-events: none; }
.moment-pager { display: none; }
.canvas-block { position: absolute; width: 360px; min-height: 150px; padding: 8px 8px 10px; border-radius: 30px; transform: scale(1.5); transform-origin: top left; cursor: grab; touch-action: none; user-select: none; filter: drop-shadow(0 9px 10px rgba(40,60,55,.14)); transition: left .14s ease, top .14s ease, filter .2s; }
.canvas-block.dragging { cursor: grabbing; filter: drop-shadow(0 18px 18px rgba(40,60,55,.2)); z-index: 20!important; }
.canvas-block.dragging { transition: filter .2s; }
.canvas-block.selected { outline: 3px solid #17312d; outline-offset: 4px; }
.canvas-block.tongue.has-subbases { z-index: 10!important; }
.base-image { position: absolute; inset: 0; border-radius: 30px; background-size: 100% 100%; background-repeat: no-repeat; z-index: 0; }
.remove-block { position: absolute; right: -7px; top: -7px; z-index: 5; width: 25px; height: 25px; border: 2px solid white; border-radius: 50%; background: #243c37; color: white; cursor: pointer; opacity: 0; transition: opacity .15s; }
.canvas-block:hover .remove-block { opacity: 1; }
.dice-zone { position: relative; z-index: 2; min-height: 124px; display: flex; justify-content: center; align-items: center; gap: 14px; pointer-events: none; }
.canvas-block.tongue .dice-zone { justify-content: space-between; padding: 0 29px; }
.canvas-block.tongue > .dice-zone { display: none; }
.tongue-corner-controls { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.tongue-corner-slot { position: absolute; width: 50%; height: 50%; padding: 0; border: 0; border-radius: 24px; background: transparent; cursor: pointer; pointer-events: auto; }
.tongue-corner-slot.topLeft { left: 0; top: 0; }
.tongue-corner-slot.topRight { right: 0; top: 0; }
.tongue-corner-slot.bottomLeft { left: 0; bottom: 0; }
.tongue-corner-slot.bottomRight { right: 0; bottom: 0; }
.tongue-corner-slot:hover, .tongue-corner-slot:focus-visible { outline: 3px solid rgba(255,255,255,.9); background: rgba(255,255,255,.14); }
.tongue-corner-slot.occupied { pointer-events: none; }
.canvas-block.lips .dice-zone { min-height: 134px; align-items: center; justify-content: space-between; gap: 0; padding: 0 42px; }
.canvas-block.airflow .dice-zone { align-items: center; justify-content: space-between; padding: 0 35px; }
.airflow-toggle { position: absolute; z-index: 5; left: 50%; top: 9px; width: 38px; height: 132px; transform: translateX(-50%); padding: 7px 4px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; border: 0; border-radius: 21px; background: #fff; box-shadow: 0 2px 7px rgba(0,0,0,.12); cursor: pointer; }
.toggle-mic { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: #191919; transition: color .2s ease, background .2s ease, filter .2s ease, transform .2s ease; }
.toggle-mic svg { width: 22px; height: 22px; overflow: visible; }
.toggle-mic rect { fill: currentColor; stroke: none; }
.toggle-mic path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.airflow-toggle.on .toggle-mic { color: #fff; background: #13a5df; filter: drop-shadow(0 0 5px #fff) drop-shadow(0 0 9px #13a5df); transform: scale(1.08); }
.toggle-track { position: relative; width: 27px; height: 74px; border-radius: 15px; background: #d8d8d8; box-shadow: inset 0 1px 3px rgba(0,0,0,.12); }
.toggle-knob { position: absolute; left: 4px; bottom: 4px; width: 19px; height: 33px; border-radius: 11px; background: #514d4d; transition: bottom .22s cubic-bezier(.2,.8,.2,1), background .22s; }
.airflow-toggle.on .toggle-knob { bottom: 37px; background: #159dcb; }
.toggle-dots { display: flex; gap: 3px; height: 8px; align-items: center; }
.toggle-dots i { display: block; width: 5px; height: 5px; border-radius: 50%; background: #4c4b4b; transition: background .2s, transform .2s; }
.toggle-dots i:first-child { background: #159dcb; }
.airflow-toggle.on .toggle-dots i:first-child { transform: scale(1.4); }
.airflow-toggle:not(.on) .toggle-dots i:last-child { transform: scale(1.4); }
.airflow-toggle:focus-visible { outline: 3px solid white; box-shadow: 0 0 0 5px #17312d; }
.main-die-slot { width: 80px; height: 88px; display: grid; place-items: center; border: 0; border-radius: 19px; background: rgba(255,255,255,.2); overflow: hidden; cursor: pointer; pointer-events: auto; }
.main-die-slot .die { width: 100%; height: 100%; border: 0; border-radius: 19px; }
.tongue-subbase { position: absolute; width: 320px; height: 120px; z-index: 4; display: flex; flex-direction: row; gap: 12px; align-items: center; justify-content: center; padding: 12px; border: 0; border-radius: 30px; background: #ffdf58; box-shadow: 0 4px 0 rgba(176,137,20,.2); transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease; }
.tongue-subbase.just-added { animation: subbase-pop .24s cubic-bezier(.2,.85,.3,1.2); }
.tongue-subbase.just-added.topLeft, .tongue-subbase.just-added.topRight { transform-origin: center bottom; }
.tongue-subbase.just-added.bottomLeft, .tongue-subbase.just-added.bottomRight { transform-origin: center top; }
.tongue-subbase.dragging { cursor: grabbing; }
.tongue-subbase::before, .tongue-subbase::after { content: ''; position: absolute; left: 50%; width: 44px; height: 17px; transform: translateX(-50%); border-radius: 50%; background: #f8f8f4; }
.tongue-subbase::before { top: -8px; }
.tongue-subbase::after { bottom: -8px; }
.tongue-subbase.orientation-horizontal.topLeft { left: -88px; top: -110px; }
.tongue-subbase.orientation-horizontal.topRight { left: 118px; top: -110px; }
.tongue-subbase.orientation-horizontal.bottomLeft { left: -88px; top: 140px; }
.tongue-subbase.orientation-horizontal.bottomRight { left: 118px; top: 140px; }
.tongue-subbase.orientation-vertical { width: 120px; height: 320px; flex-direction: column; }
.tongue-subbase.orientation-vertical.topLeft { left: 12px; top: -310px; }
.tongue-subbase.orientation-vertical.topRight { left: 218px; top: -310px; }
.tongue-subbase.orientation-vertical.bottomLeft { left: 12px; top: 140px; }
.tongue-subbase.orientation-vertical.bottomRight { left: 218px; top: 140px; }
.tongue-subbase.orientation-vertical .position1-slot { order: 1; }
.tongue-subbase.orientation-vertical .position2-slot { order: 2; }
.tongue-subbase.orientation-vertical .action-slot { order: 3; }
.subbase-side-notch { display: none; position: absolute; top: 50%; width: 17px; height: 44px; transform: translateY(-50%); border-radius: 50%; background: #f8f8f4; }
.subbase-side-notch.side-left { left: -8px; }
.subbase-side-notch.side-right { right: -8px; }
.tongue-subbase.selected { outline: 3px solid #17312d; outline-offset: 4px; }
.subbase-slot { width: 88px; height: 88px; flex: none; display: grid; place-items: center; border: 0; border-radius: 20px; background-repeat: no-repeat; background-size: 600% 100%; background-position: 0 center; overflow: hidden; cursor: pointer; }
.subbase-slot.default-action { background-image: url('blockati/tongue-action-1.png'); background-size: cover; background-position: center; }
.subbase-slot.default-position { background-image: url('blockati/ToungePostion.png'); }
.tongue-subbase .die { width: 88px; height: 88px; border: 0; border-radius: 20px; }
.remove-subbase { position: absolute; right: -8px; top: -9px; width: 23px; height: 23px; z-index: 5; border: 2px solid white; border-radius: 50%; background: #243c37; color: white; cursor: pointer; opacity: 0; }
.tongue-subbase:hover .remove-subbase { opacity: 1; }
.die { --face: 0; position: relative; width: 80px; height: 80px; padding: 0; border: 2px solid rgba(255,255,255,.9); border-radius: 17px; background-image: var(--sprite); background-repeat: no-repeat; background-size: calc(var(--faces) * 100%) 100%; background-position: calc(var(--face) * 100% / (var(--faces) - 1)) center; box-shadow: none; cursor: pointer; pointer-events: auto; transition: transform .12s ease, background-position .15s; }
.die.centered-face-die { background-size: cover; background-position: center; }
.canvas-block.throat .die { width: 80px; height: 88px; border: 0; border-radius: 20px; background-color: #16a58e; }
.die:hover { transform: scale(1.035); }
.die.selected { border-color: #17312d; outline: 3px solid white; outline-offset: 2px; }
.die.flipping { animation: flip .32s ease; }
.connector { display: none; }
.canvas-block.attached { filter: drop-shadow(0 4px 5px rgba(40,60,55,.09)); }
.canvas-block.attached-above, .canvas-block.attached-below { z-index: 2; }
@keyframes flip { 0%{transform:scale(1)} 50%{transform:scale(.9)} 100%{transform:scale(1)} }
@keyframes subbase-pop { 0% { opacity: 0; transform: scale(.78); } 70% { opacity: 1; transform: scale(1.04); } 100% { opacity: 1; transform: scale(1); } }
dialog { width: min(440px, calc(100% - 32px)); padding: 30px; border: 0; border-radius: 24px; color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,35,32,.45); backdrop-filter: blur(4px); }
dialog h2 { margin: 0 0 18px; }
.dialog-close { position: absolute; right: 15px; top: 13px; border: 0; background: #edf0ec; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; }
dialog ol { list-style: none; padding: 0; margin: 0 0 23px; display: grid; gap: 13px; }
dialog li { display: flex; gap: 12px; align-items: center; }
dialog li > span { display: grid; place-items: center; flex: none; width: 31px; height: 31px; border-radius: 10px; background: #e9f5f2; color: #159681; font-weight: 900; }
dialog li p { margin: 0; font-size: 14px; color: var(--muted); }
dialog li strong { display: block; color: var(--ink); font-size: 15px; }
.full { width: 100%; }
@media (min-width: 0) {
  .topbar { height: calc(82px + env(safe-area-inset-top, 0px)); padding: calc(34px + env(safe-area-inset-top, 0px)) 8px 0; }
  .brand { gap: 6px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand strong { font-size: 22px; }
  .brand small { display: none; }
  .top-actions { gap: 5px; }
  .quiet-button, .primary-button { display: block; padding: 7px 9px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
  .primary-button { box-shadow: 0 2px 0 #0b1f1c; }
  .workspace-layout { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 70%) minmax(0, 30%); transition: grid-template-rows .28s ease; }
  .app-shell.sidebar-closed .workspace-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, calc(100% - 38px)) 38px; }
  .board-wrap { grid-column: 1; grid-row: 1; width: 100%; min-width: 0; }
  .palette { position: relative; inset: auto; grid-column: 1; grid-row: 2; width: 100%; height: 100%; min-height: 0; padding: 34px 8px calc(8px + env(safe-area-inset-bottom, 0px)); overflow: auto; opacity: 1; transform: none; pointer-events: auto; z-index: 5; border: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgba(23,49,45,.08); transition: padding .25s ease; }
  .app-shell.sidebar-closed .palette { width: 100%; height: 38px; padding: 0; overflow: hidden; opacity: 1; transform: none; pointer-events: auto; }
  .sidebar-toggle { display: none; }
  .palette-close { position: absolute; display: grid; left: 50%; right: auto; top: 5px; width: 58px; height: 24px; transform: translateX(-50%); border-radius: 12px; background: #17312d; color: white; font-size: 20px; line-height: 1; }
  .palette-close span { transition: transform .22s ease; }
  .app-shell.sidebar-closed .palette-close span { transform: rotate(180deg); }
  .app-shell.sidebar-closed .palette-heading, .app-shell.sidebar-closed #paletteGroups, .app-shell.sidebar-closed .palette-tip { display: none; }
  .palette-heading { padding: 0 2px; }
  .palette-heading .eyebrow, .palette-heading > p:last-child { display: none; }
  .palette-heading h1 { margin: 0 0 6px; font-size: 18px; }
  #paletteGroups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; align-items: start; }
  .palette-group { margin-bottom: 7px; border-radius: 13px; }
  .group-toggle { padding: 6px; gap: 6px; }
  .group-swatch { width: 24px; height: 24px; border-radius: 7px; font-size: 14px; }
  .group-toggle strong { font-size: 12px; }
  .group-content { padding: 0 5px 6px; gap: 5px; }
  .palette-item { min-height: 44px; padding: 4px; gap: 5px; border-radius: 9px; }
  .item-preview { width: 48px; height: 32px; border-radius: 7px; }
  .palette-item span { font-size: 10px; }
  .palette-item small { display: none; }
  .palette-tip { display: none; }
  .board-toolbar { position: relative; height: 46px; padding: 0 8px; }
  .board-toolbar-left { gap: 7px; }
  .board-title > span:not(.status-dot) { display: none; }
  .board-title small { border-left: 0; padding-left: 2px; white-space: nowrap; font-size: 18px; }
  .zoom-controls { display: none; }
  .timeline-grid { direction: ltr; }
  .timeline-grid::before, .timeline-grid::after { display: none; }
  .viewport { contain: strict; background-color: #f4f6f2; background-image: none; }
  .timeline-part { overflow: hidden; border-right: 0; background: #fffdf8; box-shadow: inset 0 0 0 1px rgba(23,49,45,.05); }
  .timeline-part:nth-child(even) { background: #fffdf8; }
  .timeline-part > span { top: 20px; width: 48px; height: 48px; border-width: 4px; font-size: 28px; }
  .empty-state { left: 540px; top: 500px; width: 380px; }
  .empty-icon { width: 82px; height: 82px; border-width: 3px; border-radius: 22px; font-size: 52px; }
  .empty-state h2 { margin-top: 18px; font-size: 40px; }
  .empty-state p { margin-top: 5px; font-size: 25px; line-height: 1.25; }
  .app-shell.mobile-paging .board { transition: transform .32s cubic-bezier(.22,.75,.25,1); }
  .app-shell.mobile-paging .board.swiping { transition: none; }
  .moment-pager { position: absolute; z-index: 3; left: 50%; top: 50%; min-width: 184px; height: 38px; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 3px 4px; border: 1px solid rgba(23,49,45,.1); border-radius: 13px; background: rgba(255,253,248,.96); box-shadow: none; }
  .moment-pager > button { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 9px; background: #17312d; color: white; font-size: 22px; line-height: 1; cursor: pointer; }
  .moment-pager > button:disabled { opacity: .28; }
  .moment-progress { min-width: 96px; display: grid; justify-items: center; gap: 3px; }
  .moment-progress > span { font-size: 14px; font-weight: 900; white-space: nowrap; }
  .moment-dots { display: flex; gap: 5px; }
  .moment-dots i { width: 5px; height: 5px; border-radius: 50%; background: #c6d0cc; transition: width .2s, background .2s; }
  .moment-dots i.active { width: 16px; border-radius: 5px; background: #17312d; }
  .canvas-hint { display: none; }
  dialog { padding: 25px 20px; border-radius: 20px; }
}

@media (max-width: 480px) {
  body { padding: 6px; }
  .app-shell { width: min(calc(100vw - 12px), calc(56.25dvh - 6.75px), 440px); height: min(calc(177.7778vw - 21.3333px), calc(100dvh - 12px), 782.222px); border-radius: 49px; }
}
