/* Global styles */

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

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: #f3f4f6;
    color: #111827;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Keep `hidden` authoritative even when a class sets `display`. */
[hidden] {
    display: none !important;
}

.anim-header {
    padding: 14px 20px;
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.98) 0%, rgba(10, 15, 28, 0.98) 100%);
    color: #f9fafb;
    flex: 0 0 auto;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.28);
}

.anim-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.anim-header__left,
.anim-header__right,
.anim-header__meta,
.anim-header__project,
.anim-header__editor {
    display: flex;
    align-items: center;
}

.anim-header__left {
    gap: 12px;
    min-width: 0;
}

.anim-header__right {
    margin-left: auto;
    gap: 14px;
    flex-wrap: wrap;
}

.anim-header__meta {
    gap: 14px;
    flex-wrap: wrap;
}

.anim-header__logo-link,
.anim-header__back-link {
    text-decoration: none;
}

.anim-header__back-link {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    background-color: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.14);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    font-size: 18px;
    line-height: 1;
}

.anim-header__back-link:hover {
    color: #ffffff;
    background-color: rgba(99, 102, 241, 0.18);
    border-color: rgba(129, 140, 248, 0.38);
}

.anim-header__logo {
    display: inline-block;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    background: linear-gradient(90deg, #a78bfa 0%, #818cf8 45%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.anim-header__project {
    gap: 10px;
    min-width: 0;
}

.anim-header__status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14), 0 0 12px rgba(239, 68, 68, 0.9);
}

.anim-header__project-title {
    color: #f8fafc;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(32vw, 360px);
}

.anim-header__user {
    margin: 0;
    font-size: 13px;
    color: #cbd5e1;
}

.anim-header__user a {
    color: #c4b5fd;
    text-decoration: none;
}

.anim-header__user a:hover {
    color: #ddd6fe;
}

.anim-page--projects {
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.18), transparent 24%),
        linear-gradient(180deg, #0b1120 0%, #090f1c 100%);
}

.anim-page--projects main {
    padding: 28px;
}

main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Messages */

.messages {
    list-style: none;
    padding: 0;
    margin: 12px 0;
    display: grid;
    gap: 6px;
}

.message {
    padding: 8px 10px;
    border-radius: 6px;
    background-color: #e0f2fe;
    color: #0c4a6e;
    font-size: 14px;
}

.message--success {
    background-color: #d1fae5;
    color: #065f46;
}

.message--error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Project dashboard */

.projects-dashboard {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.projects-dashboard__sidebar {
    position: sticky;
    top: 24px;
}

.projects-sidebar {
    padding: 8px 0;
}

.projects-sidebar__title {
    margin: 0 0 16px;
    font-size: 28px;
    line-height: 1.05;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: -0.03em;
}

.projects-sidebar__actions {
    display: grid;
    gap: 12px;
}

.projects-shortcut {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    background-color: rgba(15, 23, 42, 0.72);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.26);
    color: #f8fafc;
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.projects-shortcut:hover {
    transform: translateY(-1px);
    border-color: rgba(129, 140, 248, 0.28);
    background-color: rgba(17, 24, 39, 0.9);
}

.projects-shortcut--primary {
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.projects-shortcut__icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.24), rgba(168, 85, 247, 0.18));
    color: #c4b5fd;
    font-size: 22px;
    flex: 0 0 auto;
}

.projects-shortcut__text {
    font-size: 16px;
    font-weight: 600;
}

.projects-messages {
    margin: 0 0 18px;
}

.anim-page--projects .message {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background-color: rgba(15, 23, 42, 0.88);
    color: #e2e8f0;
    box-shadow: 0 12px 24px rgba(2, 6, 23, 0.2);
}

.anim-page--projects .message--success {
    border-color: rgba(16, 185, 129, 0.26);
    background: linear-gradient(180deg, rgba(6, 95, 70, 0.22), rgba(15, 23, 42, 0.92));
    color: #d1fae5;
}

.anim-page--projects .message--error {
    border-color: rgba(239, 68, 68, 0.28);
    background: linear-gradient(180deg, rgba(127, 29, 29, 0.24), rgba(15, 23, 42, 0.92));
    color: #fee2e2;
}

.projects-section {
    display: grid;
    gap: 18px;
}

.projects-group {
    display: grid;
    gap: 14px;
}

.projects-group + .projects-group {
    margin-top: 10px;
}

.projects-group__header {
    display: grid;
    gap: 4px;
}

.projects-group__title {
    margin: 0;
    color: #f8fafc;
    font-size: 22px;
    line-height: 1.1;
    font-weight: 700;
}

.projects-group__subtitle {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
}

.projects-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.projects-section__title {
    margin: 0;
    font-size: 26px;
    line-height: 1.1;
    font-weight: 700;
    color: #f8fafc;
}

.projects-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 292px), 1fr));
    gap: 22px;
}

.project-card {
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(12, 18, 32, 0.92));
    box-shadow: 0 20px 40px rgba(2, 6, 23, 0.34);
    min-width: 0;
}

.project-card__cover {
    display: block;
    height: 176px;
    background: linear-gradient(135deg, #312e81, #1d4ed8);
    text-decoration: none;
}

.project-card__image,
.project-card__placeholder {
    width: 100%;
    height: 100%;
    display: block;
}

.project-card__image {
    object-fit: cover;
}

.project-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 30%, rgba(248, 250, 252, 0.16), transparent 18%),
        linear-gradient(135deg, #38bdf8 0%, #6366f1 50%, #7c3aed 100%);
}

.project-card__placeholder-initial {
    font-size: 54px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.88);
}

.project-card__body {
    padding: 18px 18px 16px;
    display: grid;
    gap: 16px;
    min-width: 0;
}

.project-card__head,
.project-card__meta,
.project-card__footer,
.project-card__actions {
    display: flex;
    align-items: center;
}

.project-card__head,
.project-card__footer {
    justify-content: space-between;
    gap: 12px;
}

.project-card__head {
    align-items: flex-start;
}

.project-card__footer {
    flex-wrap: wrap;
    row-gap: 12px;
}

.project-card__title {
    color: #f8fafc;
    text-decoration: none;
    font-size: 21px;
    line-height: 1.24;
    font-weight: 700;
    letter-spacing: -0.02em;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.project-card__title:hover {
    color: #c4b5fd;
}

.project-card__menu {
    display: flex;
    align-items: flex-start;
    flex: 0 0 auto;
}

.project-card__icon-button {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.54);
    color: #e2e8f0;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.project-card__icon-button:hover {
    background-color: rgba(79, 70, 229, 0.2);
    border-color: rgba(129, 140, 248, 0.32);
    color: #ffffff;
    transform: translateY(-1px);
}

