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

:root {
    --bg-top: #0d1b2a;
    --bg-bottom: #172a3a;
    --panel: rgba(255, 255, 255, 0.08);
    --panel-strong: rgba(255, 255, 255, 0.14);
    --line: rgba(255, 255, 255, 0.16);
    --text: #edf6ff;
    --muted: #b2c6d9;
    --primary: #ffd166;
    --secondary: #06d6a0;
    --danger: #ef476f;
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: 'IBM Plex Sans', 'Segoe UI', Tahoma, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 12% 12%, #22485f 0%, transparent 38%),
        radial-gradient(circle at 88% 18%, #3f2b56 0%, transparent 35%),
        linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
    position: relative;
}

.bg-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(transparent 0, rgba(255, 255, 255, 0.015) 100%);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 26px;
    background: rgba(11, 18, 34, 0.78);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topnav a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}

.topnav a:hover {
    color: var(--text);
}

.badge {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 22px 18px 44px;
}

h1,
h2,
h3 {
    margin: 0 0 10px;
    font-family: 'Space Grotesk', sans-serif;
    line-height: 1.2;
}

p {
    margin: 0 0 12px;
}

.hero {
    margin-bottom: 18px;
    padding: 26px;
    background: linear-gradient(130deg, rgba(255, 209, 102, 0.15), rgba(6, 214, 160, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.19);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.panel {
    margin-bottom: 16px;
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.flash {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.flash-success {
    background: rgba(6, 214, 160, 0.14);
}

.flash-error {
    background: rgba(239, 71, 111, 0.14);
}

.inline-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.stack-form,
.grid-form,
.inline-grid {
    display: grid;
    gap: 10px;
}

.grid-form {
    grid-template-columns: 1fr;
}

.inline-grid {
    grid-template-columns: minmax(130px, 200px) minmax(120px, 160px) auto;
    align-items: end;
}

label {
    font-size: 0.85rem;
    color: var(--muted);
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: rgba(8, 15, 30, 0.6);
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid rgba(255, 209, 102, 0.35);
    border-color: rgba(255, 209, 102, 0.75);
}

.btn {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.btn-secondary {
    background: var(--secondary);
    color: #00261f;
}

.btn-ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--text);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.muted {
    color: var(--muted);
}

.hint {
    color: var(--muted);
    font-size: 0.82rem;
}

.auth-wrap {
    min-height: calc(100vh - 200px);
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(100%, 500px);
    padding: 28px;
    border-radius: 18px;
    background: rgba(11, 20, 36, 0.84);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

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

.project-card {
    display: block;
    color: inherit;
    text-decoration: none;
    padding: 16px;
    border-radius: 14px;
    background: rgba(8, 14, 28, 0.75);
    border: 1px solid var(--line);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 209, 102, 0.7);
}

.meta-row {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 0.82rem;
}

.project-header {
    margin-bottom: 16px;
}

.back-link {
    color: var(--muted);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 10px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.scene-board {
    display: grid;
    gap: 12px;
}

.scene-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(7, 12, 24, 0.75);
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 12px;
    padding: 12px;
}

.scene-card.dragging {
    opacity: 0.6;
}

.scene-handle {
    user-select: none;
    cursor: move;
    color: var(--muted);
    font-size: 1.1rem;
    padding-top: 6px;
}

.scene-body {
    display: grid;
    gap: 10px;
}

.scene-edit-form {
    display: grid;
    gap: 8px;
}

.scene-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.scene-output {
    border-top: 1px dashed var(--line);
    padding-top: 10px;
    font-size: 0.92rem;
}

.scene-output a {
    color: var(--primary);
}

.error-text {
    color: var(--danger);
}

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

.users-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.users-table th,
.users-table td {
    text-align: left;
    border-bottom: 1px solid var(--line);
    padding: 10px;
    vertical-align: top;
}

.admin-actions {
    display: grid;
    gap: 8px;
}

.admin-actions form {
    display: flex;
    gap: 8px;
}

.hidden {
    display: none !important;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.7);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    padding: 16px;
    z-index: 80;
}

.modal-card {
    width: min(100%, 760px);
    max-height: 90vh;
    overflow: auto;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(7, 12, 24, 0.95);
    box-shadow: var(--shadow);
    padding: 18px;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

@media (max-width: 800px) {
    .topbar {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .inline-grid {
        grid-template-columns: 1fr;
    }

    .scene-card {
        grid-template-columns: 1fr;
    }

    .scene-handle {
        display: none;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }
}
