:root {
  --bg: #f4f6ef;
  --card: #ffffff;
  --ink: #1b2a1f;
  --muted: #5f7365;
  --line: #d6dfd0;
  --accent: #0f6b3f;
  --accent-2: #cde9d8;
  --danger: #8d2f2f;
  --shadow: 0 12px 30px rgba(26, 39, 30, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 0% 0%, #edf4e8 0%, transparent 35%), radial-gradient(circle at 100% 100%, #e8f3f0 0%, transparent 40%), var(--bg);
  color: var(--ink);
}
a { color: var(--accent); }
.wrap { width: min(1040px, 92vw); margin: 0 auto; }
header.site { padding: 18px 0; border-bottom: 1px solid var(--line); }
.site-head {
  display: grid;
  gap: 10px;
  justify-items: center;
}
.brand { font-weight: 800; letter-spacing: 0.3px; text-decoration: none; color: var(--ink); }
.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
}
.main-nav a {
  text-decoration: none;
  color: #214334;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 7px 12px;
  border-radius: 999px;
}
.main-nav a:hover {
  background: #eaf3ed;
}
main { padding: 22px 0 50px; }
.hero { background: linear-gradient(155deg, #fefefe 0%, #edf6ef 100%); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 20px; }
h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.5rem); line-height: 1.1; text-align: center; }
.sub { color: var(--muted); margin: 10px 0 0; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.stack { display: grid; gap: 10px; }
.card[data-converter] {
  padding: 18px 20px;
}
.card[data-converter].stack {
  gap: 14px;
}
.controls { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.controls.has-swap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 48px minmax(0, 1fr); }
.view-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d9e3dd;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 4px 6px;
  width: max-content;
  margin-left: auto;
  align-self: end;
}
.view-mode-label {
  font-weight: 600;
  color: var(--muted);
  padding: 0 2px 0 6px;
  font-size: 0.82rem;
}
.view-mode-toggle button {
  min-height: 28px;
  background: transparent;
  color: #4f6457;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 600;
}
.view-mode-toggle button.active {
  background: #e9f2ec;
  color: #1e4b33;
  border-color: #c7dbce;
}
.mode-easy [data-complex-only="true"] {
  display: none !important;
}
.controls-one { grid-template-columns: max-content; justify-content: center; }
.controls-one button[data-run] {
  min-height: 88px;
  min-width: 240px;
  font-size: 1.2rem;
  padding: 0 28px;
}
.swap-btn {
  min-height: 48px;
  min-width: 48px;
  width: 48px;
  border-radius: 999px;
  border: 1px solid #c5d3c9;
  background: #eef5f1;
  color: #173625;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  justify-self: center;
}
input, select, button, textarea { min-height: 44px; border-radius: 10px; border: 1px solid #c5d3c9; font-size: 1rem; padding: 0 12px; }
textarea { padding: 10px 12px; resize: vertical; }
.card[data-converter] select {
  background: #ffffff;
  border: 1px solid #cfdad3;
  color: #34475b;
  font-weight: 700;
}
button { background: var(--accent); color: #fff; border: none; font-weight: 700; cursor: pointer; }
button.secondary { background: #e3eee5; color: #173625; }
.btn {
  min-height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0 12px;
  border: none;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
}
.btn.secondary { background: #e3eee5; color: #173625; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-2); color: #174d33; border-radius: 999px; padding: 5px 10px; font-size: 0.82rem; }
.rate { font-size: clamp(1.2rem, 3.8vw, 2rem); font-weight: 800; }
.card[data-converter] .rate {
  text-align: center;
  justify-self: center;
  width: 100%;
  margin-top: 4px;
  margin-bottom: 6px;
}
.meta, small { color: var(--muted); }
.card[data-converter] [data-window] {
  font-size: 1rem;
  line-height: 1.5;
}
.card[data-converter] .meta {
  margin-top: 2px;
}
.pair-facts {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}
.pair-facts-head {
  display: flex;
  align-items: center;
}
.pair-facts-live {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border: 1px solid #2a9b4b;
  color: #167036;
  font-weight: 800;
  font-size: 0.88rem;
}
.pair-facts-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}
.pair-facts-label {
  font-weight: 700;
  color: #2e3b32;
}
.pair-facts-value {
  font-weight: 700;
}
.pair-facts-delta {
  font-weight: 800;
}
.pair-facts-delta.up {
  color: #1e9a53;
}
.pair-facts-delta.down {
  color: #cf3838;
}
.history-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.history-block h3 {
  margin: 0;
  padding: 10px 12px;
  background: #0f4f86;
  color: #fff;
  font-size: 1.12rem;
}
.history-block .sub {
  margin: 10px 12px 0;
}
.history-links {
  margin: 8px 12px 10px;
  color: var(--muted);
}
.history-range {
  border: 0;
  background: transparent;
  color: #0a5ea4;
  text-decoration: underline;
  font-weight: 700;
  min-height: 0;
  padding: 0;
  margin-right: 6px;
  cursor: pointer;
}
.history-range.active {
  color: #063b67;
  text-decoration: none;
}
.history-table-wrap {
  overflow-x: auto;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
}
.history-table td {
  padding: 7px 12px;
  border-top: 1px solid #e3e8e3;
  vertical-align: top;
}
.history-table tbody tr:nth-child(even) td {
  background: #f2f5f8;
}
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a { text-decoration: none; border: 1px solid var(--line); padding: 8px 10px; border-radius: 10px; background: #fff; }
.notice { border-left: 4px solid var(--accent); background: #f1f8f2; padding: 10px 12px; border-radius: 8px; }
.warn { border-left-color: var(--danger); background: #fff1f1; }
footer { padding-top: 30px; color: var(--muted); font-size: 0.92rem; }
.site-footer {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.footer-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.footer-grid h3 {
  margin: 0 0 6px;
  font-size: 0.96rem;
}
.footer-links {
  display: grid;
  gap: 6px;
}
.footer-links a {
  text-decoration: none;
}
.footer-note {
  margin: 14px 0 0;
  color: var(--muted);
}
.infer-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.infer-card {
  background: #fff;
  border: 1px solid #d7eaf3;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 8px 20px rgba(7, 56, 82, 0.06);
}
.infer-card b {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5c7f91;
  margin-bottom: 4px;
}
.infer-card p {
  margin: 0;
  font-weight: 700;
  color: #0d3142;
}

.home-hybrid {
  background: linear-gradient(160deg, #e9f7ff, #f7fcff 52%, #ffffff);
  color: #0f202a;
}
.home-hybrid .hero {
  background: #ffffff;
  border: 1px solid #d7eaf3;
  border-radius: 14px;
}
.home-hybrid .hero > h1 {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 0.9;
  font-size: clamp(2.2rem, 7vw, 5rem);
  color: #062737;
}
.home-hybrid .hero > .sub {
  color: #3f6f86;
}
.home-hybrid button[data-run] {
  background: #0079bf;
}
.home-hybrid .rate {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 0.9;
  letter-spacing: 0.01em;
  color: #062737;
}
.cue-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cue-card {
  background: #fff;
  border: 1px solid #d7eaf3;
  border-radius: 12px;
  padding: 10px;
}
.cue-card b {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5c7f91;
  margin-bottom: 4px;
}
.cue-card p {
  margin: 0;
  font-weight: 800;
  font-size: 1.28rem;
  color: #0d3142;
}
.cue-card select {
  margin-top: 8px;
  width: 100%;
}
.matrix-wrap {
  overflow-x: auto;
}
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
.matrix-table th,
.matrix-table td {
  border: 1px solid #c9dfee;
  padding: 8px 10px;
  text-align: left;
}
.matrix-table th {
  background: #edf6fb;
}
@media (max-width: 740px) { .controls { grid-template-columns: 1fr; } }
@media (max-width: 740px) { .main-nav { border-radius: 12px; } }
@media (max-width: 900px) { .infer-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .cue-strip { grid-template-columns: 1fr; } }
