:root {
    --bg: #080b12;
    --panel: rgba(22, 28, 39, .86);
    --panel-2: rgba(35, 44, 61, .82);
    --text: #f7f8fb;
    --muted: #b7c2d6;
    --line: rgba(255, 255, 255, .12);
    --accent: #f5d547;
    --accent-2: #00d37f;
    --accent-3: #e31b35;
    --danger: #e43d54;
    --shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at 18% 10%, rgba(227, 27, 53, .23), transparent 30%),
        radial-gradient(circle at 82% 16%, rgba(0, 211, 127, .18), transparent 28%),
        linear-gradient(180deg, #090d15 0%, #111827 45%, #080b12 100%);
    color: var(--text);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(180deg, rgba(0,0,0,.8), transparent 78%);
}

a { color: inherit; }

main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px max(16px, calc((100vw - 1180px) / 2));
    background: rgba(8, 11, 18, .78);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.topbar nav {
    max-width: 100%;
}

.brand, .topbar nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    font-weight: 800;
    text-decoration: none;
    min-width: 0;
}

.brand span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-logo {
    width: 86px;
    max-height: 38px;
    object-fit: contain;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .28));
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    background: var(--accent);
    color: #111;
    border-radius: 8px;
}

.nav-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.nav-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .045);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .14);
    transition: transform .22s ease, border-color .22s ease, background .22s ease, box-shadow .22s ease;
    white-space: nowrap;
}

.nav-button::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 15%, rgba(255,255,255,.22) 50%, transparent 80%);
    transform: translateX(-120%);
    transition: transform .55s ease;
}

.nav-button:hover {
    transform: translateY(-3px);
    border-color: rgba(245, 213, 71, .58);
    background: rgba(245, 213, 71, .12);
    box-shadow: 0 16px 34px rgba(0, 0, 0, .24);
}

.nav-button:hover::before {
    transform: translateX(120%);
}

.vote-link {
    background: linear-gradient(135deg, var(--accent), #f08b24);
    color: #111;
    border-color: transparent;
}

.login-link {
    background: linear-gradient(135deg, var(--accent-2), #19a7ce);
    color: #06110d;
    border-color: transparent;
}

.nav-button.subtle {
    color: var(--muted);
}

.hero {
    position: relative;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    min-height: 390px;
    padding: 78px 0 54px;
    animation: riseIn .7s ease both;
}

.hero h1, .ranking-screen h1 {
    margin: 0;
    font-size: clamp(42px, 7vw, 96px);
    line-height: .95;
    text-shadow: 0 10px 34px rgba(0, 0, 0, .45);
    overflow-wrap: anywhere;
}

.hero p {
    max-width: 620px;
    color: var(--muted);
    font-size: 18px;
}

.hero-inline-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-logo {
    position: absolute;
    right: 0;
    top: 44px;
    width: min(260px, 42vw);
    opacity: .16;
    filter: drop-shadow(0 18px 42px rgba(0, 0, 0, .45));
}

.hero-glow {
    position: absolute;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    filter: blur(12px);
    opacity: .2;
    pointer-events: none;
    animation: floatGlow 7s ease-in-out infinite;
}

.hero-glow.one {
    left: -80px;
    bottom: 30px;
    background: var(--accent-3);
}

.hero-glow.two {
    right: 170px;
    top: 80px;
    background: var(--accent-2);
    animation-delay: -2s;
}

.hero-actions, .section-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #111;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(245, 213, 71, .2);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.button.small { min-height: 34px; padding: 0 12px; }
.button.ghost { background: var(--panel-2); color: var(--text); }
.button.danger { background: var(--danger); color: white; margin-top: 18px; }

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(245, 213, 71, .26);
    filter: saturate(1.08);
}

.grid-section { padding-bottom: 44px; }

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 18px;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(26px, 4vw, 44px);
}

.section-logo, .panel-logo {
    width: 118px;
    max-height: 48px;
    object-fit: contain;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
    gap: 16px;
}

