:root {
    color-scheme: dark;
    --bg: #070910;
    --surface: rgb(18 23 39 / 86%);
    --surface-strong: #101629;
    --surface-soft: rgb(255 255 255 / 7%);
    --line: rgb(255 255 255 / 15%);
    --text: #f7f8fc;
    --muted: #b9c3db;
    --pink: #ff55b9;
    --cyan: #35e6de;
    --lime: #c8ff77;
    --danger: #ff9bac;
    --shell: min(78rem, calc(100% - 2rem));
}

* {
    box-sizing: border-box;
}

body {
    min-width: 20rem;
    margin: 0;
    background:
        radial-gradient(circle at 9% 8%, rgb(255 85 185 / 18%), transparent 23rem),
        radial-gradient(circle at 88% 16%, rgb(53 230 222 / 14%), transparent 25rem),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    letter-spacing: 0;
}

body.is-authenticated {
    min-height: 100svh;
    background:
        linear-gradient(180deg, rgb(255 255 255 / 2%), transparent 18rem),
        var(--bg);
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

.skip-link {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
    transform: translateY(-160%);
    padding: 0.7rem 0.9rem;
    border-radius: 0.5rem;
    background: var(--text);
    color: var(--bg);
}

.skip-link:focus {
    transform: none;
}

.app-header,
main {
    width: var(--shell);
    margin-inline: auto;
}

body.is-authenticated .app-header {
    display: none;
}

body.is-authenticated main {
    width: 100%;
    min-height: 100svh;
    padding: 0;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-block: 1.25rem;
}

.app-header p {
    margin: 0;
    color: var(--muted);
    font-weight: 800;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    font-weight: 950;
}

.brand img {
    width: 1.45rem;
    height: 1.45rem;
    object-fit: contain;
    filter: drop-shadow(0 0 0.8rem rgb(255 85 185 / 45%));
}

main {
    padding-block: clamp(1rem, 4vw, 4rem) 4rem;
}

.eyebrow {
    margin: 0 0 0.75rem;
    color: var(--cyan);
    font-size: 0.82rem;
    font-weight: 950;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 1rem;
    font-size: clamp(2rem, 6vw, 5rem);
    line-height: 1;
    letter-spacing: 0;
    text-wrap: balance;
}

h2 {
    margin-bottom: 1rem;
    font-size: clamp(1.25rem, 3vw, 2rem);
    letter-spacing: 0;
}

h3 {
    margin-bottom: 0.2rem;
    letter-spacing: 0;
}

.auth-copy {
    max-width: 50rem;
    margin-bottom: 1.4rem;
}

.auth-copy > p:last-child,
.panel-head p,
.auth-provider-panel p {
    color: var(--muted);
}

.auth-provider-panel {
    max-width: 34rem;
}

.auth-panels,
.dashboard-grid,
.feed-list {
    display: grid;
    gap: 1rem;
}

.surface {
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface);
    box-shadow: 0 1.5rem 5rem rgb(0 0 0 / 30%);
    backdrop-filter: blur(1rem);
}

.form-card,
.profile-panel,
.feed-card {
    padding: clamp(1rem, 3vw, 1.4rem);
}

form,
label,
.spectrum {
    display: grid;
    gap: 0.45rem;
}

form {
    gap: 0.85rem;
}

label {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    background: rgb(4 7 14 / 75%);
    color: var(--text);
    padding: 0.72rem;
}

input[type="range"] {
    accent-color: var(--pink);
    padding: 0.2rem 0;
}

textarea {
    resize: vertical;
}

button {
    min-height: 2.9rem;
    border: 0;
    border-radius: 0.5rem;
    background: linear-gradient(115deg, var(--pink), #8b72ff 48%, var(--cyan));
    color: #070810;
    cursor: pointer;
    font-weight: 950;
}

button:disabled {
    cursor: default;
    opacity: 0.55;
}

.quiet-button {
    border: 1px solid var(--line);
    background: rgb(255 255 255 / 9%);
    color: var(--text);
}

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.checkbox input {
    width: 1rem;
    margin-top: 0.2rem;
    accent-color: var(--cyan);
}

.hidden {
    display: none;
}

.dashboard {
    min-height: 100svh;
}

.mobile-menu-button {
    position: fixed;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    width: auto;
    min-height: 2.7rem;
    padding-inline: 0.8rem;
    box-shadow: 0 1rem 2.5rem rgb(0 0 0 / 32%);
}

.mobile-menu-button img,
.nav-item img,
.placeholder-card img,
.empty-state img {
    width: 1.25rem;
    height: 1.25rem;
    object-fit: contain;
}

.app-shell {
    display: grid;
    min-height: 100svh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: min(19rem, calc(100vw - 2rem));
    padding: 1rem;
    border-right: 1px solid var(--line);
    background: rgb(9 13 24 / 96%);
    box-shadow: 1rem 0 3rem rgb(0 0 0 / 34%);
    transform: translateX(-105%);
    transition: transform 190ms ease;
}

body.sidebar-open .app-sidebar {
    transform: translateX(0);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgb(0 0 0 / 58%);
}

.sidebar-top,
.sidebar-bottom,
.sidebar-nav {
    display: grid;
    gap: 0.65rem;
}

.sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 3rem;
    margin-bottom: 0.8rem;
    color: var(--text);
    text-decoration: none;
}

