.student-table, .student-header, .student-row {
    font-family: "Segoe UI", "Arial", "Helvetica Neue", Arial, sans-serif;
}
/* ============================================================
   ANIMATION POPOUT WINDOW
============================================================ */

.animation-popout, body.popout-mode {
    position: relative;
    height: 200px;
    max-height: 200px;
    width: 100vw;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
}

/* If AnimationCanvas needs to fill the window: */
.animation-popout canvas, body.popout-mode canvas {
    width: 100vw;
    height: 200px;
    display: block;
}

.presentation-mode-btn {
    position: absolute;
    top: 0.7rem;
    right: 0.9rem;
    z-index: 5;
    border: 1px solid rgba(20, 52, 72, 0.16);
    background: rgba(255, 255, 255, 0.9);
    color: #17384d;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.presentation-mode-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 10;
    background: #fff;
    border: 1.5px solid #bbb;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: box-shadow 0.2s, border-color 0.2s, background 0.2s;
}
.presentation-mode-btn svg {
    width: 28px;
    height: 28px;
    stroke: #333;
}
.presentation-mode-btn:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
    border-color: #666;

    background:
        radial-gradient(circle at top left, rgba(255, 214, 78, 0.5), transparent 28%),
        radial-gradient(circle at bottom right, rgba(45, 139, 211, 0.28), transparent 34%),
        linear-gradient(135deg, #f7fbff 0%, #dbeeff 52%, #fef6d3 100%);
}
/* ============================================================
   GLOBAL
============================================================ */

body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
}

.login-shell {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(320px, 1.1fr) minmax(320px, 0.9fr);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(58, 106, 136, 0.16);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 28px 80px rgba(23, 56, 77, 0.18);
    backdrop-filter: blur(8px);
}

.login-hero {
    padding: 3rem;
    background:
        linear-gradient(180deg, rgba(12, 82, 123, 0.96) 0%, rgba(29, 112, 159, 0.92) 100%),
        linear-gradient(45deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
    color: #fff;
    display: grid;
    align-content: start;
    gap: 1rem;
}

.login-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.login-logo {
    width: min(320px, 100%);
    height: auto;
    filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.18));
}

.login-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3.3rem);
    line-height: 1.02;
    max-width: 11ch;
}

.login-subtitle {
    margin: 0;
    max-width: 34rem;
    font-size: 1.02rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.88);
}

.login-duck-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.4rem 0 0.8rem;
}

.login-duck {
    width: min(220px, 58%);
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.24));
}

.login-feature-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.2rem;
}

.login-feature-item {
    padding: 0.95rem 1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 600;
}

.login-panel {
    padding: 3rem;
    display: grid;
    align-content: center;
    gap: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 250, 255, 0.98) 100%);
}

.login-panel-header h2 {
    margin: 0;
    font-size: 2rem;
    color: #17384d;
}

.login-panel-header p {
    margin: 0.5rem 0 0;
    color: #4d6573;
    line-height: 1.6;
}

.login-panel-kicker {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0e719f;
}

.login-form-field {
    display: grid;
    gap: 0.45rem;
}

.login-form-field label {
    font-weight: 700;
    color: #17384d;
}

.login-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #c7d8e2;
    border-radius: 14px;
    padding: 0.95rem 1rem;
    font: inherit;
    color: #17384d;
    background: #fff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-input:focus {
    outline: none;
    border-color: #1d84bb;
    box-shadow: 0 0 0 4px rgba(29, 132, 187, 0.14);
}

.login-helper-copy {
    margin: 0;
    color: #5b7280;
    font-size: 0.94rem;
    line-height: 1.55;
}

.login-inline-link {
    color: #0d6f9d;
    font-weight: 700;
    text-decoration: none;
}

.login-inline-link:hover {
    text-decoration: underline;
}

.login-primary-btn,
.login-microsoft-btn {
    min-height: 52px;
    border-radius: 14px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.login-primary-btn {
    border: none;
    background: linear-gradient(135deg, #0d7eb0 0%, #095f89 100%);
    color: #fff;
    box-shadow: 0 14px 28px rgba(13, 126, 176, 0.24);
    cursor: pointer;
}

.login-primary-btn:hover,
.login-microsoft-btn:hover {
    transform: translateY(-1px);
}

.login-primary-btn:disabled {
    opacity: 0.75;
    cursor: default;
    transform: none;
}

.login-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.8rem;
    align-items: center;
    color: #6a7f8b;
    font-size: 0.9rem;
}

.login-divider::before,
.login-divider::after {
    content: "";
    height: 1px;
    background: #d8e4ea;
}

.login-microsoft-btn {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.login-microsoft-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
}

.login-error-box {
    border-radius: 14px;
    padding: 0.9rem 1rem;
    border: 1px solid #efb6b6;
    background: #fff4f4;
    color: #8b1f1f;
    font-weight: 600;
}
/* ============================================================
   LAYOUT
============================================================ */
/* ============================================================
   LAYOUT
============================================================ */

:root {
    --sidebar-width: 420px;
    --sidebar-width-collapsed: 48px;
    --sidebar-transition: 0.25s cubic-bezier(0.4,0.2,0.2,1);
}

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    overflow: hidden;
    transition: grid-template-columns var(--sidebar-transition);
}

