* { box-sizing: border-box; }

:root {
    --ink: #1f2f3f;
    --muted: #607086;
    --line: #d8e3f4;
    --blue: #4285f4;
    --green: #2f9e44;
    --red: #d64545;
    --paper: #ffffff;
    --wash: #f5f8fc;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Roboto, Arial, sans-serif;
    color: var(--ink);
    background: linear-gradient(135deg, #ed1c24 0%, #0054a6 100%);
}

.hidden { display: none !important; }

.student-shell {
    width: min(1120px, calc(100vw - 28px));
    margin: 24px auto;
    display: grid;
    gap: 18px;
}

.student-topbar,
.student-panel,
.student-summary,
.lock-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.14);
}

.student-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 20px;
    width: min(560px, 100%);
    margin-left: auto;
    margin-right: auto;
}

/* Once a class has been joined, the topbar sits above the full-width dashboard
   (module grid) rather than the narrow login/join card, so it should match that
   wider layout instead of staying pinned to the login-screen width. */
body.student-joined .student-topbar {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(1.7rem, 4vw, 2.4rem); }
h2 { margin-bottom: 10px; }
p { color: var(--muted); line-height: 1.55; }

.student-btn {
    border: 0;
    border-radius: 8px;
    background: #95a5a6;
    color: #fff;
    font-weight: 800;
    padding: 12px 18px;
    cursor: pointer;
}

.student-btn.primary { background: var(--blue); }
.student-btn:disabled { opacity: 0.65; cursor: wait; }

.student-auth-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 14px;
}

.student-name-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.student-panel {
    padding: 20px;
    width: min(560px, 100%);
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

label {
    display: grid;
    gap: 6px;
    margin: 12px 0;
    color: var(--ink);
    font-weight: 800;
}

input {
    border: 1px solid #b9c7d8;
    border-radius: 8px;
    padding: 12px;
    font: inherit;
}

.student-error {
    margin-top: 12px;
    color: var(--red);
    font-weight: 800;
}

.student-home {
    display: grid;
    gap: 18px;
}

.student-summary {
    display: grid;
    grid-template-columns: minmax(260px, 520px);
    justify-content: center;
    gap: 0;
    overflow: visible;
}

.student-connection-inline { display: none; }

.student-summary > div {
    padding: 20px;
    background: var(--paper);
}

.eyebrow {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.student-summary strong {
    font-size: 2rem;
}

.student-notifications {
    display: grid;
    gap: 8px;
}

.student-notice {
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--line);
    font-weight: 800;
}

.student-notice.positive { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.student-notice.negative { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

.student-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.student-live-section {
    display: grid;
    gap: 12px;
}

.student-live-section-head {
    display: grid;
    gap: 4px;
    text-align: center;
}

.student-live-section-head h2 {
    margin-bottom: 0;
}

.student-live-section-head p {
    margin: 0 auto;
    max-width: 60ch;
}

.student-module {
    min-height: 92px;
    border: 2px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-weight: 900;
    cursor: pointer;
    padding: 14px;
}

.student-live-module {
    display: grid;
    gap: 6px;
    text-align: left;
    background: linear-gradient(180deg, #f7fafc 0%, #edf2f7 100%);
    color: #55657a;
    cursor: default;
    opacity: 0.78;
}

.student-live-module strong {
    font-size: 1.02rem;
    color: #3f5368;
}

.student-live-module span {
    font-size: 0.9rem;
    font-weight: 800;
    color: #6c7c8f;
}

.student-live-module.is-live {
    opacity: 1;
    cursor: pointer;
    border-color: #bfdbfe;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e3a8a;
    box-shadow: 0 10px 26px rgba(59, 130, 246, 0.12);
}

.student-live-module.is-live strong,
.student-live-module.is-live span {
    color: #1e3a8a;
}

.student-live-module.is-live:focus-visible {
    outline: 3px solid rgba(66, 133, 244, 0.35);
    outline-offset: 2px;
}

.module-view {
    min-height: 220px;
}

.student-modal-card.bell-modal {
    width: min(460px, 90vw);
}

.student-modal-card.bell-modal .module-view {
    text-align: center;
}

.student-modal-card.bell-modal .student-module-body--centered {
    gap: 16px;
    justify-items: center;
    align-content: center;
    min-height: 180px;
}

.reward-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.reward-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--wash);
}

.student-option-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.student-option-card {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 64px;
    padding: 14px 18px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: var(--wash);
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--ink);
    cursor: pointer;
    transition: 0.15s;
}

.student-option-card:hover {
    border-color: var(--blue);
}

.student-option-card .student-option-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.student-option-card:has(.student-option-input:checked),
.student-option-card.selected {
    border-color: var(--blue);
    background: rgba(66, 133, 244, 0.12);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.25);
}

