/* Global / layout */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #020617; /* very dark */
    color: #e5e7eb;
}

a {
    color: #93c5fd;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Top nav (shared) */
.nav {
    background: #020617;            /* in light theme, use #ffffff instead */
    border-bottom: 1px solid #1f2937; /* in light theme, use #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 #4b5563;   /* light: #d1d5db */
    background: #020617;         /* light: #f9fafb */
    color: inherit;
    text-decoration: none;
}
.nav-theme-toggle:hover {
    opacity: 0.85;
}


/* Home / index */
.shell {
    min-height: calc(100vh - 48px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.card {
    width: 100%;
    max-width: 540px;
    background: #020617;
    border-radius: 18px;
    padding: 24px 20px 20px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.4);
}
h1 {
    margin: 0 0 6px;
    font-size: 24px;
}
.subtitle {
    font-size: 14px;
    color: #9ca3af;
    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: #1d4ed8;
    color: #eff6ff;
}
.role-host {
    background: #22c55e;
    color: #022c22;
}

label {
    font-size: 13px;
    display: block;
    margin-top: 10px;
    margin-bottom: 2px;
}
input[type=text],
input[type=email],
input[type=password] {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #e5e7eb;
}
input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 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: #022c22;
}

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

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

/* Dashboard */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}
.page-header,
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.page-title,
header h1 {
    margin: 0;
    font-size: 24px;
}
.page-subtitle,
header .sub {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 4px;
}
.btn-small {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
}
.btn-ghost {
    background: transparent;
    color: #e5e7eb;
    border: 1px solid #4b5563;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.card-metric {
    background: #020617;
    border-radius: 16px;
    border: 1px solid #1f2937;
    padding: 16px 16px 18px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}
.card-metric h2 {
    margin: 0 0 6px;
    font-size: 15px;
}
.stat {
    font-size: 22px;
    font-weight: 600;
    margin-top: 4px;
}
.card-full {
    background: #020617;
    border-radius: 16px;
    border: 1px solid #1f2937;
    padding: 16px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
    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 #1f2937;
    text-align: left;
}
th {
    font-weight: 500;
    color: #9ca3af;
}
tr:last-child td {
    border-bottom: none;
}
.code-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #111827;
    font-size: 11px;
    color: #e5e7eb;
}
.empty {
    font-size: 13px;
    color: #9ca3af;
}

/* Host view in play.php */
.host-shell {
    max-width: 900px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 18px 14px 28px;
}
.host-card {
    background: #020617;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.4);
}
.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: #111827;
    color: #e5e7eb;
}
.status-active {
    background: #14532d;
    color: #bbf7d0;
}
.status-completed {
    background: #1f2937;
    color: #facc15;
}

/* Player view in play.php */
.player-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: #020617;
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
}
.player-main {
    flex: 1;
    padding: 16px 16px 80px;
}
.player-card {
    background: #020617;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
}
.q-number {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    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: #1e293b;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.5);
    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: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.option-btn.selected {
    background: #22c55e;
    color: #0f172a;
}
.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, #020617 70%, transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #9ca3af;
}
.back-btn {
    border-radius: 999px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #e5e7eb;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
}
.back-btn:disabled {
    opacity: 0.35;
    border-color: #374151;
    cursor: default;
}

.wait-banner {
    background: #1f2937;
    border: 1px solid #60a5fa;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 10px;
}
.end-banner {
    background: #451a03;
    border: 1px solid #f97316;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 10px;
}
.expired-banner {
    background: #1f2937;
    border: 1px solid #9ca3af;
    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: #020617;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

/* 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; }
