/* teacher page · tab «ហ្គេមក្រុម»: the game lobby (class + lessons, game, teams, one big Start bar) */
.tgl { display: flex; flex-direction: column; gap: 16px; max-width: 1100px; }
.tgl-step { background: #fff; border: 1px solid var(--line, #e3ded0); border-radius: 20px; padding: 18px 20px 20px; box-shadow: 0 6px 22px rgba(31, 37, 71, .06); }
.tgl-sh { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tgl-sh h3 { margin: 0; flex: 1; font-size: 20px; color: #1f2547; }
.tgl-n { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; }
.tgl-body { display: flex; flex-direction: column; gap: 14px; }
.tgl-f { display: flex; align-items: center; gap: 12px; font-weight: 700; color: #1f2547; }
.tgl-f select { max-width: 320px; min-height: 46px; border-radius: 12px; }
.tgl-lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; max-height: 270px; overflow: auto; padding: 2px; }
.tgl-lesson { min-height: 48px; padding: 8px 14px; border-radius: 12px; border: 2px solid #e3ded0; background: #fff; color: #1f2547; text-align: left; font-weight: 600; box-shadow: none; display: flex; flex-direction: column; justify-content: center; }
.tgl-lesson small { color: var(--brand); font-weight: 700; }
.tgl-lesson.on { border-color: var(--brand); background: #edf3ff; }
.tgl-hint { color: #6b7280; margin: 0; }
.tgl-qn { display: flex; align-items: center; gap: 12px; font-weight: 700; color: #1f2547; flex-wrap: wrap; }
.tgl-chips { display: flex; gap: 8px; }
.tgl-chips button { min-height: 40px; min-width: 46px; border-radius: 99px; border: 2px solid #e3ded0; background: #fff; color: #1f2547; font-weight: 800; box-shadow: none; }
.tgl-chips button.on { background: #1f2547; border-color: #1f2547; color: #fff; }
.tgl-ghost { min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1.5px solid #bcd0f3; background: #fff; color: var(--brand); font-weight: 700; box-shadow: none; }
.tgl-ghost:disabled { opacity: .5; }
.tgl-styles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tgl-style { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 0 0 12px; border: 3px solid transparent; border-radius: 18px; overflow: hidden; background: #fff; text-align: left; color: #1f2547; box-shadow: 0 6px 20px rgba(31, 37, 71, .14); transition: transform .15s, box-shadow .15s; }
.tgl-style:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(31, 37, 71, .2); }
.tgl-style img { width: 100%; height: 130px; object-fit: cover; display: block; }
.tgl-style b { padding: 6px 14px 0; font-size: 19px; }
.tgl-style small { padding: 0 14px; color: #6b7280; font-size: 14px; line-height: 1.5; }
.tgl-style i { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; display: none; place-items: center; border-radius: 50%; background: var(--brand); color: #fff; font-style: normal; font-weight: 800; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
.tgl-style.on { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(107, 99, 224, .18), 0 12px 28px rgba(31, 37, 71, .2); }
.tgl-style.on i { display: grid; }
.tgl-trow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tgl-stepper { display: flex; align-items: center; gap: 10px; }
.tgl-stepper button { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 24px; font-weight: 800; background: var(--brand); color: #fff; box-shadow: none; }
.tgl-stepper button:disabled { background: #cfd4e6; }
.tgl-stepper output { min-width: 36px; text-align: center; font-size: 28px; font-weight: 800; color: #1f2547; }
.tgl-sw { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: #1f2547; }
.tgl-sw input { width: 20px; height: 20px; accent-color: var(--brand); }
.tgl-info { margin: 0; color: #6b7280; }
.tgl-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tgl-team { border-radius: 14px; background: #f7f9fc; border-top: 6px solid var(--c); padding: 8px 14px 12px; }
.tgl-th { display: flex; justify-content: space-between; align-items: baseline; color: var(--c); }
.tgl-th span { color: #6b7280; font-size: 14px; }
.tgl-team p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.7; color: #1f2547; }
.tgl-bar { position: sticky; bottom: 10px; z-index: 5; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-radius: 18px; background: #1f2547; color: #fff; box-shadow: 0 12px 32px rgba(31, 37, 71, .4); }
.tgl-sum { flex: 1; min-width: 200px; font-weight: 700; }
.tgl-link { color: #c7d0f0; font-weight: 600; text-decoration: underline; }
.tgl-go { min-height: 52px; padding: 0 30px; border-radius: 99px; background: #e8590c; color: #fff; font-size: 18px; font-weight: 800; box-shadow: 0 6px 18px rgba(232, 89, 12, .5); }
.tgl-go:disabled { background: #6b7280; box-shadow: none; }
.tgl-more { margin-top: 24px; max-width: 1100px; }
.tgl-more h3 { margin: 0 0 10px; color: #1f2547; }
.tgl-more-g { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.tgl-o { border: 1px solid #e3ded0; border-radius: 16px; padding: 14px; background: #fff; }
.tgl-o p { color: #6b7280; margin: 6px 0 10px; }
@media (max-width: 640px) { .tgl-go { width: 100%; } .tgl-bar { bottom: 6px; } }
.tgl-chips input { width: 110px; min-height: 40px; border-radius: 99px; border: 2px solid #e3ded0; padding: 0 14px; font-weight: 800; text-align: center; box-shadow: none; }
.tgl-chips input.on { border-color: #1f2547; background: #edf3ff; }
.tgl-deal { min-height: 46px; padding: 0 22px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 16px; font-weight: 800; box-shadow: 0 6px 16px rgba(107, 99, 224, .4); }
.tgl-deal:disabled { background: #cfd4e6; box-shadow: none; }
/* the divide-groups pop-up */
.tgp-back { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(31, 37, 71, .62); backdrop-filter: blur(4px); animation: tgp-in .25s both; }
@keyframes tgp-in { from { opacity: 0; } to { opacity: 1; } }
.tgp-card { position: relative; width: min(96vw, 1500px); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; border-radius: 24px; background: linear-gradient(180deg, #eaf5f2, #fdf6e8); border: 6px solid #1f6f66; box-shadow: 0 24px 70px rgba(0, 0, 0, .5); animation: tgp-pop .4s cubic-bezier(.2, 1.4, .3, 1) both; }
@keyframes tgp-pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tgp-ban { flex: none; display: flex; flex-direction: column; gap: 2px; padding: 16px 24px; color: #fff; background: linear-gradient(100deg, #1f6f66, #2d8f7e 60%, #3aa68f); }
.tgp-ban b { font-size: clamp(22px, 4vw, 34px); } .tgp-ban small { font-size: 16px; opacity: .92; font-weight: 600; }
.tgp-grid { flex: 1; min-height: 0; overflow: auto; grid-auto-rows: max-content; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 14px; padding: 18px 22px; align-content: start; }
.tgp-g { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 6px 16px rgba(0, 0, 0, .14); transition: transform .2s, box-shadow .2s; }
.tgp-g.wait { opacity: .55; } .tgp-g.active { transform: scale(1.03); box-shadow: 0 0 0 3px var(--c), 0 12px 26px rgba(0, 0, 0, .25); }
.tgp-gh { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: var(--c); color: #fff; }
.tgp-gh b { font-size: 20px; } .tgp-gh span { opacity: .92; font-weight: 600; }
.tgp-g ol { margin: 0; padding: 8px 14px 12px 38px; font-size: 18px; font-weight: 700; color: #1b2733; line-height: 1.6; }
.tgp-g ol li::marker { color: var(--c); font-weight: 800; } .tgp-g .ph { color: #b8c0cc; }
.tgp-act { flex: none; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 10px 22px 18px; }
.tgp-act button { min-height: 44px; padding: 0 22px; border-radius: 99px; border: 0; font-weight: 800; font-size: 16px; box-shadow: none; background: #1f2547; color: #fff; }
.tgp-act .tgp-skip { background: #e3ded0; color: #1f2547; } .tgp-act .tgp-again { background: #e8590c; }
.tgp-fw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.tgl-tools { display: inline-flex; gap: 8px; }

/* every group card is as tall as its names (never squeezed to the window height); the grid scrolls instead; smaller type on short windows */
.tgp-g { min-height: min-content; }
@media (max-height: 760px) { .tgp-g ol { font-size: 16px; line-height: 1.45; padding-top: 6px; padding-bottom: 8px; } .tgp-gh { padding: 6px 12px; } .tgp-gh b { font-size: 18px; } }
@media (max-height: 760px) { .tgp-ban { padding: 8px 18px; } .tgp-ban b { font-size: 24px; } .tgp-ban small { font-size: 14px; } .tgp-grid { padding: 10px 16px; gap: 10px; } .tgp-act { padding: 6px 18px 10px; } .tgp-act button { min-height: 36px; } .tgp-card { max-height: 96vh; } }

/* Balanced layouts by group count (no isolated / orphan cards) */
.tgp-card.count-1 { width: min(92vw, 420px); }
.tgp-grid.count-1 { grid-template-columns: minmax(0, 360px); justify-content: center; }

.tgp-card.count-2 { width: min(94vw, 760px); }
.tgp-grid.count-2 { grid-template-columns: repeat(2, minmax(240px, 340px)); justify-content: center; }
@media (max-width: 560px) { .tgp-grid.count-2 { grid-template-columns: 1fr; } }

.tgp-card.count-3 { width: min(96vw, 1060px); }
.tgp-grid.count-3 { grid-template-columns: repeat(3, minmax(220px, 330px)); justify-content: center; }
@media (max-width: 760px) { .tgp-grid.count-3 { grid-template-columns: 1fr; } }

.tgp-card.count-4 { width: min(98vw, 1320px); }
.tgp-grid.count-4 { grid-template-columns: repeat(4, minmax(200px, 300px)); justify-content: center; }
@media (max-width: 960px) { .tgp-grid.count-4 { grid-template-columns: repeat(2, minmax(200px, 1fr)); } }
@media (max-width: 520px) { .tgp-grid.count-4 { grid-template-columns: 1fr; } }

/* 5 groups: 2x3 (3 on top, 2 centered below) */
.tgp-card.count-5 { width: min(96vw, 1120px); }
.tgp-grid.count-5 { display: flex; flex-wrap: wrap; justify-content: center; align-content: start; gap: 14px; }
.tgp-grid.count-5 > .tgp-g { flex: 0 1 calc(33.333% - 10px); min-width: 220px; max-width: 340px; box-sizing: border-box; }
@media (max-width: 780px) {
  .tgp-grid.count-5 > .tgp-g { flex: 0 1 calc(50% - 10px); }
}
@media (max-width: 520px) {
  .tgp-grid.count-5 > .tgp-g { flex: 0 1 100%; }
}

/* 6 groups: 2 rows of 3 (2x3 = 3 columns x 2 rows: 3 on top, 3 on bottom) */
.tgp-card.count-6 { width: min(96vw, 1120px); }
.tgp-grid.count-6 { grid-template-columns: repeat(3, minmax(220px, 340px)); justify-content: center; }
@media (max-width: 820px) { .tgp-grid.count-6 { grid-template-columns: repeat(2, minmax(200px, 1fr)); } }
@media (max-width: 520px) { .tgp-grid.count-6 { grid-template-columns: 1fr; } }

/* 7 groups: 4 on top + 3 centered below */
.tgp-card.count-7 { width: min(98vw, 1340px); }
.tgp-grid.count-7 { display: flex; flex-wrap: wrap; justify-content: center; align-content: start; gap: 14px; }
.tgp-grid.count-7 > .tgp-g { flex: 0 1 calc(25% - 12px); min-width: 220px; max-width: 305px; box-sizing: border-box; }
@media (max-width: 980px) { .tgp-grid.count-7 > .tgp-g { flex: 0 1 calc(33.333% - 12px); } }
@media (max-width: 740px) { .tgp-grid.count-7 > .tgp-g { flex: 0 1 calc(50% - 12px); } }
@media (max-width: 520px) { .tgp-grid.count-7 > .tgp-g { flex: 0 1 100%; } }

/* 8 groups: 4 on top + 4 on bottom (4x2 = 8 groups) */
.tgp-card.count-8 { width: min(98vw, 1360px); }
.tgp-grid.count-8 { grid-template-columns: repeat(4, minmax(200px, 310px)); justify-content: center; }
@media (max-width: 940px) { .tgp-grid.count-8 { grid-template-columns: repeat(2, minmax(200px, 1fr)); } }
@media (max-width: 520px) { .tgp-grid.count-8 { grid-template-columns: 1fr; } }

/* 9 groups: 3 columns x 3 rows (3x3 = 9 groups) */
.tgp-card.count-9 { width: min(96vw, 1120px); }
.tgp-grid.count-9 { grid-template-columns: repeat(3, minmax(220px, 340px)); justify-content: center; }
@media (max-width: 780px) { .tgp-grid.count-9 { grid-template-columns: repeat(2, minmax(200px, 1fr)); } }
@media (max-width: 520px) { .tgp-grid.count-9 { grid-template-columns: 1fr; } }

/* 10 groups: 5 on top + 5 on bottom (5x2 = 10 groups) */
.tgp-card.count-10 { width: min(98vw, 1480px); }
.tgp-grid.count-10 { grid-template-columns: repeat(5, minmax(170px, 260px)); justify-content: center; }
@media (max-width: 1100px) { .tgp-grid.count-10 { grid-template-columns: repeat(3, minmax(190px, 1fr)); } }
@media (max-width: 760px) { .tgp-grid.count-10 { grid-template-columns: repeat(2, minmax(180px, 1fr)); } }
@media (max-width: 520px) { .tgp-grid.count-10 { grid-template-columns: 1fr; } }

/* 11 groups: 4 + 4 + 3 centered */
.tgp-card.count-11 { width: min(98vw, 1480px); }
.tgp-grid.count-11 { display: flex; flex-wrap: wrap; justify-content: center; align-content: start; gap: 14px; }
.tgp-grid.count-11 > .tgp-g { flex: 0 1 calc(25% - 12px); min-width: 200px; max-width: 290px; box-sizing: border-box; }
@media (max-width: 980px) { .tgp-grid.count-11 > .tgp-g { flex: 0 1 calc(33.333% - 12px); } }
@media (max-width: 740px) { .tgp-grid.count-11 > .tgp-g { flex: 0 1 calc(50% - 12px); } }
@media (max-width: 520px) { .tgp-grid.count-11 > .tgp-g { flex: 0 1 100%; } }

/* 12 groups: 4 columns x 3 rows (4x3 = 12 groups) */
.tgp-card.count-12 { width: min(98vw, 1360px); }
.tgp-grid.count-12 { grid-template-columns: repeat(4, minmax(190px, 305px)); justify-content: center; }
@media (max-width: 940px) { .tgp-grid.count-12 { grid-template-columns: repeat(3, minmax(180px, 1fr)); } }
@media (max-width: 720px) { .tgp-grid.count-12 { grid-template-columns: repeat(2, minmax(170px, 1fr)); } }
@media (max-width: 520px) { .tgp-grid.count-12 { grid-template-columns: 1fr; } }