.student-module-body {
    display: grid;
    gap: 12px;
}

.student-module-body--centered {
    justify-items: center;
    text-align: center;
}

.student-module-body--centered .student-module-note {
    max-width: 36ch;
}

.student-module-note.centered {
    text-align: center;
}

.student-module-note {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.student-agenda-section {
    text-align: left;
}

.student-agenda-section h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--ink);
}

.student-agenda-item {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--wash);
    margin-bottom: 8px;
    line-height: 1.4;
}

.student-points-total {
    font-size: clamp(2.4rem, 8vw, 4.8rem);
    line-height: 1;
    font-weight: 900;
    color: var(--blue);
}

.student-point-log {
    display: grid;
    gap: 10px;
}

.student-point-entry {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fbff;
}

.student-point-entry.positive {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.student-point-entry.negative {
    border-color: #fecaca;
    background: #fef2f2;
}

.student-point-entry-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.student-point-entry-reason {
    font-weight: 800;
}

.student-point-entry-total {
    color: var(--muted);
    font-size: 0.92rem;
}

.student-empty {
    margin: 0;
    color: var(--muted);
}

.student-reward-card {
    display: grid;
    gap: 8px;
    text-align: center;
    justify-items: center;
}

.student-lock {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(6, 18, 34, 0.88);
    overflow-y: auto;
}

.student-lock.ping-mode {
    background: rgba(245, 158, 11, 0.2);
}

.lock-card {
    width: min(760px, 100%);
    max-height: calc(100vh - 44px);
    overflow-y: auto;
    padding: clamp(24px, 5vw, 42px);
    text-align: center;
}

.student-lock.buzzer-mode .lock-card {
    width: min(940px, 100%);
    display: grid;
    gap: 20px;
    align-content: center;
    min-height: calc(100vh - 44px);
}

.student-lock.game-mode .lock-card {
    width: 100%;
    max-width: none;
    display: grid;
    gap: 14px;
    align-content: start;
    min-height: calc(100vh - 44px);
    padding: 12px 18px 18px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: linear-gradient(180deg, #f7fbff 0%, #edf5ff 12%, #f7fbff 100%);
}

.student-lock.ping-mode .lock-card {
    width: min(560px, 92vw);
    display: grid;
    gap: 16px;
    align-content: center;
    min-height: calc(100vh - 44px);
    border: 0;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
}

.student-lock.game-mode #lock-title,
.student-lock.game-mode #lock-message {
    display: none;
}

.student-lock.ping-mode #lock-title,
.student-lock.ping-mode #lock-message,
.student-lock.ping-mode #lock-target-note {
    margin: 0;
}

.student-lock.ping-mode #lock-title,
.student-lock.ping-mode #lock-message {
    display: none;
}

.student-lock.ping-mode #lock-target-note {
    color: var(--ink);
    font-weight: 700;
}

.student-lock.game-mode #lock-fullscreen-btn {
    justify-self: center;
    margin-bottom: -2px;
}

.lock-card h2 {
    font-size: clamp(2rem, 6vw, 4rem);
}

