:root {
  --bg: #f5ede1;
  --bg-deep: #eadbc8;
  --paper: rgba(255, 252, 247, 0.92);
  --paper-strong: #fffdfa;
  --bg-end: #fbf5eb;
  --ink: #261b17;
  --muted: #6f5f57;
  --text-strong: #261b17;
  --text-soft: #5f524c;
  --line: rgba(70, 46, 32, 0.12);
  --accent: #b24a32;
  --accent-deep: #8f3724;
  --accent-soft: rgba(178, 74, 50, 0.14);
  --accent-border: rgba(178, 74, 50, 0.18);
  --accent-border-hover: rgba(178, 74, 50, 0.24);
  --accent-border-strong: rgba(178, 74, 50, 0.28);
  --accent-border-active: rgba(178, 74, 50, 0.3);
  --accent-surface: rgba(178, 74, 50, 0.08);
  --accent-surface-strong: rgba(178, 74, 50, 0.16);
  --accent-shadow: 0 18px 32px rgba(178, 74, 50, 0.22);
  --accent-button-shadow: 0 14px 28px rgba(178, 74, 50, 0.2);
  --olive: #6b7460;
  --olive-soft: rgba(107, 116, 96, 0.12);
  --olive-border: rgba(107, 116, 96, 0.16);
  --olive-border-strong: rgba(107, 116, 96, 0.22);
  --olive-shadow: 0 12px 26px rgba(107, 116, 96, 0.14);
  --shadow: 0 22px 50px rgba(74, 47, 28, 0.14);
  --hero-orb: rgba(178, 74, 50, 0.18);
  --switch-border: rgba(29, 36, 48, 0.08);
  --switch-ink: rgba(29, 36, 48, 0.72);
  --switch-muted: rgba(29, 36, 48, 0.48);
  --switch-surface: rgba(255, 255, 255, 0.56);
  --hero-surface: linear-gradient(150deg, rgba(255, 255, 255, 0.86), rgba(248, 241, 228, 0.82));
  --panel-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 249, 239, 0.9));
  --card-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 243, 233, 0.9));
  --article-surface: rgba(255, 252, 247, 0.58);
  --article-line: rgba(70, 46, 32, 0.12);
  --link-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 241, 230, 0.9));
  --link-hover-surface: linear-gradient(180deg, rgba(255, 244, 238, 0.96), rgba(247, 227, 218, 0.9));
  --link-hover-shadow: 0 16px 28px rgba(178, 74, 50, 0.12);
  --link-active-surface: linear-gradient(135deg, var(--accent), #cf6043);
  --link-active-text: #fffdf8;
  --link-active-kicker: rgba(255, 253, 248, 0.68);
  --panel-topline: linear-gradient(90deg, var(--accent), #d98558, var(--olive));
  --primary-surface: linear-gradient(135deg, var(--accent), #cf6043);
  --primary-surface-hover: linear-gradient(135deg, #983b28, #b94d33);
  --primary-text: #fffdf8;
  --secondary-surface: linear-gradient(180deg, #eef1e6, #dde4d4);
  --secondary-surface-hover: linear-gradient(180deg, #e7ecd9, #d4dcc8);
  --secondary-text: #46503f;
  --ghost-border: rgba(29, 36, 48, 0.14);
  --editor-text: #22303d;
  --editor-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 244, 236, 0.92));
  --field-label: rgba(70, 46, 32, 0.72);
  --helper-highlight: #8f3724;
  --helper-surface: linear-gradient(180deg, rgba(255, 244, 238, 0.9), rgba(250, 231, 222, 0.84));
  --code-surface: rgba(70, 46, 32, 0.08);
  --status-surface: linear-gradient(120deg, rgba(29, 36, 48, 0.9), rgba(42, 53, 69, 0.88));
  --status-solid: #1d2430;
  --status-text: rgba(255, 251, 244, 0.94);
  --radius-xl: 14px;
  --radius-lg: 10px;
  --radius-md: 6px;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  --font-body: "Aptos", "Segoe UI", "Microsoft JhengHei UI", sans-serif;
  --font-mono: "Consolas", "Cascadia Code", "Courier New", monospace;
}

html[data-theme="dark"],
html[data-theme="microsoft"] {
  --bg: #f3f7fb;
  --bg-deep: #161d27;
  --paper: rgba(18, 24, 34, 0.9);
  --paper-strong: rgba(21, 28, 39, 0.96);
  --bg-end: #0e141d;
  --ink: #eef3f8;
  --muted: #d1dce8;
  --text-strong: #f6fbff;
  --text-soft: #dce7f2;
  --line: rgba(114, 154, 194, 0.16);
  --accent: #6cb6ff;
  --accent-deep: #93caff;
  --accent-soft: rgba(108, 182, 255, 0.14);
  --accent-border: rgba(108, 182, 255, 0.24);
  --accent-border-hover: rgba(108, 182, 255, 0.34);
  --accent-border-strong: rgba(108, 182, 255, 0.42);
  --accent-border-active: rgba(108, 182, 255, 0.48);
  --accent-surface: rgba(108, 182, 255, 0.12);
  --accent-surface-strong: rgba(108, 182, 255, 0.22);
  --accent-shadow: 0 18px 32px rgba(8, 25, 46, 0.42);
  --accent-button-shadow: 0 14px 28px rgba(7, 24, 43, 0.38);
  --olive: #7ed6a3;
  --olive-soft: rgba(126, 214, 163, 0.12);
  --olive-border: rgba(126, 214, 163, 0.18);
  --olive-border-strong: rgba(126, 214, 163, 0.24);
  --olive-shadow: 0 12px 26px rgba(9, 28, 23, 0.34);
  --shadow: 0 24px 54px rgba(2, 8, 16, 0.44);
  --hero-orb: rgba(108, 182, 255, 0.24);
  --switch-border: rgba(114, 154, 194, 0.16);
  --switch-ink: rgba(241, 247, 255, 0.96);
  --switch-muted: rgba(199, 214, 229, 0.9);
  --switch-surface: rgba(22, 31, 44, 0.84);
  --hero-surface: linear-gradient(150deg, rgba(24, 33, 45, 0.96), rgba(16, 22, 31, 0.92));
  --panel-surface: linear-gradient(180deg, rgba(24, 33, 45, 0.94), rgba(17, 24, 35, 0.96));
  --card-surface: linear-gradient(180deg, rgba(29, 40, 55, 0.96), rgba(20, 27, 39, 0.94));
  --article-surface: rgba(15, 21, 30, 0.38);
  --article-line: rgba(143, 188, 232, 0.18);
  --link-surface: linear-gradient(180deg, rgba(28, 37, 50, 0.96), rgba(18, 24, 34, 0.9));
  --link-hover-surface: linear-gradient(180deg, rgba(35, 48, 66, 0.98), rgba(22, 31, 44, 0.94));
  --link-hover-shadow: 0 16px 28px rgba(6, 19, 35, 0.34);
  --link-active-surface: linear-gradient(135deg, #1f5c99, #2a7fd0);
  --link-active-text: #f8fbff;
  --link-active-kicker: rgba(248, 251, 255, 0.74);
  --panel-topline: linear-gradient(90deg, #6cb6ff, #2a7fd0, #7ed6a3);
  --primary-surface: linear-gradient(135deg, #1f5c99, #2a7fd0);
  --primary-surface-hover: linear-gradient(135deg, #2a7fd0, #4094e0);
  --primary-text: #ffffff;
  --secondary-surface: linear-gradient(180deg, rgba(27, 54, 50, 0.9), rgba(22, 39, 37, 0.92));
  --secondary-surface-hover: linear-gradient(180deg, rgba(33, 68, 63, 0.96), rgba(26, 47, 44, 0.96));
  --secondary-text: #e3fff0;
  --ghost-border: rgba(114, 154, 194, 0.18);
  --editor-text: #e8eef5;
  --editor-surface: linear-gradient(180deg, rgba(14, 19, 27, 0.98), rgba(19, 26, 37, 0.94));
  --field-label: rgba(173, 218, 255, 0.92);
  --helper-highlight: #e0f0ff;
  --helper-surface: linear-gradient(180deg, rgba(26, 43, 63, 0.92), rgba(18, 30, 45, 0.94));
  --code-surface: rgba(108, 182, 255, 0.12);
  --status-surface: linear-gradient(120deg, rgba(7, 17, 29, 0.98), rgba(14, 31, 52, 0.94));
  --status-solid: #0d1825;
  --status-text: rgba(240, 247, 255, 0.96);
  --font-display: "Aptos Display", "Segoe UI", "Microsoft JhengHei UI", sans-serif;
  --font-body: "Aptos", "Segoe UI", "Microsoft JhengHei UI", sans-serif;
}

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

html {
  min-height: 100%;
}

html[data-font-scale="sm"] {
  font-size: 14px;
}

html[data-font-scale="md"] {
  font-size: 15px;
}

html[data-font-scale="lg"] {
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, var(--accent-soft), transparent 34%),
    radial-gradient(circle at bottom right, var(--olive-soft), transparent 32%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-end) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.26) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 100% 34px, 34px 100%;
  opacity: 0.26;
  mix-blend-mode: soft-light;
}

.workspace {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 14px 14px 18px;
}

.hero,
.panel,
.status {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  padding: 10px 12px 12px;
  border-radius: var(--radius-xl);
  background:
    var(--hero-surface),
    var(--paper);
}

.hero::after {
  content: "";
  position: absolute;
  top: -28px;
  right: -18px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--hero-orb), transparent 68%);
  pointer-events: none;
}

.hero-topline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.hero-meta {
  display: grid;
  gap: 2px;
  flex: 1 1 auto;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 4px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--accent);
}

.hero-heading {
  display: block;
}

.hero h1,
.panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero h1 {
  max-width: none;
  line-height: 0.9;
  font-size: clamp(1.08rem, 2.4vw, 1.42rem);
}

.hero-badge {
  flex-shrink: 0;
  padding: 4px 8px;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  background: var(--accent-surface);
  color: var(--accent-deep);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hero-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: end;
  gap: 6px;
}

.hero-controls-top {
  flex-shrink: 0;
  align-items: start;
}

.pill-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--switch-border);
  border-radius: 8px;
  background: var(--switch-surface);
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

.font-scale-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--switch-border);
  border-radius: 8px;
  background: var(--switch-surface);
}