.project-card__meta {
    gap: 8px 10px;
    flex-wrap: wrap;
    color: #94a3b8;
    font-size: 13px;
}

.project-card__details {
    display: grid;
    gap: 8px;
}

.project-card__detail {
    display: grid;
    gap: 3px;
}

.project-card__detail-label {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.project-card__detail-value {
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card__badge,
.project-card__resolution {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    background-color: rgba(148, 163, 184, 0.1);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.project-card__actions {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
    flex: 0 0 auto;
    max-width: 100%;
}

.project-card__action {
    border: 1px solid rgba(129, 140, 248, 0.18);
    background-color: rgba(99, 102, 241, 0.14);
    color: #e9d5ff;
    padding: 8px 12px;
    min-height: 36px;
    border-radius: 11px;
    cursor: pointer;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.project-card__action--danger {
    border-color: rgba(248, 113, 113, 0.22);
    background-color: rgba(239, 68, 68, 0.14);
    color: #fecaca;
}

.project-card__action:hover {
    background-color: rgba(99, 102, 241, 0.22);
    border-color: rgba(129, 140, 248, 0.3);
    transform: translateY(-1px);
}

.project-card__action--danger:hover {
    background-color: rgba(239, 68, 68, 0.22);
    border-color: rgba(248, 113, 113, 0.36);
}

.project-empty--dashboard {
    grid-column: 1 / -1;
    padding: 28px;
    border-radius: 18px;
    background-color: rgba(15, 23, 42, 0.7);
    border: 1px dashed rgba(148, 163, 184, 0.18);
    text-align: center;
}

.tool-button,
.project-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 15px;
    border-radius: 12px;
    border: 1px solid rgba(129, 140, 248, 0.32);
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.96), rgba(67, 56, 202, 0.94));
    color: #f8fafc;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow:
        0 14px 24px rgba(37, 99, 235, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    appearance: none;
}

.tool-button:hover,
.project-action:hover {
    transform: translateY(-1px);
    border-color: rgba(147, 197, 253, 0.38);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.98), rgba(79, 70, 229, 0.96));
}

.tool-button:focus-visible,
.project-action:focus-visible,
.project-card__action:focus-visible,
.project-card__icon-button:focus-visible,
.modal__close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.tool-button:disabled,
.project-action:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.tool-button--secondary,
.project-action {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(30, 41, 59, 0.82);
    color: #e2e8f0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tool-button--secondary:hover,
.project-action:hover {
    background: rgba(51, 65, 85, 0.92);
    border-color: rgba(129, 140, 248, 0.24);
}

.tool-button--danger,
.project-action--danger,
.share-button--danger {
    border-color: rgba(248, 113, 113, 0.32);
    background: rgba(127, 29, 29, 0.28);
    color: #fecaca;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tool-button--danger:hover,
.project-action--danger:hover,
.share-button--danger:hover {
    background: rgba(153, 27, 27, 0.38);
    border-color: rgba(248, 113, 113, 0.42);
}

.project-action-form {
    margin: 0;
}

.project-empty {
    color: #6b7280;
    font-size: 14px;
}

/* Modals */

body.modal-open {
    overflow: hidden;
}

.anim-page--editor,
.anim-page--editor input,
.anim-page--editor select,
.anim-page--editor textarea,
.anim-page--editor progress {
    accent-color: #3b82f6;
}

.anim-page--editor input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    height: 18px;
    background: transparent;
    cursor: pointer;
}

.anim-page--editor input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
    border: 1px solid rgba(147, 197, 253, 0.24);
}

.anim-page--editor input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -6px;
    border-radius: 999px;
    border: 2px solid #dbeafe;
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.38);
}

.anim-page--editor input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
    border: 1px solid rgba(147, 197, 253, 0.24);
}

.anim-page--editor input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid #dbeafe;
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.38);
}

.anim-page--editor input[type="range"]:focus-visible {
    outline: none;
}

.anim-page--editor input[type="range"]:focus-visible::-webkit-slider-runnable-track {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.anim-page--editor input[type="range"]:focus-visible::-moz-range-track {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.anim-page--editor :is(
    .history-list,
    .layers-list,
    .project-comments-list,
    .editor-sidebar,
    .discussion-panel
) {
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 165, 250, 0.7) rgba(15, 23, 42, 0.72);
}

.anim-page--editor :is(
    .history-list,
    .layers-list,
    .project-comments-list,
    .editor-sidebar,
    .discussion-panel
)::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.anim-page--editor :is(
    .history-list,
    .layers-list,
    .project-comments-list,
    .editor-sidebar,
    .discussion-panel
)::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
}

.anim-page--editor :is(
    .history-list,
    .layers-list,
    .project-comments-list,
    .editor-sidebar,
    .discussion-panel
)::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
    border: 2px solid rgba(15, 23, 42, 0.72);
}

.anim-page--editor :is(
    .history-list,
    .layers-list,
    .project-comments-list,
    .editor-sidebar,
    .discussion-panel
)::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #93c5fd 0%, #3b82f6 100%);
}

.editor-popup-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(17, 24, 39, 0.55);
    z-index: 1900;
}

.editor-popup-backdrop[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2300;
}

.modal[hidden] {
    display: none;
}

.modal__overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(17, 24, 39, 0.55);
}

.modal__content {
    position: relative;
    z-index: 1;
    width: min(420px, 90vw);
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(9, 14, 26, 0.98));
    box-shadow: 0 28px 60px rgba(2, 6, 23, 0.5);
    padding: 20px;
    display: grid;
    gap: 14px;
    color: #e2e8f0;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal__title {
    margin: 0;
    font-size: 20px;
    color: #f8fafc;
}

.modal__close {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.56);
    font-size: 22px;
    cursor: pointer;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.modal__close:hover {
    color: #f8fafc;
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(129, 140, 248, 0.26);
    transform: translateY(-1px);
}

.modal__body {
    display: grid;
    gap: 10px;
}

.modal__text {
    margin: 0;
    font-size: 14px;
    color: #cbd5e1;
}

.modal__text--danger {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(248, 113, 113, 0.24);
    background-color: rgba(127, 29, 29, 0.18);
    color: #fecaca;
    font-size: 15px;
    line-height: 1.6;
}

.modal__hint {
    margin: 0;
    font-size: 13px;
    color: #94a3b8;
}

.modal__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Export modal */