.sidebar-brand img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    filter: drop-shadow(0 0 0.8rem rgb(255 85 185 / 45%));
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    width: 100%;
    min-height: 2.8rem;
    padding: 0.68rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--muted);
    text-align: left;
    font-weight: 850;
}

.nav-item img {
    flex: 0 0 auto;
    opacity: 0.82;
}

.nav-item.is-active {
    border-color: rgb(53 230 222 / 32%);
    background: rgb(53 230 222 / 11%);
    color: var(--text);
}

.logout-item {
    color: var(--danger);
}

.app-content {
    width: min(82rem, calc(100% - 1.4rem));
    margin-inline: auto;
    padding: 5.3rem 0.7rem 2rem;
}

.dashboard-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.dashboard-head h1 {
    font-size: clamp(1.65rem, 4vw, 3.3rem);
    overflow-wrap: anywhere;
}

.dashboard-head button {
    width: auto;
    padding-inline: 1rem;
}

.app-view {
    display: none;
}

.app-view.is-active {
    display: block;
}

.view-heading {
    display: grid;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.view-heading h2 {
    margin-bottom: 0;
    font-size: clamp(1.45rem, 4vw, 2.35rem);
}

.view-heading > p,
.settings-card p,
.placeholder-card p,
.empty-state p {
    margin: 0;
    color: var(--muted);
}

.settings-layout {
    display: grid;
    gap: 1rem;
}

.settings-card,
.profile-preview-card,
.placeholder-card,
.empty-state {
    padding: clamp(1rem, 3vw, 1.4rem);
}

.settings-card,
.profile-preview-card {
    align-self: start;
}

.settings-side {
    display: grid;
    gap: 1rem;
}

.profile-media-tools,
.avatar-editor-entry {
    display: grid;
    gap: 0.8rem;
}

.avatar-editor-entry {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
}

.avatar-editor-entry h3 {
    margin: 0 0 0.2rem;
}

.avatar-editor-entry p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.avatar-upload-button {
    position: relative;
    display: block;
    width: 5rem;
    height: 5rem;
    cursor: pointer;
}

.avatar-upload-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.avatar-upload-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgb(3 6 12 / 58%);
    opacity: 0;
    transition: opacity 160ms ease;
}

.avatar-upload-overlay img {
    width: 1.35rem;
    height: 1.35rem;
    object-fit: contain;
}

.avatar-upload-button:hover .avatar-upload-overlay,
.avatar-upload-button:focus-within .avatar-upload-overlay {
    opacity: 1;
}

.avatar-preview,
.public-avatar {
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 25%, rgb(255 85 185 / 50%), transparent 45%),
        radial-gradient(circle at 70% 65%, rgb(53 230 222 / 45%), transparent 48%),
        var(--surface-strong);
    background-position: center;
    background-size: cover;
}

.avatar-preview {
    width: 5rem;
    height: 5rem;
}

.public-avatar {
    width: 6rem;
    height: 6rem;
    margin-bottom: 1rem;
}

.public-profile-card h4 {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
}

.public-profile-card #preview-handle {
    margin-bottom: 0.7rem;
    color: var(--cyan);
    font-weight: 900;
}

.public-profile-card p {
    margin-bottom: 0.65rem;
    color: var(--muted);
}

#preview-bio {
    white-space: pre-wrap;
}

.preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.preview-tags span {
    padding: 0.32rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 999rem;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 800;
}

.profile-media-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.profile-media-item,
.profile-media-add {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: rgb(4 7 14 / 55%);
    aspect-ratio: 9 / 16;
}

.profile-media-item {
    cursor: grab;
    touch-action: none;
}

.profile-media-item:active {
    cursor: grabbing;
}

.profile-media-item.is-dragging {
    opacity: 0.45;
    transform: scale(0.98);
}

.profile-media-item.is-drop-target {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px rgb(53 230 222 / 28%);
}

.profile-media-item img,
.profile-media-item video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--surface-strong);
}

.profile-media-item p {
    margin: 0;
    padding: 0.65rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.profile-media-add {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.45rem;
    min-height: 0;
    padding: 1rem;
    border-style: dashed;
    color: var(--muted);
    text-align: center;
}

.profile-media-add span {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--text);
    font-size: 2rem;
    line-height: 1;
}

.profile-media-add small {
    color: inherit;
    font-weight: 850;
}

