.board-page { background: #eef0ed; }
.board-page [hidden] { display: none !important; }
.site-nav .is-current { color: var(--ink); }

.board-titlebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 64px;
  padding-top: 58px;
  padding-bottom: 38px;
}
.board-titlebar .eyebrow { margin-bottom: 17px; }
.board-titlebar h1 { margin: 0 0 12px; font-size: 54px; line-height: 1; }
.board-titlebar > div > p:last-child { margin: 0; color: var(--muted); font-size: 14px; }
.board-title-meta { display: grid; grid-template-columns: repeat(3, auto); gap: 0; margin: 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.board-title-meta div { min-width: 132px; padding: 13px 20px 14px; border-left: 1px solid var(--line); }
.board-title-meta div:first-child { border-left: 0; }
.board-title-meta dt { color: var(--muted); font: 9px/1.2 Arial, sans-serif; text-transform: uppercase; }
.board-title-meta dd { display: flex; align-items: center; gap: 7px; margin: 6px 0 0; font-size: 12px; font-weight: 700; white-space: nowrap; }
.board-title-meta dd i { width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); }

.editor-section { padding-bottom: 112px; }
.editor-frame { width: min(calc(100% - 32px), 1440px); margin-inline: auto; border: 1px solid var(--ink); background: var(--paper-bright); }
.editor-commandbar { display: grid; grid-template-columns: 224px minmax(0, 1fr) auto; align-items: stretch; min-height: 64px; border-bottom: 1px solid var(--ink); }
.editor-command-brand { display: flex; align-items: center; gap: 13px; padding: 0 18px; border-right: 1px solid var(--line); }
.editor-command-brand > span { display: grid; place-items: center; width: 29px; height: 29px; background: var(--red); color: var(--white); font: 700 10px/1 Arial, sans-serif; }
.editor-command-brand div { display: grid; gap: 2px; }
.editor-command-brand strong { font-size: 14px; }
.editor-command-brand small { color: var(--muted); font-size: 10px; }
.editor-command-scroll, .editor-output-actions { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 9px 12px; }
.editor-command-scroll { overflow-x: auto; scrollbar-width: none; }
.editor-command-scroll::-webkit-scrollbar { display: none; }
.editor-output-actions { justify-content: flex-end; border-left: 1px solid var(--line); }
.editor-command, .editor-icon-command { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 2px; background: transparent; color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 700; transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .18s ease; }
.editor-command { gap: 7px; padding: 0 13px; }
.editor-command span { font-size: 16px; font-weight: 400; }
.editor-icon-command { width: 42px; padding: 0; font-size: 20px; }
.editor-command:hover, .editor-command:focus-visible, .editor-icon-command:hover, .editor-icon-command:focus-visible { border-color: var(--ink); background: var(--paper); transform: translateY(-1px); }
.editor-command[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--white); }
.editor-command:disabled, .editor-icon-command:disabled { opacity: .3; cursor: default; transform: none; }
.editor-command-primary { border-color: var(--ink); background: var(--ink); color: var(--white); }
.editor-command-primary:hover, .editor-command-primary:focus-visible { border-color: var(--red); background: var(--red); }
.command-divider { flex: 0 0 1px; width: 1px; height: 28px; margin: 0 2px; background: var(--line); }

