:root {
  --bg: #f0f0f0;
  --panel: #fbfbf8;
  --panel-border: rgba(65, 65, 60, 0.1);
  --panel-shadow:
    0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 22px rgba(33, 36, 31, 0.09);
  --text: #172016;
  --muted: #5d6d59;
  --accent: #ff6b2c;
  --accent-strong: #d44c16;
  --surface: #f6f6f3;
  --field-line: rgba(255, 255, 255, 0.92);
  --viewport-height: 900px;
  --viewport-width: 1400px;
  --toolbar-button-height: 72px;
  --toolbar-compact-height: 60px;
  --format-button-height: 56px;
  --sidebar-gap: 12px;
  --panel-padding: 16px;
  --shell-padding: 14px;
  --tool-icon-size: 28px;
  --toolbar-button-bg: #41413c;
  --toolbar-button-bg-top: #56564f;
  --toolbar-button-bg-mid: #43433e;
  --toolbar-button-bg-bottom: #2f2f2b;
  --toolbar-button-border: rgba(240, 240, 240, 0.12);
  --toolbar-button-text: #f0f0f0;
  --toolbar-button-active: #a3b85d;
  --toolbar-button-active-dark: #8fa452;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans", "Barlow", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body[data-color-mode="light"] .sidebar .tool-button,
body[data-color-mode="light"] .sidebar .section-toggle {
  color: #172016;
  border-color: rgba(15, 52, 44, 0.14);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.7), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(242, 242, 238, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 -1px 0 rgba(15, 52, 44, 0.05),
    0 6px 12px rgba(33, 36, 31, 0.08);
}

body[data-color-mode="light"] .sidebar .tool-button:hover,
body[data-color-mode="light"] .sidebar .section-toggle:hover {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.84), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(244, 244, 240, 1) 100%);
}

body[data-color-mode="light"] .sidebar .tool-button.active {
  color: #172016;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(242, 242, 238, 0.98)) padding-box,
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.2)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(244, 244, 240, 1) 100%);
  border-color: rgba(228, 148, 98, 0.98);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(15, 52, 44, 0.05),
    0 0 0 2px rgba(228, 148, 98, 0.16),
    0 10px 20px rgba(228, 148, 98, 0.14);
}

body[data-color-mode="light"] .sidebar .section-toggle {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 242, 238, 0.98));
}

body[data-color-mode="light"] .sidebar .section-toggle-button {
  background: rgba(15, 52, 44, 0.06);
  color: #172016;
  border-color: rgba(15, 52, 44, 0.12);
}

body[data-color-mode="eisern"] .sidebar .tool-button,
body[data-color-mode="eisern"] .sidebar .section-toggle {
  color: #342a26;
  border-color: rgba(138, 69, 36, 0.18);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.72), transparent 46%),
    linear-gradient(180deg, rgba(255, 250, 244, 0.98) 0%, rgba(247, 241, 232, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(112, 64, 40, 0.05),
    0 6px 12px rgba(53, 39, 33, 0.08);
}

body[data-color-mode="eisern"] .sidebar .tool-button:hover,
body[data-color-mode="eisern"] .sidebar .section-toggle:hover {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.84), transparent 46%),
    linear-gradient(180deg, rgba(255, 252, 247, 1) 0%, rgba(248, 241, 233, 1) 100%);
}

body[data-color-mode="eisern"] .sidebar .tool-button.active {
  color: #342a26;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(248, 241, 233, 0.98)) padding-box,
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.2)),
    linear-gradient(180deg, rgba(255, 252, 247, 1) 0%, rgba(248, 241, 233, 1) 100%);
  border-color: rgba(218, 52, 33, 0.98);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.58),
    inset 0 -1px 0 rgba(112, 64, 40, 0.04),
    0 0 0 2px rgba(218, 52, 33, 0.14),
    0 10px 20px rgba(218, 52, 33, 0.14);
}

body[data-color-mode="eisern"] .sidebar .section-toggle {
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.98), rgba(247, 241, 232, 0.98));
}

body[data-color-mode="eisern"] .sidebar .section-toggle-button {
  background: rgba(138, 69, 36, 0.06);
  color: #342a26;
  border-color: rgba(138, 69, 36, 0.12);
}

body[data-color-mode="eisern"] .sidebar .tool-button.icon-only {
  padding-block: 10px;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 14px;
  padding: var(--shell-padding);
  height: var(--viewport-height);
  max-height: var(--viewport-height);
  align-items: stretch;
}

.sidebar,
.inspector {
  display: flex;
  flex-direction: column;
  gap: var(--sidebar-gap);
  min-height: 0;
  height: calc(var(--viewport-height) - (var(--shell-padding) * 2));
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: calc(var(--viewport-height) - (var(--shell-padding) * 2));
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.brand,
.panel,
.canvas-card,
.canvas-toolbar-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  box-shadow: var(--panel-shadow);
}

.brand,
.panel {
  padding: var(--panel-padding);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 116px;
  padding: 12px 16px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: "Barlow", "Noto Sans", sans-serif;
}

