@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap");

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

:root {
    --bg: #0d0d0d;
    --surface: #161616;
    --border: #2a2a2a;
    --text: #e8e8e8;
    --text-muted: #6b6b6b;
    --accent: #c8c8c8;
    --error: #c44;
    --font: "Oswald", system-ui, sans-serif;
    --font-size-body: 17px;
    --font-size-ui: 16px;
    --font-size-small: 15px;
    --font-size-caption: 14px;
    --font-size-micro: 13px;
    --feed-width: 640px;
    --header-height: 65px;
}

html {
    scrollbar-gutter: stable;
}

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-top: var(--header-height);
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.brand {
    font-size: var(--font-size-ui);
    letter-spacing: 0.02em;
    color: var(--text-muted);
}

.header-center,
.feed-scope {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.feed-scope {
    display: flex;
    align-items: center;
    gap: 20px;
}

.feed-scope__btn {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font);
    font-size: var(--font-size-ui);
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s;
}

.feed-scope__btn:hover {
    color: var(--text);
}

.feed-scope__btn--active {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.username-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font);
    font-size: var(--font-size-ui);
    color: var(--accent);
    cursor: pointer;
    transition: color 0.15s;
}

.username-btn:hover {
    color: var(--text);
}

.main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height));
}

.main--feed {
    display: block;
    padding: 0;
    position: relative;
    z-index: 1;
}

.main--admin {
    display: block;
    padding: 28px 24px 48px;
}

