@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&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;
    --accent-colored: #e96d1b;
    --error: #c44;
    --font: "Oswald", system-ui, sans-serif;
    --font-memo: "Noto Sans", 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;
    --scrollbar-size: 6px;
    --scrollbar-track: var(--bg);
    --scrollbar-thumb: #2a2a2a;
    --scrollbar-thumb-hover: #3d3d3d;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

html {
    scrollbar-gutter: stable;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
    width: var(--scrollbar-size);
    height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

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;
    gap: 24px;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.brand {
    display: inline-block;
    font-family: var(--font);
    font-size: var(--font-size-ui);
    letter-spacing: 0.02em;
    color: var(--accent-colored);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s;
    flex-shrink: 0;
}

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

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

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

.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__checkbox {
    white-space: nowrap;
}

.admin-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-caption);
    color: var(--text-muted);
    cursor: pointer;
}

.admin-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--error);
}

.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);
    will-change: transform;
}

.feed--pull-animating {
    transition: transform 0.22s ease;
}

.pull-refresh {
    position: absolute;
    top: 4px;
    left: 0;
    right: 0;
    z-index: 2;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 28px;
    color: var(--text-muted);
    font-size: var(--font-size-caption);
    text-transform: lowercase;
    pointer-events: none;
}

.pull-refresh--visible {
    display: flex;
}

.pull-refresh__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--text-muted);
    border-radius: 50%;
    opacity: 0.55;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.pull-refresh--ready .pull-refresh__spinner {
    opacity: 1;
    border-top-color: var(--accent);
    transform: scale(1.08);
}

.pull-refresh--loading .pull-refresh__spinner {
    opacity: 1;
    border-top-color: var(--accent);
    animation: pull-refresh-spin 0.7s linear infinite;
}

@keyframes pull-refresh-spin {
    to {
        transform: rotate(360deg);
    }
}

.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-header__user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.feed-header__user .feed-meta--right {
    margin-left: 0;
}

.feed-user-link,
.feed-avatar-link {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.feed-user-link:hover .feed-line {
    color: var(--accent);
}

.feed-avatar-link {
    line-height: 0;
}

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

.feed-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #111;
    overflow: hidden;
    border-radius: 12px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.feed-like-burst {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.feed-like-burst__heart {
    color: #e84545;
    font-size: 152px;
    line-height: 1;
    opacity: 0;
    transform: scale(0.35);
    text-shadow:
        0 0 12px rgba(232, 69, 69, 0.55),
        0 4px 24px rgba(232, 69, 69, 0.35);
    animation: feed-like-burst 0.8s ease-out forwards;
}

@keyframes feed-like-burst {
    0% {
        opacity: 0;
        transform: scale(0.35);
    }
    18% {
        opacity: 1;
        transform: scale(1.12);
    }
    42% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.3);
    }
}

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

.feed-entry--playing .feed-cover {
    filter: brightness(0.68);
}

.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-footer {
    display: grid;
    grid-template-columns: 40px 1fr;
    align-items: start;
    gap: 16px;
    width: 100%;
    min-height: 28px;
}

.feed-footer__likes {
    display: flex;
    align-items: flex-start;
    min-height: 20px;
}

.feed-footer__memo {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 8px;
    min-height: 20px;
    min-width: 0;
}

.feed-memo {
    font-family: var(--font);
    font-size: var(--font-size-small);
    line-height: 1.5;
    color: #fff;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: right;
    max-width: 100%;
}

.feed-edit-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    padding: 2px;
    cursor: pointer;
    opacity: 0.72;
}

.feed-edit-btn:hover {
    opacity: 1;
}

.feed-edit-btn img {
    display: block;
}

.feed-edit-btn--on-cover {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 1;
    padding: 6px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0.9;
}

.feed-edit-btn--on-cover:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.5);
}

.feed-playing-viz {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    bottom: auto;
    height: 52%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 10%;
    pointer-events: none;
    transform: translateY(-50%);
}

.feed-playing-viz span {
    display: block;
    min-width: 2px;
    height: 100%;
    border-radius: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 18%,
        rgba(255, 255, 255, 0.35) 38%,
        rgba(255, 255, 255, 0.62) 50%,
        rgba(255, 255, 255, 0.35) 62%,
        rgba(255, 255, 255, 0.08) 82%,
        transparent 100%
    );
    filter: blur(1.4px);
    transform-origin: center center;
    animation: feed-playing-bar 0.95s ease-in-out infinite alternate;
}

