:root {
  --topbar-size: 63px;
  color-scheme: light;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: style;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 300px;
  background: radial-gradient(ellipse 81% 48% at 49% 99%, rgb(var(--sky-rgb) / .39), transparent) fixed;
}
button, textarea, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.shell { width: min(1240px, calc(100% - 80px)); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--line); background: var(--surface); box-shadow: 0 1px 2px rgb(var(--shadow-rgb) / .04); }
.topbar-inner { min-height: var(--topbar-size); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand {
  display: inline-flex; align-items: center; gap: 11px; color: var(--ink);
  font-size: 1.36rem; font-weight: 750; text-decoration: none; letter-spacing: -.048em;
}
.brand-icon {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px 12px 6px 12px;
  background: var(--accent); color: white;
}
.brand-icon .icon { width: 29px; height: 29px; }
.brand-dot { color: var(--accent); }
.privacy-note {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: var(--pill-radius); background: var(--subtle); color: var(--muted); font-size: .86rem;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--surface-radius);
  box-shadow: 0 2px 9px rgb(var(--shadow-rgb) / .045);
}
.text-card { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.card-header {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  min-height: 64px; padding: 11px 17px; border-bottom: 1px solid var(--line);
}
h2 { font-size: 1rem; font-weight: 720; margin: 0; }
.small-button, .text-button, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; font-size: .875rem; font-weight: 600; color: var(--accent-dark);
}
.small-button {
  min-height: 36px; background: var(--subtle); border: 1px solid transparent; color: var(--ink);
  padding: 6px 11px; border-radius: var(--pill-radius);
}
.small-button:not(:disabled):not([aria-pressed="true"]):hover, .export-button:not(:disabled):hover { background: var(--control); }
.small-button:disabled, .text-button:disabled { color: var(--disabled-ink); opacity: .68; }
textarea, .comparison {
  border: 0; outline: 0; width: 100%; min-height: 0; flex: 1 1 0;
  font-size: 1rem; line-height: 1.69; padding: 17px 18px; resize: none;
  color: var(--ink); background: transparent; overflow-wrap: anywhere;
}
textarea:focus-visible, .comparison:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
textarea::placeholder { color: var(--muted); }
.file-bar { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 2px 12px 2px 18px; background: var(--subtle); color: var(--ink); font-size: .85rem; }
.file-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { border: 0; background: transparent; min-width: 32px; min-height: 30px; border-radius: 10px; margin-left: auto; }
.icon-button:hover { background: var(--control-hover); }
.card-footer {
  min-height: 52px; display: flex; justify-content: space-between; gap: 6px;
  align-items: center; border-top: 1px solid var(--line); padding: 8px 17px;
  color: var(--muted); font-size: .85rem;
}
.footer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.text-button { padding: 4px 2px; min-height: 34px; border: 0; background: transparent; border-radius: 4px; }
.text-button:not(:disabled):hover { text-decoration: underline; }
.text-button.muted { color: var(--muted); }
.empty-result {
  flex: 1; min-height: 0; overflow: auto; display: grid; align-content: center; justify-items: center; text-align: center;
  padding: 26px 14px;
  background: radial-gradient(ellipse 58% 57% at 50% 61%, rgb(var(--sky-soft-rgb) / .59), transparent) var(--surface);
}
.empty-icon {
  display: grid; place-items: center; width: 48px; height: 48px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px 15px 6px 15px;
  margin-bottom: 13px; font-size: 1.34rem;
}
.empty-result p { margin: 0 0 5px; font-weight: 650; font-size: .94rem; }
.empty-result span { color: var(--muted); font-size: .875rem; }
.comparison { overflow: auto; white-space: pre-wrap; }
.comparison del { background: var(--removed-bg); color: var(--danger); border-radius: 3px; }
.comparison ins { background: var(--added-bg); color: var(--added-ink); text-decoration: underline; text-underline-offset: 3px; border-radius: 3px; }
.comparison .legend { display: flex; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 12px; font-size: .85rem; color: var(--muted); }
.comparison .legend span { padding: 1px 6px; border-radius: 4px; }
.legend .removed { background: var(--removed-bg); color: var(--danger); }
.legend .added { background: var(--added-bg); color: var(--added-ink); }
.segment { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; background: var(--subtle); padding: 3px; border-radius: var(--pill-radius); }
.segment button {
  min-height: 36px; border: 1px solid transparent; padding: 4px 5px; border-radius: var(--pill-radius);
  color: var(--muted); background: transparent; font-size: .875rem; font-weight: 620;
}
.segment button[aria-pressed="true"] { background: var(--tint); color: var(--accent-dark); }
.segment button[aria-pressed="false"]:hover { background: var(--control); color: var(--ink); }
.auto-settings { font-size: .875rem; line-height: 1.55; color: var(--muted); }
.auto-settings p { margin: 17px 0 13px; }
.auto-settings ul { list-style: none; padding: 0; margin: 0; }
.auto-settings li { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.auto-settings .icon { color: var(--muted); }
.custom-settings { display: grid; gap: 6px; padding-top: 14px; font-size: .875rem; }
.custom-settings > label { font-weight: 600; }
.select-wrap { position: relative; margin-bottom: 5px; }
.select-wrap .icon { position: absolute; right: 10px; top: 11px; pointer-events: none; color: var(--muted); }
select {
  appearance: none; width: 100%; min-height: 39px; border: 1px solid var(--control-border);
  border-radius: 11px; background: var(--surface); color: var(--ink); padding: 6px 32px 6px 9px;
}
.checkbox { display: flex; gap: 7px; align-items: center; min-height: 32px; }
.checkbox input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.primary-button, .export-button {
  min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--pill-radius); font-size: .94rem; font-weight: 680; border: 1px solid transparent; line-height: 1.25;
}
.primary-button { background: var(--accent); color: var(--surface); }
.primary-button:not(:disabled):hover { background: var(--accent-dark); }
.primary-button:disabled { background: var(--disabled-bg); color: var(--disabled-ink); }
.export-button { background: var(--subtle); color: var(--ink); }
.export-button:disabled { color: var(--disabled-ink); background: var(--subtle); }
.page-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; padding: 26px 0 32px; color: var(--muted); font-size: .86rem; text-align: center; }
.page-footer .icon { color: var(--muted); }
.page-footer a { color: var(--accent-dark); text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }
.sr-copy-buffer { position: fixed; left: -9999px; opacity: 0; pointer-events: none; }
.workbench {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: calc(100dvh - var(--topbar-size) - 1px);
  min-height: 485px;
  padding-block: 14px;
}
body:not(.chat-is-open) .workbench { padding-bottom: calc(4.3rem + env(safe-area-inset-bottom)); }
.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(200px, 1fr) auto;
  min-height: 0;
  gap: 14px;
}
.settings {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
  padding: 9px 12px;
}
.settings-top { display: flex; align-items: center; gap: 7px; }
.settings-top .icon { color: var(--muted); }
.settings .segment { flex: 0 1 220px; min-width: 154px; }
.action-stack { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-left: auto; }
.action-stack > button { padding-inline: 12px; }
.word-format-shortcut { min-height: 44px; }
.status {
  flex: 1 0 100%;
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.38;
  overflow-wrap: anywhere;
}
.status:empty { display: none; }
.status[data-error="true"] { color: var(--danger); }
.editor-details { display: grid; gap: 10px; padding-top: 9px; }
.editor-details > * { scroll-margin: 12px; }
.auto-settings, .custom-settings, .editor-details .word-settings { padding: 12px 14px; }
.auto-settings summary { font-weight: 700; color: var(--accent-dark); cursor: pointer; }
.custom-settings { grid-template-columns: max-content minmax(135px, 1fr) max-content minmax(135px, 1fr); align-items: center; column-gap: 12px; }
.custom-settings .checkbox { grid-column: 1 / -1; }
.custom-settings .select-wrap { margin: 0; }
.editor-details .word-settings { margin: 0; }
@media (min-width: 1350px) { .workspace { gap: 16px; } }
@media (max-width: 1060px) {
  .shell { width: calc(100% - 44px); }
  .workspace { gap: 10px; }
  .card-header, .card-footer, textarea, .comparison { padding-inline: 13px; }
}
@media (max-width: 665px) {
  .settings .segment { flex: 1 1 154px; }
  .action-stack { flex: 1 0 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
  .word-format-shortcut { grid-column: 1 / -1; }
  .custom-settings { grid-template-columns: 1fr; }
  .custom-settings .select-wrap { margin-bottom: 3px; }
}
@media (max-width: 525px) {
  .shell { width: calc(100% - 28px); }
  :root { --topbar-size: 58px; }
  .brand { font-size: 1.2rem; gap: 7px; }
  .brand-icon { width: 31px; height: 31px; }
  .brand-icon .icon { width: 25px; height: 25px; }
  .privacy-note { gap: 4px; padding: 5px 7px; font-size: .79rem; }
  .workbench { min-height: 550px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(135px, 1fr)) auto; }
  .card-header { min-height: 55px; padding-block: 8px; }
  .card-footer { min-height: 47px; padding-block: 5px; }
  textarea, .comparison { padding-block: 12px; }
  .empty-result { padding: 8px; }
  .empty-icon { width: 34px; height: 34px; margin-bottom: 4px; }
  .empty-result p { margin: 0; }
  .empty-result span { display: none; }
  .page-footer { padding-top: 18px; }
}

.word-settings { grid-column: 1 / -1; margin-top: 13px; padding: 8px 9px; border: 1px solid var(--line); border-radius: var(--surface-radius); background: var(--surface); }
.word-settings summary { color: var(--accent-dark); font-size: .9rem; font-weight: 700; cursor: pointer; line-height: 1.55; }
.word-settings summary .icon { vertical-align: -.18em; }
.word-hint { margin: 7px 0 9px; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.word-fields { display: grid; gap: 4px; }
.word-fields label { font-size: .85rem; font-weight: 600; }
.word-fields select { min-height: 34px; padding: 4px 6px; font-size: .86rem; appearance: auto; }
.word-color-row { display: flex; gap: 4px; align-items: center; justify-content: space-between; }
.word-color-row input[type="color"] { width: 34px; height: 30px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); padding: 3px; }
.word-tables { margin: 12px 0 2px; padding: 5px 0 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.word-tables legend { padding-right: 5px; color: var(--ink); font-size: .87rem; font-weight: 700; }
