@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #0a0e13;
  --panel: #10161e;
  --panel2: #151d27;
  --line: #222c39;
  --line2: #2c3848;
  --text: #e4ebf2;
  --muted: #8794a5;
  --faint: #5b6778;
  --accent: #5eead4;
  --bottom: #34d399;
  --rising: #7cc4fa;
  --top: #f87171;
  --falling: #f5b74a;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: Vazirmatn, Tahoma, sans-serif; font-size: 14.5px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); font-weight: 400; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
h1, h2 { margin: 0; font-weight: 700; }
h1 { font-size: 19px; }
h2 { font-size: 16px; }

/* header */
.top { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #0e141b, var(--bg)); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 40px; height: 24px; color: var(--accent); flex: none; }
.sub { margin: 0; color: var(--muted); font-size: 12.5px; }
.status { font-size: 12.5px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bottom); display: inline-block; }
.status .dot.busy { background: var(--falling); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); }
.lg::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-left: 5px; vertical-align: -1px; background: var(--c); }
.z-bottom { --c: var(--bottom); } .z-rising { --c: var(--rising); } .z-top { --c: var(--top); } .z-falling { --c: var(--falling); }
.lowq::before { background: transparent; border: 1px dashed var(--muted); }
.hint { color: var(--faint); font-size: 12px; margin: 8px 0 0; }

/* matrix */
.matrix-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 1040px; font-size: 12.5px; }
.matrix th, .matrix td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--line); }
.matrix thead th { background: var(--panel2); color: var(--muted); font-weight: 500; position: sticky; top: 0; }
.matrix thead tr.groups th { font-size: 11.5px; color: var(--faint); border-bottom: none; padding-bottom: 0; }
.matrix thead tr.groups th span { display: block; border-bottom: 1px solid var(--line2); margin: 0 6px; padding-bottom: 3px; }
.matrix .symcell { position: sticky; right: 0; background: var(--panel); text-align: right; padding-right: 12px; min-width: 120px; z-index: 1; border-left: 1px solid var(--line); }
.matrix thead .symcell { background: var(--panel2); z-index: 2; }
.matrix tbody tr:hover td { background: #131b25; }
.matrix tbody tr:hover .symcell { background: #131b25; }
.matrix tbody tr.sel .symcell { box-shadow: inset -3px 0 0 var(--accent); }
.symcell b { font-size: 13.5px; letter-spacing: .3px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.symcell small { display: block; color: var(--muted); font-size: 11.5px; direction: ltr; text-align: right; }
.cell { cursor: pointer; border-radius: 8px; padding: 3px 2px 2px; border: 1px solid transparent; background: color-mix(in srgb, var(--c) 9%, transparent); transition: transform .12s, border-color .12s; min-width: 66px; }
.cell:hover { border-color: var(--c); transform: translateY(-1px); }
.cell.low { opacity: .45; border: 1px dashed var(--line2); }
.cell.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cell svg { width: 54px; height: 20px; display: block; margin: 0 auto; }
.cell .zl { display: block; color: var(--c); font-size: 11px; font-weight: 500; line-height: 1.4; }
.cell.err { --c: var(--faint); color: var(--faint); font-size: 11px; cursor: default; opacity: .7; }

/* detail */
.sym-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.chip { flex: none; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 4px 12px; font: 500 12.5px ui-monospace, Menlo, Consolas, monospace; cursor: pointer; }
.chip.on { border-color: var(--accent); color: var(--accent); }
.sym-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.sym-name { font-size: 22px; font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; }
.sym-name small { font-size: 15px; color: var(--muted); margin-right: 10px; font-family: Vazirmatn, sans-serif; font-weight: 500; }
.sym-meta { color: var(--muted); font-size: 12.5px; }
.btn { background: transparent; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); border-radius: 8px; padding: 7px 14px; font: 500 13px Vazirmatn, sans-serif; cursor: pointer; }
.btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.btn[disabled] { opacity: .5; cursor: wait; }
.scale-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { flex: none; background: none; border: none; color: var(--muted); font: 500 13px Vazirmatn, sans-serif; padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px; }
.tab i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); display: inline-block; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }

.grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
.card-title { font-weight: 500; font-size: 13.5px; margin-bottom: 10px; color: #cfd8e3; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

/* position card */
.pos-zone { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pos-zone b { font-size: 24px; color: var(--c); }
.pos-zone span { color: var(--muted); }
.pos-svg { width: 100%; height: auto; display: block; margin: 8px 0 4px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.stat .l { color: var(--muted); font-size: 11.5px; }
.stat .v { font-size: 14.5px; font-weight: 500; overflow-wrap: anywhere; }
.stat .v small { color: var(--muted); font-weight: 400; font-size: 11.5px; display: block; }
.stat.wide { grid-column: 1 / -1; }
.badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--c); color: var(--c); }
.q-high { --c: var(--bottom); } .q-medium { --c: var(--falling); } .q-low { --c: var(--muted); }
.note { color: var(--muted); font-size: 12px; margin-top: 10px; }
.warn { color: var(--falling); font-size: 12px; margin-top: 8px; }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; display: block; }
.axis text { fill: var(--faint); font-size: 10.5px; font-family: Vazirmatn, sans-serif; }
.gridl { stroke: var(--line); stroke-width: 1; }
.chart-legend { color: var(--muted); font-size: 11.5px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.k { display: inline-block; width: 16px; height: 0; border-top: 2px solid; margin: 0 8px 0 2px; vertical-align: middle; }
.k-act { border-color: #c5ced9; } .k-mod { border-color: var(--accent); } .k-fc { border-color: var(--accent); border-top-style: dashed; }

table.comp { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 10px; }
table.comp th, table.comp td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: right; }
table.comp th { color: var(--muted); font-weight: 500; }
table.comp tr.tgt td { color: var(--accent); }
table.comp td.num { direction: ltr; text-align: left; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

.hist { display: flex; gap: 2px; flex-wrap: wrap; direction: ltr; }
.hist i { width: 12px; height: 22px; border-radius: 2px; background: var(--c); opacity: .85; display: block; position: relative; }
.hist i::after { content: ''; position: absolute; left: 3px; right: 3px; height: 2px; background: #0a0e13; bottom: calc(var(--p) * 18px + 1px); }
.hist-cap { display: flex; justify-content: space-between; color: var(--faint); font-size: 11px; margin-top: 4px; }

table.all { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.all td, table.all th { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: right; }
table.all th { color: var(--muted); font-weight: 500; }
table.all tr { cursor: pointer; }
table.all tr:hover td { background: var(--panel); }
table.all .zc { color: var(--c); font-weight: 500; }

.method details summary { cursor: pointer; list-style: none; }
.method details summary::-webkit-details-marker { display: none; }
.method summary h2::after { content: ' ▾'; color: var(--muted); }
.method-body p { margin: 10px 0; color: #c9d2dc; }
.disclaimer { color: var(--faint); font-size: 12px; text-align: center; margin: 8px 0 32px; }
.empty { color: var(--muted); padding: 30px 10px; text-align: center; }

.tip { position: fixed; z-index: 50; pointer-events: none; background: #0d131a; border: 1px solid var(--line2); border-radius: 8px; padding: 6px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.4); max-width: 260px; }
@media (max-width: 700px) { .top { position: static; } h1 { font-size: 16px; } }

.card.full { grid-column: 1 / -1; }
.cbar { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; margin-top: 6px; }
.cbar i { flex: 1; max-width: 260px; height: 8px; border-radius: 4px; display: block; }
.cbar b { color: var(--text); font-weight: 500; }
.chart svg, .pos-svg svg, .cell svg { direction: ltr; }
