:root {
  --bg-app: #f7f6f3;
  --bg-panel: #ffffff;
  --bg-workspace: #f3f2ee;
  --bg-hover: #f6f7f9;
  --bg-active: #eaf0ff;
  --bg-track: #e8e8ec;
  --border: #eceae6;
  --border-strong: #dddcd7;
  --text: #1c1c21;
  --text-muted: #6f6f78;
  --text-soft: #8b8b94;
  --accent: #2f6bff;
  --accent-hover: #245cf0;
  --accent-pressed: #1e4fd6;
  --accent-soft: #eaf0ff;
  --accent-ring: rgba(47, 107, 255, 0.28);
  --support-bg: #fff6ea;
  --support-border: #f0d9b0;
  --support-text: #8b5310;
  --support-hover: #ffefd4;
  --ink: #19191c;
  --shadow-bar: 0 1px 0 rgba(28, 28, 33, 0.06);
  --shadow-page:
    0 0 0 1px rgba(28, 28, 33, 0.06),
    0 1px 2px rgba(28, 28, 33, 0.04),
    0 22px 40px rgba(28, 28, 33, 0.08);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-xs: 6px;
  --topbar-h: 52px;
  --footer-h: 32px;
  --leftbar-w: 80px;
  --inspector-w: 276px;
  --font: "Segoe UI", "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --halftone: rgba(40, 44, 58, 0.07);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ——— Top toolbar ——— */

.top-toolbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0 14px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-bar);
  z-index: 4;
  user-select: none;
  overflow-x: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex-shrink: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: block;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--ink);
  white-space: nowrap;
}

.brand-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
  flex-shrink: 0;
}

.brand-link {
  height: 28px;
  padding: 0 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
}

.brand-link:hover {
  color: var(--accent);
}

.brand-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .brand {
    min-width: 0;
    gap: 6px;
  }

  .brand-name {
    font-size: 14px;
  }

  .brand-link {
    padding: 0 6px;
    font-size: 12px;
  }

  .save-status {
    display: none;
  }
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.tb-sep {
  width: 1px;
  height: 16px;
  background: var(--border-strong);
  margin: 0 4px;
}

.save-status {
  min-width: 58px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.01em;
  user-select: none;
  pointer-events: none;
}

.tb-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tb-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.tb-btn:active:not(:disabled) {
  background: #ecece8;
}

.tb-btn:disabled {
  color: #b0b0b6;
  background: transparent;
  border-color: transparent;
}

.tb-btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
}

.ref-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 268px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-page);
  z-index: 20;
}

.ref-popover[hidden] {
  display: none;
}

