:root {
  color-scheme: light;
  --background: #f4f6f2;
  --paper: #fff;
  --ink: #17271f;
  --muted: #526158;
  --line: #d7dfd8;
  --accent: #15563f;
  --accent-deep: #0f432f;
  --accent-light: #e8f1e9;
  --error: #972f24;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--accent-deep); }
button, a, input, textarea { outline-offset: 3px; }
:focus-visible { outline: 2px solid #257953; }
[hidden] { display: none !important; }
.shell { width: min(70rem, calc(100% - 3rem)); margin-inline: auto; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-content { display: flex; justify-content: space-between; align-items: center; min-height: 3.75rem; gap: 1rem; }
.wordmark { text-decoration: none; font-weight: 750; display: inline-flex; align-items: center; gap: .65rem; }
.logo { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: .45rem; background: var(--accent); color: white; }
.guide-link { font-size: .9rem; font-weight: 650; text-underline-offset: .2rem; }

.intro { padding: clamp(2.2rem, 5vw, 4rem) 0 1.8rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.4rem, 6vw, 4.25rem); line-height: 1.04; letter-spacing: -.052em; }
.intro p { color: var(--muted); max-width: 41rem; font-size: clamp(1rem, 2vw, 1.15rem); line-height: 1.55; margin-top: .85rem; }

.workspace { display: grid; grid-template-columns: minmax(14.75rem, .8fr) minmax(0, 1.6fr); gap: 1rem; align-items: start; }
.card { min-width: 0; padding: clamp(1rem, 3vw, 1.45rem); border: 1px solid var(--line); border-radius: .95rem; background: var(--paper); box-shadow: 0 .2rem .7rem #21312408; }
h2 { font-size: 1.22rem; letter-spacing: -.018em; }
.drop-zone { display: grid; justify-items: center; gap: .7rem; padding: 1.35rem .65rem; margin: 1rem 0 .7rem; border: 1px dashed #88a996; border-radius: .65rem; background: #f6faf6; text-align: center; }
.drop-zone.dragging { background: var(--accent-light); border-color: var(--accent); }
.file-icon { display: grid; place-items: center; min-width: 2.6rem; min-height: 3.15rem; border: 1px solid #b0cbbb; border-radius: .38rem; background: var(--paper); color: var(--accent); box-shadow: .2rem .2rem 0 #dce9df; font: 700 .7rem ui-monospace, Consolas, monospace; }
.drop-zone p { font-weight: 650; }
small, .file-status, .field-help, .summary, .action-status { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.file-status { margin-top: .35rem; overflow-wrap: anywhere; }
.file-status.error, .summary.error, .action-status.error { color: var(--error); }
.text-button { border: 0; background: none; color: var(--accent-deep); padding: .25rem 0; min-height: 2.4rem; font-size: .9rem; font-weight: 650; text-decoration: underline; text-underline-offset: .2rem; }
.primary, .secondary { border: 1px solid transparent; border-radius: .45rem; min-height: 2.75rem; font-size: .91rem; font-weight: 650; padding: .55rem .85rem; white-space: normal; }
.primary { background: var(--accent); color: white; }
.primary:hover:not(:disabled) { background: var(--accent-deep); }
.secondary { border-color: var(--line); color: var(--accent-deep); background: var(--paper); }
.secondary:hover:not(:disabled) { background: var(--accent-light); }
.primary:disabled, .secondary:disabled { background: #edf0ed; border-color: #e2e8e2; color: #5c6a61; }

.chunk-options { border: 0; border-top: 1px solid var(--line); padding: .65rem 0 0; margin: 1rem 0 0; min-inline-size: 0; }
.chunk-options legend { padding: 0 .5rem 0 0; font-weight: 700; }
.chunk-options label { display: block; font-size: .91rem; }
#max-words { display: block; width: 6rem; margin: .4rem 0 .65rem; padding: .45rem .55rem; min-height: 2.6rem; border: 1px solid #a6b4a9; border-radius: .35rem; color: var(--ink); background: white; }
.chunk-options .check-label { display: flex; align-items: start; gap: .5rem; min-height: 2.75rem; padding-top: .6rem; }
.check-label input { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; flex-shrink: 0; margin: .1rem 0 0; }

.output-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.formats { display: inline-flex; padding: .2rem; margin: 0; min-inline-size: 0; gap: .15rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--background); }
.formats label { cursor: pointer; position: relative; }
.formats input { opacity: 0; position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.formats span { display: inline-grid; min-height: 2.25rem; place-items: center; padding: .4rem .65rem; border: 1px solid transparent; border-radius: .36rem; font-size: .86rem; font-weight: 650; color: var(--muted); }
.formats input:checked + span { color: var(--accent-deep); background: white; border-color: var(--line); box-shadow: 0 1px 2px #233c2812; }
.formats input:focus-visible + span { outline: 2px solid #257953; outline-offset: 2px; }
.summary { margin: .75rem 0 .55rem; }
.result { display: block; width: 100%; min-height: 15.5rem; resize: vertical; padding: .95rem; border: 1px solid var(--line); border-radius: .55rem; background: #f7f9f6; color: var(--ink); font: .9rem/1.65 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.result::placeholder { color: var(--muted); }
.output-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-top: .8rem; }

.guide { padding: 2rem 0 2.75rem; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.guide article { border-top: 1px solid var(--line); padding-top: .85rem; }
.guide h3 { font-size: 1rem; }
.guide p { color: var(--muted); margin-top: .45rem; line-height: 1.55; font-size: .92rem; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 46rem) {
  .shell { width: calc(100% - 2rem); }
  .workspace, .guide-grid { grid-template-columns: 1fr; }
  .intro { padding-bottom: 1.35rem; }
  .result { min-height: 13rem; }
}
