:root {
    --page-bg: #f4efe6;
    --panel-bg: rgba(255, 250, 243, 0.92);
    --panel-strong: #fff7ee;
    --ink: #17212b;
    --muted: #5d6b75;
    --line: rgba(23, 33, 43, 0.12);
    --accent: #0f766e;
    --accent-2: #c7672a;
    --accent-soft: #dff2ee;
    --danger: #a9382a;
    --shadow: 0 18px 50px rgba(38, 51, 64, 0.12);
}

html, body {
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 34%),
        radial-gradient(circle at bottom right, rgba(199, 103, 42, 0.18), transparent 32%),
        linear-gradient(180deg, #faf4eb 0%, #f4efe6 40%, #efe6d8 100%);
    color: var(--ink);
}

body {
    min-height: 100vh;
}

a, .btn-link {
    color: var(--accent);
}

a {
    text-decoration: none;
}

a:hover {
    color: #0b5a54;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem rgba(255,255,255,.6), 0 0 0 0.25rem rgba(15,118,110,.25);
}

.content {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

h1:focus {
    outline: none;
}

h1, h2, h3 {
    font-family: 'Noto Serif TC', 'PMingLiU', serif;
}

h1 {
    margin-bottom: 0.9rem;
}

p {
    line-height: 1.7;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.hero-panel,
.panel-shell,
.feature-card,
.login-card,
.winner-panel {
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 247, 237, 0.98), rgba(223, 242, 238, 0.82));
    border-radius: 28px;
    padding: 2rem;
    margin-bottom: 1.75rem;
}

.hero-copy,
.page-intro,
.prose-copy {
    color: var(--muted);
}

.eyebrow {
    margin-bottom: 0.7rem;
    color: var(--accent-2);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.78rem;
    font-weight: 700;
}

.hero-status {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.85rem 1.1rem;
    font-weight: 700;
}

.status-ok {
    background: rgba(15, 118, 110, 0.16);
    color: var(--accent);
}

.status-warn {
    background: rgba(199, 103, 42, 0.12);
    color: var(--accent-2);
}

.status-meta {
    color: var(--muted);
    font-size: 0.95rem;
}

.table-status-chip {
    padding: 0.38rem 0.72rem;
    font-size: 0.82rem;
}

.dashboard-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 1.5rem;
}

.two-col-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.feature-card {
    display: block;
    border-radius: 22px;
    background: var(--panel-bg);
    padding: 1.35rem;
    color: inherit;
    transition: transform .16s ease, border-color .16s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: rgba(15, 118, 110, 0.25);
}

.feature-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
    margin-bottom: 0.9rem;
}

.panel-shell,
.login-card {
    background: var(--panel-bg);
    border-radius: 24px;
    margin-bottom: 1.4rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem 0;
}

.panel-meta {
    color: var(--muted);
    font-size: 0.92rem;
}

.panel-subtitle {
    margin: 1.2rem 0 0.8rem;
    font-weight: 700;
    color: var(--accent-2);
}

.panel-body {
    padding: 1.2rem 1.25rem 1.25rem;
}

.notice-box {
    border-radius: 18px;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
}

.success-box {
    background: rgba(15, 118, 110, 0.1);
}

.warning-box {
    background: rgba(199, 103, 42, 0.1);
}

.danger-box {
    background: rgba(169, 56, 42, 0.1);
}

.filter-grid,
.compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.95rem;
    align-items: end;
}

.stack-form {
    display: grid;
    gap: 0.95rem;
}

.field-input {
    width: 100%;
    border: 1px solid rgba(23, 33, 43, 0.14);
    border-radius: 14px;
    padding: 0.72rem 0.85rem;
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink);
}

.field-input:focus {
    outline: 2px solid rgba(15, 118, 110, 0.25);
    border-color: rgba(15, 118, 110, 0.35);
}

.primary-action,
.ghost-button,
.preview-action,
.logout-button,
.inline-action {
    border-radius: 999px;
    padding: 0.72rem 1rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.primary-action {
    background: linear-gradient(135deg, var(--accent), #115e59);
    color: white;
}

.ghost-button,
.ghost-link,
.login-link,
.inline-action {
    background: rgba(255,255,255,0.8);
    border-color: rgba(23, 33, 43, 0.1);
    color: var(--ink);
}

.preview-action {
    background: rgba(199, 103, 42, 0.12);
    border-color: rgba(199, 103, 42, 0.28);
    color: #8f4b21;
}

.preview-action:hover {
    background: rgba(199, 103, 42, 0.18);
    border-color: rgba(199, 103, 42, 0.34);
    color: #7a3f1b;
}

.toolbar-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--accent);
    font-weight: 700;
}