.font-scale-button {
  min-width: 31px;
  padding: 5px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--switch-ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: none;
}

.font-scale-button:hover,
.font-scale-button:focus-visible {
  color: var(--accent-deep);
  background: var(--accent-surface);
}

.font-scale-button.is-active {
  background: linear-gradient(135deg, var(--accent-surface-strong), var(--accent-surface));
  color: var(--accent-deep);
  box-shadow: inset 0 0 0 1px var(--accent-surface);
}

.theme-dot-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.theme-dot-button:hover,
.theme-dot-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-border-hover);
  background: var(--accent-surface);
}

.theme-dot-button.is-active {
  border-color: var(--accent-border-strong);
  background: var(--accent-surface);
}

.theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 0 0 1px rgba(29, 36, 48, 0.08);
}

.theme-dot-warm {
  background:
    radial-gradient(circle at 30% 30%, #ffd8c7, transparent 38%),
    linear-gradient(135deg, #b24a32, #d98558);
}

.theme-dot-dark {
  background:
    radial-gradient(circle at 30% 30%, #c4e3ff, transparent 34%),
    linear-gradient(135deg, #1f5c99, #17212e);
}

.switch-button {
  padding: 5px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--switch-ink);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: none;
}

.switch-button:hover,
.switch-button:focus-visible {
  color: var(--accent-deep);
  background: var(--accent-surface);
}

.switch-button.is-active {
  background: linear-gradient(135deg, var(--accent-surface-strong), var(--accent-surface));
  color: var(--accent-deep);
  box-shadow: inset 0 0 0 1px var(--accent-surface);
}

.hero-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.hero-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--switch-border);
  background: var(--link-surface);
  color: var(--switch-ink);
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.hero-link-kicker {
  color: var(--switch-muted);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-link strong {
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero-link-kicker {
  display: none;
}

.hero-link:hover,
.hero-link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent-border-hover);
  background: var(--link-hover-surface);
  color: var(--accent-deep);
  box-shadow: var(--link-hover-shadow);
}

.hero-link.is-active {
  border-color: var(--accent-border-active);
  background: var(--link-active-surface);
  color: var(--link-active-text);
  box-shadow: var(--accent-shadow);
}

.hero-link.is-active .hero-link-kicker {
  color: var(--link-active-kicker);
}

.hero-secondary-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.hero-secondary-link {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 5px 8px;
  border: 1px dashed var(--accent-border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background-color 160ms ease;
}

.hero-secondary-link strong {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero-secondary-link:hover,
.hero-secondary-link:focus-visible {
  border-color: var(--accent-border-hover);
  background: var(--accent-surface);
  color: var(--accent-deep);
}

.hero-secondary-link.is-active {
  border-style: solid;
  border-color: var(--accent-border-strong);
  background: var(--accent-surface);
  color: var(--accent-deep);
}

.panel-summary {
  margin: 2px 0 0;
  color: var(--text-soft);
  line-height: 1.48;
  font-size: 0.84rem;
}

.toolbox-views {
  position: relative;
}

.tool-view {
  display: grid;
  gap: 12px;
}

.tool-view[hidden] {
  display: none;
}

.format-lead {
  padding: 12px 14px;
  border: 1px solid var(--olive-border);
  border-radius: 8px;
  background: linear-gradient(140deg, var(--olive-soft), rgba(255, 255, 255, 0.78));
}

.format-lead p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.reference-grid {
  display: grid;
  gap: 12px;
}

.reference-demo {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--article-line);
}

.reference-lead {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
  font-size: 0.89rem;
}

.reference-demo-grid {
  display: grid;
  gap: 12px;
}

.reference-demo-card,
.reference-card {
  display: grid;
  gap: 8px;
  padding: 12px 0 0;
  border-top: 1px solid var(--article-line);
  background: transparent;
}

.reference-demo-label {
  color: var(--field-label);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.reference-demo-code {
  display: block;
  white-space: pre-wrap;
  line-height: 1.5;
}

.reference-demo-render {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: var(--article-surface);
  color: var(--text-strong);
}

.reference-demo-render h4,
.reference-demo-render p,
.reference-demo-render blockquote,
.reference-demo-render ul,
.reference-demo-render table {
  margin: 0;
}

.reference-demo-render h4 {
  font-size: 1rem;
  font-family: var(--font-display);
}

.reference-demo-render blockquote {
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
}

.reference-demo-render ul {
  padding-left: 18px;
}

.reference-demo-emphasis {
  display: grid;
  gap: 7px;
}

.reference-demo-emphasis code {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent-surface) 62%, white 38%);
  color: var(--accent-deep);
  font-size: 0.84rem;
}

.reference-demo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.reference-demo-table th,
.reference-demo-table td {
  padding: 6px 8px;
  border: 1px solid var(--switch-border);
  text-align: left;
}

.reference-demo-table th {
  background: var(--accent-surface);
  color: var(--accent-deep);
}

.reference-card h3 {
  margin: 0;
  font-size: 0.96rem;
  color: var(--text-strong);
}

.reference-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  line-height: 1.58;
  font-size: 0.84rem;
}

.reference-list li + li {
  margin-top: 6px;
}

.panel {
  padding: 16px;
  border-radius: var(--radius-lg);
  background:
    var(--panel-surface),
    var(--paper-strong);
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--panel-topline);
}

