@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #000;
    --bg-card: rgba(14, 14, 14, 0.94);
    --fg: #ecedee;
    --fg-muted: #a1a1aa;
    --content1: #0a0a0a;
    --content2: #0f0f0f;
    --content3: #141414;
    --content4: #1a1a1a;
    --divider: rgba(255, 255, 255, 0.06);
    --divider-strong: rgba(255, 255, 255, 0.12);
    --primary: #4d8eff;
    --radius: 14px;
    --radius-sm: 10px;
}

html {
    color-scheme: dark;
    background:
        radial-gradient(60% 40% at 50% -10%, rgba(77, 142, 255, 0.1), transparent),
        radial-gradient(40% 35% at 80% 20%, rgba(77, 142, 255, 0.05), transparent),
        radial-gradient(35% 30% at 15% 60%, rgba(77, 142, 255, 0.04), transparent),
        radial-gradient(45% 40% at 70% 80%, rgba(77, 142, 255, 0.03), transparent),
        linear-gradient(#0a0a0a, #000);
    background-attachment: fixed;
    min-height: 100%;
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: transparent;
    color: var(--fg);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Landing page */
main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 20px;
}

.landing-card {
    background: var(--bg-card);
    border: 1px solid var(--divider);
    border-radius: 16px;
    padding: 36px 20px 28px;
    overflow: visible;
    width: 416px;
    max-width: 100%;
    text-align: center;
    box-shadow: rgba(255, 255, 255, 0.02) 0px 0px 0px 1px inset, rgba(0, 0, 0, 0.35) 0px 24px 48px 0px;
    backdrop-filter: blur(16px);
}

.logo {
    width: 80px;
    height: auto;
    margin: 0 auto 18px;
    display: block;
}

h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.tld {
    color: #4d8eff;
    text-shadow: 0 0 8px rgba(77, 142, 255, 0.6), 0 0 20px rgba(77, 142, 255, 0.3);
}

.tagline {
    color: var(--fg-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.landing-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.landing-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: var(--fg-muted);
}

.landing-links a {
    transition: opacity 0.15s;
}

.landing-links a:hover {
    opacity: 0.8;
}

.link-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 24px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.8;
}

.btn-secondary {
    background: transparent;
    color: var(--fg);
    border: 2px solid var(--divider-strong);
}

.btn-secondary:hover {
    opacity: 0.8;
}

.btn-full {
    width: 100%;
}

/* Auth pages (login/register) */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--divider);
    border-radius: 16px;
    padding: 28px 20px;
    width: 416px;
    max-width: 100%;
    box-shadow: rgba(255, 255, 255, 0.02) 0px 0px 0px 1px inset, rgba(0, 0, 0, 0.35) 0px 24px 48px 0px;
    backdrop-filter: blur(16px);
}

.auth-card .logo {
    width: 56px;
    margin-bottom: 20px;
}

.auth-card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--fg);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--fg-muted);
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--content2);
    border: 1px solid var(--divider);
    border-radius: var(--radius-sm);
    color: var(--fg);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: rgba(255, 255, 255, 0.2);
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--fg-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    font-family: inherit;
}

.toggle-password:hover {
    color: var(--fg);
}

.forgot-link {
    display: block;
    text-align: right;
    font-size: 0.8rem;
    color: var(--fg-muted);
    margin-bottom: 20px;
    transition: opacity 0.15s;
}

.forgot-link:hover {
    opacity: 0.8;
}

.auth-card .btn {
    width: 100%;
    margin-top: 8px;
}

.auth-switch {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--fg-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}

.auth-switch:hover {
    opacity: 0.8;
}

/* Legal pages (tos/privacy) */
.legal-wrapper {
    max-width: 720px;
    margin: 0 auto;
    padding: 60px 24px 80px;
}

.legal-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-muted);
    margin-bottom: 12px;
}

.legal-wrapper h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: left;
}

.legal-date {
    font-size: 0.85rem;
    color: var(--fg-muted);
    margin-bottom: 32px;
}

.legal-intro {
    color: var(--fg-muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
    line-height: 1.7;
}

.legal-wrapper h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
}

.legal-wrapper p {
    color: var(--fg-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.7;
}

.legal-wrapper ul {
    list-style: none;
    padding: 0;
    margin-bottom: 16px;
}

.legal-wrapper ul li {
    color: var(--fg-muted);
    font-size: 0.9rem;
    line-height: 1.7;
    padding-left: 16px;
    position: relative;
    margin-bottom: 4px;
}

.legal-wrapper ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 4px;
    height: 4px;
    background: var(--fg-muted);
    border-radius: 50%;
}