.export-fieldset {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    padding: 8px 10px;
    display: grid;
    gap: 6px;
    background: rgba(15, 23, 42, 0.58);
}

.export-legend {
    font-size: 12px;
    color: #94a3b8;
    padding: 0 4px;
}

.export-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #e2e8f0;
}

.export-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 460px) {
    .export-grid {
        grid-template-columns: 1fr;
    }
}

.export-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #e2e8f0;
}

.export-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #cbd5e1;
}

.export-spinner {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid #d1d5db;
    border-top-color: #2563eb;
    animation: export-spin 0.8s linear infinite;
}

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

/* Rename form */

.project-rename-form {
    margin-top: 12px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    display: grid;
    gap: 10px;
    max-width: 420px;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.24);
}

.project-current-title {
    margin: 8px 0 0;
    color: #cbd5e1;
}

.form-field {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: #cbd5e1;
}

.form-field > span:first-child {
    color: #cbd5e1;
    font-weight: 600;
}

.form-field :is(
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="password"],
    input[type="url"],
    input[type="search"],
    select,
    textarea
),
.share-card__copy input[readonly],
.share-inline-form select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    background: rgba(15, 23, 42, 0.78);
    color: #f8fafc;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field :is(
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="password"],
    input[type="url"],
    input[type="search"],
    select,
    textarea
)::placeholder,
.share-card__copy input[readonly]::placeholder {
    color: #64748b;
}

.form-field :is(
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="password"],
    input[type="url"],
    input[type="search"],
    select,
    textarea
):hover:not(:focus):not(:disabled),
.share-card__copy input[readonly]:hover,
.share-inline-form select:hover:not(:focus):not(:disabled) {
    border-color: rgba(129, 140, 248, 0.28);
    background: rgba(15, 23, 42, 0.86);
}

.form-field :is(
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="password"],
    input[type="url"],
    input[type="search"],
    select,
    textarea
):focus,
.share-card__copy input[readonly]:focus,
.share-inline-form select:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.92);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
}

.form-field :is(
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="password"],
    input[type="url"],
    input[type="search"],
    textarea
):read-only,
.share-card__copy input[readonly] {
    background: rgba(15, 23, 42, 0.62);
    color: #cbd5e1;
    border-style: dashed;
}

.form-field :is(
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="password"],
    input[type="url"],
    input[type="search"],
    select,
    textarea
):disabled,
.share-card__copy input[readonly]:disabled,
.share-inline-form select:disabled {
    opacity: 0.68;
    cursor: not-allowed;
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.52);
    box-shadow: none;
}

.form-field select,
.share-inline-form select {
    appearance: none;
    padding-right: 36px;
    background-image:
        linear-gradient(45deg, transparent 50%, #94a3b8 50%),
        linear-gradient(135deg, #94a3b8 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.form-field input[type="file"] {
    width: 100%;
    min-height: 48px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.72);
    color: #cbd5e1;
    box-sizing: border-box;
}

.form-field input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(30, 41, 59, 0.82);
    color: #e2e8f0;
    cursor: pointer;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-error {
    margin: 0;
    color: #fda4af;
    font-size: 13px;
}

/* Editor root */

.editor-root {
    --editor-sidebar-width: clamp(320px, 24vw, 380px);
    --editor-panel-gap: 12px;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 16px;
    padding: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Editor controls in the main header */

.anim-page--editor {
    background:
        radial-gradient(circle at top center, rgba(59, 130, 246, 0.12), transparent 26%),
        linear-gradient(180deg, #08111f 0%, #090e1a 100%);
}

.anim-page--editor main {
    padding: 14px 16px 16px;
    overflow: hidden;
}

.anim-page--editor .anim-header {
    padding: 12px 18px;
}

.anim-page--editor .anim-header__inner {
    gap: 16px 18px;
    flex-wrap: nowrap;
}

.anim-page--editor .anim-header__left,
.anim-page--editor .anim-header__right,
.anim-page--editor .anim-header__meta {
    min-width: 0;
}

.anim-page--editor .anim-header__left {
    flex: 1 1 auto;
}

.anim-page--editor .anim-header__right {
    gap: 12px;
    flex: 0 1 auto;
}

.anim-page--editor .anim-header__meta {
    margin-left: auto;
}

.anim-header__project-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.anim-page--editor .anim-header__project {
    gap: 12px;
}

.anim-page--editor .anim-header__project-title {
    max-width: min(34vw, 420px);
}

.anim-page--editor .anim-header__project-meta {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.3;
}

.anim-page--editor .anim-header__user {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

.anim-header__editor,
.site-header__editor {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-wrap: wrap;
}

.editor-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.editor-save {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.view-menu {
    position: relative;
    display: inline-flex;
}

.view-menu__button {
    min-width: 0;
}

.view-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 2400;
    width: 220px;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 22px 42px rgba(2, 6, 23, 0.42);
    display: grid;
    gap: 4px;
}

.view-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.view-menu__item:hover {
    background: rgba(59, 130, 246, 0.16);
}

.view-menu__item input {
    accent-color: #60a5fa;
}

.save-button-tooltip {
    position: relative;
    display: inline-flex;
}

.save-status-tooltip {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    max-width: min(300px, 70vw);
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.96);
    color: #e2e8f0;
    box-shadow: 0 16px 30px rgba(2, 6, 23, 0.36);
    display: none;
    z-index: 2200;
    line-height: 1.3;
    gap: 4px;
}

.save-status-tooltip::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 16px;
    width: 10px;
    height: 10px;
    background-color: rgba(15, 23, 42, 0.96);
    border-left: 1px solid rgba(148, 163, 184, 0.2);
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    transform: rotate(45deg);
}

.save-button-tooltip:hover .save-status-tooltip,
.save-button-tooltip:focus-within .save-status-tooltip {
    display: grid;
}

/* Toolbar panel */

.editor-toolbar-panel {
    position: relative;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 96px;
    min-width: 96px;
    align-self: stretch;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, rgba(15, 23, 42, 0.84) 100%);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 24px;
    box-shadow: 0 20px 42px rgba(2, 6, 23, 0.3);
    padding: 14px 10px;
    display: grid;
    align-content: start;
    gap: 12px;
    z-index: 20;
    line-height: normal;
    overflow: visible;
}

.editor-toolbar-panel.editor-toolbar-panel--popup-active {
    z-index: auto;
}

.editor-toolbar-panel.editor-ui--global-modal-suppressed {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    box-shadow: none;
}

.editor-toolbar-panel__header {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
}

.editor-toolbar-panel__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-align: center;
    color: #93c5fd;
}

