:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #14202b;
  --muted: #5b6b79;
  --line: #e2e8ee;
  --accent: #0f766e;
  --accent-soft: #e0f2ef;
  --down: #0f766e;
  --up: #c2410c;
  --input: #f8fafb;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1418; --card: #151f25; --text: #e6edf2; --muted: #93a4b1; --line: #24323b;
    --accent: #2dd4bf; --accent-soft: #123a37; --down: #2dd4bf; --up: #fb923c; --input: #10191e;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1418; --card: #151f25; --text: #e6edf2; --muted: #93a4b1; --line: #24323b;
  --accent: #2dd4bf; --accent-soft: #123a37; --down: #2dd4bf; --up: #fb923c; --input: #10191e;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
button, input, select { font: inherit; color: inherit; }

.top { border-bottom: 1px solid var(--line); background: var(--card); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 650; }
.brand svg { color: var(--accent); flex: none; }
.top-actions { display: flex; gap: 6px; }
.ghost {
  border: 1px solid var(--line); background: transparent; border-radius: 8px;
  height: 36px; min-width: 40px; padding: 0 10px; cursor: pointer; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.ghost:hover { background: var(--input); }

.hero { padding: 36px 0 20px; }
.hero h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.15; margin: 0 0 8px; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); font-size: 17px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card h2 { margin: 0 0 4px; font-size: 20px; }
.muted { color: var(--muted); margin: 0 0 14px; font-size: 14px; }

.tabs { display: flex; gap: 4px; background: var(--input); border: 1px solid var(--line); padding: 4px; border-radius: 10px; margin-bottom: 20px; overflow-x: auto; }
.tab { flex: 1; border: 0; background: transparent; padding: 8px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
@media (max-width: 420px) { .tab { padding: 8px 6px; font-size: 13px; } .card { padding: 16px; } }
.tab[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }

.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field small { color: var(--muted); font-weight: 400; }
.combo { display: flex; border: 1px solid var(--line); border-radius: 10px; background: var(--input); overflow: hidden; }
.combo:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.combo input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 11px 12px; font-size: 18px; font-weight: 600; outline: none; }
.combo select { border: 0; border-left: 1px solid var(--line); background: transparent; padding: 0 10px; font-weight: 600; cursor: pointer; outline: none; }
.combo select option { background: var(--card); }
input.bad { color: #dc2626; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; color: var(--muted); }
.chip:hover, .chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.time-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.time-inputs label { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--input); padding-right: 10px; }
.time-inputs label:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.time-inputs input { width: 100%; min-width: 0; border: 0; background: transparent; padding: 11px 12px; font-size: 18px; font-weight: 600; outline: none; }
.time-inputs span { color: var(--muted); font-size: 14px; }

.adv summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.adv input[type=range] { width: 100%; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.result { background: var(--accent-soft); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 18px; align-self: start; }
.res-block + .res-block { border-top: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); padding-top: 16px; }
#resTime, #resSize { display: flex; flex-direction: column; gap: 16px; }
#resTime[hidden], #resSize[hidden], #resSpeed[hidden] { display: none; }
.res-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.down { background: var(--down); } .dot.up { background: var(--up); }
.res-big { font-size: clamp(26px, 4.4vw, 34px); font-weight: 750; letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.res-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.share { align-self: flex-start; display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--accent); color: var(--accent); background: transparent; border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: 14px; font-weight: 600; }
.share:hover { background: var(--card); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
td.t { font-weight: 650; font-variant-numeric: tabular-nums; }
td.s { color: var(--muted); }
.bar-col { width: 32%; }
.bar { height: 8px; border-radius: 4px; background: var(--accent); opacity: .85; min-width: 2px; }
tr.mine td { background: var(--accent-soft); }
@media (max-width: 560px) { .bar-col, td.b { display: none; } th, td { padding: 8px 6px; } }

.faq details { border-top: 1px solid var(--line); padding: 12px 0; }
.faq details:first-of-type { margin-top: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--muted); margin: 8px 0 0; }

.foot { color: var(--muted); font-size: 13px; padding-top: 4px; padding-bottom: 32px; text-align: center; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateX(-50%); }