.legal-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fg-muted);
    font-size: 0.85rem;
    margin-bottom: 32px;
    transition: opacity 0.15s;
}

.legal-back:hover {
    opacity: 0.8;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    font-size: 0.8rem;
    color: var(--fg-muted);
}

.site-footer {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Topbar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.85);
    border-bottom: 1px solid var(--divider);
    backdrop-filter: blur(16px);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
}

.topbar-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--content3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-muted);
}

.topbar-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.topbar-username {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fg);
}

.topbar-rank {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    text-shadow: 0 0 6px rgba(77, 142, 255, 0.4);
}

.topbar-logout {
    background: none;
    border: none;
    color: var(--fg-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.topbar-logout:hover {
    color: var(--fg);
}

/* Dashboard */
.dash-main {
    padding-top: 56px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-content {
    text-align: center;
}

.dash-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.dash-sub {
    color: var(--fg-muted);
    font-size: 0.9rem;
}

.rank-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(77, 142, 255, 0.15);
    color: var(--primary);
    text-shadow: 0 0 6px rgba(77, 142, 255, 0.4);
}

/* Turnstile captcha */
.cf-turnstile {
    margin: 12px 0 4px;
}

/* Auth error */
.auth-error {
    color: #ff4d4d;
    font-size: 0.8rem;
    margin-bottom: 8px;
    min-height: 1.2em;
}

/* Topbar button */
.btn-topbar {
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    padding: 6px 14px;
    border-radius: 8px;
    background: var(--content3);
    border: 1px solid var(--divider);
    color: var(--fg-muted);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-topbar:hover, .btn-topbar.active {
    background: rgba(77, 142, 255, 0.15);
    color: var(--primary);
    border-color: rgba(77, 142, 255, 0.3);
}

.topbar-time {
    font-size: 0.6rem;
    color: var(--fg-muted);
}

.dash-time-big {
    color: var(--fg-muted);
    font-size: 0.85rem;
    margin-top: 12px;
}

/* Admin panel */
.admin-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 80px 20px 40px;
}

.admin-section {
    margin-bottom: 32px;
}

.admin-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 14px;
}

.key-create {
    display: flex;
    gap: 10px;
    align-items: center;
}

.key-create .btn {
    height: 40px;
    padding: 0 20px;
    font-size: 0.8rem;
}

.admin-select {
    padding: 8px 12px;
    background: var(--content2);
    border: 1px solid var(--divider);
    border-radius: 8px;
    color: var(--fg);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}

.admin-select option {
    background: var(--content1);
}

.admin-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--content2);
    border: 1px solid var(--divider);
    border-radius: 8px;
    color: var(--fg);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}

.key-result {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--content2);
    border: 1px solid var(--divider);
    border-radius: 8px;
}

.key-result span {
    font-family: ui-monospace, monospace;
    font-size: 0.9rem;
    color: var(--primary);
    text-shadow: 0 0 6px rgba(77, 142, 255, 0.4);
}

.btn-copy {
    font-size: 0.75rem;
    font-family: inherit;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--content3);
    border: 1px solid var(--divider);
    color: var(--fg-muted);
    cursor: pointer;
}

.btn-copy:hover {
    color: var(--fg);
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fg-muted);
    border-bottom: 1px solid var(--divider);
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--divider);
    color: var(--fg);
}

.admin-table .mono {
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
}

.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-sm {
    font-size: 0.7rem;
    font-family: inherit;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--content3);
    border: 1px solid var(--divider);
    color: var(--fg-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-sm:hover {
    color: var(--fg);
    background: var(--content4);
}

.btn-sm.btn-warn {
    color: #f59e0b;
}

.btn-sm.btn-warn:hover {
    background: rgba(245, 158, 11, 0.1);
}

.btn-sm.btn-danger {
    color: #ff4d4d;
}

.btn-sm.btn-danger:hover {
    background: rgba(255, 77, 77, 0.1);
}

.status-active {
    color: #34d399;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-banned {
    color: #ff4d4d;
    font-size: 0.8rem;
    font-weight: 600;
}

.rank-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(77, 142, 255, 0.15);
    color: var(--primary);
    text-shadow: 0 0 6px rgba(77, 142, 255, 0.4);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-card {
    background: var(--content1);
    border: 1px solid var(--divider);
    border-radius: 14px;
    padding: 24px;
    min-width: 300px;
    max-width: 400px;
}

.modal-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-card .btn {
    height: 40px;
    font-size: 0.85rem;
}

@media (max-width: 480px) {
    .auth-card,
    .landing-card {
        padding: 24px 16px;
    }

    .legal-wrapper {
        padding: 40px 16px 60px;
    }
}