.editor-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    overflow: visible;
    padding: 0;
}

.editor-toolbar-colors {
    display: grid;
    justify-items: center;
    justify-content: center;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.editor-toolbar-colors input[type="color"] {
    width: 42px;
    height: 42px;
    border: 2px solid rgba(148, 163, 184, 0.24);
    border-radius: 6px;
    padding: 0;
    background: rgba(15, 23, 42, 0.6);
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.24);
}

.tool-settings-popover {
    position: absolute;
    left: calc(100% + 14px);
    top: 0;
    width: 260px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.97);
    color: #e2e8f0;
    box-shadow: 0 22px 44px rgba(2, 6, 23, 0.36);
    z-index: 1850;
}

.tool-settings-popover.editor-popup--active {
    z-index: 2250;
}

.tool-settings-popover.editor-ui--global-modal-suppressed {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    box-shadow: none;
}

.tool-settings-popover::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 16px;
    width: 10px;
    height: 10px;
    background-color: rgba(15, 23, 42, 0.97);
    border-left: 1px solid rgba(148, 163, 184, 0.16);
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    transform: rotate(45deg);
}

.tool-settings-popover__inner {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.tool-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 2px 0;
    color: #dbeafe;
}

.tool-control--group {
    flex-wrap: wrap;
    background: rgba(2, 6, 23, 0.36);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 12px;
    padding: 8px;
}

.tool-control__label {
    font-size: 12px;
    color: #93c5fd;
    white-space: nowrap;
    flex: 0 0 100%;
}

.tool-control input[type="range"] {
    flex: 1 1 auto;
}

.editor-toolbar > .tool-button {
    width: 60px;
    height: 60px;
    min-height: 60px;
    padding: 0;
    margin: 0 auto;
}

.tool-button--mode {
    padding: 4px 8px;
    font-size: 13px;
}

.tool-icon {
    width: 24px;
    height: 24px;
    display: block;
}

.tool-icon--small {
    width: 18px;
    height: 18px;
}

.anim-page--editor .tool-icon,
.anim-page--editor .layer-icon {
    filter: brightness(0) invert(1);
}

.save-indicator {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background-color: #9ca3af;
}

.save-indicator--idle {
    background-color: #9ca3af;
}

.save-indicator--saved {
    background-color: #10b981;
}

.save-indicator--dirty {
    background-color: #f59e0b;
}

.save-indicator--saving {
    background-color: #3b82f6;
}

.save-indicator--error {
    background-color: #ef4444;
}

.save-status {
    font-size: 13px;
    color: #e2e8f0;
}

.save-status--dirty {
    color: #b45309;
}

.save-status--saving {
    color: #1d4ed8;
}

.save-status--saved {
    color: #059669;
}

.save-status--error {
    color: #b91c1c;
}

.save-last-time {
    font-size: 12px;
    color: #94a3b8;
}

.save-status-tooltip .save-last-time:empty {
    display: none;
}

/* Main editor area */

.editor-main {
    margin-top: 0;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) var(--editor-sidebar-width);
    align-items: stretch;
    gap: 18px;
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    overflow: visible;
}

.editor-main--toolbar-hidden {
    grid-template-columns: minmax(0, 1fr) var(--editor-sidebar-width);
}

.editor-main--sidebar-hidden {
    grid-template-columns: 96px minmax(0, 1fr);
}

.editor-main--toolbar-hidden.editor-main--sidebar-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.editor-main--sidebar-hidden .editor-sidebar {
    display: none;
}

.editor-workspace {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-self: stretch;
}

.comment-notifications {
    position: absolute;
    top: 16px;
    left: 0;
    z-index: 1350;
    width: min(440px, calc(100% - 24px));
    max-width: calc(100% - 24px);
    display: grid;
    gap: 8px;
    pointer-events: none;
}

.comment-notification {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 9px;
    align-items: end;
    min-width: 0;
    animation: comment-notification-in 0.18s ease-out both;
}

.comment-notification__avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(191, 219, 254, 0.24);
    background: linear-gradient(135deg, #22c55e 0%, #3b82f6 52%, #4f46e5 100%);
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 12px 24px rgba(2, 6, 23, 0.26);
}

.comment-notification__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.comment-notification__bubble {
    min-width: 0;
    width: fit-content;
    max-width: min(100%, 340px);
    padding: 8px 11px 9px;
    border-radius: 16px 16px 16px 5px;
    border: 1px solid rgba(96, 165, 250, 0.24);
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 18px 42px rgba(2, 6, 23, 0.34);
    backdrop-filter: blur(14px);
}

.comment-notification__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.comment-notification__author {
    color: #f8fafc;
    font-size: 13px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comment-notification__scope {
    flex: 0 0 auto;
    color: #93c5fd;
    font-size: 10px;
    line-height: 1;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.comment-notification__body {
    margin: 4px 0 0;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.35;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@keyframes comment-notification-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.canvas-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 76px 24px 24px;
    border-radius: 30px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background:
        radial-gradient(circle at top center, rgba(96, 165, 250, 0.08), transparent 30%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, rgba(10, 15, 27, 0.92) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 24px 54px rgba(2, 6, 23, 0.3);
}

.canvas-stage__controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 1300;
    padding: 6px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(2, 6, 23, 0.48);
    box-shadow: 0 14px 28px rgba(2, 6, 23, 0.2);
}

.canvas-stage__workspace {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    align-self: stretch;
}

.canvas-wrapper {
    padding: 18px;
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 24px;
    box-shadow: 0 28px 60px rgba(2, 6, 23, 0.34);
    position: relative;
    display: inline-block;
    line-height: 0;
    margin: 0 auto;
    flex: 0 0 auto;
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
}

/* Canvas itself */

#editor-canvas,
#editor-overlay,
.layer-canvas,
.onion-canvas {
    display: block;
    /* Prevent overflow on smaller screens. */
    max-width: 100%;
}

#editor-canvas {
    width: auto;
    height: auto;
    background-color: #f9fafb;
    background-image:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.72);
    cursor: crosshair;
}

.editor-main.editor-main--canvas-fullscreen .canvas-wrapper {
    box-shadow: 0 36px 80px rgba(2, 6, 23, 0.4);
}

.editor-main.editor-main--canvas-fullscreen {
    grid-template-columns: minmax(0, 1fr);
}

.editor-main.editor-main--canvas-fullscreen .editor-toolbar-panel,
.editor-main.editor-main--canvas-fullscreen .editor-sidebar {
    display: none;
}

.editor-main.editor-main--canvas-fullscreen .editor-workspace {
    grid-column: 1 / -1;
}

