@font-face { font-family: "Kufi"; src: url("fonts/NotoKufiArabic-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Kufi"; src: url("fonts/NotoKufiArabic-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "NSans"; src: url("fonts/NotoSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "NSans"; src: url("fonts/NotoSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #0b0f17; --card: #131a26; --line: #243045; --ink: #e8edf5; --dim: #93a1b8;
  --acc: #f5b301; --ok: #22c55e; --bad: #ef4444; --r: 12px;
  --font: "NSans", "Kufi", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); }
html[lang="ar"] body { font-family: "Kufi", "NSans", system-ui, sans-serif; }
body { min-height: 100vh; line-height: 1.6; }
button, input, textarea, select { font: inherit; color: inherit; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--acc); color: #111; font-size: 22px; font-weight: 700; }
.brand b { display: block; font-size: 1.1rem; }
.brand small { color: var(--dim); font-size: .8rem; }

.tabs { display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; position: sticky; top: 0; background: var(--bg); z-index: 5; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1 1 0; min-width: 0; color: var(--ink); font-weight: 400; justify-content: center; text-align: center; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--acc); color: #111; border-color: var(--acc); font-weight: 700; }

main { max-width: 820px; margin: 0 auto; padding: 16px; }
.panel h2 { margin: 4px 0 14px; font-size: 1.25rem; }
.panel h3 { margin: 22px 0 10px; font-size: 1.05rem; }
.field { display: block; margin: 0 0 16px; }
.field > span { display: block; color: var(--dim); font-size: .9rem; margin-bottom: 6px; }
input, textarea { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input:focus, textarea:focus { outline: 2px solid var(--acc); outline-offset: 0; }
input[type=color] { width: 70px; height: 42px; padding: 4px; }
input[type=number] { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
.row input { flex: 1; }
.inline { display: flex; align-items: center; gap: 8px; color: var(--dim); }
.inline input { width: 80px; flex: none; }
.hint { color: var(--dim); font-size: .85rem; margin: 6px 0; }

button, .btn { background: var(--acc); color: #111; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 400; }
.small { padding: 7px 12px; font-size: .9rem; }
button:disabled { opacity: .45; cursor: not-allowed; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg button { background: transparent; color: var(--ink); border: 0; border-radius: 0; font-weight: 400; padding: 8px 14px; }
.seg button.on { background: var(--acc); color: #111; font-weight: 700; }

.pts { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
.pts label { display: flex; flex-direction: column; align-items: center; font-size: .78rem; color: var(--dim); }
.pts input { padding: 6px; }

#logoPrev { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; background: var(--card); }

.teamlist { list-style: none; padding: 0; margin: 0 0 10px; counter-reset: t; }
.teamlist li { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; counter-increment: t; }
.teamlist li::before { content: counter(t); min-width: 28px; text-align: center; color: var(--dim); }
.teamlist input { flex: 1; }
.teamlist .x { background: transparent; color: var(--bad); border: 1px solid var(--line); padding: 8px 12px; }
.bulk summary { cursor: pointer; color: var(--dim); margin: 10px 0; }
.bulk textarea { margin-bottom: 8px; }

.mtab { background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 400; }
.mtab.on { background: var(--acc); color: #111; font-weight: 700; }
.entry { width: 100%; border-collapse: collapse; margin-top: 10px; }
.entry th { color: var(--dim); font-weight: 400; font-size: .85rem; text-align: start; padding: 6px; }
.entry td { padding: 4px 6px; border-top: 1px solid var(--line); }
.entry td.n { width: 100%; }
.entry input { width: 74px; padding: 7px; }
.entry tr.dup input.p, .entry input.bad { border-color: var(--bad); background: #3a1414; }
.entry tr.win td.n { color: var(--acc); font-weight: 700; }
select { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px; max-width: 160px; }
#ocrBox { margin-top: 16px; }
.entry.ocr td.n small { color: var(--dim); }
.entry.ocr tr.warn td { background: #2a2210; }
.entry.ocr b.w { color: #f59e0b; font-size: .8rem; }
.entry.ocr small.ok { color: var(--ok); }
.status { margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.status.bad { border-color: var(--bad); }
.status.ok { border-color: var(--ok); }

.tablewrap { overflow-x: auto; }
.standings { width: 100%; border-collapse: collapse; }
.standings th { color: var(--dim); font-weight: 400; font-size: .82rem; padding: 6px; text-align: center; }
.standings td { padding: 8px 6px; border-top: 1px solid var(--line); text-align: center; }
.standings td.n { text-align: start; font-weight: 700; }
.standings tr.top1 td { color: var(--acc); }
.standings td.tot { font-weight: 700; }

canvas { width: 100%; max-width: 420px; display: block; margin: 12px auto; border-radius: 10px; border: 1px solid var(--line); background: #000; }
.pro { margin-top: 22px; padding: 14px; border: 1px dashed var(--acc); border-radius: var(--r); }
.pro p { margin: 6px 0 0; color: var(--dim); }
.foot { text-align: center; color: var(--dim); padding: 24px 16px 40px; font-size: .85rem; }
.foot a { color: var(--acc); }
@media (max-width: 520px) { .entry input { width: 58px; } main { padding: 12px; } .tabs { padding: 8px 10px; gap: 4px; } .tabs button { padding: 7px 6px; font-size: .8rem; white-space: normal; line-height: 1.3; } }
