/* Assistant (v24, hebrew+latin subset) is self-hosted from /fonts — no third-party requests. */
@font-face { font-family: Assistant; font-style: normal; font-weight: 200; font-display: swap; src: url('../fonts/assistant-v24-hebrew_latin-200.woff2') format('woff2'); }
@font-face { font-family: Assistant; font-style: normal; font-weight: 300; font-display: swap; src: url('../fonts/assistant-v24-hebrew_latin-300.woff2') format('woff2'); }
@font-face { font-family: Assistant; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/assistant-v24-hebrew_latin-regular.woff2') format('woff2'); }
@font-face { font-family: Assistant; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/assistant-v24-hebrew_latin-500.woff2') format('woff2'); }
@font-face { font-family: Assistant; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/assistant-v24-hebrew_latin-600.woff2') format('woff2'); }
@font-face { font-family: Assistant; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/assistant-v24-hebrew_latin-700.woff2') format('woff2'); }
@font-face { font-family: Assistant; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/assistant-v24-hebrew_latin-800.woff2') format('woff2'); }
/* Latin-only on purpose: any Hebrew in a code context falls through to Assistant
   instead of being squeezed into monospaced Hebrew. */
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/jetbrains-mono-latin-400.woff2') format('woff2'); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/jetbrains-mono-latin-600.woff2') format('woff2'); }
:root { color-scheme: dark; interpolate-size: allow-keywords; font-family: var(--sans); color: #dfe4de; background: #181d1f; font-synthesis: none; --line: #ffffff13; --accent: #d4df9e; --sans: Assistant, Arial, "Noto Sans Hebrew", sans-serif; --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, Assistant, monospace; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100dvh; overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { opacity: .3; cursor: default; }
a { color: inherit; text-decoration: none; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, a, summary, input, textarea, select, pre { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--accent); }
button { transition: background .15s, color .15s, border-color .15s, transform .12s; }
.button:active:not(:disabled), .icon-button:active:not(:disabled) { transform: translateY(1px); }
svg { width: 19px; height: 19px; flex-shrink: 0; vertical-align: middle; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
h1, h2, h3, p { margin: 0; }
code, pre { font-family: var(--mono); }
/* Every piece of chrome floats over the canvas; the scrim keeps it legible above the grid. */
.site-header { position: fixed; z-index: 5; top: 0; inset-inline: 0; height: 78px; padding: 0 38px; display: flex; align-items: center; gap: 13px; pointer-events: none; background: linear-gradient(to bottom, #1a201fd4, #1a201f00); }
.site-header > * { pointer-events: auto; }
.brand-title { font-size: 16px; font-weight: 500; }
.brand { display: flex; gap: 13px; align-items: center; }
.brand-mark { color: #d4df9e; }
.brand-mark svg { width: 25px; height: 25px; }
.brand strong { font-size: 16px; font-weight: 500; }
.brand-divider { height: 17px; width: 1px; background: #ffffff1c; margin-inline: 3px; }
#layer-count { font: 10px var(--mono); color: #8b9c8f; }
.mat-tools { display: flex; gap: 13px; margin-inline-start: auto; }
.crafting-area { position: fixed; inset: 0; z-index: 0; display: flex; overflow: auto; overscroll-behavior: contain; padding-block: 96px 104px; padding-inline: 288px 56px; background-color: #222d29; background-image: linear-gradient(#b6c6aa06 1px, transparent 1px), linear-gradient(90deg, #b6c6aa06 1px, transparent 1px), linear-gradient(#b6c6aa08 1px, transparent 1px), linear-gradient(90deg, #b6c6aa08 1px, transparent 1px), radial-gradient(ellipse at 50% 40%, #3c4a3919, #0b14141f); background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px, 100% 100%; background-position: top center, top center, top center, top center, center; transition: box-shadow .2s; }
/* Fixed, not absolute: the frame belongs to the viewport, not to the scrolled stack. */
.crafting-area::before { content: ''; pointer-events: none; position: fixed; inset: 18px; border: 1px solid #a9baa413; border-radius: 2px; }
.crafting-area::after { content: ''; pointer-events: none; position: fixed; top: 18px; bottom: 18px; left: 18px; width: 9px; background: repeating-linear-gradient(to bottom, #a9baa435 0, #a9baa435 1px, transparent 1px, transparent 20px); opacity: .55; }
.crafting-area.drag-over { box-shadow: inset 0 0 70px #cbdf7c08; }
.mat-coordinate { position: fixed; font: 9px var(--mono); letter-spacing: 1.3px; color: #8b9f8860; user-select: none; pointer-events: none; }
.top-coordinate { top: 96px; left: 37px; }
/* margin:auto centres safely — flex centring would clip the top of a tall stack. */
.stack-wrap { width: min(100%, 630px); margin: auto; position: relative; z-index: 1; }
.stack { position: relative; display: flex; flex-direction: column; gap: 8px; width: 100%; min-height: 50px; }
.teal { --protocol: #8dbab0; --tint: #8dbab018; --card: #283734; --card-edge: #8dbab04a; }
.blue { --protocol: #96b9d4; --tint: #96b9d418; --card: #2c373f; --card-edge: #96b9d44a; }
.violet { --protocol: #b8a6d3; --tint: #b8a6d318; --card: #36323e; --card-edge: #b8a6d34a; }
.amber { --protocol: #d0b486; --tint: #d0b48618; --card: #3a3730; --card-edge: #d0b4864a; }
.slate { --protocol: #b9b9a9; --tint: #b9b9a918; --card: #373b36; --card-edge: #b9b9a94a; }
.layer-card { position: relative; background: var(--card); border: 1px solid #d5e0d044; border-left: 3px solid var(--protocol); border-radius: 8px; padding: 15px 20px 17px; box-shadow: 0 4px 0 #111b175c, 0 6px 20px #10161126; min-width: 0; cursor: grab; transition: border-color .15s, box-shadow .15s, transform .15s; }
.layer-card:hover, .layer-card:focus-within { border-color: var(--protocol); transform: translateY(-1px); box-shadow: 0 5px 0 #111b1770, 0 9px 24px #1016112e; }
.layer-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 25px; margin-bottom: 11px; touch-action: none; user-select: none; }
.layer-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.layer-heading h2 { font: 600 16px var(--mono); color: #f2f5ec; }
.layer-grip { color: #ffffff35; display: inline-flex; margin-left: -7px; }
.layer-grip svg { width: 12px; height: 17px; }
.protocol-icon { display: inline-flex; align-items: center; justify-content: center; color: var(--protocol); }
.protocol-icon svg { width: 16px; height: 16px; }
.layer-category { font: 9px var(--mono); color: var(--protocol); border: 1px solid var(--card-edge); background: var(--tint); border-radius: 3px; padding: 2px 4px; }
.layer-actions { display: flex; align-items: center; gap: 2px; opacity: .45; transition: opacity .14s; }
.layer-card:hover .layer-actions, .layer-card:focus-within .layer-actions { opacity: 1; }
.icon-button { width: 26px; height: 26px; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; color: #afbab3; flex-shrink: 0; padding: 5px; }
.icon-button svg { width: 15px; height: 15px; }
.icon-button:hover:not(:disabled) { background: #ffffff0d; color: #f5f5e8; }
.delete-layer:hover { color: #e4a391; background: #e4a39113; }
.inline-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px 18px; cursor: auto; }
.inline-fields:empty { display: none; }
.field { min-width: 0; margin-bottom: 17px; }
.inline-field { margin: 0; }
.field-label { display: flex; align-items: center; justify-content: space-between; min-height: 20px; margin-bottom: 6px; gap: 8px; }
.field-label label, .field-label > code { font: 11px var(--mono); color: #d4ddd2; }
.field-label label { overflow-wrap: anywhere; }
.field-meta { display: flex; align-items: center; gap: 6px; direction: rtl; }
.auto-label { font: 9px var(--sans); color: #b3c0ae; }
.type-label { font: 9px var(--mono); color: #8a978c; }
.field-reset, .expression-toggle { background: none; border: 0; color: #94a297; font: 11px var(--mono); padding: 3px; border-radius: 3px; cursor: pointer; }
.field-reset svg { width: 12px; height: 12px; }
.field-reset:hover, .expression-toggle:hover, .expression-toggle.active { color: #d4df9e; background: #d4df9e12; }
input, textarea, select { width: 100%; min-width: 0; background: #161d1b; border: 1px solid #ffffff1f; border-radius: 5px; color: #e4e7d8; font: 12px/1.6 var(--mono); padding: 9px 11px; outline-offset: 1px; }
input:focus, textarea:focus, select:focus { border-color: #c2d59a88; outline: 2px solid #c2d59a15; }
textarea { resize: vertical; min-height: 65px; tab-size: 4; }
input::placeholder, textarea::placeholder { color: #aab8a7; opacity: 1; }
/* The textarea keeps the caret and the placeholder; its own glyphs go transparent so the
   highlighted copy underneath shows through. Both layers must share every metric. */
.code-input { position: relative; }
.code-input > pre, .code-input > textarea { margin: 0; font: 12px/1.6 var(--mono); padding: 9px 11px; border: 1px solid transparent; border-radius: 5px; tab-size: 4; white-space: pre-wrap; overflow-wrap: break-word; text-align: left; }
.code-input > pre { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: #e4e7d8; background: #161d1b; border-color: #ffffff1f; }
.code-input > textarea { display: block; position: relative; resize: none; background: transparent; color: transparent; caret-color: #e4e7d8; }
.code-input > textarea:focus { outline: 2px solid #c2d59a15; }
.code-input:focus-within > pre { border-color: #c2d59a88; }
.code-input:has(textarea[aria-invalid="true"]) > pre { border-color: #d69d86; }
#import-input::placeholder { color: #61706a; opacity: 1; }
/* On the card the value is the subject: no box at rest, box on hover/focus. The
   1px transparent border is always there so revealing it never shifts anything. */
.inline-field input { background: transparent; border: 1px solid transparent; border-bottom-color: #d5e0d226; border-radius: 4px; padding: 6px 10px; font-size: 14px; line-height: 1; color: #eef3e6; height: 32px; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.inline-field input:hover { background: #121a1899; border-color: #d5e0d238; }
.inline-field input:focus { border-color: var(--protocol); background: #101915cc; }
.inline-field .field-label { margin-bottom: 5px; min-height: 14px; }
.inline-field .field-label label { font: 400 10px/1 var(--mono); letter-spacing: .06em; color: #8a978c; opacity: 1; }
.inline-field .auto-label, .inline-field .type-label { display: none; }
.inline-field .field-reset { opacity: 0; padding: 1px 3px; }
.inline-field:hover .field-reset, .inline-field:focus-within .field-reset { opacity: 1; }
.inline-field input::placeholder { color: #71817a; opacity: 1; }
/* Attached, not stacked: inset with a rail into the parent, and no OSI badge. */
.record-card { margin-inline-start: 22px; box-shadow: 0 3px 0 #111b1745, 0 4px 14px #1016111f; }
.record-card .layer-heading h2 { font-size: 14px; }
.record-card::before { content: ''; position: absolute; inset-inline-start: -12px; top: 0; bottom: -8px; width: 1px; background: var(--card-edge); }
.record-card::after { content: ''; position: absolute; inset-inline-start: -12px; top: 19px; width: 12px; height: 1px; background: var(--card-edge); }
.record-card:last-child::before { bottom: 0; }
.record-slot { display: inline-flex; align-items: center; gap: 2px; cursor: pointer; }
.record-slot svg { width: 10px; height: 10px; margin-inline-end: -1px; }
.record-slot:hover { color: #f2f5ec; border-color: var(--protocol); background: var(--tint); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #d69d86; }
.error-message { display: block; font-size: 11px; color: #efb29c; margin-top: 5px; line-height: 1.65; direction: rtl; overflow-wrap: anywhere; }
.error-message:empty { display: none; }
.field-label label.shorthand { text-decoration: underline dotted #7f8f83; text-underline-offset: 3px; cursor: help; }
/* A bit is a checkbox, sized like a control rather than stretched like a text field. */
.bit-field input[type="checkbox"] { width: 17px; height: 17px; padding: 0; margin: 0; accent-color: var(--accent); cursor: pointer; }
.inline-field.bit-field input[type="checkbox"] { margin-block: 7px; }
.empty-stack { display: flex; flex-direction: column; align-items: center; gap: 15px; border: 1px dashed #b1c4a340; border-radius: 8px; padding: 70px 20px; color: #b1bda8; text-align: center; }
.empty-stack > svg { width: 32px; height: 32px; color: #92a77f; }
.empty-stack p { font-size: 16px; }
.empty-stack span { font-size: 12px; color: #8c9d84; }
.has-drag .empty-stack { display: none; }
.insertion-gap { border: 1px dashed #cbdb9690; border-radius: 8px; background: #cbdc8510; display: grid; place-items: center; min-height: 70px; flex-shrink: 0; animation: gap-bloom .13s cubic-bezier(.2,.9,.25,1); }
/* Height is set inline by drag.js and the neighbours FLIP against it, so the bloom
   only scales/fades — the reserved space is correct from the first frame. */
@keyframes gap-bloom { from { opacity: 0; scale: 1 .8; } to { opacity: 1; scale: 1; } }
.insertion-gap span { font-size: 11px; color: #d0dda7; direction: rtl; }
.drag-overlay { position: fixed; inset: 0; z-index: 50; overflow: hidden; contain: strict; pointer-events: none; }
/* The ghost is repositioned every pointermove, so it must never ease. */
.drag-ghost { position: absolute; left: 0; top: 0; pointer-events: none; margin: 0; transform-origin: top left; box-shadow: 0 14px 35px #070d0b80, 0 0 0 1px #ffffff10; border-color: var(--protocol); opacity: .97; will-change: transform; transition: none; }
.drag-ghost .layer-actions, .drag-ghost .field-reset { opacity: 0; }
.ghost-fields { display: flex; gap: 28px; font: 11px var(--mono); color: var(--protocol); padding: 7px 0 4px; }
.ghost-fields span { flex: 1; }
.ghost-fields i { display: block; font-style: normal; color: #ffffff40; margin-top: 12px; }
.is-dragging { user-select: none; cursor: grabbing !important; }
.is-dragging * { cursor: grabbing !important; }
.mat-footer { position: fixed; z-index: 5; bottom: 26px; inset-inline-end: 38px; display: flex; align-items: center; gap: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 39px; border: 1px solid transparent; border-radius: 6px; font-size: 12px; padding: 10px 16px; white-space: nowrap; }
.button svg { height: 16px; width: 16px; }
.primary { background: #d3df9e; color: #293023; font-weight: 600; box-shadow: 0 2px 1px #1014111c; }
.primary:hover:not(:disabled) { background: #e1e9b9; }
#open-export { min-height: 47px; padding: 11px 23px; border-color: #eaf2c0; border-radius: 8px; background: linear-gradient(135deg, #e1edac, #cbdc91); color: #28331e; font-size: 14px; font-weight: 700; box-shadow: 0 3px 0 #87995e, 0 10px 24px #0c170d73; }
#open-export:hover:not(:disabled) { background: linear-gradient(135deg, #ebf4c1, #d6e6a2); }
.secondary { background: #ffffff04; border-color: #b9c5b629; color: #c6d0c4; }
.secondary:hover { background: #ffffff0a; border-color: #b9c5b657; }
/* The palette is a panel floating on the canvas: it owns its own scroller, so its height
   never touches the canvas. */
.sidebar-column { position: fixed; z-index: 5; top: 92px; bottom: 26px; inset-inline-start: 26px; width: 220px; display: flex; flex-direction: column; gap: 14px; }
/* Sidebar panels speak the cards' language at half volume: same lift, lighter shadow,
   tinted icon chip instead of a thick protocol edge. */
.layer-sidebar { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #506047 transparent; background: #1f2624e6; backdrop-filter: blur(6px); border: 1px solid #899b8e33; border-radius: 10px; box-shadow: 0 10px 30px #0b121040; }
.layers-disclosure > summary { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 500; color: #c6d0c6; padding: 15px 16px; background: #222a27f2; backdrop-filter: blur(6px); }
.layers-disclosure[open] > summary { border-bottom: 1px solid var(--line); }
.layers-disclosure > summary > [data-icon] { color: #869b80; transition: transform .2s ease; }
.layers-disclosure > summary > [data-icon] svg { width: 16px; height: 16px; }
.layers-disclosure[open] > summary > [data-icon] { transform: rotate(45deg); }
.layer-group { border-bottom: 1px solid var(--line); }
.layer-group > summary { display: flex; align-items: center; gap: 11px; padding: 12px 13px; transition: background .15s; }
.layer-group > summary:hover { background: #ffffff05; }
.group-number { font: 10px var(--mono); border: 1px solid var(--card-edge); background: var(--tint); color: var(--protocol); border-radius: 4px; padding: 3px 5px; }
.group-name { font-size: 12px; color: #d4dccf; }
.group-name small { display: block; text-align: right; font: 9px var(--mono); letter-spacing: .06em; color: #7f9078; margin-top: 3px; }
.layer-group > summary > svg { width: 13px; height: 13px; margin-inline-start: auto; color: #92a287; transform: rotate(90deg); transition: transform .2s ease; }
.layer-group[open] > summary > svg { transform: rotate(0); }
.group-protocols { display: flex; flex-direction: column; gap: 7px; padding: 0 11px 13px; }
.palette-item { touch-action: none; user-select: none; width: 100%; min-width: 0; display: flex; align-items: center; gap: 9px; position: relative; padding: 9px 10px; border: 1px solid #a8bb9e2e; border-radius: 6px; background: linear-gradient(#262f2b, #212a26); text-align: start; cursor: grab; box-shadow: 0 2px 0 #11181740; transition: background .15s, border-color .15s, transform .15s, box-shadow .15s; }
.palette-item:hover { background: var(--card); border-color: var(--card-edge); transform: translateY(-1px); box-shadow: 0 3px 0 #11181759, 0 6px 14px #0b12102e; }
.palette-item:active { transform: translateY(1px); box-shadow: 0 1px 0 #11181740; }
.palette-item .protocol-icon { width: 22px; height: 22px; border-radius: 5px; background: var(--tint); flex-shrink: 0; }
.palette-item .protocol-icon svg { width: 14px; height: 14px; }
.palette-name { font: 12px var(--mono); color: #e6ebdf; }
.palette-add { margin-inline-start: auto; color: #91a287; opacity: 0; display: inline-flex; transition: opacity .15s; }
.palette-add svg { width: 12px; height: 12px; }
.palette-item:hover .palette-add, .palette-item:focus-visible .palette-add { opacity: 1; }
.protocol-row { display: flex; align-items: stretch; gap: 5px; }
.protocol-row > .palette-item { flex: 1; }
.family-toggle { width: 26px; height: auto; border: 1px solid #a8bb9e26; border-radius: 6px; background: #ffffff03; color: #93a389; }
.family-toggle svg { width: 12px; height: 12px; transform: rotate(90deg); transition: transform .2s ease; }
.family-toggle[aria-expanded="true"] svg { transform: rotate(0); }
.subprotocols { display: flex; flex-direction: column; gap: 6px; border-inline-start: 1px solid var(--card-edge); margin: 8px 9px 3px 0; padding-inline-start: 9px; }
.subprotocols .palette-item { padding: 8px; gap: 7px; }
.subprotocols .palette-name { font-size: 11px; }
.subprotocols .protocol-icon { width: 20px; height: 20px; }
.raw-group { padding: 13px 11px; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
/* Chromium and Safari ease the disclosure; other engines keep today's instant toggle. */
details::details-content { block-size: 0; overflow: clip; transition: block-size .25s ease, content-visibility .25s allow-discrete; }
details[open]::details-content { block-size: auto; }
.presets-section { flex: none; background: #1f2624e6; backdrop-filter: blur(6px); border: 1px solid #899b8e33; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 30px #0b121040; }
.presets-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 14px; color: #c6d0c6; transition: background .15s; }
.presets-section > summary:hover { background: #ffffff05; }
.presets-label { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.presets-label > [data-icon] { color: #a4b394; }
.presets-label svg { height: 16px; width: 16px; }
.presets-section > summary > [data-icon] { color: #869b80; transition: transform .2s ease; }
.presets-section[open] > summary > [data-icon] { transform: rotate(45deg); }
.presets { display: flex; flex-direction: column; gap: 7px; padding: 0 11px 12px; }
.preset { display: flex; align-items: center; gap: 9px; text-align: start; padding: 9px; border: 1px solid #ffffff15; border-radius: 6px; background: linear-gradient(#242c2a, #202826); transition: background .15s, border-color .15s, transform .15s, box-shadow .15s; }
.preset:hover { background: #2a332c; border-color: #b9cb8955; transform: translateY(-1px); box-shadow: 0 3px 0 #11181740, 0 6px 14px #0b12102e; }
.preset:active { transform: translateY(1px); box-shadow: 0 1px 0 #11181740; }
.preset.active { background: #2c352b; border-color: #b9cb8988; }
.preset-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 22px; height: 22px; border-radius: 5px; background: #ffffff07; color: #9fb38b; }
.preset-icon svg { width: 14px; height: 14px; }
.preset strong { font-size: 11px; font-weight: 500; }
/* Detailed editing stays off the mat until requested. */
dialog { background: #232b29; color: #dbe2d6; border: 1px solid #73876c63; border-radius: 12px; box-shadow: 0 30px 100px #0007; width: min(600px, calc(100vw - 30px)); max-height: 88dvh; padding: 25px; scrollbar-width: thin; scrollbar-color: #4d5c49 transparent; opacity: 0; scale: .97; translate: 0 -6px; transition: opacity .12s ease, scale .14s cubic-bezier(.2,.9,.25,1), translate .14s cubic-bezier(.2,.9,.25,1), overlay .14s allow-discrete, display .14s allow-discrete; }
dialog[open] { opacity: 1; scale: 1; translate: 0 0; }
/* The closing dialog lingers in the top layer for the exit transition; don't let it eat clicks. */
dialog:not([open]) { pointer-events: none; }
dialog::backdrop { background: #0e1614ba; backdrop-filter: blur(5px); opacity: 0; transition: opacity .12s ease, overlay .14s allow-discrete, display .14s allow-discrete; }
dialog[open]::backdrop { opacity: 1; }
@starting-style { dialog[open] { opacity: 0; scale: .97; translate: 0 -6px; } dialog[open]::backdrop { opacity: 0; } }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.dialog-heading .icon-button { width: 32px; height: 32px; }
dialog h2 { font-size: 22px; font-weight: 500; }
.dialog-icon { width: 38px; height: 38px; background: #cedd9810; color: var(--accent); border-radius: 7px; }
.dialog-description { color: #9ba998; font-size: 12px; line-height: 1.9; margin-top: 10px; }
.dialog-description code { font-size: 11px; }
.import-label { display: block; margin: 22px 0 9px; font-size: 12px; }
.import-help { display: flex; align-items: flex-start; gap: 8px; font-size: 11px; line-height: 1.8; color: #879981; margin-top: 13px; }
.import-help svg { width: 14px; height: 14px; margin-top: 2px; }
.dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid #ffffff12; padding-top: 20px; margin-top: 23px; }
.dialog-footer > span { font-size: 10px; color: #8d9b87; line-height: 1.8; }
.inspector-dialog { padding: 0; width: min(550px, calc(100vw - 30px)); }
.inspector-dialog > .dialog-heading { padding: 19px 22px; margin: 0; border-bottom: 1px solid #ffffff0c; position: sticky; top: 0; background: #232b29f5; z-index: 2; }
.inspector-dialog h2 { font-size: 17px; }
.inspector-identity { display: flex; align-items: center; gap: 13px; padding: 20px 22px; background: var(--card); border-bottom: 1px solid var(--card-edge); }
.inspector-identity .protocol-icon { background: var(--tint); height: 36px; width: 36px; border-radius: 7px; }
.inspector-identity h3 { font: 14px var(--mono); text-align: right; }
.layer-position { font: 23px var(--mono); color: #ffffff23; margin-inline-start: auto; }
.slot-position { font-size: 14px; }
.slot-picker { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #a1ac9c; }
.slot-picker select { width: auto; padding: 4px 8px; font: 11px var(--mono); }
.inspector-fields { padding: 22px; }
.inspector-footer { position: sticky; bottom: 0; z-index: 2; padding: 15px 22px; background: #232b29f5; border-top: 1px solid #ffffff15; display: flex; align-items: center; justify-content: flex-end; }
.field-help { display: block; font-size: 10px; line-height: 1.8; color: #8c9b85; margin-top: 5px; }
.standalone-help { margin-bottom: 20px; font-size: 12px; }
.flag-buttons { display: flex; gap: 5px; margin-top: 8px; }
.flag-button { flex: 1; background: #18211b; color: #8b9f7f; border: 1px solid #889a6f30; border-radius: 4px; padding: 6px; font: 11px var(--mono); }
.flag-button.active { background: #cdd99e25; border-color: #cdd99e80; color: #d7e7b7; }
.advanced-fields { border-top: 1px solid #ffffff13; margin-top: 20px; }
.advanced-fields > summary { padding: 16px 0; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #adb89f; }
.advanced-fields > summary span { display: flex; align-items: center; gap: 5px; color: #8d9c7e; font-size: 10px; }
.advanced-fields > summary svg { width: 14px; height: 14px; }
.export-dialog { width: min(880px, calc(100vw - 30px)); }
.code-panel { margin-top: 22px; background: #141c19; border: 1px solid #8297742f; border-radius: 7px; overflow: hidden; }
.help-dialog { width: min(560px, calc(100vw - 30px)); }
.help-dialog .dialog-footer { justify-content: flex-end; }
.help-body { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; font-size: 12px; line-height: 1.95; color: #b0bbad; }
.help-body h3 { font-size: 13px; font-weight: 500; color: #dde4d6; margin-top: 4px; }
.code-heading { padding: 13px 17px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ffffff0c; font: 10px var(--mono); color: #83977a; }
.code-dot { width: 5px; height: 5px; background: #b9d394; border-radius: 50%; }
.code-body { display: flex; gap: 20px; padding: 22px 20px; font: 12px/1.9 var(--mono); overflow: auto; min-height: 200px; }
.line-numbers { color: #47593f; white-space: pre; text-align: right; user-select: none; flex-shrink: 0; }
.code-body pre { margin: 0; min-width: 0; font: inherit; }
.code-body code { font: inherit; color: #c9d3bd; }
.syntax-string { color: #bcce92; }
.syntax-keyword { color: #b9a9d3; }
.syntax-number { color: #d6b18a; }
.syntax-class { color: #93b9be; }
.code-error { margin-top: 15px; padding: 12px; background: #78584525; color: #dfb598; font-size: 12px; border-radius: 5px; }
#manual-copy { margin-top: 20px; }
.toast { position: fixed; bottom: 25px; left: 50%; transform: translate(-50%, 12px); width: max-content; max-width: calc(100vw - 30px); z-index: 60; padding: 12px 20px; border: 1px solid #bed58c44; border-radius: 7px; background: #303c2c; color: #dae6c6; box-shadow: 0 10px 25px #0003; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; font-size: 12px; line-height: 1.6; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; inset: 0; padding: 40px; z-index: 100; background: #181d1f; }
@media (max-width: 1050px) { .sidebar-column { width: 200px; inset-inline-start: 18px; } .crafting-area { padding-inline: 248px 30px; } }
@media (max-width: 760px) {
  body { height: auto; overflow: visible; display: flex; flex-direction: column; }
  .layer-card { cursor: default; }
  .layer-grip { display: none; }
  .layer-header, .palette-item { touch-action: auto; }
  .palette-item { cursor: pointer; }
  .site-header { order: 0; position: static; height: 66px; padding: 0 18px; background: none; }
  .brand { gap: 9px; } .brand strong { font-size: 14px; }
  .crafting-area { order: 1; position: static; display: flex; flex-direction: column; overflow: visible; min-height: 58dvh; padding: 34px 18px 26px; }
  .crafting-area::before, .crafting-area::after, .mat-coordinate { display: none; }
  .mat-footer { position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); inset-inline-end: auto; width: max-content; margin: 20px auto 0 0; }
  #open-export { min-width: 150px; min-height: 58px; padding: 13px 28px; border-radius: 10px; font-size: 18px; }
  .sidebar-column { order: 3; position: static; width: auto; margin: 18px; }
  .layer-sidebar { flex: none; }
  .layer-category { display: none; }
  #palette-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .layer-group { min-width: 0; }
  .layer-group:nth-child(odd) { border-inline-end: 1px solid var(--line); }
  .raw-group { grid-column: 1 / -1; }
}
@media (any-pointer: coarse) { .layer-header, .palette-item { touch-action: auto; } }
@media (max-width: 500px) {
  .site-header { padding-inline: 17px; height: 63px; }
  #layer-count { font-size: 9px; }
  .mat-tools { gap: 6px; }
  .crafting-area { padding: 28px 12px 22px; }
  .layer-card { padding: 12px 11px 13px; }
  .layer-heading { gap: 7px; } .layer-heading h2 { font-size: 13px; }
  .layer-grip { margin-left: -4px; } .layer-heading .protocol-icon { display: none; }
  .layer-header { margin-bottom: 9px; }
  .layer-actions { gap: 1px; } .layer-actions .icon-button { width: 28px; height: 28px; }
  .inline-fields { grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 9px; }
  .inline-field input { font-size: 16px; height: 36px; padding: 6px; }
  .inline-field .field-reset { opacity: 1; }
  .button { font-size: 12px; padding: 9px 14px; }
  .presets-label { font-size: 11px; gap: 7px; }
  .presets-section > summary { padding: 11px 12px; }
  .preset { padding: 8px; }
  dialog { padding: 20px; } dialog h2 { font-size: 20px; }
  input, textarea, select { font-size: 16px; }
  .inspector-dialog { padding: 0; } .inspector-fields { padding: 18px; }
  .inspector-footer { padding: 13px 18px; }
  .dialog-footer { gap: 12px; flex-wrap: wrap; }
  .dialog-footer > span { font-size: 10px; }
  .code-body { font-size: 11px; gap: 12px; padding: 17px 14px; }
}
/* Only the reset buttons need the no-hover escape hatch; .45 is legible enough to tap,
   so the card actions keep one resting opacity on every device. */
@media (any-hover: none) { .inline-field .field-reset { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after, *::details-content, *::backdrop { transition: none !important; animation: none !important; } }
