/* «اللعبة المباشرة»: the class screen (teacher-game.js, .gm) and the girl's phone (student-game.js, .sg). */
.gm-c0, .gm-opt.c0, .sg-opt.c0 { --o-bg: #fbeaf0; --o-ink: #72243e; --o-line: #d4537e; }
.gm-opt.c1, .sg-opt.c1 { --o-bg: #eeedfe; --o-ink: #3c3489; --o-line: #7f77dd; }
.gm-opt.c2, .sg-opt.c2 { --o-bg: #e1f5ee; --o-ink: #085041; --o-line: #1d9e75; }
.gm-opt.c3, .sg-opt.c3 { --o-bg: #faeeda; --o-ink: #633806; --o-line: #ba7517; }

/* ---------- the class screen ---------- */
html.gm-open { overflow: hidden; }
.gm { position: fixed; inset: 0; z-index: 80; background: var(--bg, #f7f3fb); color: var(--ink, #2a1f3d); display: flex; flex-direction: column; overflow: auto; font-size: 20px; }
.gm:focus { outline: none; }
.gm-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.gm-top { display: flex; align-items: center; gap: 10px; padding: 14px 28px; }
.gm-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--primary, #7e22ce); font-size: 20px; }
.gm-brand i { font-size: 26px; }
.gm-sp { flex: 1; }
.gm-ib { width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--card-border, #e6dff0); background: var(--surface, #fff); color: inherit; font-size: 22px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.gm-ib:hover { background: color-mix(in srgb, var(--primary, #7e22ce) 8%, var(--surface, #fff)); }
.gm-ib.is-danger { background: #a32d2d; color: #fff; border-color: #a32d2d; }
.gm-main { flex: 1; display: flex; flex-direction: column; padding: 0 clamp(16px, 4vw, 64px) 28px; max-width: 1400px; width: 100%; margin: 0 auto; }
.gm-main > div { flex: 1; display: flex; flex-direction: column; }
.gm h2 { font-size: clamp(26px, 3.2vw, 44px); font-weight: 800; text-align: center; margin: 10px 0 6px; display: flex; gap: 12px; align-items: center; justify-content: center; }
.gm-sub { text-align: center; color: var(--muted, #6f6585); font-size: clamp(17px, 1.6vw, 22px); margin: 0 0 10px; }
.gm-acts { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: auto; padding-top: 24px; }
.gm-btn { font-size: clamp(17px, 1.5vw, 22px) !important; padding: 14px 28px !important; min-height: 56px; border-radius: 16px !important; }

.gm-count { display: flex; align-items: baseline; gap: 12px; justify-content: center; margin: 18px 0 8px; }
.gm-count b { font-size: clamp(56px, 7vw, 96px); font-weight: 800; color: var(--primary, #7e22ce); line-height: 1; }
.gm-count span { font-size: 24px; color: var(--muted, #6f6585); }
.gm-names { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-height: 34vh; overflow: auto; padding: 6px; }
.gm-name { background: var(--surface, #fff); border: 1px solid var(--card-border, #e6dff0); border-radius: 999px; padding: 8px 18px; font-weight: 700; animation: gm-pop .35s ease-out; }
@keyframes gm-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.gm-secs { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 18px; color: var(--muted, #6f6585); font-size: 18px; }

.gm-qtop { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.gm-qtop > :last-child { justify-self: end; }
.gm-chip { justify-self: start; background: color-mix(in srgb, var(--primary, #7e22ce) 12%, var(--surface, #fff)); color: var(--primary, #7e22ce); font-weight: 800; padding: 8px 18px; border-radius: 999px; }
.gm-timer { width: 96px; height: 96px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface, #fff); border: 5px solid var(--primary, #7e22ce); font-size: 40px; font-weight: 800; }
.gm-timer.is-low { border-color: #d4537e; color: #a32d2d; animation: gm-beat 1s infinite; }
.gm-timer.is-done { border-color: #1d9e75; color: #0f6e56; }
@keyframes gm-beat { 50% { transform: scale(1.07); } }
.gm-ans { display: inline-flex; gap: 8px; align-items: center; color: var(--muted, #6f6585); font-weight: 700; }
.gm-title { text-align: center; font-size: clamp(30px, 4vw, 60px); font-weight: 800; margin: clamp(16px, 4vh, 48px) 0; line-height: 1.5; }
.gm-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gm-opt { display: flex; align-items: center; gap: 16px; background: var(--o-bg); color: var(--o-ink); border: 4px solid transparent; border-radius: 22px; padding: clamp(14px, 2.4vh, 26px) 22px; font-size: clamp(22px, 2.6vw, 38px); font-weight: 800; transition: opacity .3s, transform .3s; }
.gm-opt .gm-l { width: 1.6em; height: 1.6em; flex: none; border-radius: 12px; background: var(--o-line); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .8em; }
.gm-opt small { margin-inline-start: auto; font-size: .7em; display: inline-flex; gap: 6px; align-items: center; }
.gm-opt.is-dim { opacity: .35; }
.gm-opt.is-right { border-color: #0f6e56; transform: scale(1.02); }

.gm-rows { list-style: none; padding: 0; margin: 10px auto 0; width: min(760px, 100%); display: grid; gap: 10px; }
.gm-rows li { display: flex; align-items: center; gap: 16px; background: var(--surface, #fff); border: 1px solid var(--card-border, #e6dff0); border-radius: 18px; padding: 14px 22px; font-size: clamp(20px, 2vw, 28px); animation: gm-pop .35s ease-out backwards; }
.gm-rows li:nth-child(2) { animation-delay: .05s; } .gm-rows li:nth-child(3) { animation-delay: .1s; } .gm-rows li:nth-child(4) { animation-delay: .15s; }
.gm-rows li b { flex: 1; }
.gm-rows li.is-top { background: color-mix(in srgb, #e9b530 16%, var(--surface, #fff)); border-color: #e9b530; }
.gm-place { width: 44px; height: 44px; border-radius: 50%; background: var(--primary, #7e22ce); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }

.gm-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); gap: 18px; align-items: end; justify-content: center; margin-top: 30px; }
.gm-pod { border-radius: 22px 22px 8px 8px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; padding: 16px 10px; font-size: 24px; animation: gm-rise .8s ease-out backwards; }
.gm-pod em { font-style: normal; font-size: 40px; font-weight: 800; }
.gm-pod b { font-size: 26px; text-align: center; }
.gm-pod i { font-size: 46px; color: #b8860b; }
.gm-pod.p1 { background: #faeeda; color: #633806; animation-delay: .9s; }
.gm-pod.p2 { background: #f1efe8; color: #444441; animation-delay: .5s; }
.gm-pod.p3 { background: #faece7; color: #712b13; animation-delay: .1s; }
@keyframes gm-rise { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }

.gm-resume { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 60; box-shadow: 0 10px 24px -10px rgba(0,0,0,.35); }
.bx-game { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--card-border, #e6dff0); }
.bx-game p { display: flex; gap: 8px; align-items: flex-start; color: var(--muted, #6f6585); font-size: 14px; margin: 0 0 10px; }
.bx-game p i { color: var(--primary, #7e22ce); font-size: 20px; flex: none; }
.bx-game .btn { width: 100%; justify-content: center; }

@media (max-width: 700px) {
  .gm-opts { grid-template-columns: 1fr; }
  .gm-qtop { grid-template-columns: 1fr auto; }
  .gm-qtop .gm-ans { grid-column: 1 / -1; justify-self: center; }
  .gm-timer { width: 72px; height: 72px; font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) { .gm *, .sg * { animation: none !important; transition: none !important; } }

/* ---------- the girl's phone ---------- */
html.sg-open { overflow: hidden; }
.sg { position: fixed; inset: 0; z-index: 70; background: var(--bg, #f7f3fb); color: var(--ink, #2a1f3d); display: flex; flex-direction: column; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); overflow: auto; }
.sg-top { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--primary, #7e22ce); }
.sg-top .sg-sp { flex: 1; }
.sg-top .sg-score { color: var(--ink, #2a1f3d); background: var(--surface, #fff); border: 1px solid var(--card-border, #e6dff0); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.sg-x { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--card-border, #e6dff0); background: var(--surface, #fff); color: inherit; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }
.sg-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; width: min(460px, 100%); margin: 0 auto; }
.sg-msg { text-align: center; }
.sg-msg h2 { font-size: 26px; font-weight: 800; margin: 8px 0; }
.sg-msg p { color: var(--muted, #6f6585); margin: 0; font-size: 17px; }
.sg-msg .sg-big { font-size: 64px; font-weight: 800; color: var(--primary, #7e22ce); line-height: 1.1; }
.sg-msg > i { font-size: 56px; color: var(--primary, #7e22ce); }
.sg-msg.is-ok > i, .sg-msg.is-ok h2 { color: #0f6e56; }
.sg-msg.is-no > i, .sg-msg.is-no h2 { color: #a32d2d; }
.sg-qn { text-align: center; color: var(--muted, #6f6585); font-weight: 700; }
.sg-qt { text-align: center; font-size: 22px; font-weight: 800; margin: 4px 0 6px; }
.sg-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sg-opt { min-height: 96px; border-radius: 20px; border: 4px solid transparent; background: var(--o-bg); color: var(--o-ink); font: inherit; font-size: 20px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; cursor: pointer; touch-action: manipulation; }
.sg-opt .sg-l { font-size: 30px; }
.sg-opt:active { transform: scale(.97); }
.sg-opt.is-picked { border-color: var(--o-line); }
.sg-opt.is-right { border-color: #0f6e56; }
.sg-opt:disabled { cursor: default; }
.sg-opts.is-done .sg-opt:not(.is-picked):not(.is-right) { opacity: .4; }
.sg-timer { text-align: center; font-weight: 800; font-size: 18px; color: var(--primary, #7e22ce); }
.sg-join { width: 100%; min-height: 60px; font-size: 20px !important; justify-content: center; }
.sg-top3 { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.sg-top3 li { display: flex; justify-content: space-between; background: var(--surface, #fff); border: 1px solid var(--card-border, #e6dff0); border-radius: 14px; padding: 10px 14px; font-weight: 700; }
.sg-banner { position: fixed; inset-inline: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 65; display: flex; align-items: center; gap: 10px; background: var(--primary, #7e22ce); color: #fff; border-radius: 18px; padding: 12px 14px; box-shadow: 0 14px 30px -12px rgba(0,0,0,.45); animation: gm-pop .4s ease-out; }
.sg-banner > i { font-size: 30px; }
.sg-banner b { flex: 1; font-size: 17px; }
.sg-banner .btn { background: #fff; color: var(--primary, #7e22ce); border: 0; }
.gm-wait { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 28px 0 8px; font-size: 24px; }
