:root {
  color-scheme: dark;
  --bg: #1a1715;
  --surface: #24201d;
  --ink: #f1ebe4;
  --muted: #b2a79c;
  --line: #3a332e;
  --accent: #e07a5f;
  --accent-ink: #1a1715;
  --accent-soft: #3a2621;
  --panel-a: #4a3d33;
  --panel-b: #5e4c3f;
  --seam: #f08c6e;
  --top: #f1ebe4;
  --radius: 12px;
  --max: 760px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); }
img, svg { max-width: 100%; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.brand svg { width: 26px; height: 26px; }
.site-header nav a { color: var(--muted); text-decoration: none; margin-left: 16px; font-size: 15px; }
.site-header { position: relative; z-index: 20; }
.site-header nav { display: flex; align-items: center; }
.menu { margin-left: 16px; }
.menu summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 15px; display: flex; align-items: center; gap: 4px; padding: 6px 0; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: -4px 2px 0 4px; }
.menu[open] summary { color: var(--ink); }
.menu[open] summary::after { transform: rotate(225deg); margin-top: 4px; }
.menu summary:hover, .site-header nav a:hover { color: var(--ink); }
.menu summary:focus-visible, .menu-panel a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.menu-panel { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); width: min(var(--max), 100%); background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; box-shadow: 0 12px 28px rgba(0,0,0,.45); padding: 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 20px; max-height: calc(100vh - 56px); overflow-y: auto; }
.menu-h { margin: 8px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.menu-panel ul { list-style: none; margin: 0; padding: 0; }
.site-header .menu-panel a { display: block; margin: 0; padding: 7px 8px; color: var(--ink); font-size: 15px; border-radius: 6px; }
.site-header .menu-panel a:hover { background: var(--accent-soft); }
.site-header .menu-panel a.menu-all { grid-column: 1 / -1; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); border-radius: 0; color: var(--accent); font-weight: 600; }
@media (max-width: 520px) {
  .menu-panel { grid-template-columns: 1fr; border-radius: 0; border-left: 0; border-right: 0; }
}

h1 { font-size: 1.9rem; line-height: 1.2; margin: 24px 0 8px; }
h2 { font-size: 1.4rem; line-height: 1.3; margin: 40px 0 12px; }
h3 { font-size: 1.1rem; margin: 0 0 4px; }
.lede { color: var(--muted); margin: 0 0 20px; }

/* calculator form */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.presets legend { font-size: 14px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.presets button {
  font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer;
}
.presets button:hover, .presets button:focus-visible { border-color: var(--accent); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.field .hint { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.field input, .field select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--ink); min-height: 44px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.full { grid-column: 1 / -1; }
details.more { margin-top: 12px; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 15px; }
details.more .grid { margin-top: 12px; }
.go {
  margin-top: 16px; width: 100%; font: inherit; font-weight: 700; padding: 12px;
  border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); cursor: pointer; min-height: 48px;
}

/* results */
#results { display: grid; gap: 14px; margin-top: 18px; scroll-margin-top: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { text-transform: uppercase; letter-spacing: .06em; font-size: 13px; color: var(--muted); }
.big { font-size: 2.2rem; font-weight: 800; margin: 0; line-height: 1.1; }
.note { color: var(--muted); margin: 4px 0 10px; font-size: 15px; }
.steps { margin: 0 0 10px; padding-left: 20px; }
.steps li { margin-bottom: 4px; }
.alt { font-size: 15px; color: var(--muted); }
.compare { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.compare p { margin: 0; }
.aff { margin: 10px 0 0; font-weight: 600; }
.disclosure { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

.diagram { display: block; width: 100%; max-height: 320px; margin: 8px 0; }
.diagram .panel.p0 { fill: var(--panel-a); }
.diagram .panel.p1 { fill: var(--panel-b); }
.diagram .seam { stroke: var(--seam); stroke-width: 1.2; stroke-dasharray: 3 2; }
.diagram .top { fill: none; stroke: var(--top); stroke-width: 1; stroke-dasharray: 4 3; }
.diagram .lbl { fill: var(--top); font-family: inherit; font-weight: 600; }
.diagram .lbl.sub { font-weight: 400; fill: var(--muted); }

.leftover { font-size: 15px; background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; }
.share-row { margin: 12px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share {
  font: inherit; font-size: 15px; font-weight: 600; padding: 8px 14px; min-height: 44px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--surface); color: var(--accent); cursor: pointer;
}
.share:hover, .share:focus-visible { background: var(--accent-soft); }
.share-msg { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; min-width: 0; }

/* ads */
.ad { margin: 24px 0; min-height: 100px; display: flex; align-items: center; justify-content: center; }
.ad:empty { display: none; }

/* content */
table { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface); }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.formula { background: var(--surface); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 8px 8px 0; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 8px 0 0; }

.site-footer { margin-top: 48px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.site-footer a { color: var(--muted); margin-right: 14px; }

.page h1 { margin-top: 32px; }

@media (max-width: 420px) {
  h1 { font-size: 1.6rem; }
  .site-header nav a { margin-left: 10px; font-size: 14px; }
  .menu { margin-left: 10px; }
  .menu summary { font-size: 14px; }
}
@media (min-width: 700px) {
  #results { grid-template-columns: 1fr 1fr; }
  #results .card:first-child { grid-column: 1 / -1; }
  .grid.three { grid-template-columns: 1fr 1fr 1fr; }
}

/* multi-tool site */
.crumb { font-size: 14px; color: var(--muted); margin: 20px 0 0; }
.crumb a { color: var(--muted); }
.crumb + h1 { margin-top: 6px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.tool-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0;
}
.tool-card span { color: var(--muted); font-size: 15px; }
.tool-card:hover, .tool-card:focus-visible { border-color: var(--accent); }
a.next { font-weight: 600; text-decoration: none; }
a.next:hover { text-decoration: underline; }
.next-list { display: grid; gap: 6px; margin-top: 8px; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 16px; }
.foot-grid ul { list-style: none; padding: 0; margin: 0; }
.foot-grid li { margin: 4px 0; }
.foot-h { font-weight: 700; color: var(--ink); margin: 0 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; }
.legal a { margin-right: 14px; }
.cmp td:first-child { font-weight: 600; }
.best-row td { background: var(--accent-soft); }
