:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5d6878;
  --line: #dde2ea;
  --accent: #0b6e4f;
  --accent-text: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1b212a;
    --text: #e8ecf1;
    --muted: #9aa5b4;
    --line: #2c3541;
    --accent: #35b88a;
    --accent-text: #0c1512;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
}
header, main, footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
header a.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 14px;
  font-size: 0.95rem;
}
nav a:hover { color: var(--accent); }
h1 { font-size: 1.8rem; line-height: 1.25; margin: 12px 0 8px; }
h2 { font-size: 1.2rem; margin-top: 28px; }
p.lead { color: var(--muted); margin-top: 0; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
a.tool {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  color: var(--text);
  text-decoration: none;
}
a.tool:hover { border-color: var(--accent); }
a.tool strong { display: block; margin-bottom: 4px; }
a.tool span { color: var(--muted); font-size: 0.92rem; }
.drop {
  display: block;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); }
.drop input { display: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
input[type="number"], select {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  width: 130px;
}
button, a.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
#status { color: var(--muted); min-height: 1.6em; }
#results { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
#results figure { margin: 0; text-align: center; }
#results img { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
#results a { font-size: 0.9rem; color: var(--accent); }
.ad-slot { margin: 20px 0; min-height: 0; }
footer { color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); margin-top: 32px; }
footer a { color: var(--muted); }
input[type="text"] {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1.15rem;
  width: 100%;
  max-width: 320px;
}
.output {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 14px;
  min-height: 3.4em;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: start; vertical-align: top; }
.table-wrap { overflow-x: auto; }
[dir="rtl"] nav a { margin-left: 0; margin-right: 14px; }
h3 { font-size: 1.05rem; margin: 26px 0 10px; color: var(--muted); }
textarea {
  width: 100%;
  min-height: 260px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.8;
  resize: vertical;
}
button.chip {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 7px 12px;
  font-weight: 500;
  font-size: 0.92rem;
}
button.chip:hover { border-color: var(--accent); }
select { width: auto; max-width: 100%; }
.note { color: var(--muted); font-size: 0.92rem; }
#results a.btn { color: var(--accent-text); font-size: 1rem; }