h1 {
  font-size: 1.95rem;
  line-height: 1;
}

h2 {
  font-size: 1.35rem;
}

.panel-header h2 {
  font-size: 1.2rem;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.95rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.toolbar-layout {
  display: grid;
  gap: 12px;
}

.toolbar-group {
  display: grid;
  gap: 8px;
}

.toolbar-label {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-weight: 700;
}

.toolbar-sections {
  display: grid;
  gap: 10px;
}

.tool-section {
  display: grid;
  gap: 8px;
  padding-top: 2px;
  position: relative;
}

.section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--toolbar-button-bg);
  color: var(--toolbar-button-text);
  border: 1px solid var(--toolbar-button-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.section-toggle-label {
  font-size: 0.8rem;
  font-weight: 700;
}

.section-toggle-button {
  min-width: 58px;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  background: rgba(240, 240, 240, 0.08);
  color: var(--toolbar-button-text);
  border: 1px solid rgba(240, 240, 240, 0.12);
  transition:
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    color 180ms ease;
}

.section-toggle-button.active {
  background: linear-gradient(180deg, var(--toolbar-button-active) 0%, var(--toolbar-button-active-dark) 100%);
  color: #fff;
  border-color: rgba(240, 240, 240, 0.34);
  box-shadow:
    0 8px 18px rgba(81, 104, 35, 0.24),
    inset 0 0 0 1px rgba(240, 240, 240, 0.16);
}

.section-toggle-button:hover {
  background: rgba(240, 240, 240, 0.12);
  border-color: rgba(240, 240, 240, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 16px rgba(21, 24, 18, 0.1);
}

.icon-grid,
.format-grid,
.history-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.split-icon-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.split-icon-grid .split-tool {
  grid-column: span 2;
}

.history-grid,
.format-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.format-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-button,
.ghost-button,
.primary-button {
  border: 0;
  border-radius: 16px;
  font: inherit;
  cursor: pointer;
  transition:
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    color 180ms ease;
}

.tool-button {
  padding: 10px 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 18%, rgba(0, 0, 0, 0.03) 60%, rgba(0, 0, 0, 0.1) 100%),
    linear-gradient(180deg, var(--toolbar-button-bg-top) 0%, var(--toolbar-button-bg-mid) 44%, var(--toolbar-button-bg-bottom) 100%);
  color: var(--toolbar-button-text);
  text-align: left;
  border: 1px solid var(--toolbar-button-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 6px 12px rgba(21, 24, 18, 0.12);
}

.tool-button.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.02)) padding-box,
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.14), transparent 44%),
    linear-gradient(180deg, rgba(163, 184, 93, 0.12) 0%, rgba(163, 184, 93, 0.04) 22%, rgba(0, 0, 0, 0.04) 60%, rgba(0, 0, 0, 0.12) 100%),
    linear-gradient(180deg, #5b5b53 0%, #474741 42%, #30302c 100%);
  color: var(--toolbar-button-text);
  border-color: rgba(228, 148, 98, 0.98);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(228, 148, 98, 0.2),
    0 0 0 2px rgba(228, 148, 98, 0.18),
    0 14px 28px rgba(228, 148, 98, 0.16);
}

.tool-button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.tool-button.icon-button {
  min-height: var(--toolbar-button-height);
  display: grid;
  justify-items: center;
  align-content: center;
  text-align: center;
  gap: 4px;
  padding: 7px 4px;
}

.tool-button.compact {
  min-height: var(--toolbar-compact-height);
}

.tool-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.tool-short {
  display: block;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-short.tight {
  font-size: 0.52rem;
  letter-spacing: -0.01em;
}

.split-tool {
  position: relative;
  grid-column: span 2;
  min-width: 0;
}

.split-tool-button {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  overflow: hidden;
  padding: 0;
}

.split-tool-main,
.split-tool-toggle {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.split-tool-main {
  min-height: var(--toolbar-button-height);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  padding: 7px 3px 7px 5px;
}

.split-tool-toggle {
  position: relative;
  min-height: 100%;
  border-left: 1px solid rgba(240, 240, 240, 0.08);
}

.split-tool-main .tool-short {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.56rem;
  letter-spacing: -0.01em;
}

.split-tool-toggle::before,
.split-tool-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.split-tool-toggle::before {
  transform: translate(-65%, -30%) rotate(45deg);
}

.split-tool-toggle::after {
  transform: translate(-35%, -30%) rotate(-45deg);
}

.split-tool-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 12;
  display: grid;
  gap: 5px;
  padding: 6px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 18%, rgba(0, 0, 0, 0.03) 60%, rgba(0, 0, 0, 0.1) 100%),
    linear-gradient(180deg, var(--toolbar-button-bg-top) 0%, var(--toolbar-button-bg-mid) 44%, var(--toolbar-button-bg-bottom) 100%);
  border: 1px solid var(--toolbar-button-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 12px 28px rgba(21, 24, 18, 0.18);
}

.split-tool-option {
  border: 1px solid rgba(240, 240, 240, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--toolbar-button-text);
  font: inherit;
  min-height: 36px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  text-align: left;
  cursor: pointer;
}

.split-tool-option.active {
  border-color: rgba(228, 148, 98, 0.98);
  box-shadow: 0 0 0 1px rgba(228, 148, 98, 0.16);
}

.split-tool-option svg {
  width: 18px;
  height: 18px;
}

.split-tool-option-label {
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.1;
}

.format-chip {
  padding: 10px 8px;
  min-height: var(--format-button-height);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 18%, rgba(0, 0, 0, 0.03) 60%, rgba(0, 0, 0, 0.1) 100%),
    linear-gradient(180deg, var(--toolbar-button-bg-top) 0%, var(--toolbar-button-bg-mid) 44%, var(--toolbar-button-bg-bottom) 100%);
  color: var(--toolbar-button-text);
  border: 1px solid var(--toolbar-button-border);
  border-radius: 16px;
  font: inherit;
  cursor: pointer;
  text-align: center;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 6px 12px rgba(21, 24, 18, 0.12);
}

