:root {
    --bg: #03111d;
    --bg-2: #061c2d;
    --panel: #071f31;
    --panel-2: #092940;
    --line: rgba(63, 178, 255, .38);
    --text: #f4f8fb;
    --muted: #a8bdcb;
    --accent: #08a8ff;
    --accent-2: #58c8ff;
    --shadow: 0 18px 50px rgba(0,0,0,.28);
    --radius: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 72% 12%, rgba(0, 142, 224, .14), transparent 28%),
        linear-gradient(145deg, var(--bg), #041a2a 60%, #02101a);
    color: var(--text);
}

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

.topbar {
    min-height: 72px;
    padding: 0 42px;
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 34px;
    align-items: center;
    background: rgba(2, 13, 23, .96);
    border-bottom: 1px solid rgba(255,255,255,.08);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(12px);
}

.brand {
    font-weight: 900;
    letter-spacing: -.05em;
    font-size: 27px;
}
.brand-dot { color: var(--accent-2); }

.main-nav { display: flex; gap: 8px; align-items: center; height: 100%; }

.main-nav > a,
.nav-button {
    border: 0;
    background: transparent;
    color: #c9d8e3;
    padding: 25px 14px 23px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.main-nav > a:hover,
.main-nav > a.active,
.nav-button:hover { color: white; }

.nav-dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: 62px;
    left: 0;
    width: 230px;
    display: none;
    padding: 8px;
    background: #061a2a;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-menu a {
    display: flex;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 9px;
}
.dropdown-menu a:hover { background: rgba(255,255,255,.06); }
.dropdown-icon { width: 22px; color: var(--accent-2); }

.topbar-title {
    justify-self: center;
    font-family: "Segoe Print", "Comic Sans MS", cursive;
    font-size: 23px;
    font-weight: 800;
    color: white;
}
.user-menu { justify-self: end; }
.user-chip, .login-link {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    color: #dbe8ef;
}
.avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, #d9e9f3, #718b9c);
    color: #082033;
    font-weight: 900;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-large { width: 64px; height: 64px; font-size: 23px; }

.hero {
    width: min(1420px, calc(100% - 48px));
    margin: 34px auto 0;
    min-height: 370px;
    display: grid;
    grid-template-columns: 58% 42%;
    overflow: hidden;
    border: 1px solid rgba(69, 189, 255, .35);
    border-radius: 24px;
    background: #062237;
    box-shadow: var(--shadow);
}
.hero-image {
    min-height: 370px;
    display: flex;
    align-items: end;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 35%, rgba(22, 175, 232, .28), transparent 45%),
        linear-gradient(145deg, #0a2d44, #062136);
}
.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}
.hero-copy {
    padding: 54px 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.hero-copy h1 {
    font-size: clamp(38px, 4vw, 64px);
    line-height: .98;
    margin: 6px 0 18px;
    letter-spacing: -.05em;
}
.hero-copy p:not(.eyebrow) {
    max-width: 480px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.65;
}
.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: 12px;
    font-weight: 900;
    color: var(--accent-2);
}

.content-grid {
    width: min(1420px, calc(100% - 48px));
    margin: 34px auto 70px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 28px;
}
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 18px;
}
.section-heading h2 { margin: 4px 0 0; font-size: 31px; }
.app-count { color: var(--muted); font-size: 13px; }