.project-card {
    position: relative;
    min-height: 230px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    text-decoration: none;
    box-shadow: var(--shadow);
    transform: translateY(0);
    animation: cardIn .55s ease both;
    transition: transform .28s ease, border-color .28s ease, box-shadow .28s ease;
}

.project-card.no-bg {
    background:
        linear-gradient(135deg, rgba(42, 211, 139, .88), rgba(42, 211, 139, 0) 44%),
        linear-gradient(315deg, rgba(248, 216, 74, .86), rgba(248, 216, 74, 0) 40%),
        #202734;
}

.project-card:hover {
    transform: translateY(-7px) scale(1.015);
    border-color: var(--accent);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .48);
}

.project-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.18) 48%, transparent 70%);
    transform: translateX(-130%);
    transition: transform .65s ease;
}

.project-card:hover::after {
    transform: translateX(130%);
}

.project-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.82));
}

.project-info {
    position: absolute;
    inset: auto 16px 16px;
    display: grid;
    gap: 4px;
}

.project-info strong { font-size: 22px; }
.project-info small { color: var(--muted); }

.panel {
    margin: 28px 0;
    padding: 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    animation: riseIn .5s ease both;
}

.panel.narrow {
    max-width: 520px;
    margin: 48px auto;
}

.document-panel {
    border-color: rgba(0, 211, 127, .28);
}

.public-document {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 34px;
    padding: 22px;
    border: 1px solid rgba(245, 213, 71, .36);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(245, 213, 71, .14), transparent 42%),
        linear-gradient(315deg, rgba(0, 211, 127, .12), transparent 48%),
        rgba(22, 28, 39, .88);
    box-shadow: var(--shadow);
    animation: riseIn .55s ease both;
}

.public-document h2 {
    margin: 0 0 8px;
    font-size: clamp(24px, 4vw, 42px);
}

.public-document p {
    margin: 0;
    color: var(--muted);
}

.public-document-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.public-document-actions span {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--accent-2);
    font-weight: 900;
}

.public-descriptive-page {
    position: relative;
    min-height: 280px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding: 62px 0 34px;
    animation: riseIn .55s ease both;
}

.public-descriptive-page h1 {
    margin: 0;
    font-size: clamp(44px, 8vw, 104px);
    line-height: .9;
}

.public-descriptive-page p {
    max-width: 620px;
    color: var(--muted);
    font-size: 18px;
}

.document-logo {
    position: static;
    width: min(230px, 40vw);
    opacity: .85;
}

.admin-layout {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 18px;
}

.section-title {
    justify-content: space-between;
    align-items: start;
}

.title-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.section-title h1, .panel h1, .panel h2, .project-heading h1 {
    margin: 0 0 16px;
}

.form {
    display: grid;
    gap: 14px;
}

.inline-form {
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
    align-items: end;
    margin-top: 18px;
}

.group-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
    gap: 18px;
    margin-top: 18px;
}

.group-editor-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .035);
}

.group-cover {
    min-height: 170px;
    display: flex;
    align-items: flex-end;
    padding: 16px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.group-cover.no-bg {
    background:
        linear-gradient(135deg, rgba(42, 211, 139, .78), rgba(42, 211, 139, 0) 48%),
        linear-gradient(315deg, rgba(245, 213, 71, .82), rgba(245, 213, 71, 0) 45%),
        #202734;
}

.group-cover::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.72));
}

.group-cover span {
    position: relative;
    z-index: 1;
    font-size: 24px;
    font-weight: 900;
}

.compact-form {
    padding: 16px;
}

.token-line {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, .16);
    color: var(--muted);
}

.token-line code {
    justify-self: start;
}

.token-line strong {
    color: var(--text);
}

.file-links, .card-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.file-links a {
    color: var(--accent);
    font-weight: 800;
}

.delete-form {
    padding: 0 16px 16px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
}

input, textarea, select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #111620;
    color: var(--text);
    font: inherit;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 4px rgba(0, 211, 127, .12);
    background: #0d1420;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 18px 0 28px;
}

.stats div {
    padding: 16px;
    background: var(--panel-2);
    border-radius: 8px;
    border: 1px solid var(--line);
}