.layer-canvas {
    position: absolute;
    top: 12px;
    left: 12px;
    pointer-events: none;
    border-radius: 4px;
    max-width: none;
    max-height: none;
}

#editor-onion-prev,
#editor-onion-next,
.onion-canvas {
    position: absolute;
    top: 12px;
    left: 12px;
    pointer-events: none;
    border-radius: 4px;
    max-width: none;
    max-height: none;
}

.playback-preview-canvas {
    position: absolute;
    top: 12px;
    left: 12px;
    pointer-events: none;
    border-radius: 4px;
    max-width: none;
    max-height: none;
    z-index: 950;
}

.onion-canvas--prev {
    /* Above layers (10+) but below the overlay (1000). */
    z-index: 900;
}

.onion-canvas--next {
    /* Above prev but still below the overlay. */
    z-index: 901;
}

#editor-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    pointer-events: none;
    border-radius: 4px;
    max-width: none;
    max-height: none;
    z-index: 1000;
}

.eyedropper-zoom {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid #111827;
    background-color: #ffffff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    display: none;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.eyedropper-zoom.is-visible {
    display: block;
}

#eyedropper-zoom-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
    image-rendering: pixelated;
}

#editor-canvas.canvas--bucket {
    cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http://www.w3.org/2000/svg%27%20width%3D%2724%27%20height%3D%2724%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20fill%3D%27000%27%20d%3D%27M7%207h10l-2%2012H9L7%207zm-2-2h14v2H5V5zm4-3h6v2H9V2z%27/%3E%3C/svg%3E") 4 20, pointer;
}

#editor-canvas.canvas--pan {
    cursor: grab;
}

#editor-canvas.canvas--pan.canvas--panning {
    cursor: grabbing;
}

.anim-page--editor .tool-button {
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.78);
    padding: 7px 12px;
    border-radius: 12px;
    min-height: 34px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #e2e8f0;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.anim-page--editor .tool-button:hover {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(129, 140, 248, 0.26);
    transform: translateY(-1px);
}

.anim-page--editor .tool-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.anim-page--editor .tool-button--active {
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.96) 0%, rgba(67, 56, 202, 0.96) 100%);
    color: #f8fafc;
    border-color: rgba(129, 140, 248, 0.8);
    box-shadow: 0 14px 26px rgba(67, 56, 202, 0.28);
}

.anim-page--editor .tool-button--active .tool-icon {
    filter: brightness(0) invert(1);
}

.anim-page--editor .tool-button--small {
    padding: 6px 10px;
    font-size: 12px;
}

.anim-page--editor .tool-button--mode .tool-icon {
    width: 20px;
    height: 20px;
}

.editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--editor-panel-gap);
    flex: 0 0 var(--editor-sidebar-width);
    width: var(--editor-sidebar-width);
    min-width: 320px;
    max-width: 380px;
    min-height: 0;
    max-height: 100%;
    align-self: stretch;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    scrollbar-gutter: stable;
}

.editor-sidebar__panels {
    display: flex;
    flex-direction: column;
    gap: var(--editor-panel-gap);
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    min-height: auto;
    align-self: start;
    box-sizing: border-box;
}

.editor-sidebar__section,
.layers-panel,
.history-panel,
.discussion-panel {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, rgba(15, 23, 42, 0.84) 100%);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 24px;
    box-shadow: 0 20px 44px rgba(2, 6, 23, 0.28);
}

.editor-sidebar__section {
    padding: 14px;
    display: grid;
    gap: 12px;
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    align-self: stretch;
    box-sizing: border-box;
}

.history-panel,
.discussion-panel {
    position: static;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100%;
    padding: 14px;
    display: grid;
    gap: 12px;
    line-height: normal;
    overflow: hidden;
    min-height: 140px;
    min-width: 0;
    flex: 0 0 auto;
    align-self: start;
    box-sizing: border-box;
}

.layers-panel {
    position: static;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100%;
    padding: 14px;
    display: grid;
    gap: 12px;
    overflow: hidden;
    min-height: 150px;
    min-width: 0;
    flex: 0 0 auto;
    align-self: start;
    box-sizing: border-box;
    --layer-preview-size: 36px;
}

.discussion-panel {
    max-height: min(460px, calc(100vh - 190px));
    grid-template-rows: auto auto minmax(54px, auto) auto auto;
    overflow: hidden;
}

.layers-panel__header,
.history-panel__header {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
}

.editor-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.editor-section-heading--with-actions {
    align-items: center;
}

.editor-section-heading__eyebrow {
    margin: 0 0 4px;
    color: #93c5fd;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.editor-section-heading__title,
.layers-panel__title,
.history-panel__title,
.discussion-panel__title {
    margin: 0;
    color: #f8fafc;
    font-size: 15px;
    font-weight: 700;
}

.editor-collab-grid {
    display: grid;
    gap: 12px;
}

.project-presence,
.frame-lock-status {
    min-width: 0;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(2, 6, 23, 0.32);
    display: grid;
}

.project-presence {
    gap: 12px;
}

.project-presence__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.project-presence__title,
.frame-lock-status__title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #94a3b8;
}

.project-presence__count {
    min-width: 26px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.18);
    color: #dbeafe;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.project-presence__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.project-presence__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.88);
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1.3;
}

.project-presence__item--self {
    border-color: rgba(129, 140, 248, 0.32);
    background: rgba(49, 46, 129, 0.22);
}

.project-presence__indicator {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background-color: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
    flex: 0 0 auto;
}

.project-presence__body {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.project-presence__name {
    font-weight: 700;
}

.project-presence__meta,
.project-presence__empty {
    color: #94a3b8;
}

.project-presence__you {
    color: #c4b5fd;
    font-weight: 700;
}

.project-presence__empty {
    margin: 0;
    font-size: 12px;
}

.frame-lock-status {
    gap: 6px;
}

.frame-lock-status__text {
    color: #f8fafc;
    font-size: 13px;
    line-height: 1.4;
}

.frame-lock-status--pending {
    border-color: rgba(148, 163, 184, 0.18);
}

.frame-lock-status--editable {
    border-color: rgba(34, 197, 94, 0.26);
    background: rgba(20, 83, 45, 0.28);
}

.frame-lock-status--readonly {
    border-color: rgba(248, 113, 113, 0.24);
    background: rgba(127, 29, 29, 0.26);
}

.history-list,
.layers-list,
.project-comments-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    width: 100%;
    min-width: 0;
    align-self: stretch;
    align-content: start;
    align-items: start;
    scrollbar-gutter: stable both-edges;
    box-sizing: border-box;
}