.format-chip.active,
.format-chip:hover {
  color: var(--toolbar-button-text);
}

.format-chip.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.02)) padding-box,
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.14), transparent 44%),
    linear-gradient(180deg, rgba(163, 184, 93, 0.12) 0%, rgba(163, 184, 93, 0.04) 22%, rgba(0, 0, 0, 0.04) 60%, rgba(0, 0, 0, 0.12) 100%),
    linear-gradient(180deg, #5b5b53 0%, #474741 42%, #30302c 100%);
  border-color: rgba(228, 148, 98, 0.98);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(228, 148, 98, 0.2),
    0 0 0 2px rgba(228, 148, 98, 0.18),
    0 14px 28px rgba(228, 148, 98, 0.16);
}

.tool-button:hover,
.format-chip:hover {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.16), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.085) 0%, rgba(255, 255, 255, 0.03) 18%, rgba(0, 0, 0, 0.03) 60%, rgba(0, 0, 0, 0.11) 100%),
    linear-gradient(180deg, #5b5b53 0%, #45453f 44%, #31312d 100%);
  border-color: rgba(240, 240, 240, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 7px 14px rgba(21, 24, 18, 0.13);
}

.ghost-button:hover,
.primary-button:hover {
  box-shadow: 0 12px 24px rgba(21, 24, 18, 0.12);
}

.action-stack {
  display: grid;
  gap: 8px;
}

.ghost-button,
.primary-button {
  padding: 12px 14px;
}

.sidebar .panel:first-of-type {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.sidebar .panel:first-of-type .toolbar-layout {
  height: 100%;
  align-content: start;
  overflow: hidden;
}

.sidebar .panel:last-of-type {
  flex: 0 0 auto;
}

.sidebar-field-slot {
  margin-top: 10px;
}

.sidebar-help-slot {
  margin-top: 8px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

.ghost-button {
  background: #f4f7ef;
  color: var(--text);
}

.ghost-button.danger {
  color: #8b271b;
  background: #fdecea;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 16px 30px rgba(212, 76, 22, 0.28);
}

.export-button {
  border-radius: 999px;
  padding: 11px 18px;
  min-height: 42px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, var(--toolbar-button-active) 0%, var(--toolbar-button-active-dark) 100%);
  box-shadow: 0 12px 24px rgba(81, 104, 35, 0.26);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #667064;
  background: #f2f3ef;
  border: 1.5px dashed rgba(102, 112, 100, 0.42);
}

.status-pill svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
}

.canvas-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 246, 243, 0.98));
  overflow: hidden;
}

.timeline-card {
  display: grid;
  gap: 12px;
  padding: 12px 14px 14px;
  flex: 0 0 auto;
  background:
    linear-gradient(180deg, rgba(251, 251, 248, 0.98), rgba(242, 244, 239, 0.98));
  border: 1px solid rgba(23, 32, 22, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 10px 22px rgba(33, 36, 31, 0.07);
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.timeline-title {
  margin: 0;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  color: #5a6852;
}

.timeline-meta {
  margin: 0;
  color: #6c7869;
  font-size: 0.74rem;
  font-weight: 700;
  text-align: right;
}

.timeline-body {
  display: grid;
  gap: 12px;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.timeline-control-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(229, 233, 226, 0.9), rgba(214, 220, 210, 0.84));
  border: 1px solid rgba(23, 32, 22, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 8px 16px rgba(33, 36, 31, 0.06);
}

.timeline-control-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(23, 32, 22, 0.1);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.62), transparent 56%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 244, 240, 0.98));
  color: #243020;
  cursor: pointer;
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    color 180ms ease;
}

.timeline-control-button:hover {
  transform: translateY(-1px);
  border-color: rgba(228, 148, 98, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 10px 18px rgba(228, 148, 98, 0.14);
}

.timeline-control-button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.timeline-control-button.active {
  border-color: rgba(143, 164, 82, 0.84);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.18), transparent 56%),
    linear-gradient(180deg, #b8cc74 0%, #8fa452 100%);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 10px 18px rgba(78, 102, 42, 0.18);
}