.feed-playing-viz span:nth-child(1) {
    flex: 0.45;
    animation-duration: 0.78s;
    animation-delay: -0.1s;
}
.feed-playing-viz span:nth-child(2) {
    flex: 1.15;
    animation-duration: 1.05s;
    animation-delay: -0.35s;
}
.feed-playing-viz span:nth-child(3) {
    flex: 0.35;
    animation-duration: 0.7s;
    animation-delay: -0.55s;
}
.feed-playing-viz span:nth-child(4) {
    flex: 1.6;
    animation-duration: 1.12s;
    animation-delay: -0.2s;
}
.feed-playing-viz span:nth-child(5) {
    flex: 0.55;
    animation-duration: 0.86s;
    animation-delay: -0.7s;
}
.feed-playing-viz span:nth-child(6) {
    flex: 1.05;
    animation-duration: 0.98s;
    animation-delay: -0.4s;
}
.feed-playing-viz span:nth-child(7) {
    flex: 0.4;
    animation-duration: 0.74s;
    animation-delay: -0.15s;
}
.feed-playing-viz span:nth-child(8) {
    flex: 1.85;
    animation-duration: 1.18s;
    animation-delay: -0.5s;
}
.feed-playing-viz span:nth-child(9) {
    flex: 0.7;
    animation-duration: 0.88s;
    animation-delay: -0.25s;
}
.feed-playing-viz span:nth-child(10) {
    flex: 1.3;
    animation-duration: 1.02s;
    animation-delay: -0.65s;
}
.feed-playing-viz span:nth-child(11) {
    flex: 0.5;
    animation-duration: 0.8s;
    animation-delay: -0.3s;
}
.feed-playing-viz span:nth-child(12) {
    flex: 1.5;
    animation-duration: 1.1s;
    animation-delay: -0.45s;
}
.feed-playing-viz span:nth-child(13) {
    flex: 0.3;
    animation-duration: 0.68s;
    animation-delay: -0.8s;
}
.feed-playing-viz span:nth-child(14) {
    flex: 1.2;
    animation-duration: 0.94s;
    animation-delay: -0.18s;
}
.feed-playing-viz span:nth-child(15) {
    flex: 0.85;
    animation-duration: 0.9s;
    animation-delay: -0.6s;
}
.feed-playing-viz span:nth-child(16) {
    flex: 1.7;
    animation-duration: 1.15s;
    animation-delay: -0.38s;
}
.feed-playing-viz span:nth-child(17) {
    flex: 0.45;
    animation-duration: 0.76s;
    animation-delay: -0.52s;
}

@keyframes feed-playing-bar {
    from {
        transform: scaleY(0.42);
        opacity: 0.45;
    }
    to {
        transform: scaleY(1);
        opacity: 0.9;
    }
}

.feed-playing-actions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 14px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 14px;
    pointer-events: none;
}

.feed-playing-log,
.feed-playing-cancel {
    border: none;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.4);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-small);
    letter-spacing: 0.08em;
    cursor: pointer;
    padding: 10px 16px;
    pointer-events: auto;
    transition: color 0.15s, background 0.15s;
}

.feed-playing-log {
    color: #fff;
}

.feed-playing-cancel {
    color: #fff;
    background: #e84545;
}

.feed-playing-log:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.55);
}

.feed-playing-cancel:hover:not(:disabled) {
    color: #fff;
    background: #d63636;
}

.feed-playing-log:disabled,
.feed-playing-cancel:disabled {
    opacity: 0.55;
    cursor: default;
}

.feed-likes {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text);
    line-height: 1;
}

.feed-likes--stacked {
    gap: 1px;
}

.feed-likes--stacked .feed-likes__heart {
    margin-left: 0;
}

.feed-likes__heart {
    color: #fff;
    font-size: 20px;
    line-height: 1;
    text-shadow:
        0 0 1px #fff,
        0 1px 0 #ddd,
        0 2px 4px rgba(255, 255, 255, 0.25);
}

.feed-likes__heart--mine,
.feed-likes--mine .feed-likes__heart {
    color: #e84545;
    text-shadow:
        0 0 1px #e84545,
        0 1px 0 #c73636,
        0 2px 6px rgba(232, 69, 69, 0.45);
}