.history-list {
    max-height: 180px;
}

.layers-list {
    max-height: 330px;
}

.project-comments-list {
    max-height: 170px;
}

.history-empty,
.layers-empty,
.project-comments-empty {
    margin: 0;
    font-size: 13px;
    color: #94a3b8;
}

.discussion-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.discussion-filter__option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(2, 6, 23, 0.28);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.discussion-filter__option:has(input:checked) {
    border-color: rgba(96, 165, 250, 0.52);
    background: rgba(37, 99, 235, 0.18);
    color: #f8fafc;
}

.project-comment {
    position: relative;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    column-gap: 9px;
    row-gap: 0;
    min-width: 0;
    width: 100%;
    align-self: start;
    justify-self: stretch;
    color: #dbeafe;
}

.project-comment--resolved {
    opacity: 0.68;
}

.project-comment__avatar {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 30px;
    height: 30px;
    align-self: start;
    margin-top: 2px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(135deg, #38bdf8 0%, #4f46e5 100%);
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 10px 20px rgba(2, 6, 23, 0.24);
}

.project-comment__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-comment__bubble {
    position: relative;
    grid-column: 2;
    align-self: start;
    justify-self: start;
    width: fit-content;
    max-width: min(100%, 248px);
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.13);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.9);
    overflow: hidden;
}

.project-comment__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 36px 3px 12px;
}

.project-comment__author {
    color: #f8fafc;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-comment__meta {
    color: #94a3b8;
    font-size: 11px;
    white-space: nowrap;
    flex: 0 0 auto;
}

.project-comment__body {
    margin: 0;
    padding: 5px 12px 11px;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.project-comment__delete {
    position: absolute;
    top: 5px;
    right: 7px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.74);
    color: #cbd5e1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font: inherit;
    font-size: 18px;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.project-comment--own:hover .project-comment__delete,
.project-comment--own:focus-within .project-comment__delete {
    opacity: 1;
    pointer-events: auto;
}

.project-comment__delete:hover {
    background: rgba(127, 29, 29, 0.64);
    color: #fecaca;
}

.project-comment__actions {
    display: none;
}

.project-comment-form {
    display: grid;
    gap: 10px;
    padding-top: 2px;
    min-width: 0;
}

.project-comment-form__field {
    display: grid;
    gap: 7px;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 700;
}

.project-comment-form textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 76px;
    max-height: 160px;
    resize: vertical;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.84);
    color: #f8fafc;
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
}

.project-comment-form .tool-button {
    width: 100%;
    min-width: 0;
}

.project-comment-form textarea:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.86);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.history-item {
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 14px;
    padding: 9px 11px;
    background: rgba(15, 23, 42, 0.9);
    color: #dbeafe;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    min-width: 0;
    justify-self: stretch;
    box-sizing: border-box;
}

.history-item--current {
    border-color: rgba(96, 165, 250, 0.52);
    background: rgba(30, 64, 175, 0.18);
    color: #f8fafc;
    font-weight: 600;
}

.history-item--future {
    opacity: 0.52;
}

.layer-item {
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 16px;
    padding: 10px;
    display: grid;
    gap: 8px;
    background: rgba(15, 23, 42, 0.9);
    cursor: grab;
    width: 100%;
    min-width: 0;
    justify-self: stretch;
    align-self: start;
    box-sizing: border-box;
}

.layer-item--locked {
    cursor: not-allowed;
    opacity: 0.78;
}

.layer-item--active {
    border-color: rgba(96, 165, 250, 0.52);
    background: rgba(30, 64, 175, 0.18);
}

.layer-item--occupied {
    border-color: rgba(248, 113, 113, 0.24);
}

.layer-item--occupied-self {
    border-color: rgba(34, 197, 94, 0.26);
    background: rgba(20, 83, 45, 0.22);
}

.layer-item.is-dragging {
    opacity: 0.6;
}

.layer-visibility,
.layer-action {
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
}

.layer-visibility.is-hidden {
    opacity: 0.4;
}

.layer-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.layer-content {
    display: grid;
    gap: 6px;
}

.layer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.layer-title {
    display: grid;
    gap: 6px;
    min-width: 0;
    flex: 1;
    width: 100%;
}

.layer-lock-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(248, 113, 113, 0.16);
    color: #fecaca;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-lock-chip--self {
    background: rgba(34, 197, 94, 0.18);
    color: #bbf7d0;
}

.layer-name {
    font-weight: 600;
    font-size: 14px;
    color: #f8fafc;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-opacity {
    display: grid;
    gap: 4px;
    font-size: 12px;
    color: #94a3b8;
}

.layer-opacity input[type="range"] {
    width: 100%;
}

.layer-preview {
    width: var(--layer-preview-size);
    height: var(--layer-preview-size);
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background-color: #ffffff;
    display: block;
    flex: 0 0 auto;
}

.layer-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.layer-actions--primary[hidden] {
    display: none;
}

.layer-action--danger {
    color: #fca5a5;
}

.layer-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.layer-rename {
    display: grid;
    gap: 6px;
    width: 100%;
}

.layer-rename[hidden] {
    display: none;
}

.layer-item--renaming .layer-name,
.layer-item--renaming .layer-actions--primary {
    display: none;
}

.layer-rename input,
.anim-page--editor .playback-fps input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 13px;
    background: rgba(15, 23, 42, 0.84);
    color: #f8fafc;
}

.layer-rename input:focus,
.anim-page--editor .playback-fps input:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.86);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.layers-panel__add {
    min-width: 36px;
    min-height: 36px;
    padding: 0;
}

.transform-hint {
    position: absolute;
    z-index: 1200;
    pointer-events: none;
    padding: 6px 10px;
    border-radius: 10px;
    background-color: rgba(17, 24, 39, 0.92);
    color: #f9fafb;
    font-size: 12px;
    line-height: 1.25;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
    max-width: min(280px, 70vw);
    white-space: nowrap;
}

/* Frame timeline */

.timeline-wrapper {
    margin-top: 0;
    padding: 16px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(10, 15, 27, 0.95) 100%);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 26px;
    box-shadow: 0 20px 46px rgba(2, 6, 23, 0.28);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    max-width: 100%;
}

.timeline-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    flex-wrap: wrap;
}

.timeline-onion {
    display: inline-flex;
    align-items: center;
}

.onion-panel {
    position: absolute;
    left: 124px;
    top: 18px;
    width: min(320px, calc(100% - 24px));
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.96);
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 26px 52px rgba(2, 6, 23, 0.34);
    z-index: 1850;
    display: grid;
    gap: 12px;
    line-height: normal;
    color: #e2e8f0;
}