.timeline-control-button svg {
  width: 18px;
  height: 18px;
  display: block;
}

.timeline-track {
  display: flex;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.timeline-frame {
  flex: 0 0 clamp(82px, 7vw, 96px);
  min-width: clamp(82px, 7vw, 96px);
  aspect-ratio: 1 / 1;
  padding: 10px 10px 9px;
  border-radius: 20px;
  border: 1px solid rgba(23, 32, 22, 0.08);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.88), transparent 54%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 245, 240, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    0 8px 16px rgba(33, 36, 31, 0.06);
  display: grid;
  align-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background 220ms cubic-bezier(0.22, 1, 0.36, 1),
    flex-basis 220ms cubic-bezier(0.22, 1, 0.36, 1),
    min-width 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline-frame:hover {
  transform: translateY(-1px);
  border-color: rgba(228, 148, 98, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 12px 22px rgba(228, 148, 98, 0.08);
}

.timeline-frame.active {
  flex-basis: clamp(108px, 9vw, 126px);
  min-width: clamp(108px, 9vw, 126px);
  aspect-ratio: 1.3 / 1;
  border-color: rgba(228, 148, 98, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 2px rgba(228, 148, 98, 0.14),
    0 12px 20px rgba(228, 148, 98, 0.12);
}

.timeline-frame.playback {
  border-color: rgba(163, 184, 93, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 2px rgba(163, 184, 93, 0.16),
    0 12px 20px rgba(163, 184, 93, 0.12);
}

.timeline-frame-title,
.timeline-frame-meta {
  margin: 0;
}

.timeline-frame-title {
  font-family: "Barlow", "Noto Sans", sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.timeline-frame-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #6c7869;
  font-size: 0.7rem;
  font-weight: 700;
  flex-wrap: wrap;
}

.timeline-frame-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.timeline-frame-metric svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.timeline-frame-editor {
  display: grid;
  gap: 3px;
  align-self: end;
}

.timeline-frame-editor-label {
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a8678;
}

.timeline-duration-select {
  width: 100%;
  min-height: 26px;
  padding: 0 22px 0 8px;
  border-radius: 10px;
  border: 1px solid rgba(23, 32, 22, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 242, 237, 0.98));
  color: #243020;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(23, 32, 22, 0.56) 50%),
    linear-gradient(135deg, rgba(23, 32, 22, 0.56) 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0));
  background-position:
    calc(100% - 13px) 10px,
    calc(100% - 8px) 10px,
    0 0;
  background-size: 5px 5px, 5px 5px, 100% 100%;
  background-repeat: no-repeat;
}

.timeline-duration-select:focus {
  outline: none;
  border-color: rgba(228, 148, 98, 0.84);
  box-shadow: 0 0 0 3px rgba(228, 148, 98, 0.12);
}

.timeline-ghost-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 14px;
  border: 1px dashed rgba(102, 112, 100, 0.28);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.canvas-toolbar-card {
  padding: 10px 12px;
}

.canvas-toolbar {
  display: grid;
  grid-template-columns: max-content minmax(0, max-content) max-content max-content;
  gap: 6px;
  flex: 0 0 auto;
  align-items: end;
  justify-content: space-between;
}

.canvas-toolbar-group {
  min-width: 0;
}

.layout-tools-row {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  flex-wrap: wrap;
  width: max-content;
}

.canvas-tools-row {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  flex-wrap: wrap;
}

.canvas-toolbar-export {
  min-width: 0;
  justify-items: end;
}

.export-controls {
  display: inline-flex;
  align-items: stretch;
  gap: 6px;
  flex-wrap: nowrap;
}

.toolbar-icon-button {
  display: inline-grid;
  place-items: center;
  width: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 4px;
  border-radius: 14px;
  border: 1.5px solid rgba(23, 32, 22, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  cursor: pointer;
  transition:
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    color 180ms ease;
}

.toolbar-icon-button svg {
  width: 20px;
  height: 20px;
  display: block;
}

.toolbar-icon-button:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: #e49462;
  box-shadow: 0 10px 20px rgba(228, 148, 98, 0.18);
}

.export-quality-control {
  display: grid;
  gap: 3px;
  min-width: 88px;
  padding: 5px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1.5px solid rgba(23, 32, 22, 0.12);
}

.export-format-control {
  min-width: 76px;
}

.export-quality-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #667064;
}

.export-quality-select {
  width: 100%;
  min-height: 24px;
  padding: 0 20px 0 7px;
  border-radius: 9px;
  border: 1px solid rgba(23, 32, 22, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 242, 238, 0.98));
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(23, 32, 22, 0.6) 50%),
    linear-gradient(135deg, rgba(23, 32, 22, 0.6) 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0));
  background-position:
    calc(100% - 13px) 10px,
    calc(100% - 8px) 10px,
    0 0;
  background-size: 5px 5px, 5px 5px, 100% 100%;
  background-repeat: no-repeat;
}

.export-quality-select:focus {
  outline: none;
  border-color: rgba(228, 148, 98, 0.8);
  box-shadow: 0 0 0 3px rgba(228, 148, 98, 0.14);
}