.stats strong {
    display: block;
    font-size: 30px;
}

.stats span, .muted { color: var(--muted); }

.results {
    display: grid;
    gap: 12px;
}

.result-row {
    display: grid;
    grid-template-columns: 140px 1fr 48px;
    align-items: center;
    gap: 12px;
}

.bar {
    height: 14px;
    overflow: hidden;
    background: #10141c;
    border-radius: 999px;
}

.bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    animation: growBar .7s ease both;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

th { color: var(--muted); font-size: 13px; }
td a { margin-right: 10px; color: var(--accent); }
code { color: var(--accent-2); }

.link-danger {
    border: 0;
    background: none;
    color: var(--danger);
    cursor: pointer;
}

.vote-list {
    display: grid;
    gap: 10px;
}

.vote-option {
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 12px;
    background: var(--panel-2);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: border-color .2s ease, transform .2s ease, background .2s ease;
}

.vote-option input { width: auto; }

.vote-option:hover {
    border-color: var(--accent-2);
    transform: translateX(4px);
    background: rgba(35, 44, 61, .98);
}

.project-view {
    padding: 34px 0;
}

.project-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
}

.description {
    color: var(--muted);
    max-width: 820px;
}

.viewer {
    width: 100%;
    min-height: 70vh;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #05070b;
    box-shadow: var(--shadow);
}

video.viewer {
    max-height: 74vh;
}

.document-frame {
    min-height: 78vh;
    margin-top: 18px;
}

.docx-preview {
    display: grid;
    gap: 12px;
    place-items: center;
    min-height: 320px;
    margin-top: 18px;
    padding: 28px;
    border: 1px dashed rgba(245, 213, 71, .45);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(245, 213, 71, .12), transparent 45%),
        linear-gradient(315deg, rgba(0, 211, 127, .12), transparent 45%),
        rgba(255, 255, 255, .035);
    text-align: center;
}

.docx-preview strong {
    font-size: clamp(24px, 4vw, 42px);
}

.docx-preview p {
    margin: 0;
    color: var(--muted);
}

.empty, .flash {
    padding: 16px;
    margin: 18px 0;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
}

.flash.ok { border-color: var(--accent-2); color: var(--text); }
.flash.error { border-color: var(--danger); color: var(--text); }

.footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    width: min(1180px, calc(100% - 32px));
    margin: 40px auto 20px;
    color: var(--muted);
    font-size: 13px;
}

.ranking-body {
    background:
        radial-gradient(circle at 50% 0%, rgba(245, 213, 71, .18), transparent 35%),
        radial-gradient(circle at 15% 25%, rgba(227, 27, 53, .25), transparent 28%),
        radial-gradient(circle at 85% 35%, rgba(0, 211, 127, .22), transparent 30%),
        #07090f;
}

.ranking-screen {
    width: min(1300px, calc(100% - 36px));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 34px 0;
    position: relative;
}

.ranking-logo {
    position: absolute;
    right: 0;
    top: 30px;
    width: min(220px, 40vw);
    max-height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 16px 32px rgba(0, 0, 0, .5));
}

.podium {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    align-items: end;
    gap: 16px;
    min-height: 55vh;
    margin-top: 34px;
}

.podium-item {
    display: flex;
    flex-direction: column;
    justify-content: end;
    gap: 10px;
    height: 100%;
    min-height: 280px;
}

.trophy {
    align-self: center;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--accent);
    font-weight: 900;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .28);
    animation: pulseTrophy 1.8s ease-in-out infinite;
}

.podium-bar {
    display: flex;
    flex-direction: column;
    justify-content: end;
    gap: 8px;
    min-height: 100px;
    padding: 18px;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, var(--accent), #c28c20);
    color: #14100a;
    box-shadow: 0 22px 50px rgba(0, 0, 0, .36);
    animation: podiumRise .75s ease both;
}

.podium-bar strong {
    font-size: clamp(18px, 2.5vw, 34px);
}

.podium-bar span {
    font-size: 20px;
    font-weight: 800;
}

