:root {
  --bg: #ffffff;
  --fg: #16181d;
  --muted: #6a7080;
  --line: #e3e6ec;
  --accent: #2f6fd0;
  --card: #f7f8fa;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --fg: #e8eaee;
    --muted: #9aa1b0;
    --line: #272b33;
    --accent: #6ea8ff;
    --card: #1b1e24;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--fg); text-decoration: none; }
nav a { color: var(--muted); text-decoration: none; margin-left: 16px; font-size: 15px; }
nav a:hover { color: var(--accent); }
main { max-width: 760px; margin: 0 auto; padding: 28px 20px 56px; }
h1 { font-size: clamp(22px, 3.4vw, 30px); margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 19px; margin: 36px 0 10px; padding-top: 20px; border-top: 1px solid var(--line); }
p { margin: 0 0 12px; max-width: 62ch; }
.lead { color: var(--muted); margin-bottom: 22px; }
a { color: var(--accent); }
.tool { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.row { margin-bottom: 14px; }
.row.pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input, select, output {
  width: 100%; display: block; padding: 9px 10px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--fg);
}
output { min-height: 40px; font-variant-numeric: tabular-nums; overflow-x: auto; }
select { margin-top: 8px; }
#swap {
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 7px; height: 40px; width: 40px; font-size: 17px; cursor: pointer;
}
#swap:hover { border-color: var(--accent); color: var(--accent); }
.hint { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
footer { border-top: 1px solid var(--line); padding: 18px 20px; color: var(--muted); font-size: 14px; text-align: center; }
@media (max-width: 560px) {
  .row.pair { grid-template-columns: 1fr; }
  #swap { width: 100%; }
}

.row.pair3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.out .cell { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.out .cell span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.out .cell output { border: 0; padding: 0; font-size: 17px; min-height: 0; }
.out .cell.strong { border-color: var(--accent); }
.out .cell.strong output { font-weight: 600; color: var(--accent); }
@media (max-width: 560px) {
  .row.pair3, .out { grid-template-columns: 1fr; }
}