.canvas-toolbar .format-grid,
.canvas-toolbar .history-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.canvas-toolbar .format-grid {
  grid-template-columns: minmax(0, 1fr);
  width: max-content;
}

.format-chip.icon-only {
  display: inline-grid;
  place-items: center;
  width: 48px;
  min-width: 48px;
  padding: 4px;
}

.format-chip.icon-only svg {
  width: 20px;
  height: 20px;
  display: block;
}

body:not([data-field-preset="free"]) .canvas-edge-handle {
  opacity: 0;
  pointer-events: none;
}

.color-mode-wrap {
  min-width: 124px;
}

.mode-control-wrap {
  min-width: 132px;
}

.color-mode-control {
  display: grid;
  gap: 3px;
  min-height: 48px;
  padding: 5px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1.5px solid rgba(23, 32, 22, 0.12);
}

.color-mode-label {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #667064;
}

.color-mode-select {
  width: 100%;
  min-height: 24px;
  padding: 0 22px 0 7px;
  border-radius: 10px;
  border: 1px solid rgba(23, 32, 22, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 242, 238, 0.98));
  color: var(--text);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(23, 32, 22, 0.6) 50%),
    linear-gradient(135deg, rgba(23, 32, 22, 0.6) 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0));
  background-position:
    calc(100% - 14px) 10px,
    calc(100% - 9px) 10px,
    0 0;
  background-size: 5px 5px, 5px 5px, 100% 100%;
  background-repeat: no-repeat;
}

.color-mode-select:focus {
  outline: none;
  border-color: rgba(228, 148, 98, 0.8);
  box-shadow: 0 0 0 3px rgba(228, 148, 98, 0.14);
}

.mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  min-height: 48px;
  width: 100%;
  padding: 4px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(232, 234, 229, 0.98), rgba(215, 220, 211, 0.96));
  border: 1px solid rgba(23, 32, 22, 0.08);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.8),
    inset 0 -1px 2px rgba(23, 32, 22, 0.08),
    0 8px 18px rgba(23, 32, 22, 0.08);
  overflow: hidden;
}

.mode-switch::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  opacity: 0.6;
  pointer-events: none;
}

.mode-switch-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.92), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(245, 242, 237, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.94);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92),
    0 8px 16px rgba(23, 32, 22, 0.12),
    0 2px 6px rgba(23, 32, 22, 0.08);
  transition:
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 240ms cubic-bezier(0.22, 1, 0.36, 1),
    background 240ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.mode-switch.animation .mode-switch-thumb {
  transform: translateX(100%);
}

.mode-switch.animating .mode-switch-thumb {
  box-shadow:
    0 10px 22px rgba(23, 32, 22, 0.15),
    0 0 0 6px rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.98), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(244, 240, 233, 0.98));
  animation: mode-switch-pop 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes mode-switch-pop {
  0% {
    transform: translateX(0) scale(1);
  }
  45% {
    transform: translateX(var(--mode-switch-pop-target, 0)) scale(1.04, 0.98);
  }
  100% {
    transform: translateX(var(--mode-switch-pop-target, 0)) scale(1);
  }
}

.mode-switch.design.animating {
  --mode-switch-pop-target: 0;
}

.mode-switch.animation.animating {
  --mode-switch-pop-target: 100%;
}

.mode-chip {
  position: relative;
  z-index: 1;
  min-height: 40px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: #6d756a;
  font: inherit;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    color 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

.mode-chip:hover {
  color: #424a40;
}

.mode-chip.active {
  color: #172016;
}

.canvas-toolbar .tool-button.compact,
.canvas-toolbar .format-chip,
.help-trigger {
  min-height: 48px;
  width: 48px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  border: 1.5px solid rgba(23, 32, 22, 0.12);
  box-shadow: none;
}

.canvas-toolbar .tool-button.compact.active,
.canvas-toolbar .format-chip.active,
.canvas-toolbar .tool-button.compact:hover,
.canvas-toolbar .format-chip:hover,
.help-trigger.active,
.help-trigger:hover {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  border-color: #e49462;
  box-shadow: 0 10px 20px rgba(228, 148, 98, 0.18);
}

.canvas-toolbar .tool-button.compact svg,
.canvas-toolbar .format-chip svg {
  width: 20px;
  height: 20px;
}

.canvas-toolbar .tool-button.icon-button.compact {
  gap: 3px;
  padding: 4px 3px;
}

.canvas-toolbar .tool-short {
  font-size: 0.56rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
}

.canvas-toolbar .tool-short.tight {
  font-size: 0.46rem;
  letter-spacing: -0.02em;
  line-height: 1;
}

.canvas-toolbar .status-pill {
  min-height: 48px;
  min-width: 116px;
  padding: 0 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1.5px dashed rgba(102, 112, 100, 0.36);
  color: #667064;
  white-space: nowrap;
  justify-content: center;
  font-size: 0.76rem;
}

.canvas-toolbar .status-pill span {
  display: block;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.canvas-toggle-wrap {
  display: flex;
  justify-content: flex-end;
}

.canvas-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1.5px solid rgba(23, 32, 22, 0.12);
}

.canvas-toggle-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.canvas-toggle-button {
  min-width: 52px;
  min-height: 32px;
  border-radius: 999px;
  border: 1.5px solid rgba(23, 32, 22, 0.12);
  background: rgba(15, 19, 14, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    color 180ms ease;
}

.canvas-toggle-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #e49462;
  box-shadow: 0 10px 18px rgba(228, 148, 98, 0.12);
}

.canvas-toggle-button.active {
  background: rgba(228, 148, 98, 0.14);
  border-color: #e49462;
  color: #a44f20;
  box-shadow: 0 10px 20px rgba(228, 148, 98, 0.18);
}

.help-trigger svg {
  width: 20px;
  height: 20px;
}

.sidebar-help-slot .help-trigger {
  width: 104px;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 16px;
  justify-items: center;
  gap: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 241, 0.98));
  border: 1.5px solid rgba(163, 184, 93, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 8px 16px rgba(78, 102, 42, 0.08);
}

