/* لوحة الأدمن لمسابقة الاختلافات */
:root {
  --night: #04121c; --deep: #07202f; --panel: #0b2a3c; --panel-2: #103649;
  --gold: #e9b44c; --gold-2: #f6d27e; --ink: #f7f4ec; --muted: #a9bcc6; --green: #4ade80; --amber: #fbbf24; --red: #f87171;
  --display: 'Alexandria', 'Readex Pro', system-ui, sans-serif; --body: 'Readex Pro', system-ui, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--night); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--body); line-height: 1.6;
  background: radial-gradient(1000px 500px at 80% -10%, #12455f 0, transparent 70%), var(--night);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }

.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: linear-gradient(180deg, #f0c466, #dca63e); color: #241703;
}
.bar h1 { margin: 0; font: 800 18px var(--display); }
.bar .round { margin-inline-start: auto; font-weight: 700; font-size: 15px; white-space: nowrap; }
.bar { flex-wrap: wrap; }
.bar-btn {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 12px; border: 1.5px solid rgba(36, 23, 3, .55); border-radius: 10px;
  background: transparent; color: #241703; font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.bar-btn:hover { background: rgba(36, 23, 3, .12); }
.bar-btn[hidden] { display: none; }
.code-popup .code { margin: 8px 0 14px; text-align: center; user-select: all; -webkit-user-select: all; }
.code-popup .copy { width: 100%; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }

.login { display: grid; place-items: center; min-height: 70vh; padding: 16px; }
.login .card { display: grid; gap: 12px; width: min(100%, 380px); text-align: center; }
.login h2 { margin: 0; }
.login input { min-height: 52px; padding: 8px 12px; border: 0; border-radius: 12px; background: var(--panel-2); text-align: center; letter-spacing: 2px; line-height: 1.7; }
.login-note { min-height: 22px; margin: 0; color: #fca5a5; font-size: 14px; }
#over .login-note { color: var(--muted); }

.page { max-width: 1240px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.side, .main { display: grid; gap: 16px; align-content: start; min-width: 0; }
.card { background: var(--panel); border-radius: 16px; padding: 16px; }
.card h2 { margin: 0 0 12px; font: 700 16px var(--display); }

.setting + .setting { margin-top: 14px; }
.setting-name { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 14px; }
.setting-name b { color: var(--ink); font-weight: 600; }
.setting-name { align-items: center; }
.topic-button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px; padding: 8px 14px;
  border: 0; border-radius: 10px; background: var(--panel-2); font-weight: 700; font-size: 15px; text-align: start;
}
.topic-button:disabled { opacity: .45; cursor: not-allowed; }
.topic-arrow { color: var(--gold-2); transition: transform .15s; }
.topic-button[aria-expanded="true"] .topic-arrow { transform: rotate(180deg); }
.topic-menu { margin-top: 6px; padding: 4px; border-radius: 10px; background: var(--deep); }
.topic-row {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 15px; font-weight: 600;
}
.topic-row:hover { background: rgba(255, 255, 255, .06); }
.topic-row.first { border-bottom: 1px solid rgba(255, 255, 255, .1); border-radius: 8px 8px 0 0; margin-bottom: 2px; }
.topic-row.empty { opacity: .45; cursor: not-allowed; }
.topic-icon { width: 24px; text-align: center; }
.topic-row-name { flex: 1; min-width: 0; }
.topic-row small { color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.switch { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.switch input, .topic-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { position: relative; flex: none; width: 38px; height: 22px; border-radius: 22px; background: rgba(255, 255, 255, .18); transition: background .15s; }
.switch-track::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s;
}
input:checked + .switch-track { background: var(--gold); }
input:checked + .switch-track::after { inset-inline-start: 19px; }
input:focus-visible + .switch-track { outline: 2px solid var(--gold-2); outline-offset: 2px; }
input:disabled + .switch-track { opacity: .5; }
.chips { display: grid; gap: 6px; }
.chips.three { grid-template-columns: repeat(3, 1fr); }
.chips.four { grid-template-columns: repeat(4, 1fr); }
.chips.five { grid-template-columns: repeat(5, 1fr); }
.chips.six { grid-template-columns: repeat(6, 1fr); }
.chips.seven { grid-template-columns: 1.5fr repeat(6, 1fr); }
.chips.seven .chip { font-size: 14px; }
.chip {
  min-height: 44px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); font-weight: 600; font-size: 15px;
  transition: background .15s, color .15s;
}
.chip:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.chip[aria-pressed="true"] { background: var(--gold); color: #241703; }
.chip.easy[aria-pressed="true"] { background: var(--green); }
.chip.medium[aria-pressed="true"] { background: var(--amber); }
.chip.hard[aria-pressed="true"] { background: var(--red); }
.chip:disabled { opacity: .45; cursor: not-allowed; }

.actions { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.action {
  min-height: 52px; padding: 8px 10px; border: 0; border-radius: 12px; background: var(--panel-2); font-weight: 600; font-size: 15px; transition: filter .15s;
}
.action:hover:not(:disabled) { filter: brightness(1.2); }
.action.wide { grid-column: 1 / -1; }
.action.start { grid-column: 1 / -1; min-height: 60px; background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #241703; font: 800 19px var(--display); }
.action.stop { grid-column: 1 / -1; background: #b42323; color: #fff; }
.action:disabled { opacity: .4; cursor: not-allowed; }
.hint { margin: 12px 0 0; color: var(--gold-2); font-size: 14px; }

.status { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.clock { font: 800 34px var(--display); font-variant-numeric: tabular-nums; line-height: 1; }
.state { padding: 4px 12px; border-radius: 99px; background: rgba(255, 255, 255, .1); font-size: 14px; font-weight: 600; }
.state.playing { background: rgba(74, 222, 128, .2); color: var(--green); }
.state.ended { background: rgba(248, 113, 113, .2); color: #fca5a5; }
.state, .status .meta { white-space: nowrap; }
.status .meta { margin-inline-start: auto; color: var(--muted); font-size: 13px; }

.pics { display: grid; gap: 8px; grid-template-columns: 1fr; width: 100%; max-width: 720px; margin-inline: auto; }
.pic { position: relative; overflow: hidden; border-radius: 10px; aspect-ratio: 4 / 3; background: #000; }
.pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pic-label { position: absolute; top: 8px; inset-inline-start: 8px; padding: 2px 10px; border-radius: 99px; background: rgba(0, 0, 0, .6); font-size: 12px; }
.spot { position: absolute; aspect-ratio: 1; border: 3px solid var(--green); border-radius: 50%; box-shadow: 0 0 0 2px rgba(0, 0, 0, .6); transform: translate(-50%, -50%); pointer-events: none; }

.room { display: grid; gap: 10px; text-align: center; }
.room small { color: var(--muted); font-size: 13px; }
.code { font: 800 38px/1 var(--display); letter-spacing: 6px; color: var(--gold-2); font-variant-numeric: tabular-nums; direction: ltr; }
.copy { min-height: 44px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .1); font-weight: 600; }
.copy:hover { background: rgba(255, 255, 255, .18); }
.room-link { width: 100%; min-height: 42px; padding: 6px 10px; border: 0; border-radius: 10px; background: var(--deep); color: var(--muted); font-size: 13px; line-height: 1.7; text-align: center; }
.room-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.other-rooms { display: grid; gap: 8px; margin-top: 4px; }
.other-rooms[hidden] { display: none; }
.share { display: grid; place-items: center; min-height: 44px; border-radius: 10px; background: #25d366; color: #06301a; font-weight: 700; text-decoration: none; }
.share:hover { filter: brightness(1.08); }

.score-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.score-head h2 { margin: 0; }
.score-head span { color: var(--muted); font-size: 14px; }
.end { min-height: 42px; margin-top: 12px; padding: 6px 14px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); font-size: 14px; font-weight: 600; }
.end:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.end:disabled { opacity: .4; cursor: not-allowed; }
.end.yes { background: #b42323; color: #fff; }
.end-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.end-confirm .end { margin-top: 0; }

@media (max-width: 959px) {
  .side, .main { display: contents; }
  .page > * > .o1 { order: 1; } .page > * > .o2 { order: 2; } .page > * > .o3 { order: 3; }
  .page > * > .o4 { order: 4; } .page > * > .o5 { order: 5; } .page > * > .o6 { order: 6; }
}
@media (min-width: 960px) {
  .page { grid-template-columns: 380px minmax(0, 1fr); align-items: start; }
  .bar h1 { font-size: 20px; }
}

/* 📲 دعوة اللاعبين فوق الصفحة (طلب علي 2026-11-14) */
.invite-top { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 2px solid #22d3ee; border-radius: 16px; background: linear-gradient(135deg, rgba(34, 211, 238, .16), rgba(168, 85, 247, .16)); box-shadow: 0 0 18px rgba(34, 211, 238, .3); }
.invite-top[hidden] { display: none; }
.invite-title { margin: 0; color: #fff; font-weight: 800; font-size: 15px; }
.invite-title b { color: #facc15; font-size: 20px; letter-spacing: 2px; }
.invite-btns { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 260px; justify-content: flex-end; }
.invite-wa, .invite-copy { flex: 1 1 140px; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 12px; border-radius: 12px; font: inherit; font-weight: 800; font-size: 15px; text-decoration: none; cursor: pointer; }
.invite-wa { border: 0; background: linear-gradient(90deg, #22c55e, #16a34a); color: #fff; }
.invite-copy { border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); color: #fff; }