html,
body {
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    font: 400 16px Calibri, Arial, Helvetica, sans-serif;
    color: #333;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
}

.page {
    max-width: 1100px;
    margin: auto;
    padding: 20px;
}

.site-header {
    background-color: rgb(143, 204, 255);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 25px;
    border-radius: 12px;
    margin-bottom: 40px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-container img {
    height: 75px;
    width: auto;
}

.site-header nav {
    display: flex;
    gap: 20px;
}

.site-header nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
}

.site-header nav a:hover {
    text-decoration: underline;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #008ce9;
}

h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.accent {
    color: rgb(143, 204, 255);
}

p {
    color: #333;
    line-height: 1.6;
}

.hero-actions,
.form-actions,
.results-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.buzzer {
    background-color: #008ce9;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-size: 1rem;
}

.buzzer:hover {
    background-color: #0070bb;
}

.buzzer--ghost {
    background-color: white;
    color: #008ce9;
    border: 2px solid #008ce9;
}

.buzzer--ghost:hover {
    background-color: #008ce9;
    color: white;
}

.buzzer--mint {
    background-color: #28a745;
}

.buzzer--mint:hover {
    background-color: #208838;
}

.panel {
    background-color: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-bottom: 15px;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #008ce9;
}

.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.error-message {
    color: red;
    margin-top: 10px;
}

.file-input-hidden {
    display: none;
}

.questions-table {
    width: 100%;
    border-collapse: collapse;
}

.questions-table th {
    background-color: #008ce9;
    color: white;
}

.questions-table th,
.questions-table td {
    padding: 12px;
    border: 1px solid #ddd;
}

.questions-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.empty-state {
    padding: 20px;
    color: #666;
}

.quiz-progress {
    margin-bottom: 20px;
}

.scoreboard {
    display: inline-block;
    background-color: #008ce9;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
}

.progress-track {
    width: 100%;
    height: 12px;
    background-color: #ddd;
    border-radius: 10px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #008ce9;
}

.question-card {
    text-align: left;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.score-hero {
    text-align: center;
}

.score-value {
    display: block;
    font-size: 4rem;
    font-weight: bold;
    color: #008ce9;
}

.score-label {
    color: #666;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.stats-grid>* {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.results-list>* {
    background: #f8f8f8;
    padding: 15px;
    border-radius: 8px;
}

.muted {
    color: #777;
}

@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
        gap: 15px;
    }
    .site-header nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    h1 {
        font-size: 2rem;
    }
    .hero-actions,
    .form-actions,
    .results-actions {
        justify-content: center;
    }
}

body {
    animation: pageFadeIn 0.45s ease both;
}

.site-header {
    animation: slideDown 0.45s ease both;
}

.site-header nav a,
.buzzer,
input[type="text"],
input[type="password"],
.panel,
.answer-row,
.option-item {
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.site-header nav a:hover,
.buzzer:hover,
.answer-row:hover,
.option-item:hover {
    transform: translateY(-2px);
}

.buzzer:hover {
    box-shadow: 0 8px 18px rgba(0, 140, 233, 0.2);
}

.panel,
.community-filters,
.leaderboard,
.quiz-grid {
    animation: riseIn 0.45s ease both;
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1);
}

input[type="text"]:focus,
input[type="password"]:focus {
    box-shadow: 0 0 0 3px rgba(0, 140, 233, 0.14);
}

.segmented-control {
    display: inline-flex;
    gap: 6px;
    padding: 5px;
    background: #eef6ff;
    border: 1px solid #c9e5fb;
    border-radius: 10px;
    margin-bottom: 15px;
}

.segment {
    border: 0;
    background: transparent;
    color: #008ce9;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    padding: 10px 14px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.segment:hover,
.segment.is-active {
    background: #008ce9;
    color: white;
    transform: translateY(-1px);
}

.answer-row {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 12px;
    background: #fafafa;
}

.answer-row.is-correct,
.option-item.is-selected {
    border-color: #28a745;
    background: #eefaf1;
}

.progress-fill {
    transition: width 0.25s ease;
}

.logout-btn {
    margin-top: 18px;
}

.quiz-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.buzzer--danger {
    background-color: #dc3545;
    color: white;
}

.buzzer--danger:hover {
    background-color: #b02a37;
}

.quiz-grid .community-filters {
    background: #f4f8fb;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
    box-shadow: none;
}

.quiz-grid .community-filters h3 {
    margin: 0 0 10px 0;
    font-size: 13px;
    text-transform: uppercase;
    color: #777;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.community-page {
    display: grid;
    gap: 22px;
}

.community-filters,
.leaderboard,
.quiz-grid {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tag-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tag-item,
.tag-badge {
    border: 1px solid #c9e5fb;
    border-radius: 999px;
    background: #eef6ff;
    color: #008ce9;
    font-weight: bold;
}

.tag-item {
    cursor: pointer;
    padding: 9px 14px;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.tag-item:hover,
.tag-item.selected {
    background: #008ce9;
    color: white;
    transform: translateY(-2px);
}

.tag-badge {
    display: inline-flex;
    padding: 5px 9px;
    font-size: 0.82rem;
}

.community-content {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.leaderboard-item:hover {
    border-color: #008ce9;
    transform: translateX(3px);
}

.leaderboard-rank,
.quiz-stats strong {
    color: #008ce9;
    font-weight: bold;
}

.leaderboard-name {
    font-weight: bold;
}

.leaderboard-score,
.leaderboard-rate,
.quiz-card__date,
.quiz-author {
    color: #666;
    font-size: 0.9rem;
}

.quiz-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.quiz-card {
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.quiz-card:hover {
    border-color: #008ce9;
    box-shadow: 0 10px 22px rgba(0, 140, 233, 0.14);
    transform: translateY(-4px);
}

.quiz-card h3,
.quiz-card p {
    margin: 0;
}

.quiz-card h3 {
    font-size: 1.15rem;
}

.quiz-card__top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.quiz-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.quiz-stats span {
    background: #f4f8fb;
    border-radius: 10px;
    padding: 10px;
}

.quiz-stats strong,
.quiz-stats small {
    display: block;
}

.quiz-stats strong {
    font-size: 1.2rem;
}

.quiz-stats small {
    color: #666;
}

.quiz-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .community-content {
        grid-template-columns: 1fr;
    }
    .quiz-cards {
        grid-template-columns: 1fr;
    }
    .segmented-control {
        width: 100%;
    }
    .segment {
        flex: 1;
    }
}

@media (min-width: 769px) and (max-width: 1050px) {
    .quiz-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}