.panel-head {
  display: grid;
  gap: 3px;
  margin-bottom: 14px;
}

.panel h2 {
  font-size: 1.24rem;
}

.field-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--field-label);
}

.file-input {
  width: 100%;
  margin: 0 0 14px;
  padding: 11px 12px;
  border: 1px dashed var(--accent-border-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text-soft);
}

.file-input::file-selector-button {
  margin-right: 10px;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--accent-surface);
  color: var(--accent-deep);
  font-weight: 700;
  cursor: pointer;
}

.action-stack,
.action-row {
  display: grid;
  gap: 10px;
}

button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.primary-action {
  min-height: 46px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:focus-visible,
.file-input:focus-visible,
textarea:focus-visible,
.drop-zone:focus-visible {
  outline: 2px solid var(--accent-border-strong);
  outline-offset: 3px;
}

#import-btn,
#export-btn {
  background: var(--primary-surface);
  color: var(--primary-text);
  box-shadow: var(--accent-button-shadow);
}

#import-btn:hover:not(:disabled),
#export-btn:hover:not(:disabled) {
  background: var(--primary-surface-hover);
}

button.secondary {
  border-color: var(--olive-border-strong);
  background: var(--secondary-surface);
  color: var(--secondary-text);
  box-shadow: var(--olive-shadow);
}