.onion-panel.editor-popup--active {
    z-index: 2250;
}

.onion-panel.editor-ui--global-modal-suppressed {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    box-shadow: none;
}

.onion-panel.is-dragging .onion-panel__header {
    cursor: grabbing;
}

.onion-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: grab;
    user-select: none;
}

.onion-panel__title {
    font-weight: 700;
    font-size: 13px;
    color: #f8fafc;
}

.onion-panel__close {
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.6);
    padding: 2px 8px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #f8fafc;
}

.onion-panel__close:hover {
    background-color: rgba(30, 41, 59, 0.9);
}

.onion-panel__body {
    display: grid;
    gap: 10px;
}

.onion-field {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #e2e8f0;
}

.onion-field__label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    color: #cbd5e1;
}

.onion-field input[type="range"] {
    width: 100%;
}

.onion-fieldset {
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 14px;
    padding: 8px 10px;
    display: grid;
    gap: 6px;
    background: rgba(2, 6, 23, 0.24);
}

.onion-fieldset__legend {
    font-size: 12px;
    color: #94a3b8;
    padding: 0 4px;
}

.onion-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #e2e8f0;
}

.timeline-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 2px;
    flex: 1 1 auto;
    scroll-snap-type: x proximity;
}

.timeline-strip--locked {
    opacity: 0.85;
}

.timeline-frame {
    position: relative;
    width: 118px;
    height: 82px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.88) 0%, rgba(15, 23, 42, 0.94) 100%);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    display: grid;
    place-items: center;
    scroll-snap-align: start;
}

.timeline-frame:hover {
    border-color: rgba(129, 140, 248, 0.32);
}

.timeline-frame--active {
    border-color: rgba(96, 165, 250, 0.86);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.22), 0 18px 28px rgba(30, 64, 175, 0.18);
}

.timeline-frame--playback-current {
    box-shadow:
        0 0 0 2px rgba(16, 185, 129, 0.35),
        inset 0 -4px 0 rgba(16, 185, 129, 0.9);
}

.timeline-frame--locked {
    box-shadow:
        0 0 0 2px rgba(239, 68, 68, 0.18),
        inset 0 -4px 0 rgba(239, 68, 68, 0.72);
}

.timeline-frame--locked.timeline-frame--active {
    border-color: #dc2626;
}

.timeline-frame--locked-self {
    box-shadow:
        0 0 0 2px rgba(59, 130, 246, 0.2),
        inset 0 -4px 0 rgba(37, 99, 235, 0.8);
}

.playback-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.playback-loop {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #cbd5e1;
    user-select: none;
}

.playback-loop input[type="checkbox"] {
    cursor: pointer;
}

.playback-fps {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #cbd5e1;
    user-select: none;
}

.playback-fps input {
    width: 78px;
    min-height: 34px;
}

.playback-fps input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.editor-root--playback .canvas-wrapper {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2), 0 28px 60px rgba(2, 6, 23, 0.34);
}

.editor-root--playback .layer-canvas,
.editor-root--playback .onion-canvas {
    visibility: hidden;
}

.timeline-frame.is-dragging {
    opacity: 0.6;
}

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

.timeline-frame__number {
    position: absolute;
    left: 6px;
    top: 6px;
    font-size: 12px;
    padding: 2px 7px;
    border-radius: 999px;
    background-color: rgba(17, 24, 39, 0.78);
    color: #f9fafb;
    line-height: 1.2;
}

.timeline-frame__placeholder {
    font-weight: 700;
    font-size: 18px;
    color: #6b7280;
    user-select: none;
}

.timeline-frame__lock {
    position: absolute;
    right: 6px;
    bottom: 6px;
    max-width: calc(100% - 12px);
    padding: 2px 6px;
    border-radius: 999px;
    background-color: rgba(127, 29, 29, 0.9);
    color: #fee2e2;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-frame__lock--self {
    background-color: rgba(30, 64, 175, 0.88);
    color: #dbeafe;
}

@media (max-height: 760px) {
    .editor-root {
        gap: 12px;
    }

    .editor-toolbar-panel {
        width: 88px;
        min-width: 88px;
        padding: 12px 8px;
    }

    .editor-toolbar {
        gap: 6px;
    }

    .editor-toolbar > .tool-button {
        width: 54px;
        height: 54px;
        min-height: 54px;
    }

    .tool-icon {
        width: 20px;
        height: 20px;
    }

    .timeline-wrapper {
        padding: 14px;
        gap: 12px;
    }

    .timeline-strip {
        gap: 8px;
    }

    .timeline-frame {
        width: 104px;
        height: 68px;
        border-radius: 16px;
    }
}

@media (max-height: 680px) {
    .anim-header {
        padding: 8px 12px;
    }

    .anim-header__logo {
        font-size: 18px;
    }

    .timeline-frame {
        width: 96px;
        height: 60px;
        border-radius: 8px;
    }

    .timeline-frame__placeholder {
        font-size: 16px;
    }
}

@media (max-width: 1280px) {
    .anim-page--editor .anim-header__inner {
        flex-wrap: wrap;
    }

    .anim-page--editor .anim-header__right,
    .anim-page--editor .anim-header__meta {
        width: 100%;
    }

    .anim-page--editor .anim-header__meta {
        margin-left: 0;
    }
}