.ref-popover-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.ref-popover-name {
  margin: -6px 0 0;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-popover-actions {
  display: flex;
  gap: 6px;
}

.ref-popover-actions .insp-btn {
  flex: 1;
}

.ref-popover .align-group .style-btn {
  flex: 1;
  min-width: 0;
  padding: 0 4px;
  font-size: 11px;
}

.ref-popover .insp-btn {
  width: 100%;
}

.ref-popover .field-val {
  min-width: 40px;
}

.tb-action-icon {
  width: 15px;
  height: 15px;
  display: block;
  flex-shrink: 0;
}

.tb-btn-label {
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 1100px) {
  .tb-btn-label {
    display: none;
  }

  .tb-btn-icon {
    width: 32px;
    padding: 0;
    justify-content: center;
  }
}

.tb-btn-export {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

.tb-btn-export:hover:not(:disabled) {
  color: var(--accent-hover);
  background: #dde7ff;
  border-color: transparent;
}

.tb-btn-export-solid {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.tb-btn-export-solid:hover:not(:disabled) {
  color: #fff;
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.tb-btn-export-solid:active:not(:disabled) {
  background: var(--accent-pressed);
  border-color: var(--accent-pressed);
}

.tb-btn-support {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  color: var(--support-text);
  background: var(--support-bg);
  border-color: var(--support-border);
  text-decoration: none;
  white-space: nowrap;
}

.tb-btn.tb-btn-support:hover {
  color: var(--support-text);
  background: var(--support-hover);
  border-color: #e8c88a;
}

.tb-btn.tb-btn-support:active {
  background: #f6e2c0;
  border-color: #e0bc7a;
}

.tb-support-icon {
  width: 15px;
  height: 15px;
  display: block;
  flex-shrink: 0;
}

.tb-support-label {
  font-size: 12px;
  font-weight: 650;
}

@media (max-width: 980px) {
  .tb-support-label {
    display: none;
  }

  .tb-btn-support {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
  }
}

/* ——— Shell ——— */

.editor-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.app-footer {
  flex-shrink: 0;
  min-height: var(--footer-h);
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  user-select: none;
  min-width: 0;
}

.app-footer p {
  margin: 0;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: 8px;
  row-gap: 2px;
  padding: 6px 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.3;
  text-align: center;
}

.app-footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-footer-sep {
  color: inherit;
}

.app-footer a,
.app-footer .app-footer-link {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  user-select: text;
}

.app-footer .app-footer-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.app-footer a:hover,
.app-footer .app-footer-link:hover {
  color: var(--accent);
}

.app-footer a:focus-visible,
.app-footer .app-footer-link:focus-visible {
  outline-offset: 1px;
  border-radius: 2px;
}

.left-toolbar {
  width: var(--leftbar-w);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px 14px;
  overflow-y: auto;
  user-select: none;
  z-index: 3;
}

.tools-title {
  margin: 0 0 10px;
  width: 100%;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-soft);
}

.inspector {
  width: var(--inspector-w);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  padding: 16px 16px 24px;
  overflow-y: auto;
  z-index: 3;
}

.inspector-title {
  margin: 0 0 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.inspector-empty-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inspector-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 14px;
  border-radius: var(--radius);
  background: var(--bg-hover);
  color: var(--text-muted);
}

.inspector-empty-mark {
  width: 36px;
  height: 36px;
  color: var(--accent);
  margin-bottom: 2px;
}

.inspector-empty-title {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.4;
}

.inspector-empty-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.inspector-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inspector-form[hidden],
.inspector-empty[hidden],
.inspector-empty-stack[hidden] {
  display: none;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fcfcfb;
}

.field-group[hidden] {
  display: none;
}

.field-group-title {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.field-group-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
}

/* ——— Confirm dialog ——— */

.app-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 22px 22px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-page);
}

.app-dialog::backdrop {
  background: rgba(28, 28, 33, 0.32);
}

.app-dialog-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.app-dialog-copy {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dlg-btn {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 650;
}

.dlg-btn:hover {
  background: var(--bg-hover);
}

.dlg-btn-danger {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.dlg-btn-danger:hover {
  color: #fff;
  background: #2a2a30;
  border-color: #2a2a30;
}

.dlg-btn-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.dlg-btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.dlg-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.canvas-dialog {
  width: min(440px, calc(100vw - 32px));
}

.canvas-dialog .app-dialog-copy {
  margin-bottom: 16px;
}

.info-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-page);
  overflow: hidden;
}

.info-dialog-help {
  width: min(720px, calc(100vw - 24px));
}

.info-dialog::backdrop {
  background: rgba(28, 28, 33, 0.32);
}

.info-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 24px);
  outline: none;
}

.info-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.info-dialog-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.info-dialog-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.info-dialog-body {
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 22px;
}

.info-section + .info-section {
  margin-top: 18px;
}

.info-section h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.info-section p,
.info-section li,
.info-section dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.info-section p + p {
  margin-top: 8px;
}

.info-section ul,
.info-section ol {
  margin: 0;
  padding-left: 18px;
}

.info-section li + li {
  margin-top: 4px;
}

.info-section code {
  font-family: var(--font-mono);
  font-size: 12px;
}

.info-tools {
  display: grid;
  gap: 10px;
  margin: 0;
}

.info-tools dt {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.info-tools dd {
  margin: 2px 0 0;
  color: var(--text-muted);
}

.info-columns {
  columns: 2;
  column-gap: 24px;
}

.info-support-link {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

button.info-support-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
}

.info-support-link:hover,
button.info-support-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.info-section-meta p {
  color: var(--text-muted);
  font-size: 12px;
}

html.terms-pending #app,
html.terms-pending #app-toast,
html.terms-pending #drag-ghost,
html.terms-pending #font-boot {
  pointer-events: none;
}

.terms-dialog {
  width: min(640px, calc(100vw - 24px));
}

.terms-accept-header {
  align-items: flex-start;
}

.terms-accept-intro {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  font-weight: 400;
}

.terms-scroll {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: min(52vh, 480px);
  overflow: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: #f7f7f9;
  outline: none;
}

.terms-scroll:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-ring);
}

.terms-accept-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--border);
}

.terms-agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  cursor: pointer;
}

.terms-agree input {
  margin: 2px 0 0;
  flex-shrink: 0;
}

.terms-accept-footer .dlg-btn-primary {
  align-self: flex-end;
  min-width: 148px;
  height: 36px;
}

.terms-document {
  min-width: 0;
  overflow-wrap: anywhere;
}