.app-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.app-card {
    overflow: hidden;
    border: 1px solid rgba(75, 190, 255, .28);
    border-radius: var(--radius);
    background: linear-gradient(160deg, rgba(9, 40, 61, .96), rgba(5, 25, 39, .96));
    box-shadow: 0 12px 30px rgba(0,0,0,.18);
    transition: transform .18s ease, border-color .18s ease;
}
.app-card:hover {
    transform: translateY(-3px);
    border-color: rgba(75, 190, 255, .7);
}
.app-card-image {
    height: 145px;
    display: grid;
    place-items: center;
    font-size: 58px;
    color: rgba(255,255,255,.9);
}
.theme-film { background: linear-gradient(135deg, #302015, #734a20); }
.theme-support { background: linear-gradient(135deg, #12384a, #1e6d87); }
.theme-script { background: linear-gradient(135deg, #0c1d2b, #174b65); }
.theme-bikini { background: linear-gradient(135deg, #49353a, #a86877); }
.theme-emoticons { background: linear-gradient(135deg, #3d1a55, #a62082); }
.theme-default { background: linear-gradient(135deg, #173349, #216a8b); }

.app-card-body { padding: 20px; }
.app-card h3 { margin: 0 0 7px; font-size: 21px; }
.app-card p { color: var(--muted); min-height: 43px; margin: 0 0 17px; line-height: 1.45; }

.btn-primary, .btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 17px;
    border-radius: 999px;
    font-weight: 800;
}
.btn-primary {
    color: white;
    background: linear-gradient(135deg, #079ce9, #0878c7);
    border: 1px solid rgba(130,220,255,.55);
}
.btn-outline {
    width: 100%;
    border: 1px solid var(--accent);
    color: var(--accent-2);
}
.full { width: 100%; }

.profile-card {
    align-self: start;
    padding: 24px;
    border: 1px solid rgba(75, 190, 255, .38);
    border-radius: var(--radius);
    background: linear-gradient(160deg, rgba(6, 34, 54, .98), rgba(4, 24, 39, .98));
    box-shadow: var(--shadow);
}
.profile-head { display: flex; gap: 15px; align-items: center; }
.profile-head h2 { margin: 0 0 3px; font-size: 22px; }
.profile-head p { margin: 0; color: var(--muted); font-size: 13px; }
.profile-data { margin: 25px 0; }
.profile-data div { padding: 13px 0; border-top: 1px solid rgba(255,255,255,.08); }
.profile-data dt { color: var(--muted); font-size: 12px; }
.profile-data dd { margin: 4px 0 0; word-break: break-word; }
.profile-logout { display: block; text-align: center; margin-top: 14px; color: var(--muted); font-size: 13px; }
.profile-note, .muted { color: var(--muted); line-height: 1.6; }

.container { width: min(920px, calc(100% - 48px)); margin: auto; }
.page-shell { min-height: calc(100vh - 180px); padding: 60px 0; }

.auth-card, .simple-card {
    max-width: 620px;
    margin: 0 auto;
    padding: 36px;
    border-radius: var(--radius);
    background: rgba(7, 31, 49, .92);
    border: 1px solid rgba(75,190,255,.28);
    box-shadow: var(--shadow);
}
.auth-card h1, .simple-card h1 { margin: 7px 0 10px; font-size: 38px; }
.auth-card form { display: grid; gap: 17px; margin-top: 25px; }
label { display: grid; gap: 7px; color: #dbe8ef; font-weight: 700; font-size: 14px; }
input {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    color: white;
    background: #031521;
    border: 1px solid rgba(100,190,235,.25);
    border-radius: 10px;
    outline: none;
}
input:focus { border-color: var(--accent); }
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(200, 70, 70, .16);
    border: 1px solid rgba(255,100,100,.35);
    margin-top: 20px;
}
.profile-summary { display: flex; gap: 18px; align-items: center; margin: 25px 0; }
.profile-summary h2 { margin: 0 0 4px; }

.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.admin-tile {
    padding: 20px;
    border-radius: 14px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(75,190,255,.2);
}
.admin-tile strong, .admin-tile span { display: block; }
.admin-tile span { color: var(--muted); margin-top: 5px; font-size: 13px; }

.empty-state {
    padding: 35px;
    border-radius: var(--radius);
    border: 1px dashed rgba(75,190,255,.3);
    color: var(--muted);
}
.empty-state h1, .empty-state h3 { color: var(--text); }

.site-footer {
    min-height: 74px;
    padding: 0 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255,255,255,.08);
    color: var(--muted);
    font-size: 13px;
}
.footer-links { display: flex; gap: 10px; }

@media (max-width: 980px) {
    .topbar {
        grid-template-columns: auto 1fr auto;
        gap: 14px;
        padding: 0 18px;
    }
    .topbar-title { display: none; }
    .hero { grid-template-columns: 1fr; }
    .hero-image { min-height: 300px; }
    .content-grid { grid-template-columns: 1fr; }
    .profile-card { order: -1; }
}

@media (max-width: 650px) {
    .topbar { min-height: 64px; }
    .brand { font-size: 22px; }
    .main-nav > a, .nav-button { padding: 21px 8px; }
    .hero, .content-grid { width: min(100% - 24px, 1420px); }
    .hero-copy { padding: 34px 26px; }
    .app-grid { grid-template-columns: 1fr; }
    .admin-grid { grid-template-columns: 1fr; }
    .site-footer { padding: 20px 18px; flex-direction: column; gap: 8px; }
}


/* Standard layout for all QDF sub-sites */
.qdf-subsite-container {
    width: min(1483px, calc(100% - 48px));
    margin-left: auto;
    margin-right: auto;
}

.subsite-hero {
    margin-top: 28px;
    margin-bottom: 30px;
    border: 1px solid rgba(69,189,255,.35);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0,0,0,.28);
    background: #062237;
}

.subsite-hero img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1483 / 271;
    object-fit: contain;
}

/* The body of a sub-site must use the same outer width as its Hero. */
.qdf-subsite-container.simple-page {
    max-width: none;
}

@media (max-width: 760px) {
    .qdf-subsite-container {
        width: calc(100% - 24px);
    }
    .subsite-hero {
        margin-top: 18px;
        border-radius: 14px;
    }
}

/* Support / file browser */
.support-page {
    width: min(100% - 24px, 1420px);
    margin: 34px auto 56px;
}
.support-card {
    padding: 30px;
}
.support-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}
.support-heading h1 {
    margin: 6px 0 8px;
    font-size: 38px;
}
.support-count {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}
.support-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
    color: var(--muted);
    font-size: 13px;
}
.support-breadcrumb a {
    color: var(--text);
    text-decoration: none;
}
.support-list {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    overflow: hidden;
}
.support-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 190px 24px;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.06);
    transition: background .18s ease, transform .18s ease;
}
.support-row:last-child {
    border-bottom: 0;
}
.support-row:hover {
    background: rgba(255,255,255,.045);
}
.support-icon {
    font-size: 22px;
    text-align: center;
}
.support-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.support-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.support-main small,
.support-meta {
    color: var(--muted);
    font-size: 12px;
}
.support-meta {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 12px;
    text-align: right;
}
.support-arrow {
    color: var(--muted);
    font-size: 22px;
    text-align: right;
}
.support-empty {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px dashed rgba(255,255,255,.1);
    border-radius: 16px;
}
.support-empty-icon {
    font-size: 34px;
    margin-bottom: 4px;
}
@media (max-width: 760px) {
    .support-card {
        padding: 22px 16px;
    }
    .support-heading {
        align-items: flex-start;
    }
    .support-heading h1 {
        font-size: 31px;
    }
    .support-row {
        grid-template-columns: 36px minmax(0, 1fr) 24px;
        padding: 13px 12px;
    }
    .support-meta {
        display: none;
    }
}
/* QDF sub-site standard: body/list must align exactly with the Hero. */
.qdf-subsite-container.support-page {
    width: min(1483px, calc(100% - 48px));
    max-width: 1483px;
}

.qdf-subsite-container .support-card,
.support-page .support-card {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

/* Home app cards use the same Hero artwork without cropping it. */
.app-card-image.has-hero {
    overflow: hidden;
    background: #061a2a;
}

.app-card-image.has-hero img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.app-card-image.has-hero .app-icon {
    display: none;
}

@media (max-width: 760px) {
    .qdf-subsite-container.support-page {
        width: calc(100% - 24px);
    }
}