@media (max-width: 1180px) {
    .editor-main {
        grid-template-columns: 88px minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .editor-main--toolbar-hidden {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor-main--sidebar-hidden {
        grid-template-columns: 88px minmax(0, 1fr);
    }

    .editor-main--toolbar-hidden.editor-main--sidebar-hidden {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor-sidebar {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
        align-items: start;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .editor-main--sidebar-hidden .editor-sidebar {
        display: none;
    }

    .editor-sidebar__panels {
        width: 100%;
    }

    .canvas-stage {
        min-height: 540px;
    }
}

@media (max-width: 1080px) {
    .projects-dashboard {
        grid-template-columns: 1fr;
    }

    .projects-dashboard__sidebar {
        position: static;
    }

    .anim-header__editor {
        width: 100%;
    }

    .editor-sidebar {
        grid-template-columns: 1fr;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .editor-sidebar__panels {
        width: 100%;
    }
}

@media (max-width: 860px) {
    .anim-page--editor main {
        padding: 12px;
    }

    .editor-main {
        grid-template-columns: 1fr;
    }

    .editor-sidebar {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .editor-main--sidebar-hidden .editor-sidebar {
        display: none;
    }

    .editor-toolbar-panel {
        width: 100%;
        min-width: 0;
        padding: 12px;
    }

    .editor-toolbar {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
    }

    .editor-toolbar > .tool-button {
        width: 100%;
        margin: 0;
    }

    .editor-toolbar-colors {
        grid-auto-flow: column;
        justify-content: center;
    }

    .canvas-stage {
        padding: 72px 14px 14px;
        min-height: 480px;
    }

    .comment-notifications {
        top: 76px;
        left: 12px;
        width: calc(100% - 24px);
        max-width: calc(100% - 24px);
    }

    .comment-notification__bubble {
        max-width: 100%;
    }

    .canvas-stage__controls {
        left: 14px;
        right: 14px;
        justify-content: flex-start;
    }

    .canvas-wrapper {
        padding: 12px;
    }

    .onion-panel {
        left: 14px;
        top: 14px;
        width: min(320px, calc(100% - 28px));
    }

    .timeline-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .playback-controls {
        justify-content: flex-start;
    }
}

/* Authentication and profile */

.anim-page--auth {
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 22%),
        radial-gradient(circle at bottom left, rgba(99, 102, 241, 0.18), transparent 26%),
        linear-gradient(180deg, #0b1120 0%, #0f172a 100%);
}

.anim-page--auth main {
    padding: 40px 20px 56px;
    align-items: center;
}

.auth-shell {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-card {
    width: min(100%, 520px);
    padding: 28px;
    border-radius: 24px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 24px 48px rgba(2, 6, 23, 0.34);
    display: grid;
    gap: 18px;
    color: #e2e8f0;
}

.auth-card--wide {
    width: min(100%, 720px);
}

.share-page {
    gap: 24px;
}

.share-section {
    display: grid;
    gap: 16px;
    padding-top: 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.share-section:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.share-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.share-section__title {
    margin: 0;
    color: #f8fafc;
    font-size: 20px;
    font-weight: 700;
}

.share-form {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1.35fr) minmax(160px, 0.72fr) auto;
    align-items: end;
}

.share-form__actions {
    display: flex;
    justify-content: flex-start;
    align-self: end;
}

.share-list {
    display: grid;
    gap: 16px;
}

.share-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(9, 14, 26, 0.78));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.share-card__main,
.share-card__actions,
.share-card__copy,
.share-inline-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.share-card__main {
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.share-card__identity {
    display: grid;
    gap: 4px;
}

.share-card__identity strong {
    color: #f8fafc;
    font-size: 17px;
}

.share-card__identity span {
    color: #94a3b8;
    font-size: 14px;
}

.share-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.share-card__copy {
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(2, 6, 23, 0.28);
}

.share-card__copy input {
    flex: 1 1 320px;
    min-width: 0;
}

.share-inline-form {
    margin: 0;
}

.share-inline-form--role {
    flex: 1 1 auto;
}

.share-inline-form--role select {
    min-width: 152px;
}

.share-inline-form--danger {
    flex: 0 0 auto;
}

.anim-header__share-link {
    white-space: nowrap;
}

.auth-card__eyebrow {
    margin: 0;
    color: #93c5fd;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-card__title {
    margin: 0;
    color: #f8fafc;
    font-size: 34px;
    line-height: 1.05;
}

.auth-card__subtitle {
    margin: 0;
    color: #cbd5e1;
    line-height: 1.5;
}

.auth-card__hint {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.5;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-field {
    color: #e2e8f0;
}

.auth-field__input {
    width: 100%;
    box-sizing: border-box;
}

.auth-field__input:focus {
    outline: none;
}

.auth-field__help {
    color: #94a3b8;
    font-size: 12px;
}

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

.auth-submit--inline {
    width: auto;
}

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

.auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.auth-links a:not(.tool-button) {
    color: #93c5fd;
    text-decoration: none;
}

.auth-links a:not(.tool-button):hover {
    text-decoration: underline;
}

.auth-divider {
    position: relative;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.auth-divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.auth-divider span {
    position: relative;
    padding: 0 12px;
    background: rgba(15, 23, 42, 0.9);
}

.auth-google-button {
    width: 100%;
    box-sizing: border-box;
}

.profile-summary__avatar {
    width: 96px;
    height: 96px;
    border-radius: 999px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #38bdf8, #6366f1);
    color: #ffffff;
    font-size: 34px;
    font-weight: 700;
    flex: 0 0 auto;
    box-shadow: 0 18px 32px rgba(37, 99, 235, 0.2);
}

.profile-summary__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-page {
    gap: 24px;
}

.profile-page__intro {
    display: grid;
    gap: 12px;
}

.profile-hero {
    display: grid;
    gap: 18px;
    padding: 22px;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(30, 41, 59, 0.84), rgba(15, 23, 42, 0.86));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.profile-hero__identity {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.profile-summary__avatar--hero {
    width: 104px;
    height: 104px;
    font-size: 38px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 20px 35px rgba(37, 99, 235, 0.22),
        0 0 0 10px rgba(59, 130, 246, 0.08);
}

.profile-hero__copy {
    margin: 0;
    display: grid;
    gap: 8px;
    min-width: 0;
}

.profile-hero__eyebrow {
    margin: 0;
    color: #93c5fd;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.profile-hero__name {
    margin: 0;
    color: #f8fafc;
    font-size: 32px;
    line-height: 1.05;
}

.profile-hero__email {
    margin: 0;
    color: #cbd5e1;
    word-break: break-word;
}

.profile-grid {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.profile-info-card {
    display: grid;
    gap: 8px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.62);
}

.profile-info-card dt {
    color: #94a3b8;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.profile-info-card dd {
    margin: 0;
    color: #f8fafc;
    font-size: 16px;
    line-height: 1.45;
    word-break: break-word;
}

.profile-actions {
    justify-content: flex-start;
}

.anim-header__logout-form {
    display: inline;
    margin: 0;
}

.anim-header__link-button {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

@media (max-width: 720px) {
    .auth-card {
        padding: 22px;
        border-radius: 18px;
    }

    .auth-card__title {
        font-size: 28px;
    }

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

    .share-form__actions {
        justify-content: stretch;
    }

    .share-form__actions > * {
        width: 100%;
    }

    .profile-hero {
        padding: 18px;
    }

    .profile-hero__identity {
        align-items: flex-start;
    }

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

    .profile-summary__avatar--hero {
        width: 96px;
        height: 96px;
    }
}

@media (max-width: 640px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-card__footer {
        flex-wrap: wrap;
    }

    .project-card__actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }
}
