/* Currency Converter — public static build for doohickeytools.com/currency-converter/ */
/* Hidden elements must stay hidden: .dialog-backdrop sets display:flex,
   which otherwise overrides the browser's built-in [hidden] rule and
   leaves dialogs visible (and unclosable) on load. */
[hidden] { display: none !important; }
:root {
  --bg: #f7f5ef;
  --card: #fffdf6;
  --alt: #efece1;
  --ink: #16211a;
  --muted: #5c6a5f;
  --line: #ddd8c6;
  --accent: #14532d;
  --accent-soft: #e3efe6;
  --premium: #b45309;
  --premium-soft: #faf0dd;
  --down: #b3261e;
  --radius: 10px;
  --font: "Archivo", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101511;
    --card: #1a211b;
    --alt: #232b24;
    --ink: #eef2ea;
    --muted: #9aa79c;
    --line: #333d34;
    --accent: #7bc98d;
    --accent-soft: #1e3325;
    --premium: #e8a04c;
    --premium-soft: #33270f;
    --down: #f0857d;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.page { max-width: 672px; margin: 0 auto; padding: 16px 16px 40px; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

h2 { font-size: 1.2rem; margin: 0; }

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.45rem; font-weight: 800; letter-spacing: -0.01em; }
.brand-emoji { font-size: 1.5rem; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill {
  background: #eef3e6; color: #4c7a34; border: 1px solid #cfdfc0;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 4px 10px; border-radius: 999px;
}
.pill.premium { background: #22252b; color: #ffd97a; border-color: #22252b; }

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit; font-size: 0.95rem; font-weight: 600;
  border: 1px solid transparent; border-radius: 999px;
  padding: 9px 18px; cursor: pointer; background: #fff; color: var(--ink);
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-dark { background: #22252b; color: #fff; }
.btn-green { background: var(--accent); color: #fff; }
.btn-brown { background: var(--premium); color: #fff; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.link-btn {
  font-family: inherit; font-size: 0.92rem; font-weight: 600; color: var(--premium);
  background: none; border: 0; cursor: pointer; padding: 9px 4px; text-decoration: underline;
}
.link-btn.pill-on {
  text-decoration: none; background: var(--premium-soft); color: var(--premium);
  border: 1px solid var(--premium); border-radius: 999px; padding: 6px 14px;
}

/* ---------- Layout ---------- */
main { display: flex; flex-direction: column; gap: 20px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.section-copy { color: var(--muted); margin: 8px 0 16px; }
.empty-state { color: var(--muted); margin: 12px 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- Converter ---------- */
.conv-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.conv-field { flex: 1; min-width: 0; }
.conv-field:first-child { flex: 1 1 200px; }
.conv-field label, .conv-label {
  display: block; font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 6px;
}
#amountInput {
  width: 100%; font-family: var(--mono); font-size: 2.25rem; font-weight: 600;
  color: var(--ink); background: transparent; border: 0;
  border-bottom: 2px solid var(--accent); border-radius: 0;
  padding: 2px 0; outline: none;
}
#amountInput:focus { border-bottom-color: var(--accent); }
select {
  width: 100%; font-family: inherit; font-size: 0.95rem; font-weight: 600;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.conv-divider { text-align: center; font-size: 1.3rem; color: var(--muted); margin: 10px 0 2px; }
.result {
  font-size: 2rem; font-weight: 600; color: var(--accent);
  line-height: 1.15; overflow-wrap: anywhere; min-height: 1.2em;
}
@media (max-width: 480px) { .result { font-size: 1.6rem; } }
.conv-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.conv-actions .link-btn { margin-left: auto; }
.conv-meta { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.rate-line { margin: 0; font-size: 0.98rem; }
.asof-line { margin: 6px 0 0; color: var(--muted); font-size: 0.88rem; }
.stale-note { margin: 6px 0 0; color: var(--down); font-size: 0.88rem; font-weight: 600; }

/* ---------- History ---------- */
.change-badge {
  font-size: 0.85rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.change-badge.up { background: var(--accent-soft); color: var(--accent); }
.change-badge.down { background: #fbe9e7; color: var(--down); }
.history-chart { margin-top: 14px; }
.history-chart svg { display: block; width: 100%; height: 208px; }
.history-range { margin: 10px 0 0; color: var(--muted); font-size: 0.9rem; }
.history-loading { color: var(--muted); margin: 14px 0 0; }

/* ---------- Alerts ---------- */
.alert-form { margin-top: 4px; }
.alert-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.alert-field { flex: 1; min-width: 140px; }
.alert-field label, .field-label {
  display: block; font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 6px;
}
.alert-field input[type="text"] {
  width: 100%; font-family: var(--mono); font-size: 1rem;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.toggle { display: inline-flex; background: var(--alt); border-radius: 999px; padding: 3px; gap: 2px; }
.toggle-btn {
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  border: 0; border-radius: 999px; padding: 7px 16px; cursor: pointer;
  background: transparent; color: var(--muted);
}
.toggle-btn.active { background: var(--accent); color: #fff; }
.form-error { color: var(--down); font-weight: 600; margin: 0 0 12px; }
.alert-list { list-style: none; margin: 16px 0 0; padding: 0; }
.alert-row-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 2px; border-top: 1px solid var(--line); font-size: 0.95rem;
}
.alert-pair { font-weight: 700; }
.alert-status { color: var(--muted); font-size: 0.9rem; }
.triggered-pill {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--premium-soft); color: var(--premium);
  border: 1px solid var(--premium); border-radius: 999px; padding: 3px 9px;
}
.alert-delete {
  margin-left: auto; font-family: inherit; font-size: 0.85rem; font-weight: 600;
  background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px 6px;
}
.alert-delete:hover { color: var(--down); }

/* ---------- Market board ---------- */
.board-title {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 10px;
}
.board-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 640px) { .board-grid { grid-template-columns: repeat(2, 1fr); } }
.market-tile {
  font-family: inherit; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; color: var(--ink);
  display: flex; flex-direction: column; gap: 2px;
}
.market-tile:hover { border-color: var(--accent); }
.market-tile.active { border: 2px solid var(--accent); padding: 11px 13px; }
.tile-code { font-weight: 800; font-size: 1.05rem; }
.tile-name { color: var(--muted); font-size: 0.85rem; }
.tile-value { font-size: 1rem; font-weight: 600; color: var(--accent); margin-top: 4px; }
.board-note { color: var(--muted); font-size: 0.88rem; margin: 10px 0 0; }

/* ---------- Ad slot (exactly one) ---------- */
.ad-slot {
  border: 2px dashed #cfc4ae; border-radius: var(--radius);
  padding: 18px 20px; text-align: center; background: #fffdf8;
  min-height: 96px;
}
@media (prefers-color-scheme: dark) {
  .ad-slot { background: #1a211b; border-color: #4a554b; }
}
.ad-label { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; color: #a39a86; }
.ad-copy { margin: 10px 0 4px; font-weight: 600; }
.ad-link {
  font-family: inherit; font-size: 0.92rem; font-weight: 700; color: var(--accent);
  background: none; border: 0; cursor: pointer; padding: 0; text-decoration: none;
}
.ad-link:hover { text-decoration: underline; }

/* ---------- Premium teaser ---------- */
.premium-teaser { border-color: var(--premium); background: var(--premium-soft); }
.teaser-label {
  margin: 0 0 6px; font-size: 0.75rem; font-weight: 800;
  letter-spacing: 0.1em; color: var(--premium);
}

/* ---------- Footer ---------- */
footer { margin-top: 24px; }
.disclaimer {
  color: var(--muted); font-size: 0.78rem; line-height: 1.5;
  border-top: 1px solid var(--line); padding-top: 14px; margin: 0;
}
.site-footer { text-align: center; margin: 16px 0 0; font-size: 0.85rem; }
.site-footer a { color: var(--muted); }

/* ---------- Dialogs ---------- */
.dialog-backdrop {
  position: fixed; inset: 0; background: rgba(30, 25, 18, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 50;
}
.dialog {
  background: #fff; color: #16211a; border-radius: 18px; padding: 26px; width: 100%; max-width: 440px;
  max-height: calc(100vh - 48px); overflow-y: auto;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}
@media (prefers-color-scheme: dark) {
  .dialog { background: #1a211b; color: #eef2ea; }
}
.dialog-wide { max-width: 720px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog h2 { font-size: 1.4rem; margin-bottom: 6px; }
.dialog-x {
  font-family: inherit; font-size: 1rem; background: none; border: 0; cursor: pointer;
  color: var(--muted); padding: 4px 8px; line-height: 1; flex: none;
}
.dialog-sub { color: var(--muted); margin: 0 0 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 5px; }
.field input {
  width: 100%; font-family: inherit; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; margin: 10px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--premium); cursor: pointer; }
.dialog-note { color: var(--muted); font-size: 0.9rem; margin: 16px 0 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; } }
.plan {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.plan-highlight { border: 2px solid var(--premium); background: var(--premium-soft); }
.plan h3 { margin: 0; font-size: 1.05rem; }
.plan-price { font-size: 1.5rem; font-weight: 800; }
.plan-price span { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.plan-alt { margin: 0; color: var(--muted); font-size: 0.92rem; font-weight: 600; }
.plan ul { margin: 0; padding-left: 18px; font-size: 0.92rem; }
.plan ul li { margin-bottom: 5px; }
.plan-cta { margin-top: auto; width: 100%; }
.plan-preview-btn { width: 100%; margin-top: 16px; }
.preview-check { margin-top: 14px; font-weight: 600; }

/* ---------- Preview banner ---------- */
.preview-banner { background: #fdf3e3; border: 1px solid #f0d9a8; color: #7a5410; border-radius: 10px; padding: 10px 14px; margin: 12px 0; font-size: 0.92rem; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
