:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.12);
    --text: #1e293b;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.2);
    --error: #dc2626;
    --success: #16a34a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

main {
    width: min(1100px, 92vw);
    margin: 0 auto;
    padding: 3rem 0 4rem;
}

h1, h2, h3 {
    font-weight: 600;
}

a {
    color: inherit;
    text-decoration: none;
}

a.button, button, input[type="submit"] {
    cursor: pointer;
    border: none;
    border-radius: 14px;
    padding: 0.75rem 1.4rem;
    background: var(--accent);
    color: white;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

a.button:hover, button:hover, input[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(76, 110, 245, 0.25);
}

.logout-button {
    background: #dc2626;
    color: #ffffff;
}

.logout-button:hover {
    background: #b91c1c;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
}

.search-section {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-bar input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: #f8fafc;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.08);
}

.search-bar.prominent {
    padding: 0.25rem 0;
}

.search-bar.prominent input {
    font-size: 1.35rem;
    padding: 1.3rem 1.75rem;
    border-radius: 20px;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.search-results {
    display: grid;
    gap: 1rem;
}

.search-result-card {
    margin: 0;
    padding: 1.25rem 1.5rem;
}

.search-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.button.ghost,
button.ghost,
input[type="submit"].ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(37, 99, 235, 0.4);
    box-shadow: none;
}

.button.ghost:hover,
button.ghost:hover,
input[type="submit"].ghost:hover {
    background: rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
    box-shadow: none;
}

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.input-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

input[type="text"], select {
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    padding: 0.75rem 1rem;
    color: var(--text);
    width: 100%;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

nav .actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th, .table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.table th {
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.timer-bar {
    position: relative;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(76, 110, 245, 0.15);
}

.timer-bar span {
    position: absolute;
    inset: 0;
    background: var(--accent);
    transform-origin: left;
    transition: transform linear;
}

.choice {
    padding: 1rem 1.25rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: #f8fafc;
    color: var(--text);
    cursor: pointer;
    transition: border 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.choice-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
}

.choice-image {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: #fff;
}

.choice-label {
    display: inline-block;
    font-weight: 600;
    line-height: 1.3;
}

.choice:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.12);
}

.choice.selected {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.12);
}

.choice.correct {
    border-color: var(--success);
    background: rgba(22, 163, 74, 0.12);
}

.choice.incorrect {
    border-color: var(--error);
    background: rgba(220, 38, 38, 0.12);
}

.question-media {
    margin-top: 1rem;
    text-align: center;
}

.question-media img {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: #fff;
    padding: 0.5rem;
}

.mistakes {
    display: grid;
    gap: 0.75rem;
}

.mistakes li {
    list-style: none;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(241, 245, 249, 0.6);
}

.choice-status {
    margin-top: 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
}

.choice-status--correct {
    color: var(--success);
}

.choice-status--incorrect {
    color: var(--text-muted);
}

.choice-grid {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0;
}

.choice-result {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.65);
}

.choice-result img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: #fff;
}

.choice-result--correct {
    border-color: var(--success);
    background: rgba(22, 163, 74, 0.12);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.badge.Bronze { background: linear-gradient(135deg, #f97316, #f59e0b); }
.badge.Silver { background: linear-gradient(135deg, #9ca3af, #d1d5db); }
.badge.Gold { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.badge.Platinum { background: linear-gradient(135deg, #60a5fa, #a855f7); }
.badge.Diamond { background: linear-gradient(135deg, #38bdf8, #22d3ee); }
.badge.Master { background: linear-gradient(135deg, #f472b6, #a855f7); }

@media (max-width: 640px) {
    main {
        padding-top: 2rem;
    }

    nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