.sidebar-field-slot .field-trigger {
  width: 132px;
  min-height: 54px;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 18px;
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  background:
    radial-gradient(circle at 20% 0%, rgba(163, 184, 93, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 243, 235, 0.98));
  border: 1.5px solid rgba(80, 131, 74, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 20px rgba(43, 72, 40, 0.09);
}

.sidebar-field-slot .field-trigger:hover {
  transform: translateY(-1px);
  border-color: rgba(228, 148, 98, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 14px 26px rgba(43, 72, 40, 0.14);
}

.sidebar-field-slot .field-trigger.active {
  color: #fff;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.18), transparent 46%),
    linear-gradient(180deg, #eaa16e 0%, #d97e42 100%);
  border-color: rgba(217, 126, 66, 0.96);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 16px 28px rgba(228, 148, 98, 0.26);
}

.sidebar-field-slot .field-trigger svg {
  width: 24px;
  height: 24px;
}

.sidebar-help-slot .help-trigger:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 245, 231, 1));
  border-color: rgba(163, 184, 93, 0.52);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 12px 24px rgba(78, 102, 42, 0.12);
}

.sidebar-help-slot .help-trigger.active {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.16), transparent 48%),
    linear-gradient(180deg, #b8cc74 0%, #8fa452 100%);
  color: #fff;
  border-color: rgba(143, 164, 82, 0.96);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 14px 24px rgba(78, 102, 42, 0.2);
}

.sidebar-help-slot .help-trigger svg {
  width: 18px;
  height: 18px;
}

.sidebar-help-slot .tool-short {
  font-size: 0.62rem;
  font-weight: 700;
}

.sidebar-help-slot .help-trigger.active svg,
.sidebar-help-slot .help-trigger.active .tool-short {
  color: #fff;
}

body.help-cursor,
body.help-cursor #boardCanvas,
body.help-cursor .board-stage,
body.help-cursor .canvas-card {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Ccircle cx='14' cy='14' r='11' fill='%23f7faf1' stroke='%238fa452' stroke-width='2'/%3E%3Cpath d='M10.8 10.2c0-1.8 1.5-3.2 3.6-3.2 1.9 0 3.3 1.1 3.3 2.9 0 1.4-.6 2.2-2 3.1-.9.6-1.4 1.1-1.4 2.1v.4' fill='none' stroke='%23233720' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='14' cy='20.4' r='1.4' fill='%23233720'/%3E%3C/svg%3E") 14 14, help;
}

.canvas-toolbar .export-button {
  min-height: 48px;
  padding: 0 11px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 12px 24px rgba(212, 76, 22, 0.22);
  white-space: nowrap;
  font-size: 0.76rem;
}

.canvas-toolbar .export-button:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)) padding-box,
    linear-gradient(180deg, #ff7a3d 0%, #cf4714 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 14px 28px rgba(212, 76, 22, 0.26);
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.field input {
  width: 100%;
  border: 1px solid rgba(18, 25, 38, 0.1);
  border-radius: 14px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
}

.text-style-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.text-style-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Noto Sans", "Barlow", sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.text-style-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1em;
  line-height: 1;
}

.text-style-glyph-bold {
  font-weight: 800;
}

.text-style-glyph-italic {
  font-style: italic;
}

.text-style-glyph-underline {
  text-decoration: underline;
  text-underline-offset: 0.08em;
}

.text-style-button.active {
  border-color: rgba(228, 148, 98, 0.98);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.32),
    0 0 0 2px rgba(228, 148, 98, 0.14);
  background: linear-gradient(180deg, rgba(255, 251, 247, 0.98), rgba(244, 238, 232, 0.98));
}

.text-color-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
  gap: 8px;
}

.text-color-preset {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid rgba(18, 25, 38, 0.1);
  background: var(--preset-color);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 4px 10px rgba(33, 36, 31, 0.08);
}

.text-color-preset.active {
  border-color: rgba(228, 148, 98, 0.98);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 0 0 2px rgba(228, 148, 98, 0.16),
    0 6px 12px rgba(33, 36, 31, 0.1);
}