.toolbar-link:hover {
    background: transparent;
    color: #0b5a54;
}

.danger-action {
    color: var(--danger);
}

.action-row,
.table-actions,
.shortcut-list,
.photo-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.table-shell {
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
}

.compact-shell {
    margin-top: 0.9rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.8rem 0.85rem;
    border-bottom: 1px solid rgba(23, 33, 43, 0.08);
    vertical-align: top;
}

.data-table th {
    background: rgba(15, 118, 110, 0.08);
    font-size: 0.9rem;
    white-space: nowrap;
}

.dense-table th,
.dense-table td {
    padding: 0.6rem 0.7rem;
}

.rare-character-display {
    display: grid;
    gap: 0.15rem;
    min-width: 5.5rem;
}

.rare-character-link {
    font-weight: 700;
    color: var(--accent-2);
    text-decoration: none;
}

.rare-character-code {
    font-size: 0.78rem;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

.rare-text-inline {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    line-height: 1.15;
    vertical-align: middle;
}

.rare-text-segment {
    white-space: pre-wrap;
}

.rare-text-glyph,
.rare-text-glyph-link {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    text-decoration: none;
}

.rare-text-glyph-image {
    width: auto;
    max-width: none;
    object-fit: contain;
    vertical-align: middle;
}

.photo-wall {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.photo-card {
    border-radius: 20px;
    overflow: hidden;
    background: var(--panel-strong);
    border: 1px solid var(--line);
}

.photo-frame {
    aspect-ratio: 4 / 5;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(199, 103, 42, 0.12));
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder {
    display: grid;
    place-items: center;
    height: 100%;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: var(--muted);
}

.photo-meta {
    padding: 0.9rem;
    display: grid;
    gap: 0.3rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
}

.badge-ok {
    background: rgba(15, 118, 110, 0.12);
    color: var(--accent);
}

.badge-off {
    background: rgba(169, 56, 42, 0.12);
    color: var(--danger);
}

.login-shell {
    display: grid;
    place-items: center;
    min-height: 70vh;
}

.login-card {
    width: min(100%, 560px);
    padding: 1.8rem;
}

.seating-grid,
.seating-editor-grid {
    display: grid;
    gap: 0.8rem;
}

.classroom-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.classroom-meta-strip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.classroom-shell {
    display: grid;
    gap: 0.85rem;
    min-width: fit-content;
}

.classroom-board-layout {
    display: grid;
    gap: 1rem;
}

.classroom-board-layout.with-roster {
    grid-template-columns: minmax(0, 1fr) minmax(112px, 132px);
    align-items: start;
}

.classroom-board-main {
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 0.35rem;
}

.classroom-stage {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(15, 118, 110, 0.16);
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.15), rgba(255, 255, 255, 0.9));
    color: var(--accent);
    font-weight: 700;
}

.classroom-middle {
    display: grid;
    gap: 0.85rem;
    align-items: stretch;
}

.classroom-middle-left {
    grid-template-columns: minmax(92px, 112px) minmax(0, 1fr);
}

.classroom-middle-right {
    grid-template-columns: minmax(0, 1fr) minmax(92px, 112px);
}

.classroom-aisle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.7rem;
    border-radius: 20px;
    padding: 0.8rem 0.65rem;
    background: rgba(15, 118, 110, 0.07);
    border: 1px dashed rgba(15, 118, 110, 0.22);
}

.classroom-aisle-track {
    flex: 1;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.45rem;
    text-align: center;
}

.classroom-aisle-label {
    color: var(--accent);
    font-weight: 700;
}

.classroom-door {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 999px;
    padding: 0.35rem 0.6rem;
    border: 1px solid rgba(23, 33, 43, 0.1);
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 700;
}

.classroom-seat-zone {
    position: relative;
    border-radius: 22px;
    padding: 1.2rem 0.3rem;
    background: rgba(255, 255, 255, 0.28);
    min-width: fit-content;
}