.terms-document h1 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.terms-document h2 {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.terms-document p,
.terms-document li {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.terms-document p + p,
.terms-document h2 + p {
  margin-top: 8px;
}

.terms-document a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.terms-document a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.terms-document ul {
  margin: 8px 0;
  padding-left: 18px;
}

.terms-document li + li {
  margin-top: 4px;
}

.terms-status {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.terms-error {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #b42318;
}

.font-license-list {
  display: grid;
  gap: 10px;
}

.font-license-card {
  padding: 10px 0 2px;
  border-top: 1px solid var(--border);
}

.font-license-card:first-child {
  border-top: none;
  padding-top: 0;
}

.font-license-name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.font-license-card p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.font-license-type {
  font-weight: 650;
}

.font-license-details {
  margin-top: 6px;
}

.font-license-group {
  margin-top: 0;
}

.font-license-group + .font-license-group {
  margin-top: 6px;
}

.font-license-group > .font-license-list {
  margin-top: 10px;
}

.font-license-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}

.font-license-details summary:hover {
  text-decoration: underline;
}

.font-license-text {
  margin: 8px 0 0;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-track);
  color: var(--text);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.shortcut-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.shortcut-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
}

.shortcut-keys {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.shortcut-or,
.shortcut-plus {
  color: var(--text-soft);
  font-size: 11px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-hover);
  color: var(--ink);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
}

@media (max-width: 640px) {
  .info-dialog,
  .info-dialog-help {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .info-columns {
    columns: 1;
  }

  .shortcut-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .shortcut-keys {
    justify-content: flex-start;
  }
}

.canvas-presets {
  margin-bottom: 16px;
}

.canvas-presets .style-btn {
  font-size: 11px;
  padding: 0 4px;
}

.canvas-size-fields {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.canvas-size-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.canvas-size-field input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.canvas-size-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.canvas-size-field input.is-invalid {
  border-color: #c44;
}

.canvas-swap {
  width: 36px;
  height: 36px;
  margin-bottom: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  flex: none;
}

.canvas-swap svg {
  width: 16px;
  height: 16px;
  display: block;
}

.canvas-swap:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

.canvas-size-hint {
  margin: 8px 0 20px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.canvas-dialog .app-dialog-actions {
  margin-top: 0;
}

.tooltip,
.ui-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: min(240px, calc(100vw - 16px));
  padding: 6px 9px;
  border-radius: 6px;
  background: #2a2a30;
  color: #fff;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.35;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 14px rgba(28, 28, 33, 0.22);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(3px);
  transition: opacity 0.1s ease, transform 0.1s ease;
  white-space: normal;
}

.tooltip.is-visible,
.ui-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.font-picker-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.font-picker-actions .insp-btn {
  flex: 1;
}

.font-picker-hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-soft);
  font-weight: 500;
}

.font-missing-note {
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 650;
  color: #b45309;
}

.font-manager-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.font-manager-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
}

.font-manager-name {
  font-size: 13px;
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-manager-empty {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.font-manager-empty[hidden] {
  display: none;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--footer-h) + 10px);
  transform: translateX(-50%);
  z-index: 10001;
  max-width: min(360px, calc(100vw - 24px));
  padding: 8px 12px;
  border-radius: 8px;
  background: #2a2a30;
  color: #fff;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(28, 28, 33, 0.2);
  pointer-events: none;
}

.app-toast.is-error {
  background: #5c2a2a;
}

.font-boot {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(247, 246, 243, 0.72);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
  pointer-events: none;
}

.font-boot[hidden] {
  display: none;
}

.export-dialog {
  width: min(980px, calc(100vw - 24px));
  height: min(680px, calc(100vh - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-page);
  overflow: hidden;
}

.export-dialog::backdrop {
  background: rgba(28, 28, 33, 0.32);
}

.export-dialog-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  outline: none;
}

.export-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.export-dialog-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.export-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.export-close svg {
  width: 16px;
  height: 16px;
  display: block;
}

.export-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.export-dialog-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 286px;
}

.export-preview {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--bg-workspace);
  border-right: 1px solid var(--border);
}

