:root {
  --bg: #0d1210; --panel: #16201b; --line: #26352d; --text: #eef3ef; --muted: #9db0a5;
  --accent: #2fbf71; --active: #f2c94c; --danger: #e5484d; --cloth: #1f7a3f;
  --r: 14px; font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100dvh; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; touch-action: manipulation; }
button:active { transform: scale(0.97); }
button.primary { background: var(--accent); border-color: var(--accent); color: #04140b; font-weight: 700; }
button.danger { border-color: var(--danger); color: #ffd6d6; }
button.on { outline: 2px solid var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 14px; }
h1 { font-size: 24px; margin: 6px 0 14px; }
h2 { font-size: 18px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
label { display: block; color: var(--muted); font-size: 14px; margin: 10px 0 6px; }
input[type=text] { width: 100%; background: #0b100e; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { min-width: 56px; }
.seg button.sel { background: var(--accent); color: #04140b; border-color: var(--accent); font-weight: 700; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* לוח תוצאות */
.score { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
.player { background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); padding: 10px 14px; text-align: center; }
.player.active { border-color: var(--active); box-shadow: 0 0 0 2px rgba(242, 201, 76, .25) inset; }
.player .name { font-size: clamp(16px, 2.6vw, 26px); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .pts { font-size: clamp(44px, 9vw, 96px); font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.player .frames { color: var(--muted); font-size: 15px; }
.mid { display: flex; flex-direction: column; justify-content: center; gap: 4px; text-align: center; min-width: 120px; }
.mid .big { font-size: clamp(22px, 4vw, 40px); font-weight: 800; color: var(--active); }
.mid .lbl { font-size: 13px; color: var(--muted); }
.notice { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: #2a2412; color: #ffe7a3; text-align: center; }
.notice.win { background: #123222; color: #b7f5cf; font-size: 20px; font-weight: 700; }

/* מסך שופט */
.ref { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; padding: 10px; }
@media (max-width: 900px) { .ref { grid-template-columns: 1fr; } }
.stage { position: relative; background: #000; border-radius: var(--r); overflow: hidden; min-height: 180px; }
.stage video { width: 100%; height: auto; display: block; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.prompt { position: absolute; top: 10px; inset-inline: 10px; background: rgba(0,0,0,.75); padding: 10px 12px; border-radius: 10px; font-size: 18px; text-align: center; }
.status { margin-top: 6px; color: var(--muted); font-size: 14px; }
.balls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ball { border-radius: 999px; aspect-ratio: 1; font-weight: 800; padding: 0; font-size: 14px; border: 2px solid rgba(255,255,255,.2); }
.b-red { background: #c8102e; } .b-yellow { background: #f6c700; color: #222; } .b-green { background: #0f7a4a; }
.b-brown { background: #7a4a1e; } .b-blue { background: #1f5fd1; } .b-pink { background: #f28cb1; color: #222; } .b-black { background: #111; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.proposal { margin-top: 10px; background: #12301f; border: 2px solid var(--accent); border-radius: var(--r); padding: 12px; }
.proposal .t { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.log { margin-top: 10px; font-size: 14px; color: var(--muted); max-height: 180px; overflow: auto; }
.log div { padding: 4px 0; border-bottom: 1px solid var(--line); }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--r); max-width: 92vw; }
dialog::backdrop { background: rgba(0,0,0,.6); }
.qr { background: #fff; padding: 10px; border-radius: 10px; display: inline-block; }
.qr img, .qr svg { display: block; width: 220px; height: 220px; }
.linkbox { direction: ltr; font-size: 12px; word-break: break-all; background: #0b100e; padding: 8px; border-radius: 8px; margin: 8px 0; }

/* דף צפייה */
.watch .tablewrap { margin-top: 12px; background: var(--panel); border-radius: var(--r); padding: 10px; }
.watch svg.table { width: 100%; height: auto; display: block; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.live.ok::before { background: var(--accent); }
.remote .grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.remote .grid button { padding: 18px; font-size: 18px; }

.ball:disabled { opacity: .22; filter: grayscale(.6); cursor: default; }