.lock-target-note {
    margin: 0;
    color: var(--green);
    font-weight: 900;
}

.student-game-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(33, 150, 243, 0.12);
    color: var(--text-dark);
    font-size: 1.05rem;
    margin-bottom: 10px;
}

.student-game-shell {
    width: 100%;
    display: grid;
    gap: 14px;
    justify-self: stretch;
}

.student-game-canvas-wrap {
    position: relative;
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding-top: 84px;
}

.student-game-scoreboard {
    position: absolute;
    inset: 0 0 auto;
    z-index: 4;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(219,230,243,0.95);
    border-radius: 20px;
    padding: 12px;
    box-shadow: 0 10px 24px rgba(15,23,42,0.06);
    backdrop-filter: blur(10px);
}

.student-game-score {
    background: rgba(255,255,255,0.95);
    border: 1px solid #dbe6f3;
    border-radius: 18px;
    padding: 12px 14px;
    text-align: center;
    display: grid;
    gap: 4px;
}

.student-game-score strong {
    color: var(--text-dark);
    font-size: 0.95rem;
}

.student-game-score .points {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 900;
    color: var(--primary-color);
    line-height: 1;
}

.student-game-canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
    border: 1px solid rgba(15,23,42,0.08);
    background: linear-gradient(180deg, #d9ecff 0%, #eef6ff 52%, #dff0dc 100%);
    box-shadow: inset 0 -12px 0 rgba(62, 118, 68, 0.18);
}

.student-game-overlay {
    position: absolute;
    inset: auto 0 16px;
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 0 18px;
    pointer-events: none;
}

.student-game-scorebox {
    width: min(720px, calc(100% - 24px));
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    padding: 16px 20px;
    border-radius: 18px;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
    color: #16324f;
}

.student-game-scorebox strong {
    display: block;
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1;
}

.student-game-score-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 900;
}

.student-game-vs {
    font-size: 1.2rem;
    font-weight: 900;
    color: #1d4ed8;
}

.student-game-hint {
    margin: 0;
    max-width: 740px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.72);
    color: #24425d;
    font-size: 0.98rem;
    font-weight: 700;
    text-align: center;
    pointer-events: none;
}

.student-game-leaderboard {
    display: grid;
    gap: 10px;
    padding-top: 4px;
}

.student-game-leaderboard h3 {
    margin: 0 0 2px;
    font-size: 1.05rem;
}

.student-game-leaderboard-card {
    display: grid;
    grid-template-columns: minmax(160px, 1.2fr) repeat(4, minmax(92px, 1fr)) minmax(200px, 1fr);
    gap: 12px;
    align-items: stretch;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    color: #1f3347;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.student-game-leaderboard-card .name {
    display: grid;
    gap: 6px;
    align-content: center;
}

.student-game-leaderboard-card .rank {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef4ff;
    color: #2f5fce;
    font-weight: 900;
    font-size: 0.8rem;
}

.student-game-leaderboard-card .name strong {
    font-size: 1.08rem;
    line-height: 1.15;
    color: #1f2f3f;
    overflow-wrap: anywhere;
}

.student-game-leaderboard-card .name span {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
}

.student-game-leaderboard-stat {
    display: grid;
    gap: 4px;
    align-content: center;
    justify-items: center;
    text-align: center;
    padding: 10px 8px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e5edf7;
}

.student-game-leaderboard-stat strong {
    font-size: 1.7rem;
    line-height: 1;
    color: var(--blue);
}

.student-game-leaderboard-stat span {
    font-size: 0.8rem;
    color: var(--muted);
    letter-spacing: 0.05em;
    font-weight: 800;
    text-transform: uppercase;
}

.student-game-leaderboard-form {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
    align-content: center;
}

.student-game-leaderboard-form .chip {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.82rem;
    color: #fff;
    background: #94a3b8;
}

.student-game-leaderboard-form .chip.win {
    background: var(--green);
}

.student-game-leaderboard-form .chip.loss {
    background: var(--red);
}

