:root {
    --bg: #f6f8fb;
    --card: #fff;
    --ink: #182235;
    --muted: #65738a;
    --primary: #4f7cff;
    --primary2: #7c4dff;
    --ok: #0aa77f;
    --danger: #e94b64;
    --line: #dfe6f3;
    --soft: #edf3ff
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: Inter, Segoe UI, Arial, sans-serif;
    background: linear-gradient(135deg, #f9fbff, #eef5ff);
    color: var(--ink)
}

a {
    color: var(--primary);
    text-decoration: none
}

.topbar {
    height: 64px;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 5
}

.brand {
    font-weight: 800;
    color: var(--ink)
}

nav a {
    margin-left: 18px
}

.container {
    max-width: 1180px;
    margin: 30px auto;
    padding: 0 20px
}

.container-fluid {
    max-width: 1500px;
    margin: 24px auto;
    padding: 0 18px
}

.hero {
    min-height: calc(100vh - 64px);
    display: grid;
    place-items: center;
    padding: 40px 20px
}

.hero h1 {
    font-size: clamp(38px, 7vw, 74px);
    line-height: 1;
    margin: 0 0 18px
}

.hero p {
    font-size: 20px;
    color: var(--muted)
}

.cards {
    display: grid;
    gap: 22px
}

.cards.two {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 18px 45px rgba(45, 70, 120, .08);
    padding: 24px
}

.narrow {
    max-width: 520px;
    margin: 40px auto
}

.biglink {
    display: block;
    color: var(--ink);
    transition: .2s
}

.biglink:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 55px rgba(79, 124, 255, .15)
}

.biglink span {
    font-size: 44px
}

label {
    display: block;
    font-weight: 700;
    margin: 12px 0 6px
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 13px 14px;
    font: inherit;
    background: #fff
}

textarea {
    resize: vertical
}

button,
.btn {
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: #fff;
    font-weight: 800;
    padding: 12px 16px;
    cursor: pointer;
    display: inline-block;
    margin-top: 10px
}

button:disabled {
    opacity: .45;
    cursor: not-allowed
}

.ghost {
    background: #eef3ff;
    color: var(--primary)
}

.danger {
    background: var(--danger) !important
}

.flash {
    max-width: 900px;
    margin: 16px auto;
    padding: 0 20px
}

.flash div {
    background: #fff2c4;
    border: 1px solid #ffe08a;
    border-radius: 14px;
    padding: 12px
}

.inline {
    display: flex;
    gap: 10px;
    align-items: end
}

.folder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    margin: 10px 0;
    background: #fbfdff
}

.tilegrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px
}

.tile {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(45, 70, 120, .06);
    overflow: hidden
}

.badge {
    display: inline-block;
    background: var(--soft);
    color: var(--primary);
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 800;
    font-size: 12px
}

.latex-help {
    background: #f7f9ff;
    border: 1px dashed #b8c7ef;
    border-radius: 16px;
    padding: 12px;
    color: var(--muted);
    margin: 10px 0
}

.preview,
.task-view {
    min-height: 80px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    margin: 12px 0
}

.student-head,
.control-head {
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap
}

.room-code {
    font-size: 34px;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 4px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px 20px
}

.giant {
    font-size: 54px
}

.paper {
    max-width: 920px;
    margin: 20px auto
}

.waiting {
    text-align: center;
    font-size: 24px;
    color: var(--muted);
    padding: 90px 20px
}

.tabs button {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    margin-right: 8px
}

.tabs .active {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: #fff
}

.layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px
}

.dropbank,
.drop-zone {
    min-height: 85px;
    border: 2px dashed #c7d3ea;
    border-radius: 18px;
    background: #f9fbff;
    padding: 12px;
    margin: 10px 0
}

.students {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px
}

.student-card {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    padding: 14px
}

.student-card.inactive {
    opacity: .55
}

.student-card h3 {
    margin: 0 0 8px
}

.chip {
    border-radius: 16px;
    border: 1px solid var(--line);
    padding: 12px;
    margin: 8px 0;
    background: #fff;
    box-shadow: 0 6px 18px rgba(45, 70, 120, .07);
    cursor: grab
}

.chip.task {
    border-left: 7px solid var(--ok)
}

.chip.paper {
    border-left: 7px solid var(--primary)
}

.chip .kind {
    font-size: 11px;
    font-weight: 900;
    color: var(--muted);
    text-transform: uppercase
}

.type-picks {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0
}

.type-pick {
    width: 86px;
    height: 64px;
    border: 2px solid var(--line);
    border-radius: 16px;
    background: #fff;
    cursor: pointer
}

.type-pick.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px #dfe8ff
}

canvas {
    max-width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px
}

.mini-graph {
    height: 180px
}

.mini-graph.big {
    height: 360px
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 31, 52, .45);
    z-index: 10;
    align-items: center;
    justify-content: center;
    padding: 20px
}

.modal.open {
    display: flex
}

.modal-box {
    background: #fff;
    border-radius: 24px;
    padding: 24px;
    max-width: 860px;
    max-height: 86vh;
    overflow: auto;
    width: 100%;
    position: relative
}

.close {
    position: absolute;
    right: 16px;
    top: 10px;
    background: #eef3ff;
    color: #182235
}

.entries-table {
    display: flex;
    gap: 16px;
    overflow: auto;
    padding: 14px 0
}

.paper-column {
    min-width: 260px;
    background: #f9fbff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px
}

.entry-cell {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    margin: 10px 0;
    padding: 10px
}

.author {
    font-size: 12px;
    color: var(--muted);
    font-weight: 800
}

.presentation {
    background: white
}

.presentation-paper {
    break-inside: avoid;
    margin-bottom: 22px
}

.presentation-entry {
    padding: 18px;
    border-bottom: 1px solid var(--line)
}

.muted {
    color: var(--muted)
}

.room-small {
    font-size: 28px;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 3px
}

@media(max-width:900px) {
    .layout {
        grid-template-columns: 1fr
    }

    .inline {
        display: block
    }

    .giant {
        font-size: 38px
    }
}