.editor-body { display: grid; grid-template-columns: 80px minmax(0, 1fr) 320px; min-height: 700px; }
.tool-rail { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 9px 8px; border-right: 1px solid var(--ink); background: var(--ink); }
.tool-button { display: grid; place-items: center; gap: 3px; min-width: 0; min-height: 68px; padding: 7px 2px; border: 0; border-bottom: 1px solid #414341; border-radius: 0; background: transparent; color: #bfc2bf; cursor: pointer; transition: background-color .18s ease, color .18s ease; }
.tool-button span { font: 22px/1 Arial, sans-serif; }
.tool-button b { font-size: 10px; font-weight: 600; }
.tool-button:hover, .tool-button:focus-visible { color: var(--white); }
.tool-button.is-active { background: var(--paper-bright); color: var(--ink); }
.tool-button.is-active::after { width: 20px; height: 2px; background: var(--red); content: ""; }

.editor-stage { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; background: #dfe2de; }
.editor-stage-head { display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 0 20px; border-bottom: 1px solid #b4b9b4; }
.editor-stage-head > div { display: flex; align-items: baseline; gap: 12px; }
.editor-stage-head > div:last-child { flex-direction: row-reverse; }
.editor-stage-head span { color: #777c77; font: 9px/1 Arial, sans-serif; }
.editor-stage-head strong { font-size: 12px; }
.canvas-desk { display: grid; place-items: center; min-height: 566px; padding: 22px; overflow: hidden; }
.board-device-frame { position: relative; width: min(100%, 760px); aspect-ratio: 1.39 / 1; padding: 7.3% 7.1% 9.4%; border: 1px solid #858a85; border-radius: 3px; background: #cfd2ce; box-shadow: 0 24px 54px rgba(22, 23, 22, .13); }
.board-device-frame::before { position: absolute; inset: 4.2% 4.4% 6.2%; border: 1px solid #a1a6a1; border-radius: 2px; content: ""; pointer-events: none; }
.device-label { position: absolute; top: 2.7%; color: #767b76; font: 8px/1 Arial, sans-serif; }
.device-label-left { left: 7.1%; }
.device-label-right { right: 7.1%; }
.board-device-inner { position: relative; z-index: 1; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border: 2px solid var(--ink); background: #fffefa; }
#board-canvas, #board-overlay { position: absolute; inset: 0; display: block; width: 100%; height: 100%; aspect-ratio: 4 / 3; }
#board-canvas { z-index: 0; background: #fffefa; cursor: default; image-rendering: auto; touch-action: none; }
#board-overlay { z-index: 1; pointer-events: none; }
.board-device-button { position: absolute; right: 3.4%; bottom: 2.4%; width: 4%; aspect-ratio: 1; border: 1px solid #8d928d; border-radius: 50%; background: #bcbfbb; }
.editor-stage-status { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 58px; padding: 0 20px; border-top: 1px solid #b4b9b4; background: #eef0ed; color: var(--muted); font-size: 10px; }
.editor-stage-status p { margin: 0; text-align: right; }
.board-palette-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; }
.board-palette-legend span { display: inline-flex; align-items: center; gap: 6px; }
.board-palette-legend i { width: 7px; height: 7px; border-radius: 50%; }
.legend-black { background: #171714; }.legend-red { background: #c6312b; }.legend-white { border: 1px solid #8a8d89; background: #fffefa; }.legend-yellow { background: #d9a715; }

.inspector { min-width: 0; max-height: 700px; overflow-y: auto; border-left: 1px solid var(--ink); background: var(--paper-bright); scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
.inspector-tabs { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; min-height: 54px; border-bottom: 1px solid var(--ink); background: var(--paper-bright); }
.inspector-tab { border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.inspector-tab:last-child { border-right: 0; }
.inspector-tab span { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 5px; padding: 0 5px; border-radius: 9px; background: var(--paper-muted); font: 9px/1 Arial, sans-serif; }
.inspector-tab.is-active { box-shadow: inset 0 -3px var(--red); color: var(--ink); }
.inspector-panel { min-width: 0; }
.selection-summary { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; min-height: 86px; padding: 17px 18px; background: var(--ink); color: var(--white); }
.selection-summary span { color: #aeb2ae; font: 9px/1.2 Arial, sans-serif; }
.selection-summary strong { grid-column: 1 / -1; font-size: 15px; }
.selection-summary small { grid-column: 1 / -1; color: #b9bdb9; font-size: 10px; }
.inspector-group { padding: 20px 18px 22px; border-bottom: 1px solid var(--line); }
.inspector-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 17px; }
.inspector-heading span { color: var(--red); font: 9px/1 Arial, sans-serif; }
.inspector-heading h2 { margin: 0; font-size: 14px; }
.color-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.color-button { display: grid; place-items: center; gap: 6px; min-width: 0; min-height: 56px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 2px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }
.color-button i { width: 22px; height: 22px; border: 1px solid transparent; border-radius: 50%; }
.color-black i { background: #171714; }.color-red i { background: #c6312b; }.color-white i { border-color: #8a8d89; background: #fffefa; }.color-yellow i { background: #d9a715; }
.color-button:hover, .color-button:focus-visible, .color-button.is-active { border-color: var(--ink); color: var(--ink); }
.color-button.is-active { box-shadow: inset 0 -2px var(--ink); }
.panel-capability { margin: 11px 0 0; color: var(--muted); font: 8px/1.3 Arial, sans-serif; }
.position-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.position-fields label { color: var(--muted); font: 9px/1 Arial, sans-serif; }
.position-fields input { width: 100%; min-height: 40px; margin-top: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--paper); color: var(--ink); font-size: 13px; }
.position-fields input:disabled { opacity: .45; }
.board-range-label { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.board-range-label output { color: var(--red); font-weight: 700; }
.board-range { width: 100%; height: 28px; margin: 8px 0 5px; accent-color: var(--red); cursor: pointer; }
.stroke-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; font-size: 11px; }
.stroke-options label { display: inline-flex; align-items: center; gap: 7px; }
.stroke-options input { width: 17px; height: 17px; accent-color: var(--red); }
.stroke-options i { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.board-text-input, .board-text-row select { width: 100%; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--paper-bright); color: var(--ink); font-family: inherit; }
.board-text-input { min-height: 80px; padding: 10px; resize: vertical; font-size: 13px; line-height: 1.55; }
.board-text-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.board-text-row label { color: var(--muted); font-size: 9px; }
.board-text-row label span { display: block; margin-bottom: 5px; }
.board-text-row select { min-height: 40px; padding: 0 8px; font-size: 12px; }
.inspector-action { width: 100%; min-height: 42px; margin-top: 10px; border: 1px solid var(--ink); border-radius: 2px; background: var(--ink); color: var(--white); cursor: pointer; font-size: 12px; font-weight: 700; }
.inspector-action:hover, .inspector-action:focus-visible { border-color: var(--red); background: var(--red); }
.template-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.template-grid button { display: grid; grid-template-columns: 24px 1fr; grid-template-rows: auto auto; gap: 3px 6px; min-height: 72px; padding: 10px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.template-grid button > span { grid-row: 1 / -1; color: var(--red); font: 9px/1.2 Arial, sans-serif; }
.template-grid strong { font-size: 11px; }
.template-grid small { color: var(--muted); font: 8px/1.2 Arial, sans-serif; }
.template-grid button:hover, .template-grid button:focus-visible { background: var(--paper); }

.layer-panel-head { display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.layer-panel-head > div { display: grid; gap: 3px; }
.layer-panel-head span { color: var(--muted); font: 8px/1 Arial, sans-serif; }
.layer-panel-head strong { font-size: 14px; }
.layer-panel-head button { min-height: 38px; padding: 0 12px; border: 1px solid var(--red); border-radius: 2px; background: transparent; color: var(--red); cursor: pointer; font-size: 11px; font-weight: 700; }
.layer-list { margin: 0; padding: 0; list-style: none; }
.layer-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 64px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.layer-item.is-selected { box-shadow: inset 3px 0 var(--red); background: var(--paper); }
.layer-visibility, .layer-action { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--muted); cursor: pointer; }
.layer-visibility:hover, .layer-visibility:focus-visible, .layer-action:hover, .layer-action:focus-visible { border-color: var(--line-strong); color: var(--ink); }
.layer-main { min-width: 0; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.layer-main strong, .layer-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-main strong { font-size: 11px; }
.layer-main small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.layer-actions { display: flex; align-items: center; }
.layer-action.is-danger { color: var(--red); }
.layer-empty { padding: 46px 18px; color: var(--muted); font-size: 12px; text-align: center; }

.editor-footer { display: flex; align-items: center; gap: 24px; min-height: 39px; padding: 0 18px; border-top: 1px solid var(--ink); background: var(--paper); color: var(--muted); font: 8px/1 Arial, sans-serif; }
.editor-footer strong { margin-left: auto; color: var(--ink); font-weight: 700; }

.board-bridge { display: grid; grid-template-columns: .8fr 1.2fr; gap: 90px; padding-top: 112px; padding-bottom: 124px; }
.board-bridge h2 { margin: 0; font-size: 48px; line-height: 1.2; }
.bridge-steps { border-top: 1px solid var(--ink); }
.bridge-steps article { display: grid; grid-template-columns: 34px 170px 1fr; align-items: center; gap: 12px; min-height: 82px; border-bottom: 1px solid var(--line); }
.bridge-steps article > span { color: var(--red); font: 9px/1 Arial, sans-serif; }
.bridge-steps article strong { font-size: 14px; }
.bridge-steps article p { margin: 0; color: var(--muted); font-size: 12px; }
.bridge-steps > .text-link { margin-top: 20px; }

@media (max-width: 1100px) {
  .board-titlebar { grid-template-columns: 1fr; gap: 30px; }
  .board-title-meta { justify-self: stretch; grid-template-columns: repeat(3, 1fr); }
  .editor-commandbar { grid-template-columns: 200px minmax(0, 1fr); }
  .editor-output-actions { grid-column: 1 / -1; justify-content: flex-end; min-height: 58px; border-top: 1px solid var(--line); border-left: 0; }
  .editor-body { grid-template-columns: 72px minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; max-height: none; border-top: 1px solid var(--ink); border-left: 0; }
  .inspector-panel.is-active { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .selection-summary, .template-group, .layer-panel-head, .layer-list { grid-column: 1 / -1; }
  .inspector-tabs { position: static; }
  .tool-rail { padding-inline: 6px; }
  .tool-button { min-height: 65px; }
}

@media (max-width: 760px) {
  .board-titlebar { width: calc(100% - 32px); padding-top: 42px; padding-bottom: 28px; }
  .board-titlebar h1 { font-size: 40px; }
  .board-titlebar > div > p:last-child { max-width: 300px; line-height: 1.8; }
  .board-title-meta { overflow-x: auto; }
  .board-title-meta div { min-width: 122px; padding-inline: 12px; }
  .editor-section { padding-bottom: 76px; }
  .editor-frame { width: 100%; border-right: 0; border-left: 0; }
  .editor-commandbar { grid-template-columns: minmax(0, 1fr) auto; }
  .editor-command-brand { min-height: 58px; border-right: 0; }
  .editor-output-actions { grid-column: 2; grid-row: 1; min-height: 58px; padding: 7px 8px; border-top: 0; border-left: 1px solid var(--line); }
  .editor-output-actions .editor-command { min-width: 46px; padding: 0 9px; font-size: 0; }
  .editor-output-actions .editor-command span { font-size: 18px; }
  .editor-command-scroll { grid-column: 1 / -1; grid-row: 2; min-height: 58px; border-top: 1px solid var(--line); }
  .editor-command, .editor-icon-command { min-height: 44px; }
  .editor-body { display: flex; flex-direction: column; min-height: 0; }
  .tool-rail { order: 0; flex-direction: row; width: 100%; padding: 0; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--ink); scrollbar-width: none; }
  .tool-rail::-webkit-scrollbar { display: none; }
  .tool-button { flex: 0 0 58px; min-height: 58px; border-right: 1px solid #414341; border-bottom: 0; }
  .tool-button.is-active::after { width: 18px; }
  .editor-stage { order: 1; }
  .editor-stage-head { min-height: 48px; padding-inline: 16px; }
  .canvas-desk { min-height: 0; padding: 18px 10px; }
  .board-device-frame { width: 100%; padding: 7.3% 7.1% 9.4%; box-shadow: 0 14px 32px rgba(22, 23, 22, .12); }
  .editor-stage-status { align-items: flex-start; min-height: 64px; padding: 11px 16px; }
  .board-palette-legend { gap: 10px; }
  .inspector { order: 2; }
  .inspector-panel.is-active { display: block; }
  .inspector-tabs { min-height: 56px; }
  .selection-summary { min-height: 82px; }
  .inspector-group { padding: 20px 16px; }
  .color-button { min-height: 58px; }
  .position-fields input, .board-text-row select, .inspector-action { min-height: 46px; font-size: 16px; }
  .board-text-input { min-height: 92px; font-size: 16px; }
  .template-grid button { min-height: 78px; }
  .layer-item { min-height: 68px; }
  .layer-visibility, .layer-action { width: 44px; height: 44px; }
  .layer-item { grid-template-columns: 44px minmax(0, 1fr) auto; padding-inline: 6px; }
  .editor-footer { gap: 12px; overflow-x: auto; white-space: nowrap; }
  .editor-footer strong { margin-left: 0; }
  .board-bridge { grid-template-columns: 1fr; gap: 46px; width: calc(100% - 32px); padding-top: 76px; padding-bottom: 84px; }
  .board-bridge h2 { font-size: 36px; }
  .bridge-steps article { grid-template-columns: 30px 1fr; gap: 5px 10px; min-height: 94px; padding: 14px 0; }
  .bridge-steps article p { grid-column: 2; }
}

@media (max-width: 380px) {
  .board-titlebar h1 { font-size: 36px; }
  .editor-command-brand { padding-inline: 12px; }
  .editor-command-brand > span { display: none; }
  .board-palette-legend span { font-size: 9px; }
  .editor-stage-status p { max-width: 116px; }
  .color-row { gap: 3px; }
  .color-button { min-height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .editor-command, .editor-icon-command, .tool-button { transition: none; }
}
