@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url(fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 800; font-display: swap; src: url(fonts/inter-latin-800-normal.woff2) format('woff2'); }

:root, [data-theme=dark] {
  --bg: #0A0A0A; --card: #121214; --line: #232327; --field: #18181B; --field-line: #2E2E33;
  --text: #FAFAFA; --muted: #A1A1AA; --faint: #71717A; --accent: #FACC15; --accent-ink: #0A0A0A;
  --up: #FACC15; --down: #A1A1AA; --stage: #050505; --radius: 12px;
}
[data-theme=light] {
  --bg: #FAFAF9; --card: #FFFFFF; --line: #E7E5E4; --field: #F5F5F4; --field-line: #D6D3D1;
  --text: #0A0A0A; --muted: #57534E; --faint: #78716C; --accent: #FACC15; --accent-ink: #0A0A0A;
  --up: #A16207; --down: #52525B; --stage: #F5F5F4;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
html[data-theme=light] { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--text); }

.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.hub { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.hub-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.top nav { display: flex; gap: 18px; align-items: center; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.top nav a:hover, .hub:hover { color: var(--accent); }
.theme { background: var(--field); border: 1px solid var(--field-line); color: var(--muted); border-radius: 999px; padding: 4px 12px; font: 600 13px Inter, sans-serif; cursor: pointer; }
.theme:hover { color: var(--text); }

.hero { max-width: 1100px; margin: 0 auto; padding: 36px 24px 8px; }
.hero h1 { margin: 0; font-size: clamp(36px, 5vw, 60px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.lead { margin: 10px 0 0; color: var(--muted); font-size: 18px; max-width: 640px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.status { margin: 0; font-size: 13px; color: var(--muted); min-height: 1em; }

.inputs { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 8px; }
.lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.hrow { display: flex; align-items: center; gap: 8px; }
.hrow input { width: 110px; font-size: 26px; font-weight: 700; padding: 6px 10px; }
.hrow input#ft, .hrow input#in { width: 76px; }
.suf { color: var(--muted); font-weight: 600; margin-right: 6px; }
.tries { margin: 0 0 6px; font-size: 13px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
input[type=text], input[type=number], select {
  width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--field-line); border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 14px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(250, 204, 21, .18); }
input[type=number]::-webkit-inner-spin-button { opacity: .4; }

.row { display: flex; align-items: center; }
.gap { gap: 8px; flex-wrap: wrap; }
.btn { appearance: none; border: 1px solid var(--field-line); background: var(--field); color: var(--text); border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn[aria-disabled=true] { opacity: .45; pointer-events: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; font: inherit; font-size: 13px; cursor: pointer; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--field); border: 1px solid var(--field-line); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button { white-space: nowrap; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg.big button { font-size: 16px; padding: 10px 22px; }
.seg.mini { justify-self: start; width: max-content; }

.result { padding: 4px 2px 0; }
.headline { margin: 0; font-size: clamp(26px, 3.6vw, 42px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.12; }
.headline .y { color: var(--up); }
.headline .g { color: var(--down); }
.subline { margin: 8px 0 0; color: var(--muted); }

.mapcard { display: flex; flex-direction: column; gap: 10px; }
.mapbox { position: relative; }
#map { display: block; width: 100%; height: auto; }
#map path.c { stroke: var(--bg); stroke-width: .4; cursor: pointer; transition: fill .25s; }
#map path.c:hover, #map circle.dot:hover, #map .on { stroke: var(--text); stroke-width: 1.2; }
#map path.nd { cursor: default; }
#map circle.dot { stroke: var(--bg); stroke-width: .8; cursor: pointer; }
.tip { position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--field-line); border-radius: 10px; padding: 8px 12px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.35); min-width: 180px; z-index: 3; }
.tip b { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.tip img { width: 20px; height: 15px; border-radius: 2px; }
.tip .d { font-weight: 700; }
.tip .d.up { color: var(--up); } .tip .d.down { color: var(--down); }
.tip span { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 28px; height: 12px; border-radius: 3px; }
.legend .sep { width: 14px; }
.legend .end { margin: 0 6px; }

.lists { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.list h3 { margin: 0 0 8px; font-size: 16px; }
.list ol { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.list li img { width: 22px; height: 16px; border-radius: 2px; }
.list .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .av { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.list .d { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 62px; text-align: right; }
.d.up { color: var(--up); } .d.down { color: var(--down); }
.list .empty { color: var(--faint); font-size: 13px; padding-top: 6px; }

.share { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; align-items: start; }
.share h2 { margin: 0; font-size: 20px; }
.share-controls { display: flex; flex-direction: column; gap: 12px; }
.canvas-wrap { background: var(--stage); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; place-items: center; }
canvas { display: block; max-width: 100%; max-height: 640px; width: auto; height: auto; border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.export-out { display: flex; flex-direction: column; gap: 8px; }
.export-out img { width: 180px; border-radius: 6px; border: 1px solid var(--line); }

.note { margin: 0; color: var(--muted); font-size: 13px; }
.how { max-width: 1100px; margin: 0 auto; padding: 16px 24px 8px; }
.how h2 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 10px; }
.faq details { border-top: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--muted); margin: 8px 0 0; max-width: 760px; }
.foot { max-width: 1100px; margin: 0 auto; padding: 24px; color: var(--faint); font-size: 14px; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }
.foot p { margin: 4px 0; }
[hidden] { display: none !important; }

@media (max-width: 860px) {
  .lists { grid-template-columns: 1fr; }
  .share { grid-template-columns: 1fr; }
  .canvas-wrap { order: -1; }
  canvas { max-height: 70vh; }
  .top nav a[href="#about"] { display: none; }
}