.student-game-empty {
    padding: 14px;
    border-radius: 14px;
    border: 1px dashed var(--line);
    background: #fafcff;
    color: var(--muted);
    font-weight: 700;
    text-align: center;
}

.student-game-players,
.student-game-hint {
    color: var(--muted);
    font-weight: 700;
    line-height: 1.4;
}

.student-game-players {
    margin-bottom: 8px;
}

.student-lock.game-mode .lock-target-note .student-game-status {
    margin-bottom: 0;
    min-width: 0;
    padding: 12px 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(246,249,255,0.92));
    border: 1px solid #dbe6f3;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
    font-weight: 800;
    color: #41576c;
    text-align: center;
}

.student-lock.game-mode .lock-target-note .student-game-status,
.student-lock.game-mode .lock-target-note .student-game-score,
.student-lock.game-mode .lock-target-note .student-game-canvas,
.student-lock.game-mode .lock-target-note .student-game-leaderboard {
    margin-inline: auto;
}

.student-lock.game-mode .lock-target-note .student-game-canvas {
    width: 100%;
    max-width: none;
}

.student-lock.game-mode .lock-target-note .student-game-hint {
    display: none;
}

.student-ping-overlay {
    display: grid;
    gap: 14px;
    justify-items: center;
    text-align: center;
}

.student-ping-countdown {
    font-size: clamp(4rem, 20vw, 10rem);
    line-height: 1;
    font-weight: 900;
    color: #c2410c;
    font-family: monospace;
}

.student-ping-note {
    max-width: 32ch;
    color: #7c2d12;
    font-weight: 800;
    line-height: 1.35;
}

.student-ping-action {
    width: min(240px, 76vw);
    aspect-ratio: auto;
    border-radius: 18px;
    font-size: 1.4rem;
    padding: 16px 22px;
    border: 0;
    background: linear-gradient(180deg, #f8fbff 0%, #dbeafe 100%);
    color: #1d4ed8;
    box-shadow: 0 16px 30px rgba(29, 78, 216, 0.18);
}

.student-ping-action:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(29, 78, 216, 0.22);
}

.student-buzzer-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    text-align: center;
    min-height: min(55vh, 560px);
    width: 100%;
}

.student-buzzer-stage-compact {
    min-height: min(46vh, 460px);
    gap: 18px;
}

.student-reminder-stage {
    min-height: min(40vh, 420px);
    gap: 14px;
}

.student-buzzer-prompt-wrap {
    width: 100%;
    display: grid;
    place-items: center;
}

.student-buzzer-prompt {
    width: 100%;
    max-width: 800px;
    height: 180px;
    font-size: 2.2rem;
    padding: 20px;
    border-radius: 12px;
    border: 2px dashed #cbd5e0;
    margin: 0;
    text-align: center;
    font-family: 'Roboto', sans-serif;
    resize: none;
    background: #fdfdfd;
    color: var(--text-dark);
}

.student-buzzer-prompt-display {
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: pre-wrap;
    overflow: auto;
    box-sizing: border-box;
    text-align: center;
    height: auto;
    min-height: 132px;
    padding: 18px 20px;
    line-height: 1.25;
}

.student-buzzer-stage-compact .student-buzzer-prompt {
    height: 152px;
    font-size: 2rem;
}

.student-reminder-stage .student-buzzer-prompt {
    height: 132px;
    font-size: 1.8rem;
    border-style: solid;
    border-color: rgba(66, 133, 244, 0.28);
    box-shadow: 0 0 0 1px rgba(66, 133, 244, 0.06) inset;
}

.student-reminder-stage .student-buzzer-prompt-wrap {
    animation: studentReminderFlash 0.85s ease-in-out infinite alternate;
}

.student-reminder-stage .student-buzzer-prompt-display {
    font-size: 1.75rem;
    border-style: solid;
    border-color: rgba(66, 133, 244, 0.28);
    box-shadow: 0 0 0 1px rgba(66, 133, 244, 0.06) inset;
    color: #17324d;
}

