:root {
  --bg: #0e1411;
  --panel: #151d18;
  --line: #243029;
  --text: #e6eee9;
  --muted: #8da197;
  --accent: #4ade80;
  --warn: #fbbf24;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 8px 14px; border-radius: 8px; font: inherit; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); }
main { max-width: 1040px; margin: 0 auto; padding: 32px 24px 64px; }
h1 { font-size: 1.9rem; margin: 0 0 8px; }
.lead { color: var(--muted); max-width: 70ch; margin: 0 0 24px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
.col label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
textarea { width: 100%; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: inherit; resize: vertical; }
textarea:focus, select:focus, .btn:focus-visible, .drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.opts { border: 1px solid var(--line); border-radius: 10px; margin: 16px 0; padding: 12px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 24px; }
.opts legend { color: var(--muted); font-size: .85rem; padding: 0 6px; }
.opts label { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.opts select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font: inherit; }
.actions { display: flex; align-items: center; gap: 12px; }
.btn { background: var(--accent); color: #05210f; border: 0; border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn.alt { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.muted { color: var(--muted); font-size: .9rem; }
.report { margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--panel); font-size: .92rem; }
.report h2 { font-size: 1rem; margin: 0 0 8px; }
.report ul { margin: 6px 0 0; padding-left: 20px; }
.drop { display: grid; justify-items: center; gap: 4px; border: 1.5px dashed var(--line); border-radius: 12px; padding: 36px 16px; color: var(--muted); text-align: center; }
.drop p { margin: 0; }
.drop.over { border-color: var(--accent); color: var(--text); }
.link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.files { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; }
.files li { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--panel); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.files .name { font-weight: 600; word-break: break-all; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: .78rem; border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; color: var(--muted); }
.tag.ai { border-color: var(--warn); color: var(--warn); }
.removed { display: grid; gap: 4px; margin-top: 8px; font-size: .86rem; }
.removed .row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.removed .row.ai, .removed .row.sensitive { color: var(--warn); }
.removed .row span:last-child { white-space: nowrap; }
.note { color: var(--muted); font-size: .88rem; max-width: 70ch; }
footer { display: flex; justify-content: space-between; gap: 12px; padding: 18px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.prose { max-width: 70ch; }
.prose h2 { font-size: 1.2rem; margin-top: 28px; }

/* Layout helpers */
.back { color: var(--muted); font-size: .92rem; }
.links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.links a { color: var(--muted); }
.links a:hover { color: var(--accent); }
.detect { margin: 8px 0 0; font-size: .9rem; color: var(--text); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 20px 0 28px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 4px; }
.card strong { font-size: 1.4rem; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; }
.countries { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.countries li { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) minmax(60px, 1.2fr) auto; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.countries .code { font-weight: 700; color: var(--accent); }
.countries .cname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }

/* Phones and notches */
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); padding-bottom: env(safe-area-inset-bottom); -webkit-text-size-adjust: 100%; }
.btn, .tabs button { min-height: 44px; }
.opts label { min-height: 32px; }
textarea { font-size: 16px; }
@media (max-width: 640px) {
  .top { padding: 10px 14px; flex-wrap: wrap; }
  main { padding: 20px 14px 48px; }
  h1 { font-size: 1.5rem; }
  footer { flex-direction: column; padding: 16px 14px; }
  .files li { flex-direction: column; align-items: stretch; }
  .files .btn { text-align: center; text-decoration: none; }
  .countries li { grid-template-columns: 2.2rem minmax(0, 1fr) auto; }
  .countries progress { grid-column: 1 / -1; }
}
.files .btn { display: inline-block; text-decoration: none; }

/* Light theme */
@media (prefers-color-scheme: light) {
  :root { --bg: #f6faf7; --panel: #ffffff; --line: #d5e0d9; --text: #14201a; --muted: #55675d; --accent: #15803d; --warn: #b45309; }
  .btn { color: #ffffff; }
}

/* Fewer animations */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Feedback form */
.feedback { margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: grid; gap: 10px; }
.feedback .fb-title { margin: 0; font-size: .92rem; }
.feedback fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.feedback legend { color: var(--muted); font-size: .85rem; padding: 0; margin-bottom: 4px; }
.feedback label { display: flex; align-items: center; gap: 6px; font-size: .92rem; min-height: 32px; }
.feedback .btn { justify-self: start; }

/* Highlighted passages */
.marked-box { margin-top: 20px; }
.marked { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 360px; overflow: auto; }
mark { background: rgba(251, 191, 36, .28); color: inherit; border-bottom: 2px solid var(--warn); border-radius: 3px; padding: 0 2px; cursor: help; }