.classroom-origin {
    position: absolute;
    z-index: 1;
    padding: 0.24rem 0.55rem;
    border-radius: 999px;
    background: rgba(23, 33, 43, 0.88);
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
}

.classroom-seat-zone.origin-top .classroom-origin {
    top: 0.5rem;
}

.classroom-seat-zone.origin-bottom .classroom-origin {
    bottom: 0.5rem;
}

.classroom-seat-zone.origin-left .classroom-origin {
    left: 0.55rem;
}

.classroom-seat-zone.origin-right .classroom-origin {
    right: 0.55rem;
}

.seat-card,
.seat-editor-card {
    background: rgba(255,255,255,0.88);
    border-radius: 18px;
    border: 1px solid var(--line);
    padding: 0.85rem;
    min-height: 118px;
    display: grid;
    gap: 0.5rem;
}

.seat-editor-card {
    position: relative;
    overflow: visible;
    padding-top: 1rem;
}

.seat-disabled {
    background: rgba(254, 226, 226, 0.96);
    border-color: rgba(220, 38, 38, 0.34);
}

.seat-unassigned {
    background: rgba(255, 255, 255, 0.94);
}

.seat-assigned-male {
    background: rgba(219, 234, 254, 0.9);
    border-color: rgba(96, 165, 250, 0.24);
}

.seat-assigned-female {
    background: rgba(252, 231, 243, 0.92);
    border-color: rgba(244, 114, 182, 0.24);
}

.seat-assigned-neutral {
    background: rgba(236, 253, 245, 0.9);
    border-color: rgba(16, 185, 129, 0.2);
}

.seat-drop-target {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.16);
}

.seat-index {
    display: grid;
    gap: 0.15rem;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.25;
    margin-bottom: 0.5rem;
}

.seat-index-summary {
    color: var(--text);
    font-weight: 600;
}

.seat-index-sequence {
    font-size: 0.78rem;
}

.seat-name {
    font-weight: 700;
}

.seat-empty {
    color: var(--muted);
}

.seat-card .seat-name,
.seat-card .seat-meta,
.seat-card .seat-empty {
    width: 100%;
    justify-self: center;
    text-align: center;
}

.seat-meta,
.meta-line {
    color: var(--muted);
    font-size: 0.92rem;
}

.seat-card-actions {
    position: absolute;
    top: -0.55rem;
    left: -0.18rem;
    right: -0.18rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0;
    z-index: 3;
    pointer-events: none;
}

.seat-icon-button,
.seat-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border: 1px solid rgba(199, 103, 42, 0.18);
    background: rgba(255, 255, 255, 0.97);
    color: var(--ink);
    border-radius: 999px;
    padding: 0;
    flex: 0 0 auto;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.seat-toggle-button.is-disabled {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(254, 226, 226, 0.9);
    color: #991b1b;
}

.seat-drag-handle {
    cursor: grab;
}

.seat-drag-handle:active {
    cursor: grabbing;
}

.seat-student-drag {
    display: grid;
    gap: 0.35rem;
}

.seat-editor-card .seat-student-drag {
    justify-items: center;
    text-align: center;
}

.seat-editor-card .seat-name,
.seat-editor-card .seat-meta,
.seat-editor-card .seat-empty {
    width: 100%;
    justify-self: center;
    text-align: center;
}

.seat-action-icon {
    width: 0.82rem;
    height: 0.82rem;
    fill: currentColor;
    stroke: none;
}

.seat-drop-surface {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 0.9rem;
    text-align: center;
    color: var(--accent);
    font-weight: 700;
    background: rgba(15, 118, 110, 0.08);
    border: 2px dashed rgba(15, 118, 110, 0.24);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 120ms ease, background 120ms ease, border-color 120ms ease;
}

.seat-drop-surface.is-active {
    opacity: 1;
    background: rgba(15, 118, 110, 0.14);
    border-color: rgba(15, 118, 110, 0.48);
}

.format-options-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.format-option-card {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    padding: 0.75rem 0.85rem;
    border-radius: 16px;
    border: 1px solid rgba(23, 33, 43, 0.08);
    background: rgba(255, 255, 255, 0.82);
}

.classroom-roster-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.55rem;
    border-radius: 22px;
    border: 1px solid rgba(23, 33, 43, 0.08);
    background: rgba(255, 255, 255, 0.88);
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 8rem);
    overflow: hidden;
    min-width: 0;
}