.layout-collapsed {
    grid-template-columns: var(--sidebar-width-collapsed) 1fr;
}

/* ============================================================
   SIDEBAR
============================================================ */


.sidebar {
    background: #1e1e1e;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0;
    gap: 0.5rem;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    box-sizing: border-box;
    transition: width var(--sidebar-transition), min-width var(--sidebar-transition), max-width var(--sidebar-transition);
    overflow-x: hidden;
    height: 100vh;
}

.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
    min-width: var(--sidebar-width-collapsed);
    max-width: var(--sidebar-width-collapsed);
    align-items: center;
    gap: 0.25rem;
    background: transparent;
    box-shadow: none;
}

.sidebar.expanded {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    align-items: stretch;
    gap: 0.5rem;
}

.sidebar-controls {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    padding: 0.5rem 0.5rem 0.5rem 0.5rem;
    overflow-y: auto;
    height: 100%;
}

/* Ensure cards in sidebar are readable */
.sidebar .panel {
    background: #fff;
    color: #222;
}
.sidebar .panel-title {
    color: #222;
}

.collapse-toggle {
    background: #222;
    color: #fff;
    border: none;
    border-radius: 0.4rem;
    width: 40px;
    height: 40px;
    margin: 0 auto 0.5rem auto;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar.collapsed .collapse-toggle {
    margin-bottom: 0.25rem;
}

.side-btn {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
    border: none;
    border-radius: 0.4rem;
    background: #333;
    color: white;
    cursor: pointer;
    margin: 0.1rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.side-btn:hover, .collapse-toggle:hover {
    background: #444;
}

/* ============================================================
   MAIN AREA
============================================================ */

.main {
    display: grid;
    grid-template-rows: auto auto auto 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    overflow-y: auto;
    min-height: 0;
}

.main.main-info-hidden {
    grid-template-rows: auto auto 1fr;
}

.main.main-animation-hidden {
    grid-template-rows: auto auto auto 1fr;
}

.main.main-expanded {
    grid-template-rows: auto auto 1fr;
}

/* ============================================================
   ANIMATION PANEL
============================================================ */

.animation-panel {
    max-height: none;
}

.animation-panel.animation-panel-collapsed {
    max-height: none;
}

.animation-canvas {
    width: 100%;
    height: 200px;
    display: block;
}

.animation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.animation-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.join-code-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: #fff4cc;
    color: #5c4400;
    border: 1px solid #e5cc72;
    font-size: 0.85rem;
    white-space: nowrap;
}

.join-code-badge strong {
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 0.95rem;
}

.join-code-badge-pending {
    background: #eef2ff;
    color: #243b78;
    border-color: #b8c5f2;
}

.join-code-badge-error {
    max-width: min(44ch, 55vw);
    background: #ffe4e4;
    color: #7a1616;
    border-color: #e5a4a4;
    white-space: normal;
}

.popout-btn {
    border: none;
    background: #eee;
    border-radius: 0.3rem;
    padding: 0.1rem 0.4rem;
    cursor: pointer;
}

.logout-mini-btn {
    font-size: 0.9rem;
    line-height: 1;
    padding: 0.12rem 0.38rem;
}

.error-box {
    background: #ffe0e0;
    padding: 0.5rem;
    border-left: 4px solid #d00;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* ============================================================
   TEACHER CONTROLS
============================================================ */

.teacher-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.control-block {
    display: grid;
    gap: 0.4rem;
    background: white;
    padding: 0.8rem;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.control-block input {
    padding: 0.4rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.control-block button {
    padding: 0.4rem;
    border-radius: 4px;
    border: none;
    background: #0078d4;
    color: white;
    cursor: pointer;
}

/* ============================================================
   DASHBOARD GRID
============================================================ */

.dashboard-grid {
    margin-top: 1rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    overflow-y: auto;
    min-height: 0;
}

.dashboard-grid > * {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* Make StudentList span full width of dashboard grid */
.dashboard-grid > .studentlist-fullwidth {
    grid-column: 1 / -1;
}

/* ============================================================
   ANSWERS PANEL
============================================================ */

.answers-panel {
    overflow-y: auto;
}

.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.answer-card {
    padding: 0.5rem;
    border-radius: 0.4rem;
    border: 1px solid #ddd;
    background: white;
    font-size: 0.85rem;
}

/* ============================================================
   PANEL COMPONENT (Unified)
============================================================ */

.panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.panel-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 600;
}

/* ============================================================
   TEXT HELPERS
============================================================ */

.muted {
    color: #777;
}

.small {
    font-size: 0.85rem;
}

/* ============================================================
   BUTTONS (Unified)
============================================================ */

.btn-primary {
    background: #0078d4;
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    border: 1px solid #0078d4;
    color: #0078d4;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
}

.btn-outline:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sent-tag {
    color: #0a8f00;
    font-weight: 600;
}

.mt {
    margin-top: 1rem;
}

/* ============================================================
   INPUTS (Unified)
============================================================ */

.input-area,
.input {
    width: 90%;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 1rem;
    resize: vertical;
}

/* ============================================================
   FILE INPUT
============================================================ */

.file-input {
    margin-top: 0.5rem;
}

/* ============================================================
   STATUS TEXT
============================================================ */

.status-text {
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.status-success {
    color: #0a8f00;
}

.status-error {
    color: #c62828;
}

/* ============================================================
   ANSWER LIST (AskQuestion + AnswerPreview)
============================================================ */

.answer-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.answer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid #eee;
}

.answer-row:last-child {
    border-bottom: none;
}

.answer-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.answer-right {
    color: #666;
    font-size: 0.9rem;
}

.duck-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
}

.away-tag {
    color: #d98c00;
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

/* ============================================================
   MCQ PREVIEW
============================================================ */

.info-box {
    background: #eef6ff;
    border: 1px solid #bcd9ff;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.mcq-preview {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

.mcq-preview li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0;
}

.mcq-letter {
    font-weight: 600;
}

.correct-tick {
    color: #0a8f00;
    font-weight: bold;
}

/* ============================================================
   MARKING PANEL
============================================================ */

.marking-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.marking-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid #eee;
}

.marking-row:last-child {
    border-bottom: none;
}

.marking-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.marking-answer {
    font-size: 0.95rem;
}

/* ============================================================
   QUEUE PANEL
============================================================ */

.queue-box {
    margin-bottom: 1rem;
}

.divider {
    border-bottom: 1px solid #eee;
    margin: 1rem 0;
}

/* ============================================================
   STUDENT LIST
============================================================ */

.count-badge {
    background: #555;
    color: #fff;
    padding: 0.2rem 0.55rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.student-table {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

.student-header,
.student-row {
    display: grid;
    grid-template-columns: 50px minmax(100px,200px) 120px 60px minmax(200px,4fr);
    align-items: center;
    padding: 0.4rem 0;
}

.student-header {
    font-weight: 600;
    border-bottom: 2px solid #ddd;
    margin-bottom: 0.4rem;
}

.student-row {
    border-bottom: 1px solid #eee;
}

.student-row-menu-open {
    background: rgba(9, 77, 117, 0.08);
}

.student-row:last-child {
    border-bottom: none;
}

.studentlist-fullwidth {
    position: relative;
}

.student-score-menu {
    position: fixed;
    z-index: 1000;
    display: grid;
    gap: 0.45rem;
    min-width: 140px;
    padding: 0.7rem;
    background: #fff;
    border: 1px solid #cdd8de;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.student-score-menu-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #27485a;
}

.student-score-menu-btn {
    border: 1px solid #7ea1b7;
    background: #f5fbff;
    color: #16384b;
    border-radius: 8px;
    padding: 0.45rem 0.65rem;
    text-align: left;
    cursor: pointer;
}

.student-score-menu-btn:hover {
    background: #e7f4fb;
}

.student-score-menu-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.status-tag {
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-connected {
    background: #0a8f00;
    color: white;
}

.status-away {
    background: #ffcc00;
    color: #333;
}

.status-disconnected {
    background: #999;
    color: white;
}

/* ============================================================
   MOBILE
============================================================ */

@media (max-width: 700px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar,
    .sidebar.expanded,
    .sidebar.collapsed {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        width: 100vw !important;
        min-width: 0 !important;
        max-width: 100vw !important;
        height: 60px;
        padding: 0.2rem 0.2rem;
        gap: 0.2rem;
    }

    .sidebar-controls {
        flex-direction: row;
        gap: 0.5rem;
        padding: 0.2rem;
        height: auto;
        overflow-x: auto;
        overflow-y: visible;
    }
}
.student-duck {
    width: 28px;
    height: auto;
    image-rendering: pixelated;
    border-radius: 4px;
}