button.secondary:hover:not(:disabled) {
  background: var(--secondary-surface-hover);
}

button.ghost {
  border-color: var(--ghost-border);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}

button.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--accent-border-hover);
  color: var(--accent-deep);
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.drop-zone {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin-top: 12px;
  padding: 16px;
  border: 1px dashed var(--accent-border-strong);
  border-radius: 10px;
  background:
    linear-gradient(140deg, var(--accent-surface), rgba(255, 255, 255, 0.74)),
    rgba(255, 255, 255, 0.58);
  color: var(--text-soft);
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.drop-zone strong {
  color: var(--ink);
  font-size: 1rem;
}

.drop-zone-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  border-radius: 6px;
  padding: 5px 10px;
  background: var(--accent-surface);
  color: var(--accent-deep);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.drop-zone.active {
  transform: translateY(-1px);
  border-color: var(--accent);
  background:
    linear-gradient(140deg, var(--accent-soft), rgba(255, 255, 255, 0.88)),
    rgba(255, 255, 255, 0.84);
}

textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  margin-top: 0;
  border: 1px solid var(--switch-border);
  border-radius: 8px;
  padding: 14px;
  background:
    var(--editor-surface);
  color: var(--editor-text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.helper {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.55;
  font-size: 0.84rem;
}

html[data-theme="dark"] .hero-link strong,
html[data-theme="microsoft"] .hero-link strong,
html[data-theme="dark"] .reference-card h3,
html[data-theme="microsoft"] .reference-card h3,
html[data-theme="dark"] .drop-zone strong,
html[data-theme="microsoft"] .drop-zone strong {
  color: #f4f8fc;
}

html[data-theme="dark"] .panel-summary,
html[data-theme="microsoft"] .panel-summary,
html[data-theme="dark"] .helper,
html[data-theme="microsoft"] .helper,
html[data-theme="dark"] .reference-list,
html[data-theme="microsoft"] .reference-list,
html[data-theme="dark"] .reference-demo-render,
html[data-theme="microsoft"] .reference-demo-render,
html[data-theme="dark"] .format-lead p,
html[data-theme="microsoft"] .format-lead p,
html[data-theme="dark"] .drop-zone,
html[data-theme="microsoft"] .drop-zone {
  color: var(--text-soft);
}

html[data-theme="dark"] .reference-demo-render,
html[data-theme="microsoft"] .reference-demo-render {
  background: rgba(17, 24, 34, 0.88);
}

html[data-theme="dark"] .reference-demo-emphasis code,
html[data-theme="microsoft"] .reference-demo-emphasis code {
  background: color-mix(in srgb, var(--panel) 76%, var(--accent) 24%);
  color: var(--text-strong);
}

html[data-theme="dark"] .reference-demo-table th,
html[data-theme="microsoft"] .reference-demo-table th {
  color: #eef6ff;
}

html[data-theme="dark"] .reference-demo-label,
html[data-theme="microsoft"] .reference-demo-label,
html[data-theme="dark"] .field-label,
html[data-theme="microsoft"] .field-label,
html[data-theme="dark"] .hero-link-kicker,
html[data-theme="microsoft"] .hero-link-kicker {
  color: #b9d7f4;
}

html[data-theme="dark"] .file-input,
html[data-theme="microsoft"] .file-input,
html[data-theme="dark"] button.ghost,
html[data-theme="microsoft"] button.ghost,
html[data-theme="dark"] .drop-zone,
html[data-theme="microsoft"] .drop-zone {
  background: rgba(21, 30, 42, 0.94);
  color: var(--text-soft);
}

html[data-theme="dark"] .file-input::file-selector-button,
html[data-theme="microsoft"] .file-input::file-selector-button {
  background: rgba(108, 182, 255, 0.18);
  color: #edf6ff;
}

html[data-theme="dark"] .hero-badge,
html[data-theme="microsoft"] .hero-badge {
  color: #eef6ff;
  background: rgba(108, 182, 255, 0.18);
}

.panel-reference {
  background: linear-gradient(180deg, var(--paper-strong), color-mix(in srgb, var(--paper-strong) 82%, transparent 18%));
}

.panel-head-article {
  margin-bottom: 18px;
}

@media (min-width: 520px) {
  .tool-view[data-tool-view="import"] {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .tool-view[data-tool-view="import"] .field-label,
  .tool-view[data-tool-view="import"] .file-input,
  .tool-view[data-tool-view="import"] .action-stack,
  .tool-view[data-tool-view="import"] .drop-zone,
  .tool-view[data-tool-view="import"] .helper {
    grid-column: 1 / -1;
  }

  .tool-view[data-tool-view="export"] {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .tool-view[data-tool-view="export"] .action-row {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
  }

  .tool-view[data-tool-view="export"] .field-label,
  .tool-view[data-tool-view="export"] textarea,
  .tool-view[data-tool-view="export"] .helper {
    grid-column: 1 / -1;
  }

  .tool-view[data-tool-view="import"] .action-stack,
  .tool-view[data-tool-view="export"] .action-row {
    width: min(100%, 32rem);
  }

  .tool-view[data-tool-view="import"] .action-stack .primary-action {
    width: min(100%, 22rem);
    white-space: nowrap;
  }

  .tool-view[data-tool-view="export"] .action-row > button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .tool-view[data-tool-view="export"] #export-btn {
    width: min(100%, 22rem);
  }

  .tool-view[data-tool-view="export"] #save-as-btn {
    width: min(100%, 18rem);
  }

  .tool-view[data-tool-view="export"] #copy-all-btn {
    width: min(100%, 14rem);
  }

  .tool-view[data-tool-view="format"] {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.92fr);
    column-gap: 16px;
    align-items: start;
  }

  .tool-view[data-tool-view="format"] .format-lead {
    grid-column: 1 / -1;
  }

  .tool-view[data-tool-view="format"] .action-stack,
  .tool-view[data-tool-view="format"] #md-auto-import-helper,
  .tool-view[data-tool-view="format"] .helper:last-child {
    grid-column: 1;
  }

  .tool-view[data-tool-view="format"] #md-auto-import-helper,
  .tool-view[data-tool-view="format"] .helper:last-child {
    max-width: 44rem;
  }

  .reference-demo-grid,
  .reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 18px;
    row-gap: 14px;
  }
}

.helper.visible {
  padding: 10px 12px;
  border: 1px solid var(--accent-border-hover);
  border-radius: 8px;
  background: var(--helper-surface);
  color: var(--helper-highlight);
}

.status {
  margin: 0;
  min-height: 52px;
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--status-surface), var(--status-solid);
  color: var(--status-text);
  line-height: 1.55;
  font-size: 0.88rem;
}

code {
  border-radius: 0.2em;
  padding: 0.15em 0.38em;
  background: var(--code-surface);
  color: var(--accent-deep);
  font-family: var(--font-mono);
  font-size: 0.92em;
}

@media (max-width: 480px) {
  .workspace {
    gap: 12px;
    padding: 12px 10px 16px;
  }

  .hero,
  .panel,
  .status {
    border-radius: 12px;
  }

  .hero-heading {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hero-badge {
    display: inline-flex;
  }

  .hero-controls {
    gap: 6px;
    justify-content: flex-end;
  }

  .hero-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .hero-link {
    min-height: 44px;
    padding: 7px 8px;
  }

  .hero-link strong {
    font-size: 0.86rem;
  }

  .hero-secondary-actions {
    justify-content: flex-start;
  }
}