.classroom-roster-header {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.classroom-roster-header h3 {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.15;
}

.classroom-roster-header .panel-meta {
    font-size: 0.7rem;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
}

.classroom-roster-sections {
    display: grid;
    gap: 0.55rem;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.1rem;
}

.roster-section {
    display: grid;
    gap: 0.35rem;
}

.classroom-roster-list {
    display: grid;
    gap: 0.4rem;
}

.classroom-roster-item,
.student-pool-item {
    display: grid;
    gap: 0.2rem;
    padding: 0.45rem 0.5rem;
    border-radius: 14px;
    border: 1px solid rgba(23, 33, 43, 0.08);
    background: rgba(243, 244, 246, 0.85);
    min-width: 0;
}

.classroom-roster-item.is-assigned {
    background: rgba(220, 252, 231, 0.72);
}

.classroom-roster-item.is-unassigned,
.student-pool-item {
    background: rgba(254, 243, 199, 0.6);
}

.classroom-roster-main {
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.classroom-roster-meta {
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.2;
}

.compact-meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.classroom-roster-empty {
    padding: 0.5rem;
    border-radius: 12px;
    color: var(--muted);
    background: rgba(243, 244, 246, 0.72);
    font-size: 0.72rem;
    line-height: 1.25;
    word-break: break-word;
}

.roster-dropzone {
    padding: 0.45rem 0.5rem;
    border-radius: 12px;
    border: 1px dashed rgba(15, 118, 110, 0.35);
    background: rgba(15, 118, 110, 0.06);
    color: var(--accent);
    font-size: 0.7rem;
    line-height: 1.25;
    font-weight: 600;
    text-align: center;
    white-space: normal;
    word-break: break-word;
}

.roster-dropzone-active {
    background: rgba(15, 118, 110, 0.14);
    border-color: rgba(15, 118, 110, 0.52);
}

.roster-status-chip {
    justify-self: start;
    padding: 0.18rem 0.45rem;
    font-size: 0.66rem;
    line-height: 1.1;
}

.roster-header-chip {
    justify-self: stretch;
    white-space: normal;
    text-align: center;
}

.seat-drag-handle[draggable="true"],
.student-pool-item[draggable="true"] {
    cursor: grab;
}

.seat-drag-handle[draggable="true"]:active,
.student-pool-item[draggable="true"]:active {
    cursor: grabbing;
}

.table-actions button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 1200px) {
    .classroom-board-layout.with-roster {
        grid-template-columns: 1fr;
    }

    .classroom-roster-panel {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 900px) {
    .classroom-board-layout.with-roster {
        grid-template-columns: 1fr;
    }

    .classroom-middle-left,
    .classroom-middle-right {
        grid-template-columns: 1fr;
    }
}

.transcript-class-groups {
    display: grid;
    gap: 1rem;
}

.transcript-class-group {
    border: 1px solid rgba(23, 33, 43, 0.08);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.86);
    padding: 1rem 1.1rem;
}

.transcript-class-group h3 {
    margin: 0 0 0.85rem;
    font-size: 1rem;
}

.transcript-class-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.transcript-class-option {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    padding: 0.75rem 0.85rem;
    border-radius: 16px;
    background: rgba(243, 244, 246, 0.8);
}

.classlist-option-row {
    width: fit-content;
}

.classlist-preview-stack {
    display: grid;
    gap: 1rem;
}

.classlist-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.drawlots-shell .panel-body {
    display: grid;
    gap: 1rem;
}

.drawlots-mode-links {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mode-link {
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(23, 33, 43, 0.1);
    background: rgba(255, 255, 255, 0.75);
    color: var(--text);
    text-decoration: none;
}

.mode-link.active {
    background: rgba(15, 118, 110, 0.14);
    border-color: rgba(15, 118, 110, 0.32);
    color: var(--accent);
    font-weight: 700;
}

.drawlots-settings-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.settings-card {
    border-radius: 20px;
    border: 1px solid rgba(23, 33, 43, 0.08);
    background: rgba(255, 255, 255, 0.86);
    padding: 1rem 1.1rem;
    box-shadow: 0 20px 48px rgba(17, 24, 39, 0.06);
}

.settings-card-title,
.table-shell-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
}

.compact-stack {
    gap: 0.8rem;
}

.option-inline {
    display: flex;
    gap: 0.65rem;
    align-items: center;
}

.option-inline.is-disabled {
    color: var(--muted);
}

.photo-permission-note {
    color: var(--muted);
    font-size: 0.92rem;
}

.drawlots-action-row {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.drawlots-board-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
}

.winner-panel {
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(15,118,110,0.1), rgba(255,255,255,0.78));
    padding: 1.2rem;
}

