:root {
  color-scheme: light;
  --ink: #233e35;
  --muted: #607268;
  --green: #236653;
  --border: #b9cbbf;
  --paper: #f6f7f1;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font: 20px/1.65 Arial, Helvetica, sans-serif;
  isolation: isolate;
}
a { color: var(--green); }
.page-content {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(24px, 8svh, 72px) 0 24px;
}
h1 {
  margin: 0 0 20px;
  font: 400 clamp(36px, 5.5vw, 46px)/1.2 Georgia, 'Times New Roman', serif;
  letter-spacing: -1px;
  overflow-wrap: anywhere;
}
.intro { max-width: 660px; margin: 0 0 28px; }
.controls { display: flex; align-items: stretch; gap: 12px; }
.drop-zone, #run-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 22px;
  border: 1px solid var(--green);
  border-radius: 7px;
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.drop-zone { background: #ffffffd9; color: var(--green); }
.drop-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.dragging, .drop-zone:focus-within { background: #e6efe5; }
.drop-zone:has(input:disabled) { opacity: .55; cursor: wait; }
#run-button { background: var(--green); color: #fff; gap: 16px; }
#run-button:disabled { opacity: .48; cursor: not-allowed; }
#run-button:enabled:hover { background: #174a3c; }
.file-selection { margin: 14px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.file-selection strong { font-weight: 500; }
#file-meta { display: block; color: var(--muted); font-size: 12px; }
.upload-help, .download-note { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
footer { margin-top: 28px; }
footer p { margin: 0; font-size: 14px; }
.attribution { font-size: 10px; color: var(--muted); }
.status { margin-top: 18px; padding: 12px 16px; border-radius: 6px; background: #e6f0e8; font-size: 13px; }
.status.error { background: #fff1eb; color: #8c3928; }
.status.busy::before {
  content: '';
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid #b2cbbb;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 9px;
  vertical-align: middle;
}
.download-link { display: inline-block; margin-top: 10px; font-size: 13px; }
dialog { border: 1px solid var(--border); border-radius: 12px; padding: 25px; max-width: min(620px, 90vw); color: var(--ink); }
dialog::backdrop { background: #152a2466; }
.dialog-top { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
h2 { margin: 0; font: 400 25px/1.2 Georgia, serif; }
#close-error { border: 0; background: none; font-size: 26px; color: var(--muted); cursor: pointer; }
dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 45vh; overflow: auto; background: var(--paper); padding: 15px; font-size: 12px; }
dialog p { font-size: 12px; color: var(--muted); }
:focus-visible { outline: 2px solid #388b72; outline-offset: 4px; }
[hidden] { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) {
  .page-content { width: calc(100% - 32px); padding-top: 24px; }
  h1 { margin-bottom: 16px; }
  .intro { font-size: 14px; margin-bottom: 22px; }
  .controls { gap: 8px; }
  .drop-zone, #run-button { padding: 10px 12px; font-size: 13px; }
  #run-button { gap: 8px; }
  footer { margin-top: 22px; }
}
@media (max-height: 500px) {
  .page-content { padding-top: 16px; }
  h1 { margin-bottom: 10px; }
  .intro { margin-bottom: 16px; }
  footer { margin-top: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