input[type="color"] {
  min-height: 48px;
  padding: 6px;
}

input[type="range"] {
  padding: 0;
}

/* Canvas overlays and edge-resize controls */
.canvas-notice {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + 10px));
  z-index: 4;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 248, 231, 0.96);
  color: #8f5224;
  border: 1px solid rgba(228, 148, 98, 0.28);
  box-shadow:
    0 10px 20px rgba(33, 36, 31, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 500ms ease,
    transform 500ms ease;
}

.canvas-notice.visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.export-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(122, 126, 131, 0.26);
  backdrop-filter: blur(2px);
}

.export-overlay-card {
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 12px;
  padding: 20px 20px 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.76), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 241, 0.98));
  border: 1px solid rgba(65, 65, 60, 0.14);
  box-shadow:
    0 24px 48px rgba(33, 36, 31, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  text-align: center;
}

.export-overlay-title,
.export-overlay-status,
.export-overlay-percent {
  margin: 0;
}

.export-overlay-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
}

.export-overlay-status {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
}

.export-overlay-progress {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 32, 22, 0.08);
  box-shadow:
    inset 0 1px 2px rgba(23, 32, 22, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.export-overlay-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, #ff8b55 100%);
  box-shadow: 0 6px 14px rgba(212, 76, 22, 0.24);
  transition: width 140ms linear;
}

.export-overlay-percent {
  font-size: 1.1rem;
  font-weight: 800;
  color: #8f5224;
}

.export-overlay-cancel {
  justify-self: center;
  min-width: 128px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(65, 65, 60, 0.14);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 240, 236, 0.98));
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 20px rgba(33, 36, 31, 0.09);
  transition:
    background 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.export-overlay-cancel:hover:not(:disabled) {
  border-color: rgba(228, 148, 98, 0.68);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(244, 241, 237, 1));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 12px 24px rgba(228, 148, 98, 0.14);
}

.export-overlay-cancel:disabled {
  opacity: 0.58;
  cursor: default;
}

.debug-console {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  width: min(440px, calc(100vw - 36px));
  border-radius: 18px;
  border: 1px solid rgba(23, 32, 22, 0.16);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(20, 25, 18, 0.18);
  overflow: hidden;
}

.debug-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(240, 240, 240, 0.98), rgba(229, 231, 224, 0.98));
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.debug-console-actions {
  display: flex;
  gap: 6px;
}

.debug-console-actions button {
  border: 1px solid rgba(23, 32, 22, 0.14);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.64rem;
  font-weight: 800;
  padding: 4px 8px;
  cursor: pointer;
}

.debug-console-output {
  width: 100%;
  height: 190px;
  resize: vertical;
  border: 0;
  border-top: 1px solid rgba(23, 32, 22, 0.12);
  padding: 10px;
  background: #151713;
  color: #dce7d7;
  font: 0.72rem/1.45 "Cascadia Mono", "Consolas", monospace;
  outline: none;
  white-space: pre;
}

.debug-console.collapsed .debug-console-output {
  display: none;
}

.board-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 14px 14px;
  overflow: hidden;
  position: relative;
}

.board-frame {
  position: relative;
  background: transparent;
  border-radius: 26px;
  padding: 2px;
  border: 0;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  max-height: 100%;
}

.canvas-edge-handle {
  position: absolute;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  z-index: 2;
}

.canvas-edge-handle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 239, 233, 0.94));
  border: 1px solid rgba(23, 32, 22, 0.16);
  box-shadow:
    0 8px 18px rgba(33, 36, 31, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.canvas-edge-handle::after {
  content: "";
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(15, 52, 44, 0.72);
}

.canvas-edge-handle:hover::before,
.canvas-edge-handle:focus-visible::before {
  border-color: rgba(228, 148, 98, 0.72);
  box-shadow:
    0 10px 22px rgba(228, 148, 98, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.canvas-edge-handle:focus-visible {
  outline: none;
}

.canvas-edge-handle-top,
.canvas-edge-handle-bottom {
  left: 50%;
  width: 96px;
  height: 14px;
  transform: translateX(-50%);
}

.canvas-edge-handle-top::after,
.canvas-edge-handle-bottom::after {
  width: 44px;
  height: 3px;
}

.canvas-edge-handle-top {
  top: -18px;
  cursor: ns-resize;
}

.canvas-edge-handle-bottom {
  bottom: -18px;
  cursor: ns-resize;
}

.canvas-edge-handle-left,
.canvas-edge-handle-right {
  top: 50%;
  width: 14px;
  height: 96px;
  transform: translateY(-50%);
}

.canvas-edge-handle-left::after,
.canvas-edge-handle-right::after {
  width: 3px;
  height: 44px;
}

.canvas-edge-handle-left {
  left: -18px;
  cursor: ew-resize;
}

.canvas-edge-handle-right {
  right: -18px;
  cursor: ew-resize;
}

#boardCanvas {
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  display: block;
  border-radius: 18px;
  background: transparent;
  box-shadow:
    0 12px 24px rgba(33, 36, 31, 0.08),
    0 2px 6px rgba(33, 36, 31, 0.05);
}

body[data-color-mode="light"] #boardCanvas {
  box-shadow:
    0 0 30px rgba(15, 52, 44, 0.18),
    0 0 12px rgba(33, 36, 31, 0.1);
}

body[data-color-mode="eisern"] #boardCanvas {
  box-shadow:
    0 0 30px rgba(176, 92, 48, 0.16),
    0 0 12px rgba(53, 39, 33, 0.08);
}