.feed-likes__count {
    font-size: var(--font-size-caption);
    color: var(--text-muted);
}

.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 {
    --shuffle-btn-size: 52px;
    display: none;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    /* balance shuffle on the right so "new spin" sits visually centered */
    padding-left: calc(var(--shuffle-btn-size) + 12px);
    margin-bottom: 28px;
}

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

.new-spin-btn {
    flex: 1;
    min-width: 0;
    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;
}

.shuffle-btn {
    flex-shrink: 0;
    width: var(--shuffle-btn-size);
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.72;
    transition: opacity 0.15s;
}

.shuffle-btn:hover:not(:disabled) {
    opacity: 1;
}

.shuffle-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.shuffle-btn img {
    display: block;
}

body.collection-modal-open,
body.spin-edit-open,
body.shuffle-modal-open {
    overflow: hidden;
}

.shuffle-modal {
    z-index: 210;
}

.shuffle-modal__dialog {
    position: relative;
    max-width: 520px;
    padding: 16px 20px 20px;
    background: #0a0a0a;
    border-color: #1c1c1c;
}

.shuffle-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    min-height: 32px;
}

.shuffle-modal__title {
    margin: 0;
    font-size: var(--font-size-ui);
    font-weight: normal;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: lowercase;
}

.shuffle-modal__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.shuffle-modal__close:hover:not(:disabled) {
    color: var(--text);
}

.shuffle-modal__close:disabled {
    cursor: default;
    opacity: 0.5;
}

.shuffle-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.shuffle-card__cover-frame {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

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

.shuffle-card__cover[hidden] {
    display: none;
}

.shuffle-card__cover-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 13, 13, 0.72);
    padding: 16px;
}

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

.shuffle-card__cover-overlay-text {
    font-size: var(--font-size-small);
    color: var(--text-muted);
    letter-spacing: 0.12em;
    text-transform: lowercase;
    text-align: center;
}

.shuffle-card__cover-overlay-text--loading {
    animation: shuffle-loading-pulse 1.2s ease-in-out infinite;
}

.shuffle-card__cover-overlay-text--error {
    color: var(--error);
    letter-spacing: 0.04em;
    text-transform: none;
    line-height: 1.4;
    word-break: break-word;
}

@keyframes shuffle-loading-pulse {
    0%,
    100% {
        opacity: 0.35;
    }
    50% {
        opacity: 1;
    }
}

.shuffle-card__info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 28px 14px 12px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.78) 0%,
        rgba(0, 0, 0, 0.55) 55%,
        rgba(0, 0, 0, 0) 100%
    );
    text-align: left;
    pointer-events: none;
}

.shuffle-card__line,
.shuffle-card__tags {
    margin: 0;
    width: 100%;
    word-break: break-word;
}

.shuffle-card__line {
    font-size: var(--font-size-ui);
    color: #fff;
}

.shuffle-card__tags {
    font-size: var(--font-size-small);
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.4;
}

.shuffle-card__tags[hidden] {
    display: none;
}

.shuffle-card__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin-top: 8px;
}

.shuffle-action {
    padding: 12px 10px;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    background: #111;
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-small);
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.shuffle-action:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.shuffle-action--spin {
    font-weight: 600;
}

.shuffle-action:disabled {
    cursor: default;
}

.shuffle-action--next {
    justify-self: stretch;
}

.shuffle-card__memo {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.shuffle-card__memo[hidden] {
    display: none !important;
}

.shuffle-card__memo-field {
    width: 100%;
}

.shuffle-card__memo-field input {
    background: #111;
    border-color: #2a2a2a;
    text-align: center;
}

.shuffle-card__memo-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.btn.shuffle-card__log-btn,
.btn.shuffle-card__now-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    border-radius: 10px;
    background: #111;
    border-color: #2a2a2a;
}

.btn.shuffle-card__log-btn {
    color: var(--accent-colored);
}

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

.btn.shuffle-card__now-btn {
    color: var(--text);
}

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

.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-entry {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    flex-shrink: 0;
}

.collection-item__memo {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 0;
    background: #080808;
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-small);
    text-align: center;
}

.collection-item__memo:focus {
    outline: none;
}

