* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

a {
    color: #2563eb;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Top nav (shared) */
.nav {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 16px;
}
.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-logo {
    font-weight: 700;
    font-size: 18px;
}
.nav-logo a.wordmark { font-size: 24px; }
.nav-logo a {
    text-decoration: none;
    color: inherit;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}
.nav-links a {
    font-size: 14px;
}
.nav-theme-toggle {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: inherit;
}
.nav-theme-toggle:hover {
    opacity: 0.85;
}


/* Home */
.shell {
    min-height: calc(100vh - 48px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.card {
    width: 100%;
    max-width: 540px;
    background: #ffffff;
    border-radius: 18px;
    padding: 24px 20px 20px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
    border: 1px solid #e5e7eb;
}
h1 {
    margin: 0 0 6px;
    font-size: 24px;
}
.subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
}

.role-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}
.role-btn {
    flex: 1;
    border-radius: 999px;
    padding: 12px;
    text-align: center;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
}
.role-player {
    background: #2563eb;
    color: #eff6ff;
}
.role-host {
    background: #16a34a;
    color: #ecfdf5;
}

label {
    font-size: 13px;
    display: block;
    margin-top: 10px;
    margin-bottom: 2px;
}
input[type=text],
input[type=email],
input[type=password],
textarea {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
}
input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.4);
}

.btn {
    width: 100%;
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
}
.btn-primary {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #052e16;
}

.errors {
    margin-top: 6px;
    padding: 8px;
    border-radius: 8px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    font-size: 13px;
    color: #7f1d1d;
}
.errors li {
    margin-left: 18px;
}

.panel {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
}
.panel-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}
.small-note {
    margin-top: 10px;
    font-size: 12px;
    color: #6b7280;
}
.ad-strip {
    margin-top: 16px;
    font-size: 12px;
    color: #9ca3af;
    border-top: 1px solid #e5e7eb;
    padding-top: 8px;
}

/* Dashboard */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
header h1 {
    margin: 0;
}
header .sub {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}
.btn-small,
.btn-ghost {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
}
.btn-ghost {
    background: #ffffff;
    color: #111827;
    border: 1px solid #d1d5db;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.card-metric {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    padding: 16px 16px 18px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}
.card-metric h2 {
    margin: 0 0 6px;
    font-size: 15px;
}
.stat {
    font-size: 22px;
    font-weight: 600;
    margin-top: 4px;
}
.card-full {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    padding: 16px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
    margin-top: 8px;
}
.table-card {
    margin-top: 18px;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th, td {
    padding: 7px 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}
th {
    font-weight: 500;
    color: #6b7280;
}
tr:last-child td {
    border-bottom: none;
}
.code-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e5e7eb;
    font-size: 11px;
    color: #111827;
}
.empty {
    font-size: 13px;
    color: #6b7280;
}

/* Host view */
.host-shell {
    max-width: 900px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 18px 14px 28px;
}
.host-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
    border: 1px solid #e5e7eb;
}
.host-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    gap: 4px;
}
.status-waiting {
    background: #e5e7eb;
    color: #374151;
}
.status-active {
    background: #bbf7d0;
    color: #166534;
}
.status-completed {
    background: #fef9c3;
    color: #92400e;
}

/* Player view */
.player-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: #f3f4f6;
    color: #111827;
    display: flex;
    flex-direction: column;
}
.player-main {
    flex: 1;
    padding: 16px 16px 80px;
}
.player-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    border: 1px solid #e5e7eb;
}
.q-number {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 4px;
}
.q-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}
.option-btn {
    width: 100%;
    padding: 12px;
    border-radius: 999px;
    border: none;
    font-size: 16px;
    text-align: left;
    background: #e5e7eb;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
    cursor: pointer;
}
.option-btn span.label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.option-btn span.badge {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.option-btn.selected {
    background: #22c55e;
    color: #052e16;
}
.option-btn.selected span.badge {
    background: #bbf7d0;
}
.player-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    padding: 10px 16px 12px;
    background: linear-gradient(to top, #f3f4f6 70%, transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #6b7280;
}
.back-btn {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
}
.back-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.wait-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 10px;
}
.end-banner {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 10px;
}
.expired-banner {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 10px;
}
/* Nav buttons that look like chips (used for Login + Theme) */
.nav-links .nav-chip {
    margin-left: 14px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.nav-links .nav-chip:hover {
    opacity: 0.85;
}

/* Login modal */
.login-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.login-modal.active {
    display: flex;
}
.login-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
}
.login-modal-content {
    position: relative;
    z-index: 1;
    max-width: 380px;
    width: 90%;
    padding: 18px 18px 16px;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.5);
}

/* dark vs light background – override per theme */
.login-modal-content {
    background: #ffffff;
    border: 1px solid #e5e7eb;
}


/* Quizzalong wordmark (Lilita One, OFL) */
@font-face { font-family: "Lilita One"; src: url("fonts/LilitaOne-Regular.ttf") format("truetype"); font-display: swap; }
.wordmark { font-family: "Lilita One", Inter, system-ui, sans-serif; font-weight: 400; letter-spacing: .01em; text-decoration: none; }

.nav-logo a.logo img { height: 38px; width: auto; display: block; }
.hero-logo { display: block; width: min(560px, 90%); margin: 0 auto 10px; }

/* quiz-code autocomplete dropdown on the light theme */
html .ac-list { background: #fff; color: #111827; }
html .ac-list b { color: #b45309; }
html .ac-list li.on, html .ac-list li:hover { background: #2563eb; color: #fff; }
html .ac-list li.on b, html .ac-list li:hover b { color: #fde68a; }

/* the account menu's drop-down (css/site.css) */
:root { --qa-menu-bg: #ffffff; }