.canvas-resize-preview {
  position: absolute;
  border-radius: 18px;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.canvas-resize-mask {
  position: absolute;
  background: rgba(33, 36, 31, 0.18);
}

.canvas-resize-selection {
  position: absolute;
  border: 2px solid rgba(239, 198, 80, 0.96);
  background: rgba(239, 198, 80, 0.18);
  border-radius: 18px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 231, 0.28),
    0 8px 18px rgba(33, 36, 31, 0.08);
}

.empty-state,
.tips {
  color: var(--muted);
  line-height: 1.5;
}

.help-mode-card {
  padding: 12px 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 251, 243, 0.98)),
    linear-gradient(135deg, rgba(228, 148, 98, 0.08), rgba(163, 184, 93, 0.08));
  border: 1px solid rgba(228, 148, 98, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 10px 20px rgba(21, 24, 18, 0.06);
}

.help-mode-card p {
  margin: 0;
}

.help-mode-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #9f5428;
}

.help-mode-body {
  margin-top: 4px !important;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #566553;
}

.help-popover {
  position: fixed;
  z-index: 50;
  width: min(320px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 18px;
  pointer-events: none;
  background:
    radial-gradient(circle at top right, rgba(228, 148, 98, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(246, 250, 240, 0.98));
  border: 1px solid rgba(228, 148, 98, 0.26);
  box-shadow:
    0 18px 36px rgba(21, 24, 18, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
}

.help-popover-title {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #9f5428;
}

.help-popover-body {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #465542;
}

.hidden {
  display: none !important;
}

.inspector-fields.hidden {
  display: none;
}

.inspector-fields {
  display: grid;
  gap: 14px;
}

.field-settings-panel {
  display: grid;
  gap: 14px;
  color: var(--text);
}

.field-settings-header {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, rgba(163, 184, 93, 0.22), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 241, 0.98));
  border: 1px solid rgba(80, 131, 74, 0.16);
}

.field-settings-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(180deg, #eaa16e, #d97e42);
}

.field-settings-header h3 {
  margin: 0 0 3px;
  font-size: 1rem;
}

.field-settings-header p,
.field-settings-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.field-settings-field {
  display: grid;
  gap: 6px;
}

.field-settings-field span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.field-settings-field.disabled {
  opacity: 0.46;
}

.field-settings-field.disabled input,
.field-settings-field.disabled select {
  cursor: not-allowed;
  filter: grayscale(1);
}

.field-settings-field input,
.field-settings-field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(18, 25, 38, 0.12);
  border-radius: 13px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 245, 241, 0.98));
}

.field-settings-field input[type="color"] {
  padding: 4px;
}

.field-settings-field input[type="range"] {
  min-height: 28px;
  padding: 0;
}

.field-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inspector-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-top: 6px;
}

.layer-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.inspector-icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(18, 25, 38, 0.12);
  border-radius: 12px;
  background: #f4f7ef;
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.inspector-icon-button:hover {
  transform: translateY(-1px);
}

.inspector-icon-button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.inspector-icon-button svg {
  width: 20px;
  height: 20px;
  display: block;
}

.lock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #edf4e6;
  color: #40533c;
  font-weight: 600;
  border: 1px solid rgba(64, 83, 60, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
  cursor: pointer;
}

.global-lock-toggle {
  background: #f3efe4;
  color: #6f5610;
  border-color: rgba(111, 86, 16, 0.14);
}

.lock-toggle input {
  margin: 0;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.lock-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.lock-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  transform-origin: 50% 58%;
}

.lock-toggle.animating .lock-icon svg {
  animation: lockTogglePulse 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lock-toggle.locked {
  background: rgba(228, 148, 98, 0.14);
  border-color: rgba(228, 148, 98, 0.72);
  color: #a44f20;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    0 10px 20px rgba(228, 148, 98, 0.12);
}

.global-lock-toggle.locked {
  background: rgba(239, 198, 80, 0.18);
  border-color: rgba(214, 178, 59, 0.72);
  color: #8f6a11;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 10px 20px rgba(214, 178, 59, 0.12);
}

@keyframes lockTogglePulse {
  0% {
    transform: scale(0.9) rotate(-10deg);
    opacity: 0.78;
  }
  60% {
    transform: scale(1.06) rotate(4deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.goal-orientation {
  display: grid;
  gap: 8px;
}

.goal-orientation-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.goal-orientation-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.inspector-type {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #edf4e6;
  color: #40533c;
  font-weight: 600;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .canvas-toolbar {
    grid-template-columns: 1fr;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }
}