.student-buzzer-question-display,
.student-buzzer-verbal-note {
    min-height: 132px;
    font-size: 1.7rem;
}

.student-buzzer-verbal-note {
    color: #475569;
    background: #f8fafc;
    border-color: #d8e3f4;
}

.student-buzzer-prompt::placeholder {
    color: #9aa3af;
    opacity: 1;
}

.student-buzzer-timer-display {
    font-size: clamp(2.4rem, 9vw, 5rem);
    line-height: 1;
    font-weight: 700;
    font-family: monospace;
    color: var(--primary-color);
    text-align: center;
    width: 100%;
    white-space: nowrap;
    text-shadow: 0 0 18px rgba(66, 133, 244, 0.18);
}

.student-buzzer-stage-compact .student-buzzer-timer-display {
    font-size: clamp(2.2rem, 8vw, 4.5rem);
}

.student-reminder-stage .student-buzzer-timer-display {
    font-size: clamp(2rem, 6vw, 3.5rem);
}

.student-buzzer-timer-hint {
    margin: -2px 0 0;
    color: #666;
    font-size: 1.1rem;
    opacity: 0.6;
    font-weight: 600;
}

.student-reminder-stage .student-buzzer-timer-hint {
    font-size: 0.98rem;
    color: #55657a;
}

.student-reminder-stage .student-buzzer-btn {
    width: min(260px, 76vw);
    aspect-ratio: auto;
    border-radius: 18px;
    font-size: 1.5rem;
    padding: 18px 22px;
}

.student-reminder-stage .student-buzzer-status {
    max-width: 760px;
    color: #17324d;
}

.student-reminder-stage .student-buzzer-response {
    min-height: 92px;
}

.student-buzzer-status {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--ink);
    max-width: 800px;
}

.student-buzzer-response {
    width: min(720px, 100%);
    min-height: 120px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px 18px;
    font: inherit;
    font-size: 1.35rem;
    text-align: center;
}

.student-buzzer-btn {
    width: min(320px, 80vw);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 10px solid #ffb3b3;
    background: linear-gradient(180deg, #ff4242 0%, #c90f0f 100%);
    color: #fff;
    font-size: clamp(2.1rem, 6vw, 3.6rem);
    font-weight: 900;
    letter-spacing: 0.08em;
    cursor: pointer;
    box-shadow: 0 18px 40px rgba(201, 15, 15, 0.35), inset 0 2px 0 rgba(255,255,255,0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.student-buzzer-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 22px 48px rgba(201, 15, 15, 0.4), inset 0 2px 0 rgba(255,255,255,0.35);
}

.student-buzzer-btn:active:not(:disabled) {
    transform: scale(0.985);
}

.student-buzzer-btn:disabled,
.student-buzzer-btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.15);
}

.student-buzzer-hint {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 700;
}

.student-live-question-note {
    width: min(720px, 100%);
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--wash);
    display: grid;
    gap: 8px;
}

.student-live-question-note strong {
    font-size: 1.05rem;
}

.student-live-question-note p {
    margin: 0;
    color: var(--muted);
}

@media (max-width: 620px) {
    .student-topbar,
    .student-summary {
        grid-template-columns: 1fr;
    }

    .student-topbar {
        display: grid;
    }

    .student-name-grid {
        grid-template-columns: 1fr;
    }

    .student-buzzer-btn {
        width: min(260px, 76vw);
    }

    .student-buzzer-prompt {
        height: 150px;
        font-size: 1.7rem;
        padding: 16px;
    }

    .student-buzzer-prompt-display {
        min-height: 150px;
    }

    .student-buzzer-timer-display {
        font-size: clamp(2.2rem, 14vw, 3.8rem);
    }

    .student-reminder-stage .student-buzzer-timer-display {
        font-size: clamp(1.8rem, 11vw, 3rem);
    }

    .student-game-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .student-game-scorebox {
        width: 100%;
        padding: 14px 16px;
    }

    .student-game-leaderboard-card {
        grid-template-columns: 1fr;
    }

    .student-game-leaderboard-stat {
        justify-items: start;
    }
}

