@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg:           #eef2f7;
  --surface:      #ffffff;
  --text:         #1a1a2e;
  --text-muted:   #5a6478;
  --link:         #1e4db7;
  --primary:      #1a1a2e;
  --primary-h:    #2e2e50;
  --accent:       #1e4db7;
  --border:       #dde3ee;
  --input-border: #b8c4d8;
  --result-bg:    #f5f8fc;
  --shadow:       0 2px 16px rgba(26,26,46,.09);
  --radius-card:  14px;
  --radius-input: 7px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #0f1623;
    --surface:      #1a2236;
    --text:         #e4e9f2;
    --text-muted:   #8a97b0;
    --link:         #6b9fff;
    --primary:      #2a52be;
    --primary-h:    #3562d4;
    --accent:       #6b9fff;
    --border:       #2c3a55;
    --input-border: #3d4f70;
    --result-bg:    #111c2e;
    --shadow:       0 2px 16px rgba(0,0,0,.35);
  }
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; border: 0; margin: 0; padding: 0; line-height: 1; }

/* ── Base ──────────────────────────────────────────────────── */
html {
  font-size: 62.5%;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1.6;
  text-align: center;
}

main {
  display: block;
  padding: 0 16px 100px;
  text-align: left;
}

a { color: var(--link); font-weight: 500; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Logo ──────────────────────────────────────────────────── */
.logo {
  display: block;
  margin: 32px 0 8px;
  -webkit-user-select: none;
  user-select: none;
}
.logo img { display: block; }

/* ── Intro ─────────────────────────────────────────────────── */
.intro {
  color: var(--text-muted);
  font-size: 1.5rem;
  margin: 4px 0 16px;
}

/* ── Calculator forms ──────────────────────────────────────── */
.form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  line-height: 1.5;
  margin: 16px 0;
  padding: 20px 24px 16px;
}
.form::after { clear: both; content: ""; display: block; height: 0; }

.form fieldset {
  border: none;
  line-height: 1.6;
  margin: 10px 0;
  width: 100%;
}

.form input {
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-input);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 1.8rem;
  font-weight: 500;
  outline: none;
  padding: 7px 10px;
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,77,183,.15);
}

.form input[type=text] {
  font-size: 1.7rem;
  margin: 4px 3px;
}

.form input[type=submit] {
  background: var(--primary);
  border-radius: var(--radius-input);
  color: #fff;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: .06em;
  padding: 10px 22px;
  text-transform: uppercase;
  transition: background .15s, transform .1s;
}
.form input[type=submit]:hover  { background: var(--primary-h); }
.form input[type=submit]:active { transform: translateY(1px); }

.form .results input[type=text] {
  background: var(--result-bg);
  color: var(--text);
  font-weight: 600;
}

.values input  { min-width: 5ch; max-width: 15ch; }
.results input { min-width: 10ch; max-width: 15ch; }

/* ── Copy button ───────────────────────────────────────────── */
.btn-copy {
  cursor: pointer;
  height: 28px;
  margin-left: 3px;
  padding: 8px;
  width: 28px;
  background: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%235a6478' d='M16 1H4c-1.1 0-2 .9-2 2v12h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  border-radius: 4px;
  transition: opacity .15s;
}
.btn-copy:hover { opacity: .7; }
.btn-copy.copied {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%235a6478' d='M9 16.2l-3.5-3.5L4 14.2l5 5 11-11-1.5-1.5z'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { .btn-copy { filter: invert(1); } }

/* ── Tips bar ──────────────────────────────────────────────── */
.tips {
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  display: none;
  font-size: 1.25rem;
  padding: 6px 12px;
  text-align: center;
}

.hide   { visibility: hidden; }
.remove { display: none; }

/* ── Typography ────────────────────────────────────────────── */
h1 {
  color: var(--text);
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 32px 0 12px;
}

h2 {
  color: var(--text);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 36px 0 12px;
}

h3 {
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 24px 0 8px;
}

p { line-height: 1.7; margin: 12px 0; }

ul, ol { line-height: 1.7; padding-left: 20px; }
li { margin: 6px 0; }

kbd {
  background: var(--result-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1.3rem;
  padding: 1px 6px;
}

/* ── Tables (help page) ────────────────────────────────────── */
table {
  border-collapse: collapse;
  font-size: 1.5rem;
  margin: 16px 0;
  width: 100%;
}
th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
}
th:first-child { border-radius: 7px 0 0 0; }
th:last-child  { border-radius: 0 7px 0 0; }
td {
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 9px 14px;
}
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--result-bg); }

