*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --ink: #1d2330;
  --muted: #535d70;
  --line: #d5dae3;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --page: #f4f6f9;
  --panel: #ffffff;
  --error: #b3261e;
  --warn: #8a5300;
  --focus: #e89b00;
}

html {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--page);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body { margin: 0; }

.site-header, main, .site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); margin: 24px 0 8px; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.lead { margin: 0 0 20px; color: var(--muted); max-width: 70ch; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (min-width: 720px) {
  .layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.field-label { display: block; margin-bottom: 8px; font-weight: 600; }

input[type="file"] { max-width: 100%; font: inherit; }

input[type="text"] {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  border: 1px solid #8a93a6;
  border-radius: 6px;
  background: #fff;
}

input[type="text"]:disabled { background: #eef0f4; }
input[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }

button {
  min-height: 44px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
}

button[aria-pressed="true"], button.primary { color: var(--accent-ink); background: var(--accent); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

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

.size-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.side { flex: 1 1 110px; min-width: 0; font-weight: 600; }
#lock { flex: 0 1 auto; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.actions button { flex: 1 1 120px; }

.note { margin: 8px 0; color: var(--muted); font-size: 0.95rem; }
.note.warning { color: var(--warn); }
.error { margin: 8px 0; color: var(--error); font-weight: 600; overflow-wrap: anywhere; }
.status { margin: 12px 0 0; overflow-wrap: anywhere; }

.preview { margin: 12px 0 0; }

.preview img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  border: 1px solid var(--line);
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #dde1e8 25%, transparent 25%, transparent 75%, #dde1e8 75%),
    linear-gradient(45deg, #dde1e8 25%, transparent 25%, transparent 75%, #dde1e8 75%);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
}

.preview figcaption { margin-top: 8px; font-size: 0.95rem; overflow-wrap: anywhere; }
.is-stale img { opacity: 0.4; }
.stale { margin: 0 0 8px; color: var(--warn); font-weight: 600; }

.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; }
.facts div { display: contents; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.about {
  margin: 24px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.about ul { margin: 0; padding-left: 20px; }
.about li + li { margin-top: 6px; }

.site-footer { padding-bottom: 24px; color: var(--muted); font-size: 0.9rem; }