.drawlots-winner-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.winner-card {
    display: grid;
    gap: 0.8rem;
}

.score-badge {
    display: inline-flex;
    width: fit-content;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.12);
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 700;
}

.winner-card img {
    width: min(100%, 260px);
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 20px;
}

.winner-placeholder {
    padding: 1.4rem 0;
    color: var(--muted);
}

.empty-cell {
    text-align: center;
    color: var(--muted);
    padding: 1rem;
}

.score-cell {
    text-align: center;
    font-weight: 700;
}

.score-stepper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.compact-stepper {
    justify-content: flex-start;
}

.score-adjust-button {
    border: 1px solid rgba(15, 118, 110, 0.18);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    border-radius: 999px;
    min-width: 3rem;
    padding: 0.35rem 0.7rem;
    font-weight: 700;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.score-adjust-button:hover {
    border-color: rgba(15, 118, 110, 0.45);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.score-value {
    min-width: 3.25rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.12);
    color: var(--accent);
    font-weight: 700;
    text-align: center;
}

.group-results-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.group-card {
    border-radius: 22px;
    border: 1px solid rgba(23, 33, 43, 0.08);
    background: rgba(255, 255, 255, 0.92);
    overflow: hidden;
    box-shadow: 0 20px 48px rgba(17, 24, 39, 0.07);
}

.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.15), rgba(255, 255, 255, 0.85));
    font-weight: 700;
}

.group-student-list {
    list-style: none;
    margin: 0;
    padding: 0.8rem;
    display: grid;
    gap: 0.7rem;
}

.group-student-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.9rem;
    padding: 0.65rem 0.75rem;
    border-radius: 16px;
    background: rgba(243, 244, 246, 0.8);
}

.group-student-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.group-student-main img {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    object-fit: cover;
    flex-shrink: 0;
}

.group-student-main strong,
.group-student-main span {
    display: block;
}

.group-student-main span {
    color: var(--muted);
    font-size: 0.88rem;
}

.seat-chip {
    flex-shrink: 0;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.12);
    color: var(--accent);
    font-weight: 700;
}

.drawlots-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(10px);
}

.drawlots-modal-card {
    width: min(1040px, 100%);
    max-height: calc(100vh - 3rem);
    overflow: auto;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(237, 242, 247, 0.96));
    padding: 1.5rem;
    box-shadow: 0 36px 80px rgba(15, 23, 42, 0.3);
}

.drawlots-modal-title {
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    font-weight: 800;
    color: var(--text);
}

.drawlots-modal-copy {
    color: var(--muted);
    margin: 0.55rem 0 1rem;
}

.drawlots-rolling-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.rolling-student-card {
    display: grid;
    gap: 0.7rem;
    justify-items: center;
    text-align: center;
    padding: 1rem;
    border-radius: 24px;
    border: 2px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.12);
    animation: drawlots-float 0.95s ease-in-out infinite alternate;
}

.rolling-student-card.final {
    border-color: rgba(245, 158, 11, 0.65);
    animation: none;
}

.rolling-student-card.final .score-stepper {
    margin-top: 0.15rem;
}

.rolling-student-card img {
    width: min(100%, 160px);
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 20px;
}

.rolling-seat {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.12);
    color: var(--accent);
    font-weight: 700;
}

.modal-action-row {
    margin-top: 1rem;
    justify-content: center;
}

@keyframes drawlots-float {
    from {
        transform: translateY(-4px) scale(0.995);
    }

    to {
        transform: translateY(4px) scale(1.015);
    }
}

.shortcut-list a {
    display: inline-flex;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(23,33,43,.08);
}

.score-input {
    min-width: 90px;
}

@media (max-width: 920px) {
    .hero-panel {
        grid-template-columns: 1fr;
    }

    .drawlots-board-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hero-panel,
    .panel-body,
    .login-card {
        padding: 1rem;
    }

    .drawlots-modal-card {
        padding: 1rem;
    }

    .group-student-list li {
        align-items: flex-start;
    }

    .classlist-preview-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}