/* ── Footer ────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.25rem;
  margin-top: 48px;
  padding: 16px 0 32px;
}
footer div   { float: left; }
footer nav   { float: right; }
footer ul    { display: block; list-style: none; padding: 0; }
footer li    { display: inline; margin-left: 12px; }
footer a     { color: var(--text-muted); font-weight: 500; }
footer a:hover { color: var(--link); }

@media (max-width: 767px) {
  footer div, footer nav { float: none; display: block; }
  footer nav { margin-top: 10px; }
  footer li  { margin-left: 0; margin-right: 12px; }
}

/* ── In-stream ad placeholder ──────────────────────────────── */
#adngin-instream-0 { min-height: 90px; }
#ccpa { cursor: pointer; font-weight: 600; }

/* ── Sidebar ads (absolute positioned L/R of center col) ───── */
.sidead {
  color: var(--text);
  display: none;
  min-height: 5px;
  padding-bottom: 10px;
  position: absolute;
  max-width: 336px;
}
.sidead_left  { right: calc(50vw + 364px + 30px); text-align: right; }
.sidead_right { left:  calc(50vw + 364px + 30px); text-align: left;  }

/* ── Desktop layout ────────────────────────────────────────── */
@media (min-width: 728px) {
  main { margin: 0 auto; max-width: 728px; }
  .intro { font-size: 1.7rem; }
  .form .values  { float: left;  width: 50%; }
  .form .results { float: right; width: 50%; text-align: right; }
  .tips  { display: block; }
  .remove { display: inline; }
}

@media (min-width: 1080px) {
  .sidead { display: inline-block; }
}

/* ── Snigel dark mode overrides ────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .sn_ad_label { color: var(--text) !important; }
  .snigel-adhesive { background-color: #0f1623 !important; }
}

/* ── Cookie consent banner ──────────────────────────────────── */
#cc-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  background: var(--primary);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  box-shadow: 0 -4px 24px rgba(0,0,0,.18);
  font-size: 1.45rem;
  line-height: 1.5;
}
#cc-banner p { margin: 0; flex: 1 1 280px; }
#cc-banner a { color: #90b8ff; }


.cc-cat {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.cc-cat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--text);
}
.cc-cat p {
  color: var(--text-muted);
  font-size: 1.35rem;
  margin: 0;
  line-height: 1.55;
}
.cc-badge {
  margin-left: auto;
  background: var(--result-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 1.2rem;
  font-weight: 500;
  padding: 2px 10px;
  color: var(--text-muted);
}

/* ── Toggle switch ──────────────────────────────────────────── */
.cc-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.cc-toggle input { opacity: 0; width: 0; height: 0; }
.cc-slider {
  position: absolute;
  inset: 0;
  background: var(--input-border);
  border-radius: 22px;
  cursor: pointer;
  transition: background .2s;
}
.cc-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.cc-toggle input:checked + .cc-slider { background: var(--accent); }
.cc-toggle input:checked + .cc-slider::before { transform: translateX(18px); }
.cc-toggle input:focus-visible + .cc-slider { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Shared button row ──────────────────────────────────────── */
.cc-btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}
/* Banner: white text on dark navy */
.cc-btn-row button {
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 9px 18px;
  background: transparent;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.cc-btn-row button:hover { background: rgba(255,255,255,.12); }
.cc-btn-row button.cc-primary { background: var(--accent); border-color: var(--accent); }
.cc-btn-row button.cc-primary:hover { background: #1a41a0; border-color: #1a41a0; }

/* Settings page: buttons on light background */
main .cc-btn-row button {
  color: var(--text);
  border-color: var(--border);
  background: var(--result-bg);
}
main .cc-btn-row button:hover { background: var(--border); }
main .cc-btn-row button.cc-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
main .cc-btn-row button.cc-primary:hover { background: var(--primary-h); }