.export-preview-frame {
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.export-preview-stage {
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
  display: grid;
  grid-template: 1fr / 1fr;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  background-color: #f3f2ee;
  background-image:
    linear-gradient(45deg, #e8e6e1 25%, transparent 25%),
    linear-gradient(-45deg, #e8e6e1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8e6e1 75%),
    linear-gradient(-45deg, transparent 75%, #e8e6e1 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.export-preview-frame.has-nav .export-preview-stage {
  margin: 0 40px;
  padding: 16px;
}

.export-preview-fit {
  grid-area: 1 / 1;
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.export-preview-svg {
  position: absolute;
  top: 16px;
  left: 16px;
  width: calc(100% - 32px);
  height: calc(100% - 32px);
  display: block;
  overflow: hidden;
  pointer-events: none;
}

.export-preview-stage.is-solid {
  background-image: none;
}

.export-preview-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(28, 28, 33, 0.12);
  transform: translateY(-50%);
}

.export-preview-nav[hidden] {
  display: none;
}

.export-preview-nav:hover {
  background: var(--bg-hover);
  color: var(--text);
}

#export-preview-prev {
  left: 4px;
}

#export-preview-next {
  right: 4px;
}

.export-preview-nav svg {
  width: 16px;
  height: 16px;
  display: block;
}

.export-preview-empty {
  grid-area: 1 / 1;
  place-self: center;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.export-preview-empty[hidden] {
  display: none;
}

.export-preview-meta {
  margin: 0;
  min-height: 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.export-controls {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.export-section-title {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.export-section.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.export-note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-soft);
}

.export-note[hidden] {
  display: none;
}

.export-scope-group .style-btn {
  font-size: 11px;
  padding: 0 4px;
}

.export-num {
  width: 52px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  text-align: center;
  font-size: 12px;
  font-weight: 650;
}

.export-dialog .style-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.export-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 760px) {
  .export-dialog {
    height: min(720px, calc(100vh - 16px));
  }

  .export-dialog-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(160px, 28vh) minmax(0, 1fr);
  }

  .export-preview {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }
}

.context-menu {
  position: fixed;
  z-index: 80;
  min-width: 208px;
  padding: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-page);
  display: flex;
  flex-direction: column;
}

.context-menu:focus,
.context-menu:focus-visible {
  outline: none;
}

.context-menu[hidden] {
  display: none;
}

.context-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  text-align: left;
}

.context-menu-item:hover:not(:disabled),
.context-menu-item:focus-visible:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
}

.context-menu-item:disabled {
  color: var(--text-soft);
  opacity: 0.55;
}

.context-menu-shortcut {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.context-menu-item:hover:not(:disabled) .context-menu-shortcut,
.context-menu-item:focus-visible:not(:disabled) .context-menu-shortcut {
  color: var(--accent);
}

.context-menu-sep {
  height: 1px;
  margin: 5px 6px;
  background: var(--border);
}

#context-align-block {
  display: contents;
}

.context-menu-chevron {
  width: 7px;
  height: 7px;
  margin-right: 2px;
  border-right: 1.6px solid currentColor;
  border-top: 1.6px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.7;
}

.context-menu-item.is-open,
.context-menu-item[aria-expanded="true"]:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
}

.context-submenu {
  position: fixed;
  z-index: 81;
  min-width: 228px;
  padding: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-page);
  display: flex;
  flex-direction: column;
}

.context-submenu[hidden] {
  display: none;
}

.context-submenu:focus,
.context-submenu:focus-visible {
  outline: none;
}

.inspector-locked-note {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.inspector-locked-note[hidden] {
  display: none;
}

.inspector-form.is-locked {
  opacity: 0.78;
}

.feedback-dialog {
  width: min(680px, calc(100vw - 24px));
}

.feedback-header-copy {
  min-width: 0;
}

.feedback-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
}

.feedback-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-hover);
}

.feedback-mode {
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
}

.feedback-mode:hover:not(:disabled) {
  color: var(--text);
}

.feedback-mode.is-active {
  color: var(--accent);
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(28, 28, 33, 0.06);
}

.feedback-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.feedback-required {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
}

.feedback-field input,
.feedback-field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.feedback-field input {
  height: 36px;
  padding: 0 10px;
}

.feedback-field textarea {
  min-height: 84px;
  padding: 8px 10px;
  resize: vertical;
}

.feedback-field input:focus,
.feedback-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.feedback-field input.is-invalid,
.feedback-field textarea.is-invalid {
  border-color: #c44;
}

.feedback-help,
.feedback-privacy {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.feedback-privacy {
  margin-top: 14px;
}

.feedback-field-error {
  font-size: 12px;
  font-weight: 600;
  color: #b42318;
}

.feedback-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.feedback-tech {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-workspace);
}

.feedback-tech summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
}

.feedback-tech summary::-webkit-details-marker {
  display: none;
}

.feedback-tech summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 6px;
  font-size: 9px;
  color: var(--text-soft);
}

.feedback-tech[open] summary::before {
  content: "▼";
}

.feedback-tech .feedback-help {
  margin: 8px 0 10px;
}

.feedback-tech-list {
  margin: 0;
  display: grid;
  gap: 6px;
}

.feedback-tech-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
}

.feedback-tech-row dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 650;
}

.feedback-tech-row dd {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.feedback-form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #f0d9b0;
  border-radius: 10px;
  background: var(--support-bg);
}

.feedback-form-error p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--support-text);
}

.feedback-fallback {
  margin-top: 6px !important;
}

.feedback-fallback a {
  color: var(--accent);
  font-weight: 650;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.feedback-success-copy h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.feedback-success-copy p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.feedback-reference {
  margin-top: 10px !important;
  font-size: 12px !important;
  color: var(--text-soft) !important;
}

@media (max-width: 640px) {
  .feedback-dialog {
    width: calc(100vw - 16px);
  }

  .feedback-tech-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