.profile-media-add:disabled {
    cursor: default;
    opacity: 0.52;
}

.crop-dialog {
    width: min(31rem, calc(100% - 1rem));
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--text);
}

.crop-dialog::backdrop {
    background: rgb(0 0 0 / 72%);
}

.crop-panel {
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

.crop-canvas-wrap {
    position: relative;
}

.crop-canvas-wrap::after {
    position: absolute;
    inset: 0;
    border: 2px solid rgb(255 255 255 / 76%);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.crop-panel canvas {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface-strong);
}

.crop-grid,
.crop-actions {
    display: grid;
    gap: 0.65rem;
}

.crop-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.7rem;
    margin-top: 1rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 900;
    text-decoration: none;
}

.handle-field {
    display: grid;
    gap: 0.45rem;
}

.handle-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
}

.handle-row button {
    min-width: 10.5rem;
    padding-inline: 0.9rem;
}

.handle-row span {
    color: var(--muted);
    font-weight: 900;
}

.handle-field p {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.account-action-grid {
    display: grid;
    gap: 0.7rem;
}

.account-action {
    width: 100%;
    margin-top: 0;
}

.placeholder-grid {
    display: grid;
    gap: 1rem;
}

.placeholder-card,
.empty-state {
    min-height: 12rem;
}

.placeholder-card img,
.empty-state img {
    width: 2rem;
    height: 2rem;
    margin-bottom: 1rem;
}

.panel-head p {
    margin-bottom: 1rem;
}

.identity-panel {
    display: grid;
    gap: 0.85rem;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    padding: 0.9rem;
}

.identity-panel.hidden {
    display: none;
}

.identity-panel legend {
    padding-inline: 0.35rem;
    color: var(--lime);
    font-weight: 900;
}

.spectrum-control {
    display: grid;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid rgb(255 255 255 / 8%);
    border-radius: 0.5rem;
    transition: border-color 180ms ease, opacity 180ms ease;
}

.spectrum-control.is-disabled {
    border-color: rgb(255 255 255 / 6%);
}

.spectrum-control.is-disabled > label:first-child,
.spectrum-control.is-disabled .spectrum-axis {
    opacity: 0.48;
}

.spectrum-axis {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 900;
}

.spectrum-flags {
    display: grid;
    gap: 0.45rem;
}

.feed-card {
    min-width: 0;
}

.feed-media {
    display: grid;
    place-items: center;
    overflow: hidden;
    min-height: 14rem;
    aspect-ratio: 9 / 12;
    margin-bottom: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background:
        radial-gradient(circle at 24% 28%, rgb(255 85 185 / 58%), transparent 7rem),
        radial-gradient(circle at 75% 26%, rgb(53 230 222 / 48%), transparent 6rem),
        var(--surface-strong);
    color: var(--muted);
    text-align: center;
}

.feed-media p {
    max-width: 17rem;
    margin: 0;
    padding: 1rem;
}

.feed-media video,
.feed-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.feed-username,
.feed-meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.feed-username {
    margin-bottom: 0.65rem;
}

.feed-meta {
    border-top: 1px solid var(--line);
    padding-top: 0.7rem;
}

.report-controls {
    display: grid;
    gap: 0.6rem;
}

.app-message {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 80;
    width: fit-content;
    max-width: min(28rem, calc(100vw - 2rem));
    margin: 0;
    padding: 0.8rem 1rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface-strong);
    color: var(--muted);
}

.app-message:empty {
    display: none;
}

.app-message[data-tone="error"] {
    border-color: rgb(255 155 172 / 52%);
    color: var(--danger);
}

:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 3px;
}

@media (hover: hover) {
    button:hover {
        filter: brightness(1.08);
    }
}

@media (min-width: 45rem) {
    :root {
        --shell: min(78rem, calc(100% - 4rem));
    }

    .auth-panels {
        align-items: start;
    }

    .feed-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .placeholder-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 34rem) {
    .handle-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .handle-row button {
        grid-column: 1 / -1;
        width: 100%;
    }
}

@media (min-width: 68rem) {
    .mobile-menu-button,
    .sidebar-backdrop {
        display: none;
    }

    .app-shell {
        grid-template-columns: 18.5rem minmax(0, 1fr);
    }

    .app-sidebar {
        position: sticky;
        top: 0;
        z-index: 10;
        width: 18.5rem;
        height: 100svh;
        transform: none;
    }

    .app-content {
        width: min(86rem, calc(100% - 3rem));
        padding: 2rem 0 3rem;
    }

    .dashboard-head {
        margin-bottom: 1.6rem;
    }

    .view-heading {
        grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.42fr);
        align-items: end;
    }

    .settings-layout {
        grid-template-columns: minmax(24rem, 0.78fr) minmax(18rem, 0.35fr);
        align-items: start;
    }

    .profile-media-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .feed-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