.collection-item__memo[hidden] {
    display: none;
}

.collection-item__actions {
    width: 100%;
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-top: 1px solid var(--border);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    background: #080808;
}

.collection-entry--armed .collection-item__actions {
    display: grid;
}

.collection-item--saving ~ .collection-item__actions,
.collection-item--spun ~ .collection-item__actions {
    display: none;
}

.collection-item__spin-btn,
.collection-item__now-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #080808;
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-ui);
    letter-spacing: 0.08em;
    cursor: pointer;
    padding: 12px 14px;
    transition: color 0.15s, background 0.15s;
}

.collection-item__spin-btn {
    border-left: 1px solid var(--border);
    color: var(--accent-colored);
}

.collection-item__spin-btn:hover:not(:disabled),
.collection-item__now-btn:hover:not(:disabled) {
    color: var(--accent);
}

.collection-item__spin-btn:hover:not(:disabled) {
    color: var(--accent-colored);
}

.collection-item__spin-btn:disabled,
.collection-item__now-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.collection-entry--armed .collection-item {
    border-radius: 0;
}

.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 80px 12px 14px;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.collection-item__calendar {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.15s ease;
}

.collection-item__calendar:hover {
    opacity: 1;
}

.collection-item__calendar img {
    width: 22px;
    height: 22px;
    display: block;
    filter: brightness(1.1);
}

.collection-entry--armed .collection-item__calendar {
    display: inline-flex;
}

.collection-item__datetime {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 0;
    background: #080808;
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-small);
    text-align: center;
    color-scheme: dark;
}

@supports (-webkit-touch-callout: none) {
    /* iOS Safari zooms on inputs with font-size < 16px */
    .collection-item__memo,
    .collection-item__datetime,
    .collection-filter {
        font-size: 16px;
    }
}

.collection-item__datetime::-webkit-calendar-picker-indicator {
    display: none;
}

.collection-item__datetime::-webkit-clear-button {
    display: none;
}

.collection-item__datetime::-webkit-inner-spin-button {
    display: none;
}

.collection-item__datetime:focus {
    outline: none;
}

.collection-item__datetime[hidden] {
    display: none;
}

.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-family: "Bebas Neue", var(--font);
    font-size: 40px;
    font-weight: 400;
    letter-spacing: 0.06em;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.collection-item--armed {
    border-color: #777;
}

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

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

.collection-item--saving .collection-item__overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.65);
}

.collection-item--saving .collection-item__overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.08) 45%,
        rgba(255, 255, 255, 0) 75%
    );
    transform: translateX(-60%);
    animation: collection-sheen 0.9s ease-out infinite;
    pointer-events: none;
}

@keyframes collection-sheen {
    0% {
        transform: translateX(-60%);
    }
    100% {
        transform: translateX(60%);
    }
}

.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;
}

.collection-item--spun .collection-item__calendar {
    display: none;
}

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

    .feed-ambient {
        opacity: 0.7;
    }

    .feed-ambient__layer {
        filter: blur(44px) saturate(1.1) brightness(0.52);
    }

    .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;
}

.btn-colored {
    width: 100%;
    margin-top: 8px;
    color: var(--accent-colored);
}

.logout-form {
    display: inline;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    line-height: 0;
}

.btn-icon img {
    display: block;
}

.btn-icon:hover img {
    filter: brightness(1.35);
}

.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;
}

.login-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.login-tab {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: var(--font-size-caption);
    text-transform: lowercase;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.login-tab:hover {
    color: var(--text);
    border-color: var(--accent);
}

.login-tab--active {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.04);
}

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

.login-register-fields[hidden] {
    display: none !important;
}

.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);
}

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

.spin-edit-form input[type="datetime-local"] {
    color-scheme: dark;
}

.spin-edit-form input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.85;
    filter: invert(1);
}

.spin-edit-delete {
    color: #e84545;
}

.spin-edit-delete:hover {
    color: #ff6b6b;
}

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

.settings-user {
    font-size: var(--font-size-small);
    color: var(--accent-colored);
}

.settings-readonly {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font);
    font-size: var(--font-size-ui);
    padding: 8px 10px;
    margin: 0;
}

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

.avatar-field__row {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.avatar-preview-wrap {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.avatar-upload-btn {
    flex-shrink: 0;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-input {
    display: none;
}

.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;
}