@keyframes studentReminderFlash {
    from {
        transform: translateY(0);
        filter: brightness(1);
        opacity: 0.94;
    }
    to {
        transform: translateY(-1px);
        filter: brightness(1.08);
        opacity: 1;
    }
}

.student-game-touch-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(76px, 1fr));
    gap: 12px;
    align-items: center;
    justify-content: center;
    width: min(520px, 100%);
    justify-self: center;
    touch-action: none;
    user-select: none;
}

.student-game-control {
    min-height: 72px;
    border: 0;
    border-radius: 22px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-size: clamp(2rem, 8vw, 3.2rem);
    font-weight: 900;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.student-game-control.jump {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-8px);
}

.student-game-control:active,
.student-game-control[data-active="true"] {
    transform: scale(0.96);
    filter: brightness(0.94);
}

.student-game-control.jump:active,
.student-game-control.jump[data-active="true"] {
    transform: translateY(-8px) scale(0.96);
}

@media (hover: hover) and (pointer: fine) {
    .student-game-touch-controls {
        width: min(440px, 100%);
    }
}

.student-point-flash {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.student-point-flash.visible {
    opacity: 1;
}

.student-point-flash.positive {
    background: rgba(47, 158, 68, 0.75);
}

.student-point-flash.negative {
    background: rgba(214, 69, 69, 0.75);
}

.student-point-flash.reward {
    background: rgba(59, 130, 246, 0.8);
}

.student-point-flash-card {
    width: min(680px, 100%);
    padding: clamp(24px, 5vw, 46px);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
    color: #fff;
    text-align: center;
    backdrop-filter: blur(5px);
    transform: scale(0.96);
    transition: transform 220ms ease;
}

.student-point-flash.visible .student-point-flash-card {
    transform: scale(1);
}

.student-point-flash-kicker {
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.94;
}

.student-point-flash-title {
    margin-top: 10px;
    font-size: clamp(2rem, 8vw, 4.5rem);
    line-height: 1;
    font-weight: 900;
}

.student-point-flash-reason {
    margin-top: 16px;
    font-size: clamp(1.15rem, 4vw, 2rem);
    font-weight: 800;
    line-height: 1.3;
}

.student-point-flash-delta {
    margin-top: 20px;
    font-size: clamp(2.2rem, 9vw, 5rem);
    line-height: 1;
    font-weight: 900;
}

.student-point-entry.reward {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.student-point-entry.reward .student-point-entry-reason,
.student-point-entry.reward .student-point-entry-total {
    color: #1d4ed8;
}

.student-topbar > div:first-child {
    flex: 1;
    text-align: center;
}

.student-summary-card {
    display: grid;
    gap: 4px;
    width: 100%;
    border: 0;
    padding: 20px;
    text-align: left;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
}

.student-summary-card small {
    color: var(--muted);
    font-weight: 800;
}

.student-summary-card.points-positive { background: rgba(34, 197, 94, 0.14); }
.student-summary-card.points-negative { background: rgba(239, 68, 68, 0.14); }
.student-summary-card.points-neutral { background: var(--paper); }

.student-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 20px;
}

.student-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
}

.student-modal-card {
    position: relative;
    width: min(860px, 100%);
    max-height: min(82vh, 760px);
    overflow: auto;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.student-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.module-view { min-height: 0; }

.student-noise-level {
    border-radius: 16px;
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    color: #155e75;
    font-size: clamp(1.6rem, 5vw, 3rem);
    font-weight: 900;
    padding: 24px;
    text-align: center;
}

.student-noise-level.breached {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* Student layout refinements */
body {
    min-height: 100vh;
    display: grid;
    align-items: center;
}

.student-shell {
    margin: 24px auto;
    align-content: center;
}

.student-topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
}

.student-topbar > div:first-child {
    grid-column: 2;
    text-align: center;
    justify-self: center;
}

.student-topbar #student-auth-btn {
    grid-column: 3;
    justify-self: end;
    align-self: start;
}