.admin {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

.admin-title {
    font-size: var(--font-size-ui);
    font-weight: normal;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: lowercase;
    margin-bottom: 20px;
}

.admin-message {
    margin-bottom: 16px;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    font-size: var(--font-size-caption);
    font-weight: normal;
    color: var(--text-muted);
    text-transform: lowercase;
    letter-spacing: 0.04em;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-row-form {
    display: contents;
}

.admin-input {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-small);
}

.admin-input:focus {
    outline: none;
    border-color: var(--accent);
}

.admin-input--confirm {
    margin-top: 8px;
}

.admin-table__meta {
    font-size: var(--font-size-caption);
    color: var(--text-muted);
    white-space: nowrap;
}

.admin-table__actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.admin-table__new {
    background: rgba(255, 255, 255, 0.02);
}

.admin-table__new .admin-input::placeholder {
    color: var(--text-muted);
}

.feed-stage {
    position: relative;
    min-height: calc(100vh - var(--header-height));
}

.feed-ambient {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.feed-ambient__side {
    position: absolute;
    top: -8%;
    bottom: -8%;
    width: calc((100% - var(--feed-width)) / 2 + 48px);
    overflow: hidden;
}

.feed-ambient__side--left {
    left: 0;
}

.feed-ambient__side--right {
    right: 0;
}

.feed-ambient__side--hidden {
    visibility: hidden;
}

.feed-ambient__layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(56px) saturate(1.15) brightness(0.5);
    transform: scale(1.12);
    opacity: 0;
    will-change: opacity;
}

.feed-ambient__layer:nth-child(1) {
    z-index: 2;
}

.feed-ambient__layer:nth-child(2) {
    z-index: 1;
}

.feed {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--feed-width);
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
    padding: 24px 20px 48px;
    background: var(--bg);
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.feed-entry {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feed-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.feed-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.feed-meta--left {
    flex: 1;
}

.feed-meta--right {
    margin-left: auto;
    text-align: right;
    align-items: flex-end;
    flex-shrink: 0;
}

.feed-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.feed-media {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #111;
    overflow: hidden;
    border-radius: 12px;
}

.feed-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.feed-cover--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: var(--font-size-small);
    text-transform: lowercase;
}

.feed-line {
    font-size: var(--font-size-small);
    line-height: 1.35;
    color: var(--text);
    word-break: break-word;
}

.feed-line--muted {
    color: var(--text-muted);
}

.feed-memo {
    font-size: var(--font-size-small);
    line-height: 1.5;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-word;
}

.feed-sentinel {
    height: 1px;
}

.feed-status {
    margin-top: 18px;
    text-align: center;
    font-size: var(--font-size-small);
    color: var(--text-muted);
    min-height: 18px;
}

.new-spin-block {
    display: none;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
}

.new-spin-block--visible {
    display: flex;
}

.new-spin-btn {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-ui);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.new-spin-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.new-spin-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

body.collection-modal-open {
    overflow: hidden;
}

.collection-modal {
    z-index: 200;
    padding: 16px;
    align-items: center;
}

.collection-modal__header {
    gap: 16px;
}

.collection-done-btn {
    flex-shrink: 0;
    border-radius: 10px;
}

.collection-modal__dialog {
    width: 100%;
    max-width: min(var(--feed-width), 100%);
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    min-height: calc(100vh - 32px);
    min-height: calc(100dvh - 32px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-bottom: 20px;
}

.collection-modal__dialog .modal-header {
    margin-bottom: 0;
    flex-shrink: 0;
}

.collection-modal__dialog .collection-filter {
    flex-shrink: 0;
}

.collection-modal__dialog .collection-status {
    flex-shrink: 0;
    min-height: 1.35em;
}

.collection-modal__dialog .collection-list {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 2px;
    align-content: flex-start;
}

.collection-filter {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-ui);
}

.collection-filter:focus {
    outline: none;
    border-color: var(--accent);
}

.collection-status {
    font-size: var(--font-size-small);
    color: var(--text-muted);
    min-height: 18px;
}

.collection-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.collection-item {
    position: relative;
    width: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg);
    cursor: pointer;
    padding: 12px 44px 12px 14px;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.collection-item__title {
    font-size: var(--font-size-small);
    color: var(--text);
    line-height: 1.35;
}

.collection-item__tags {
    font-size: var(--font-size-caption);
    color: var(--text-muted);
    line-height: 1.35;
}

.collection-item__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: var(--text);
    font-size: var(--font-size-small);
    text-transform: lowercase;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.collection-item--armed {
    border-color: var(--accent);
}

.collection-item--armed .collection-item__overlay {
    opacity: 1;
}

.collection-item--spun {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
    background: rgba(255, 255, 255, 0.03);
    cursor: default;
    pointer-events: none;
}

.collection-item__check {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    display: none;
    color: var(--accent);
    font-size: 28px;
    line-height: 1;
    font-weight: 700;
}

.collection-item--spun .collection-item__check {
    display: block;
}

@media (max-width: 640px) {
    :root {
        --feed-width: 100%;
    }

    .feed-ambient {
        display: none;
    }

    .feed {
        padding-inline: 16px;
    }
}

.hero-text {
    font-size: var(--font-size-ui);
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: lowercase;
}

.btn {
    display: inline-block;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-small);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

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

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

.logout-form {
    display: inline;
}

.login {
    width: 100%;
    max-width: 320px;
    padding: 0 20px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-title {
    font-size: var(--font-size-ui);
    font-weight: normal;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: lowercase;
    margin-bottom: 4px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field span {
    font-size: var(--font-size-caption);
    color: var(--text-muted);
    text-transform: lowercase;
}

.field input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-ui);
    padding: 8px 10px;
    outline: none;
    transition: border-color 0.15s;
}

.field input:focus {
    border-color: var(--accent);
}

.error {
    font-size: var(--font-size-small);
    color: var(--error);
}

.success {
    font-size: var(--font-size-small);
    color: #6a9;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 24px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title {
    font-size: var(--font-size-ui);
    font-weight: normal;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: lowercase;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.modal-close:hover {
    color: var(--text);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-user {
    font-size: var(--font-size-small);
    color: var(--text-muted);
}

.avatar-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-label {
    font-size: var(--font-size-caption);
    color: var(--text-muted);
    text-transform: lowercase;
}

.avatar-preview-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-preview-empty {
    font-size: var(--font-size-small);
    color: var(--text-muted);
}

.field input[type="file"] {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font);
    font-size: var(--font-size-small);
    padding: 8px 10px;
}

.fieldset {
    border: 1px solid var(--border);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fieldset legend {
    font-size: var(--font-size-caption);
    color: var(--text-muted);
    text-transform: lowercase;
    padding: 0 6px;
}

.password-collapse {
    border: 1px solid var(--border);
    padding: 0 14px;
}

.password-collapse__summary {
    padding: 12px 0;
    font-size: var(--font-size-caption);
    color: var(--text-muted);
    text-transform: lowercase;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.password-collapse__summary::-webkit-details-marker {
    display: none;
}

.password-collapse__summary::before {
    content: "+ ";
    color: var(--accent);
}

.password-collapse[open] .password-collapse__summary::before {
    content: "− ";
}

.password-collapse__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 14px;
}
