:root {
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --soft: #f1f5f9;
  --primary: #2563eb;
  --sea: #f3f7fc;
  --land: #dde3ec;
  --warn: #c2410c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --fg: #e2e8f0;
    --muted: #94a3b8;
    --border: #1e293b;
    --soft: #111827;
    --primary: #3b82f6;
    --sea: #0e1626;
    --land: #1f2937;
    --warn: #fb923c;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h2 { margin: 0; font-size: 16px; font-weight: 500; }

/* Container like Tailwind's */
.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 32px 16px 48px; display: grid; gap: 20px; }
.content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 640px) { .wrap { padding-left: 24px; padding-right: 24px; gap: 40px; } }
@media (min-width: 1024px) { .wrap { padding-left: 32px; padding-right: 32px; gap: 60px; } }

.top { display: flex; align-items: center; gap: 12px; }
.top-text { flex: 1; min-width: 0; }
h1 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 500; }
.brand img { display: block; border-radius: 10px; }
.back { padding: 6px 10px; border-radius: 999px; font-size: 13px; text-decoration: none; white-space: nowrap; }
.back:hover { background: var(--soft); }
.card { display: grid; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; min-width: 0; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
footer { text-align: center; }

/* Controls: 14px, 36px high */
input, select, textarea, button {
  font: inherit; font-size: 14px; color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}
input, select { height: 36px; padding: 0 10px; width: 100%; min-width: 0; }
textarea { padding: 8px 10px; width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
button { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; white-space: nowrap; cursor: pointer; }
button:hover { background: var(--soft); }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.primary:hover { background: var(--primary); filter: brightness(.92); }
.icon { width: 36px; padding: 0; flex: none; }
.icon.on { color: var(--primary); border-color: var(--primary); }
.link { border: 0; height: auto; padding: 0; background: none; color: var(--primary); font-size: 13px; }
.link:hover { background: none; text-decoration: underline; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--soft); }
/* How it works */
.howto { border: 1px solid var(--border); border-radius: 14px; padding: 0 16px; font-size: 14px; }
.howto summary { cursor: pointer; padding: 12px 0; }
.howto[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.howto ol { padding-left: 20px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 9999; transform: translate(-50%, 12px);
  padding: 10px 16px; border-radius: 10px; background: #0f172a; color: #fff; font-size: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Light type: nothing heavier than 500 */
strong, b, th, summary { font-weight: 500; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.status { margin: 0; color: var(--muted); }
.status.ok { color: #15803d; }
.status.err { color: var(--warn); }
code { font: 13px ui-monospace, Menlo, monospace; }

/* Two columns on wide screens: build on the left, check and list on the right */
.layout { display: grid; gap: 16px; align-items: start; }
.col { display: grid; gap: 16px; min-width: 0; }
@media (min-width: 960px) { .layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }

@media (max-width: 640px) {
  input, select, textarea { font-size: 16px !important; }
  .wrap { padding-top: 16px; }
  .content { gap: 12px; }
  .top { position: sticky; top: 0; z-index: 10; margin: -16px -16px 0; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
  .brand img { width: 32px; height: 32px; }
  h1 { font-size: 20px; }
  .back { font-size: 16px; padding: 6px 8px; }
  .back span { display: none; }
  .card { padding: 12px; border-radius: 12px; }
}

/* Phones: one compact header bar across the full width, stuck to the top (same in every tool) */
@media (max-width: 639px) {
  .wrap { padding-top: 0; }
  .top { position: sticky; top: 0; z-index: 10; flex-wrap: nowrap; align-items: center; gap: 10px; margin: 0 -16px; padding: 10px 16px;
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
  .top-text { flex: 1; min-width: 0; }
  .brand img { width: 32px; height: 32px; }
  h1 { font-size: 18px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .back { padding: 6px 8px; font-size: 16px; }
  .back span { display: none; }
}