.student-module-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    align-items: stretch;
}

.student-module {
    min-height: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    text-align: center;
}

.student-modal-card {
    width: min(760px, calc(100vw - 40px));
}

.student-modal-card h2,
.student-module-note,
.student-module-body label {
    text-align: center;
}

.student-noise-student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.student-noise-card {
    min-height: 76px;
    display: grid;
    place-items: center;
    gap: 8px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--wash);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
    text-align: center;
}

.student-noise-card input {
    width: 18px;
    height: 18px;
    padding: 0;
}

.student-timetable-panel {
    display: grid;
    gap: 16px;
    padding: 8px 0;
}

.student-timetable-banner {
    display: grid;
    gap: 4px;
    justify-items: center;
    text-align: center;
    color: var(--ink);
}

.student-timetable-banner span {
    color: var(--muted);
    font-weight: 700;
}

.student-timetable-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(110px, 1fr));
    gap: 10px;
    min-width: 620px;
}

.student-timetable-head,
.student-timetable-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fbff;
    padding: 10px;
    text-align: center;
}

.student-timetable-head {
    font-weight: 900;
    background: #eef4fb;
}

.student-timetable-card {
    min-height: 120px;
    display: grid;
    gap: 8px;
    align-content: start;
}

.student-timetable-card.has-class {
    border-color: #2f9e44;
    background: #f0fdf4;
}

.student-timetable-card.today {
    outline: 2px solid var(--blue);
}

.student-timetable-card div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.student-timetable-card span {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #bbf7d0;
    background: #fff;
    color: #166534;
    font-weight: 800;
}

.student-timetable-card em {
    color: var(--muted);
    font-style: normal;
    font-weight: 700;
}

@media (max-width: 760px) {
    body { align-items: start; }
    .student-topbar { grid-template-columns: 1fr; justify-items: center; }
    .student-topbar > div:first-child,
    .student-topbar #student-auth-btn { grid-column: 1; }
    .student-topbar #student-auth-btn { order: -1; justify-self: center; }
    .student-timetable-grid { min-width: 0; grid-template-columns: 1fr; }
    .student-timetable-head { display: none; }
}


.student-lock:not(.game-mode) #lock-fullscreen-btn {
    display: none;
}

.student-lock.buzzer-mode .lock-card {
    width: min(760px, calc(100vw - 32px));
    min-height: auto;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: clamp(18px, 3vw, 30px);
}

.student-lock.buzzer-mode .student-buzzer-stage {
    min-height: 0;
    gap: 14px;
}

.student-lock.buzzer-mode .student-buzzer-prompt-display,
.student-lock.buzzer-mode .student-buzzer-question-display,
.student-lock.buzzer-mode .student-buzzer-verbal-note {
    min-height: 92px;
    font-size: clamp(1.15rem, 3vw, 1.55rem);
}

.student-lock.buzzer-mode .student-buzzer-timer-display {
    font-size: clamp(2rem, 7vw, 4rem);
}

.student-lock.buzzer-mode .student-buzzer-btn {
    width: min(240px, 66vw);
}

#student-modal-title + .student-module-body .student-points-total,
.student-points-total {
    display: grid;
    place-items: center;
    text-align: center;
    margin-inline: auto;
}

.student-noise-teacher-style { display:grid; gap:18px; justify-items:center; }
.student-noise-canvas { width:min(70vw, 520px); height:120px; border-radius:12px; background:#f0f4f8; }
.student-noise-alert { width:min(420px, 90%); padding:14px; border-radius:12px; background:#fef2f2; color:#991b1b; font-weight:900; text-align:center; border:1px solid #fecaca; }
