:root {
    --text: #1a1a1a;
    --muted: #666;
    --border: #ddd;
    --bg: #fafafa;
    --table-grid: #b8b2a8;
    --table-cell-bg: #fff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--text);
    background: #fff;
    line-height: 1.5;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
    min-width: 0;
}

.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 1rem;
    padding-top: 0.45rem;
    padding-bottom: 0.4rem;
}

.site-header__secondary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 1rem;
    padding-top: 0.3rem;
    padding-bottom: 0.4rem;
    border-top: 1px solid var(--border);
}

.logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.logo:hover {
    text-decoration: underline;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
}

.site-nav a,
.site-nav__link {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav__link:hover {
    text-decoration: underline;
}

.site-nav__link.is-active {
    font-weight: 700;
    text-decoration: underline;
}

.site-nav--catalog .site-nav__link {
    font-size: 1rem;
    font-weight: 600;
}

.site-nav--meta .site-nav__link {
    font-size: 0.8rem;
    color: var(--muted);
}

.access-badge {
    font-size: 0.8rem;
    color: var(--muted);
    white-space: nowrap;
}

.changelog-ticker {
    font-size: 0.8rem;
    color: var(--muted);
    text-decoration: none;
    margin-left: auto;
}

.changelog-ticker:hover {
    text-decoration: underline;
}

.main-content {
    padding-top: 1.25rem;
    padding-bottom: 2rem;
    min-height: 50vh;
}

.site-footer {
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    color: var(--muted);
    font-size: 0.9rem;
}

.site-footer__inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem 2rem;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

.site-footer__brand strong {
    color: var(--text);
}

.site-footer__copy {
    margin: 0.35rem 0 0;
}

.site-footer__contact {
    grid-column: 1 / -1;
    margin: 0;
}

.site-footer__contact a {
    color: var(--text);
}

.site-nav--footer {
    justify-content: flex-end;
}

.content-page {
    max-width: 42rem;
    line-height: 1.6;
}

.content-page p {
    margin: 0.75rem 0;
}

.content-meta {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 2rem;
}

.content-notice {
    padding: 0.75rem 1rem;
    background: #f5f5f5;
    border-left: 3px solid var(--border);
}

.contact-email {
    font-size: 1.1rem;
}

.contact-email a {
    color: var(--text);
}

.changelog-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.changelog-item {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
}

.changelog-item__title {
    font-size: 1.1rem;
    margin: 0 0 0.25rem;
}

.changelog-item__date {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.changelog-item__body p {
    margin: 0.5rem 0;
}

.changelog-item__body h3 {
    font-size: 1rem;
    margin: 0.85rem 0 0.35rem;
}

.changelog-item__body ul {
    margin: 0.25rem 0 0.5rem 1.25rem;
    padding: 0;
}

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

    .site-nav--footer {
        justify-content: flex-start;
    }
}

.tile-grid {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.tile-grid--live {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.tile-grid--soon {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.6rem;
    margin-top: 0;
}

.tile {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    min-height: 96px;
    display: flex;
}

.tile--live {
    min-height: 132px;
}

.tile__link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.15rem 1rem;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.tile--live .tile__title {
    font-size: 1.25rem;
}

.tile__caption {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--muted);
}

.tile__link:hover {
    background: #f3f6fa;
}

.tile--stub {
    min-height: 64px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    color: #999;
    background: #fafafa;
    border-style: dashed;
    border-color: #e0e0e0;
    cursor: default;
}

.tile--stub .tile__title {
    font-size: 0.9rem;
    font-weight: 500;
}

.tile__note {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

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

/* AG Grid (спринт 2.6): контейнер виден только после инициализации */
.catalog-grid {
    margin: 0.75rem 0;
    --ag-border-color: var(--table-grid);
    --ag-header-background-color: var(--bg);
    --ag-odd-row-background-color: var(--table-cell-bg);
    --ag-background-color: var(--table-cell-bg);
    --ag-header-foreground-color: var(--text);
}

.catalog-grid .grid-links a {
    display: block;
    line-height: 1.5;
}

.catalog-grid.catalog-grid--ready {
    width: 100%;
    border: 1px solid var(--table-grid);
}

.catalog-grid .ag-header {
    background: var(--bg);
    border-bottom: 1px solid var(--table-grid);
}

.catalog-grid .ag-header-cell,
.catalog-grid .ag-cell {
    border-right: 1px solid var(--table-grid);
    border-bottom: 1px solid var(--table-grid);
}

.catalog-grid .ag-root-wrapper,
.catalog-grid .ag-row {
    border-color: var(--table-grid);
}

.breadcrumbs {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

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

.meta-line {
    font-size: 0.95rem;
    color: var(--muted);
    margin: 0.25rem 0;
}

.table-scroll {
    overflow: auto;
    max-height: calc(100vh - 12rem);
    max-width: 100%;
    min-width: 0;
    width: 100%;
    margin: 1rem 0;
}

.catalog-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
    border: 1px solid var(--table-grid);
}

.catalog-table th,
.catalog-table td {
    border: 1px solid var(--table-grid);
    padding: 0.45rem 0.6rem;
    vertical-align: top;
    text-align: left;
    background-clip: padding-box;
}

.catalog-table td {
    background: var(--table-cell-bg);
}

.catalog-table th {
    background: #f3efe6;
    font-weight: 600;
}

.catalog-table .col-num {
    width: 3rem;
    text-align: center;
}

.catalog-table .col-forum {
    width: 6.5rem;
    text-align: center;
}

.catalog-table .col-date {
    white-space: nowrap;
}

.catalog-table.song-list .col-source {
    white-space: normal;
    min-width: 10rem;
}

.song-list-section {
    margin-top: 2rem;
}

.catalog-table.song-list-others .col-fonograms {
    white-space: normal;
    min-width: 12rem;
}

.catalog-table .col-text {
    min-width: 10rem;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.9rem;
}

.catalog-table tr.row-differs td {
    background: #fff8e6;
}

/* СКП: отличия от эталона — красный (только строки текста, не комментарий) */
.catalog-table.skp-table tr.skp-row-text td.cell-differs {
    background: #fde0e0 !important;
    color: #9b1c1c !important;
}

.catalog-table.skp-table td.col-reference:not(.cell-differs),
.catalog-table.skp-table th.col-reference {
    background: #f4faf4;
}

.catalog-table.skp-table td.col-comment {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

.reference-badge {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #2d6a2d;
    letter-spacing: 0.02em;
}

.catalog-table.skp-table .reference-badge {
    display: block;
}

.catalog-table.skf-table .reference-badge {
    margin-left: 0.45rem;
    margin-top: 0;
    vertical-align: middle;
}

.catalog-table.skp-table .skp-performer {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    font-weight: normal;
    color: var(--muted);
}

.catalog-table.skp-table tr.skp-row-text td {
    min-height: 1.6em;
}

.catalog-table.skp-table tr.skp-row-text td.col-text {
    min-height: 1.6em;
    white-space: nowrap;
    overflow-wrap: normal;
}

.lyric-empty {
    color: var(--muted);
    display: inline-block;
    min-height: 1.35em;
    line-height: 1.35em;
}

.catalog-table.skf-table .col-first-line {
    min-width: 10rem;
}

.catalog-table.skf-table .col-performer {
    min-width: 8rem;
}

.catalog-table.skf-table .skf-header-row th {
    font-weight: 600;
    white-space: normal;
    line-height: 1.25;
}

.catalog-table.skf-table .skf-song-link {
    font-weight: 600;
}

.catalog-table.skf-table .skf-empty {
    text-align: center;
    color: var(--muted);
}

.skp-reference-note {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0 0 1rem;
}

.catalog-table.skp-table-transposed {
    --skp-rownum-width: 2.15rem;
    table-layout: fixed;
    width: max-content;
    min-width: 0;
}

.catalog-table.skp-table-transposed .col-fonogram {
    width: var(--skp-col-width);
    min-width: var(--skp-col-width);
    max-width: var(--skp-col-width);
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

.catalog-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.catalog-table thead th,
.catalog-table thead td {
    background: #f3efe6;
}

.catalog-table.skf-table .skf-header-row th {
    position: sticky;
    top: 0;
    z-index: 6;
    background: #f3efe6;
}

body.page-song-detail .main-content.container {
    max-width: none;
    padding-left: 80px;
    padding-right: 80px;
}

.skp-shell {
    --skp-rownum-width: 2.15rem;
    --skp-col-width: 12rem;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    max-height: calc(100vh - 12rem);
    margin: 1rem 0;
    border: 1px solid var(--table-grid);
    overflow: hidden;
}

.skp-frozen-pane,
.skp-scroll-pane {
    min-width: 0;
    min-height: 0;
    max-height: calc(100vh - 12rem);
    overscroll-behavior: contain;
}

.skp-frozen-pane {
    flex: 0 0 auto;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 2;
    background: #fff;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.12);
    scrollbar-width: none;
}

.skp-frozen-pane::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.skp-scroll-pane {
    flex: 1 1 auto;
    overflow: auto;
}

.skp-frozen-pane .catalog-table,
.skp-scroll-pane .catalog-table {
    margin: 0;
    border: 0;
}

.skp-frozen-pane .catalog-table.skp-table-transposed {
    width: calc(var(--skp-rownum-width) + var(--skp-col-width));
    min-width: 0;
}

.skp-scroll-pane .catalog-table.skp-table-transposed {
    width: max-content;
    min-width: 0;
}

.catalog-table.skp-table-transposed .col-rownum {
    width: var(--skp-rownum-width);
    min-width: var(--skp-rownum-width);
    max-width: var(--skp-rownum-width);
    padding-left: 0.2rem;
    padding-right: 0.2rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    background: #f3efe6;
}

.catalog-table.skp-table-transposed .col-frozen,
.catalog-table.skp-table-transposed td.col-text,
.catalog-table.skp-table-transposed td.col-comment {
    width: var(--skp-col-width);
    min-width: var(--skp-col-width);
    max-width: var(--skp-col-width);
}

.catalog-table.skp-table-transposed thead th.col-frozen,
.catalog-table.skp-table-transposed td.col-frozen:not(.cell-differs) {
    background: #f4faf4;
}

.catalog-table.skp-table-transposed td.col-frozen.cell-differs {
    background: #fde0e0;
}

.skf-title {
    font-size: 1.5rem;
    margin: 0 0 0.35rem;
}

.skp-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.skp-title-text {
    font-size: 1.5rem;
}

.forum-stub {
    color: #999;
    cursor: default;
    font-size: 0.8rem;
    font-style: italic;
}

.forum-link {
    font-size: 0.9rem;
    text-decoration: underline;
}

.forum-inline {
    margin-left: 0.75rem;
    font-size: 1rem;
}

.fonogram-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fonogram-links li {
    margin: 0.2rem 0;
}

/* --- Учётная запись и навигация --- */
.site-nav--account {
    margin-left: auto;
    display: flex;
    gap: 0.75rem;
}

/* --- Сообщения (messages framework) --- */
.messages {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
}

.message {
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-left-width: 4px;
    margin-bottom: 0.5rem;
    background: var(--bg);
}

.message--success { border-left-color: #2e7d32; }
.message--error { border-left-color: #c62828; }
.message--info { border-left-color: #1565c0; }
.message--warning { border-left-color: #ef6c00; }

/* --- Формы --- */
.form {
    max-width: 480px;
    margin: 1.25rem 0;
}

.form--inline {
    display: inline-block;
    margin: 0.5rem 0;
}

.form__row {
    margin-bottom: 1rem;
}

.form__row label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--muted);
}

.form input[type="text"],
.form input[type="email"],
.form input[type="url"],
.form input[type="password"],
.form textarea {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 1rem;
    background: #fff;
}

.form__row--checkbox .form__check,
.form__check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: var(--text);
}

.form__row--captcha input[type="hidden"] {
    display: none;
}

.form__hint {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
    color: var(--muted);
}

.form__check input {
    margin-top: 0.25rem;
}

.form__field-error {
    color: #c62828;
    margin: 0.3rem 0 0;
    font-size: 0.9rem;
}

.form__errors {
    color: #c62828;
    margin-bottom: 1rem;
}

/* --- Кнопки --- */
.btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--text);
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}

.btn--primary {
    background: var(--text);
    color: #fff;
}

.btn--danger {
    border-color: #c62828;
    color: #c62828;
}

.btn--small {
    padding: 0.3rem 0.7rem;
    font-size: 0.9rem;
}

/* --- Модерация --- */
.mod-card {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1rem;
    margin: 1rem 0 1.5rem;
}

.mod-card dt { color: var(--muted); }
.mod-card dd { margin: 0; }

.mod-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 560px;
}

.mod-reject fieldset {
    border: 1px solid var(--border);
    margin: 0 0 1rem;
}

.mod-reject .form__check {
    margin: 0.4rem 0;
}

.mod-table {
    width: 100%;
}

/* --- Фотографии на странице СКФ --- */
.skf-photo-strip {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    margin: 0.75rem 0 1.1rem;
    padding: 8px 0;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
}
.skf-photo-strip__thumb {
    flex: 0 0 80px;
    box-sizing: border-box;
    width: 80px;
    height: 80px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #eee;
    cursor: pointer;
    overflow: hidden;
}
.skf-photo-strip__thumb img {
    display: block;
    width: 80px;
    height: 80px;
    object-fit: cover;
}
.skf-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
}
.skf-lightbox.is-open {
    display: flex;
}
.skf-lightbox__stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    max-width: 92vw;
    max-height: 92vh;
}
.skf-lightbox__stage img {
    display: block;
    max-width: 80vw;
    max-height: 84vh;
    object-fit: contain;
    background: #111;
}
.skf-lightbox button,
.skf-lightbox__close {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 4px;
}
.skf-lightbox__close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    font-size: 1.6rem;
}
