:root {
    --bg: #f6f8fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d8dee9;
    --primary: #1f4f82;
    --primary-dark: #173b61;
    --secondary: #eef3f8;
    --success: #1f7a4d;
    --warning: #a16207;
    --danger: #9f1239;
    --shadow: 0 12px 32px rgba(31, 41, 55, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
    line-height: 1.7;
}

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

a:hover {
    text-decoration: underline;
}

.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.brand {
    color: var(--text);
    font-weight: 700;
    font-size: 18px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.page-heading h1 {
    margin: 0 0 6px;
    font-size: clamp(26px, 4vw, 36px);
    line-height: 1.25;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.video-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.video-card h2 {
    margin: 0;
    font-size: 20px;
}

.video-card p {
    margin: 0;
    color: var(--muted);
}

.video-card__meta {
    color: var(--muted);
    font-size: 14px;
}

.primary-button,
.secondary-button,
button.primary-button,
button.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 10px 18px;
    border: 0;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
}

.primary-button {
    background: var(--primary);
    color: #ffffff;
}

.primary-button:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.secondary-button {
    background: var(--secondary);
    color: var(--primary);
}

.secondary-button:hover {
    text-decoration: none;
}

.inline-form {
    display: inline;
    margin: 0;
}

.link-button {
    background: transparent;
    border: 0;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.danger-link {
    color: var(--danger);
}

.progress {
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.progress--large {
    height: 14px;
}

.progress__bar {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 160ms ease;
}

.video-player {
    width: 100%;
    max-height: 70vh;
    background: #111827;
    border-radius: 14px;
}

.watch-status,
.viewer-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 18px 0 12px;
    align-items: center;
}

.identity-card {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.recent-student-section {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
}

.recent-student-section h3,
.form-stack h3 {
    margin: 0;
    font-size: 17px;
}

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

.student-choice-button {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 14px 16px;
    text-align: left;
}

.student-choice-button:hover {
    border-color: var(--primary);
    background: var(--secondary);
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.label {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.note-card {
    margin-top: 20px;
}

.note-card h2 {
    margin-top: 0;
    font-size: 18px;
}

.muted,
.help-text {
    color: var(--muted);
}

.help-text {
    font-size: 13px;
    font-weight: 400;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 12px 10px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.table-progress {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 48px;
    align-items: center;
    gap: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 700;
}

.badge--done {
    color: var(--success);
    background: #dcfce7;
}

.badge--partial {
    color: var(--warning);
    background: #fef3c7;
}

.badge--none {
    color: var(--muted);
    background: #f3f4f6;
}

.auth-card {
    max-width: 420px;
    margin: 48px auto;
}

.form-card {
    max-width: 720px;
}

.form-stack {
    display: grid;
    gap: 16px;
}

.form-stack label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.form-stack input,
.form-stack textarea,
.form-stack select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
}

.form-stack input[type="checkbox"] {
    width: auto;
    justify-self: start;
}

.error-text {
    color: var(--danger);
    font-weight: 700;
}

.empty-state {
    text-align: center;
}

.qr-thumbnail {
    width: 88px;
    height: 88px;
    display: block;
    background: #fff;
}

.qr-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
}

.qr-large {
    width: 220px;
    height: 220px;
    background: #fff;
    flex: 0 0 auto;
}

@media (max-width: 640px) {
    .site-header__inner,
    .page-heading,
    .qr-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .container {
        padding: 24px 14px 48px;
    }

    .card {
        padding: 18px;
        border-radius: 14px;
    }

    .qr-large {
        width: 180px;
        height: 180px;
    }
}