.rank-1 .podium-bar {
    background: linear-gradient(180deg, var(--accent-2), #128858);
    color: #04110b;
}

@keyframes riseIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(22px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes floatGlow {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(18px, -16px, 0) scale(1.08); }
}

@keyframes growBar {
    from { transform: scaleX(0); transform-origin: left; }
    to { transform: scaleX(1); transform-origin: left; }
}

@keyframes podiumRise {
    from { transform: scaleY(.3); transform-origin: bottom; opacity: .4; }
    to { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
}

@keyframes pulseTrophy {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

@media (max-width: 820px) {
    .topbar, .hero, .project-heading, .footer, .section-title {
        align-items: stretch;
        flex-direction: column;
    }

    main {
        width: min(100% - 24px, 1180px);
    }

    .topbar {
        position: sticky;
        padding: 10px 12px;
        gap: 10px;
    }

    .brand {
        width: 100%;
        justify-content: center;
    }

    .topbar nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 8px;
    }

    .brand-logo {
        width: 70px;
        flex: 0 0 auto;
    }

    .brand span:last-child {
        font-size: 15px;
    }

    .nav-button {
        min-height: 42px;
        padding: 0 10px;
        font-size: 13px;
        text-align: center;
    }

    .nav-button:hover {
        transform: none;
    }

    .hero {
        min-height: auto;
        padding: 34px 0 30px;
    }

    .hero-logo {
        position: static;
        width: min(150px, 55vw);
        opacity: .9;
        order: -1;
    }

    .hero h1, .ranking-screen h1 {
        font-size: clamp(38px, 15vw, 64px);
    }

    .hero p {
        font-size: 16px;
    }

    .public-descriptive-page {
        align-items: flex-start;
        flex-direction: column-reverse;
        min-height: auto;
        padding: 34px 0 20px;
    }

    .public-descriptive-page h1 {
        font-size: clamp(42px, 16vw, 72px);
    }

    .document-logo {
        width: min(160px, 55vw);
    }

    .hero-actions {
        flex-wrap: wrap;
    }

    .hero-inline-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .section-heading, .title-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .public-document {
        align-items: stretch;
        flex-direction: column;
        padding: 18px;
    }

    .public-document-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .public-document-actions span {
        text-align: center;
    }

    .admin-layout, .stats, .inline-form {
        grid-template-columns: 1fr;
    }

    .panel {
        margin: 18px 0;
        padding: 18px;
    }

    .project-grid {
        gap: 12px;
    }

    .project-card {
        min-height: 180px;
    }

    .project-info strong {
        font-size: 20px;
    }

    .stats {
        gap: 8px;
    }

    input, textarea, select {
        min-height: 44px;
        font-size: 16px;
    }

    .button {
        width: 100%;
        min-height: 46px;
    }

    .result-row {
        align-items: start;
    }

    .viewer {
        min-height: 68vh;
        border-radius: 6px;
    }

    .document-frame {
        min-height: 72vh;
    }

    .vote-option {
        min-height: 52px;
    }

    .ranking-screen {
        width: min(100% - 24px, 1300px);
        justify-content: flex-start;
        padding-top: 118px;
    }

    .ranking-logo {
        left: 0;
        right: auto;
        width: 140px;
    }

    .podium {
        grid-template-columns: 1fr;
        align-items: stretch;
        min-height: auto;
        margin-top: 24px;
    }

    .podium-item {
        min-height: 120px;
    }

    .podium-bar {
        min-height: 96px;
        height: auto !important;
        border-radius: 8px;
    }

    .result-row {
        grid-template-columns: 1fr 52px;
    }

    .result-row .bar {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

@media (max-width: 430px) {
    .topbar nav {
        grid-template-columns: 1fr;
    }

    .brand span:last-child {
        white-space: normal;
        text-align: center;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-logo, .panel-logo {
        width: 96px;
    }

    .project-card {
        min-height: 165px;
    }

    .group-cover {
        min-height: 145px;
    }

    .token-line {
        grid-template-columns: 1fr;
    }

    th, td {
        padding: 10px;
        font-size: 13px;
    }
}
