/* ==========================================================================
   tournament.css — Турнирная система Dzenway Library
   ========================================================================== */

/* ==========================================================================
   1. ОБЁРТКА И ЛЕЙАУТ
   ========================================================================== */

.dzw-tournament-wrap {
    max-width: 960px;
    margin: 0 auto 60px;
    padding: 0 20px;
}

.dzw-tournament-arena {
    width: 100%;
}

/* ==========================================================================
   2. НАВИГАЦИЯ ПО РАУНДАМ
   ========================================================================== */

.dzw-rounds-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.dzw-round-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.1s;
    outline: none;
    user-select: none;
}

.dzw-round-tab:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.dzw-round-tab:active {
    transform: translateY(0);
}

/* Активный таб — голосование */
.dzw-round-tab.bg-indigo-600 {
    background: #4f46e5;
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Индикатор активного голосования */
.dzw-round-tab .animate-pulse {
    animation: dzw-pulse 1.4s ease-in-out infinite;
}

@keyframes dzw-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.85); }
}

/* ==========================================================================
   3. ШАПКА РАУНДА
   ========================================================================== */

.dzw-round-header {
    margin-bottom: 24px;
}

.dzw-round-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 10px;
    line-height: 1.3;
}

/* Задание раунда */
.dzw-task-box {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.dzw-task-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6366f1;
    margin-bottom: 4px;
}

.dzw-task-text {
    font-size: 14px;
    font-weight: 600;
    color: #312e81;
    margin: 0;
    line-height: 1.5;
}

/* Таймер */
.dzw-countdown {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
    padding: 6px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.dzw-countdown svg {
    width: 14px;
    height: 14px;
    color: #94a3b8;
    flex-shrink: 0;
}

.dzw-countdown-text {
    font-variant-numeric: tabular-nums;
}

/* Таймер краснеет когда меньше часа */
.dzw-countdown.dzw-urgent {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

.dzw-countdown.dzw-urgent svg {
    color: #f43f5e;
}

/* ==========================================================================
   4. ПАНЕЛИ РАУНДОВ
   ========================================================================== */

.dzw-arena-panels {
    position: relative;
}

.dzw-arena-panel {
    animation: dzw-panel-in 0.22s ease;
}

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

/* ==========================================================================
   5. ПРОГРЕСС-БАР ОТПРАВКИ ОТРЫВКОВ
   ========================================================================== */

.dzw-submission-progress {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.dzw-submission-progress p {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 8px;
}

.dzw-progress-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.dzw-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #818cf8, #6366f1);
    border-radius: 99px;
    transition: width 0.6s ease;
}

/* ==========================================================================
   6. ФОРМА ОТРЫВКА
   ========================================================================== */

.dzw-submission-wrap {
    position: relative;
}

#dzw-excerpt-text {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    font-size: 15px;
    line-height: 1.7;
    resize: vertical;
    min-height: 200px;
    transition: border-color 0.18s, box-shadow 0.18s;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
}

#dzw-excerpt-text:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

#dzw-excerpt-text::placeholder {
    color: #94a3b8;
}

.dzw-char-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.dzw-char-hint {
    font-size: 12px;
    color: #94a3b8;
}

.dzw-char-count {
    font-size: 12px;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   7. СЕТКА КАРТОЧЕК ОТРЫВКОВ (ГОЛОСОВАНИЕ)
   ========================================================================== */

.dzw-voting-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dzw-excerpt-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}

.dzw-excerpt-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Своя карточка — с обводкой */
.dzw-excerpt-card.ring-2 {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.25),
                0 4px 16px rgba(79, 70, 229, 0.08);
}

/* Шапка карточки */
.dzw-excerpt-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.dzw-participant-label {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.02em;
}

.dzw-own-label {
    font-size: 12px;
    font-weight: 600;
    color: #6366f1;
}

.dzw-votes-badge {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

/* Тело карточки — текст отрывка */
.dzw-excerpt-body {
    padding: 24px;
}

.dzw-excerpt-text {
    font-size: 15px;
    line-height: 1.8;
    color: #1e293b;
    white-space: pre-line;
    margin: 0;
}

.dzw-excerpt-text p {
    margin: 0 0 12px;
}

.dzw-excerpt-text p:last-child {
    margin-bottom: 0;
}

/* Подвал карточки с кнопкой */
.dzw-excerpt-footer {
    padding: 0 20px 20px;
}

/* Кнопка голосования */
.dzw-vote-btn {
    width: 100%;
    padding: 12px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dzw-vote-btn:hover:not(:disabled) {
    background: #4338ca;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.dzw-vote-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.dzw-vote-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dzw-own-note {
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    padding: 8px 0 4px;
    margin: 0;
}

/* ==========================================================================
   8. РЕЗУЛЬТАТЫ РАУНДА
   ========================================================================== */

.dzw-round-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dzw-round-results h4 {
    font-size: 15px;
    font-weight: 700;
    color: #475569;
    margin: 0 0 4px;
}

.dzw-result-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    transition: box-shadow 0.18s;
}

.dzw-result-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.dzw-result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.dzw-result-medal {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.dzw-result-info {
    flex: 1;
    min-width: 0;
}

.dzw-result-book {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    transition: color 0.15s;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dzw-result-book:hover {
    color: #4f46e5;
}

.dzw-result-author {
    font-size: 12px;
    color: #94a3b8;
    margin: 2px 0 0;
}

.dzw-result-votes {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    flex-shrink: 0;
    white-space: nowrap;
}

.dzw-result-excerpt {
    padding: 16px 20px;
}

.dzw-result-excerpt p {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   9. ОЖИДАЮЩИЙ РАУНД
   ========================================================================== */

.dzw-pending-round {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
}

.dzw-pending-round svg {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    display: block;
    color: #e2e8f0;
}

.dzw-pending-round p {
    font-size: 14px;
    color: #94a3b8;
    margin: 0;
}

/* ==========================================================================
   10. ПОБЕДИТЕЛЬ ТУРНИРА
   ========================================================================== */

.dzw-tournament-winner {
    margin-top: 48px;
    padding: 40px 32px;
    border-radius: 24px;
    text-align: center;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 50%, #fde68a 100%);
    border: 2px solid #f59e0b;
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.15);
    position: relative;
    overflow: hidden;
}

/* Декоративный блик */
.dzw-tournament-winner::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
    pointer-events: none;
}

.dzw-winner-trophy {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 16px;
    display: block;
    animation: dzw-trophy-bounce 2s ease infinite;
}

@keyframes dzw-trophy-bounce {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50%       { transform: translateY(-6px) rotate(3deg); }
}

.dzw-winner-title {
    font-size: 22px;
    font-weight: 800;
    color: #78350f;
    margin: 0 0 8px;
}

.dzw-winner-cover {
    width: 80px;
    height: 120px;
    margin: 16px auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.dzw-winner-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dzw-winner-book-link {
    font-size: 20px;
    font-weight: 800;
    color: #92400e;
    text-decoration: none;
    display: block;
    margin-bottom: 6px;
    transition: color 0.15s;
    line-height: 1.3;
}

.dzw-winner-book-link:hover {
    color: #78350f;
}

.dzw-winner-author {
    font-size: 14px;
    color: #b45309;
    margin: 0 0 20px;
}

.dzw-winner-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.6);
    border: 1.5px solid rgba(245, 158, 11, 0.4);
    border-radius: 99px;
    font-size: 13px;
    font-weight: 700;
    color: #92400e;
    backdrop-filter: blur(4px);
}

/* ==========================================================================
   11. ИТОГОВАЯ ТАБЛИЦА
   ========================================================================== */

.dzw-final-table {
    margin-top: 32px;
}

.dzw-final-table h4 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 16px;
}

.dzw-final-table table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.dzw-final-table thead tr {
    background: #f8fafc;
    border-bottom: 1.5px solid #e2e8f0;
}

.dzw-final-table th {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dzw-final-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.dzw-final-table tr:last-child td {
    border-bottom: none;
}

.dzw-final-table tbody tr:hover {
    background: #fafafa;
}

.dzw-final-table tbody tr.dzw-winner-row {
    background: #fffbeb;
}

.dzw-final-table .dzw-score-cell {
    text-align: right;
    font-weight: 700;
    color: #1e293b;
}

/* ==========================================================================
   12. СКОРБОРД (САЙДБАР)
   ========================================================================== */

.dzw-scoreboard {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.dzw-scoreboard-header {
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.dzw-scoreboard-header h4 {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin: 0;
}

.dzw-scoreboard-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;
}

.dzw-scoreboard-row:last-child {
    border-bottom: none;
}

.dzw-scoreboard-row:hover {
    background: #fafafa;
}

.dzw-scoreboard-place {
    font-size: 16px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

.dzw-scoreboard-info {
    flex: 1;
    min-width: 0;
}

.dzw-scoreboard-book {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    transition: color 0.15s;
}

.dzw-scoreboard-book:hover {
    color: #4f46e5;
}

.dzw-scoreboard-author {
    font-size: 11px;
    color: #94a3b8;
    margin: 1px 0 0;
}

.dzw-scoreboard-score {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    flex-shrink: 0;
}

/* ==========================================================================
   13. ФОРМА ЗАЯВКИ
   ========================================================================== */

.dzw-entry-form-wrap {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.dzw-entry-form-wrap h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 20px;
}

.dzw-entry-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    color: #1e293b;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s, box-shadow 0.18s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.dzw-entry-select:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* ==========================================================================
   14. СТАТУСНЫЕ СООБЩЕНИЯ
   ========================================================================== */

.dzw-status-voted,
.dzw-status-submitted {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.dzw-status-voted {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.dzw-status-submitted {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.dzw-status-voted svg,
.dzw-status-submitted svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Успех после голосования — появляется в сетке */
.dzw-voted-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    font-size: 14px;
    color: #166534;
    margin-bottom: 20px;
    animation: dzw-fade-in 0.3s ease;
}

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

/* ==========================================================================
   15. ТЁМНАЯ ТЕМА
   ========================================================================== */

html.dark .dzw-excerpt-card,
body.dzw-dark .dzw-excerpt-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

html.dark .dzw-excerpt-card:hover,
body.dzw-dark .dzw-excerpt-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

html.dark .dzw-excerpt-card-header,
body.dzw-dark .dzw-excerpt-card-header {
    background: #0f172a;
    border-color: #1e293b;
}

html.dark .dzw-excerpt-text,
body.dzw-dark .dzw-excerpt-text {
    color: #e2e8f0;
}

html.dark .dzw-participant-label,
body.dzw-dark .dzw-participant-label {
    color: #94a3b8;
}

html.dark .dzw-round-header h3,
body.dzw-dark .dzw-round-header h3 {
    color: #f1f5f9;
}

html.dark .dzw-task-box,
body.dzw-dark .dzw-task-box {
    background: #1e2a4a;
    border-color: #3730a3;
}

html.dark .dzw-task-text,
body.dzw-dark .dzw-task-text {
    color: #c7d2fe;
}

html.dark .dzw-countdown,
body.dzw-dark .dzw-countdown {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

html.dark #dzw-excerpt-text,
body.dzw-dark #dzw-excerpt-text {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

html.dark #dzw-excerpt-text:focus,
body.dzw-dark #dzw-excerpt-text:focus {
    border-color: #818cf8;
}

html.dark .dzw-result-card,
body.dzw-dark .dzw-result-card {
    background: #1e293b;
    border-color: #334155;
}

html.dark .dzw-result-header,
body.dzw-dark .dzw-result-header {
    background: #0f172a;
    border-color: #1e293b;
}

html.dark .dzw-result-book,
body.dzw-dark .dzw-result-book {
    color: #e2e8f0;
}

html.dark .dzw-result-author,
body.dzw-dark .dzw-result-author {
    color: #64748b;
}

html.dark .dzw-scoreboard,
body.dzw-dark .dzw-scoreboard {
    background: #1e293b;
    border-color: #334155;
}

html.dark .dzw-scoreboard-header,
body.dzw-dark .dzw-scoreboard-header {
    background: #0f172a;
    border-color: #1e293b;
}

html.dark .dzw-scoreboard-header h4,
body.dzw-dark .dzw-scoreboard-header h4 {
    color: #94a3b8;
}

html.dark .dzw-scoreboard-book,
body.dzw-dark .dzw-scoreboard-book {
    color: #e2e8f0;
}

html.dark .dzw-scoreboard-row:hover,
body.dzw-dark .dzw-scoreboard-row:hover {
    background: #0f172a;
}

html.dark .dzw-entry-form-wrap,
body.dzw-dark .dzw-entry-form-wrap {
    background: #1e293b;
    border-color: #334155;
}

html.dark .dzw-entry-form-wrap h3,
body.dzw-dark .dzw-entry-form-wrap h3 {
    color: #f1f5f9;
}

html.dark .dzw-entry-select,
body.dzw-dark .dzw-entry-select {
    background-color: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

html.dark .dzw-final-table table,
body.dzw-dark .dzw-final-table table {
    background: #1e293b;
    border-color: #334155;
}

html.dark .dzw-final-table thead tr,
body.dzw-dark .dzw-final-table thead tr {
    background: #0f172a;
    border-color: #334155;
}

html.dark .dzw-final-table th,
body.dzw-dark .dzw-final-table th {
    color: #64748b;
}

html.dark .dzw-final-table td,
body.dzw-dark .dzw-final-table td {
    color: #cbd5e1;
    border-color: #1e293b;
}

html.dark .dzw-final-table tbody tr.dzw-winner-row,
body.dzw-dark .dzw-final-table tbody tr.dzw-winner-row {
    background: #1c1a0f;
}

html.dark .dzw-rounds-nav,
body.dzw-dark .dzw-rounds-nav {
    border-color: #1e293b;
}

/* ==========================================================================
   16. МОБИЛЬНАЯ АДАПТАЦИЯ
   ========================================================================== */

@media (max-width: 640px) {

    .dzw-tournament-wrap {
        padding: 0 12px;
        margin-bottom: 40px;
    }

    .dzw-round-header h3 {
        font-size: 17px;
    }

    .dzw-task-box {
        padding: 14px 16px;
    }

    .dzw-round-tab {
        padding: 7px 14px;
        font-size: 12px;
    }

    .dzw-excerpt-body {
        padding: 16px;
    }

    .dzw-excerpt-text {
        font-size: 14px;
        line-height: 1.7;
    }

    .dzw-excerpt-footer {
        padding: 0 16px 16px;
    }

    .dzw-tournament-winner {
        padding: 28px 20px;
    }

    .dzw-winner-title {
        font-size: 18px;
    }

    .dzw-winner-book-link {
        font-size: 17px;
    }

    .dzw-final-table th,
    .dzw-final-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .dzw-entry-form-wrap {
        padding: 20px 16px;
    }

    .dzw-status-voted,
    .dzw-status-submitted {
        font-size: 13px;
        padding: 12px 14px;
    }
}

/* ==========================================================================
   17. ШАБЛОН СТРАНИЦЫ ТУРНИРА
   ========================================================================== */

/* Hero */
.dzw-t-hero {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    margin-top: 32px;
    margin-bottom: 32px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.dzw-t-hero-cover {
    position: absolute;
    inset: 0;
}

.dzw-t-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.35;
}

.dzw-t-cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(15,23,42,0.3) 0%, rgba(15,23,42,0.85) 100%);
}

.dzw-t-hero-content {
    padding: 32px 32px 28px;
    position: relative;
}

.dzw-t-hero-over-cover {
    color: #fff;
}

/* Хлебные крошки */
.dzw-t-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.dzw-t-breadcrumbs a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.15s;
}

.dzw-t-breadcrumbs a:hover {
    color: #fff;
}

.dzw-t-breadcrumbs span:not(:last-child) {
    opacity: 0.4;
}

/* Заголовок + бейдж */
.dzw-t-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.dzw-t-title {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin: 0;
    line-height: 1.25;
    flex: 1;
    min-width: 200px;
}

.dzw-t-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    margin-top: 4px;
    flex-shrink: 0;
}

/* Мета-строка */
.dzw-t-meta-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.dzw-t-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
}

.dzw-t-meta-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.7;
}

/* ==========================================================================
   18. ДВУХКОЛОНОЧНЫЙ ЛЕЙАУТ
   ========================================================================== */

.dzw-t-layout {
    display: grid;
    grid-template-columns: 1fr 290px;
    gap: 28px;
    align-items: start;
}

.dzw-t-main {
    min-width: 0;
}

.dzw-t-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
}

/* Выравниваем первый блок сайдбара по верхнему краю контента левой колонки.
   dzw-lib-article имеет внутренний padding ~24px сверху */
.dzw-t-sidebar > .dzw-t-sidebar-block:first-child {
    margin-top: 0;
}

.dzw-t-sidebar-block {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dzw-t-sidebar-title {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin: 0;
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

/* Кнопка-призыв к действию */
.dzw-t-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: #4f46e5;
    color: #fff;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    transition: background 0.18s, box-shadow 0.18s, transform 0.1s;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.dzw-t-cta-btn:hover {
    background: #4338ca;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

/* ==========================================================================
   19. УЧАСТНИКИ
   ========================================================================== */

.dzw-t-participants-list {
    display: flex;
    flex-direction: column;
    divide-y: 1px solid #f1f5f9;
}

.dzw-t-participant {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;
}

.dzw-t-participant:last-child {
    border-bottom: none;
}

.dzw-t-participant:hover {
    background: #fafafa;
}

.dzw-t-participant-ava {
    flex-shrink: 0;
}

.dzw-t-participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.dzw-t-participant-info {
    flex: 1;
    min-width: 0;
}

.dzw-t-participant-book {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    transition: color 0.15s;
}

.dzw-t-participant-book:hover {
    color: #4f46e5;
}

.dzw-t-participant-author {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    text-decoration: none;
    margin-top: 1px;
    transition: color 0.15s;
}

.dzw-t-participant-author:hover {
    color: #64748b;
}

/* ==========================================================================
   20. ОБЗОР РАУНДОВ
   ========================================================================== */

.dzw-t-rounds-list {
    display: flex;
    flex-direction: column;
}

.dzw-t-round-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;
}

.dzw-t-round-item:last-child {
    border-bottom: none;
}

.dzw-t-round-item.dzw-t-round-active {
    background: #f0f4ff;
    border-left: 3px solid #6366f1;
}

.dzw-t-round-num {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.dzw-t-round-label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.dzw-t-round-task {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 3px;
    line-height: 1.4;
}

.dzw-t-round-deadline {
    font-size: 11px;
    color: #94a3b8;
    margin: 0;
}

/* ==========================================================================
   21. PLACEHOLDER (ЧЕРНОВИК / ОТМЕНЁН)
   ========================================================================== */

.dzw-t-placeholder {
    text-align: center;
    padding: 60px 24px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 18px;
}

.dzw-t-placeholder-cancelled {
    background: #fff5f5;
    border-color: #fecaca;
}

.dzw-t-placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1;
}

.dzw-t-placeholder-text {
    font-size: 15px;
    color: #64748b;
    margin: 0;
}

/* ==========================================================================
   22. ТЁМНАЯ ТЕМА — ШАБЛОН
   ========================================================================== */

html.dark .dzw-t-hero,
body.dzw-dark .dzw-t-hero {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
}

html.dark .dzw-t-sidebar-block,
body.dzw-dark .dzw-t-sidebar-block {
    background: #1e293b;
    border-color: #334155;
}

html.dark .dzw-t-sidebar-title,
body.dzw-dark .dzw-t-sidebar-title {
    background: #0f172a;
    border-color: #1e293b;
    color: #94a3b8;
}

html.dark .dzw-t-participant:hover,
body.dzw-dark .dzw-t-participant:hover {
    background: #0f172a;
}

html.dark .dzw-t-participant-book,
body.dzw-dark .dzw-t-participant-book {
    color: #e2e8f0;
}

html.dark .dzw-t-round-item,
body.dzw-dark .dzw-t-round-item {
    border-color: #1e293b;
}

html.dark .dzw-t-round-item.dzw-t-round-active,
body.dzw-dark .dzw-t-round-item.dzw-t-round-active {
    background: #1a1f3a;
    border-color: #6366f1;
}

html.dark .dzw-t-round-label,
body.dzw-dark .dzw-t-round-label {
    color: #cbd5e1;
}

html.dark .dzw-t-placeholder,
body.dzw-dark .dzw-t-placeholder {
    background: #1e293b;
    border-color: #334155;
}

/* ==========================================================================
   23. МОБИЛКА — ШАБЛОН
   ========================================================================== */

@media (max-width: 900px) {
    .dzw-t-layout {
        grid-template-columns: 1fr;
    }

    .dzw-t-sidebar {
        position: static;
        order: -1; /* Сайдбар над контентом на мобилке */
    }
}

@media (max-width: 640px) {
    .dzw-t-hero-content {
        padding: 24px 20px 20px;
    }

    .dzw-t-title {
        font-size: 22px;
    }

    .dzw-t-meta-row {
        gap: 12px;
    }

    .dzw-t-meta-item {
        font-size: 12px;
    }
}

/* ==========================================================================
   24. АРХИВ ТУРНИРОВ
   ========================================================================== */

/* Hero архива */
.dzw-t-archive-hero {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 20px;
    padding: 48px 32px;
    text-align: center;
    margin-top: 32px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.dzw-t-archive-hero::before {
    content: '';
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.dzw-t-archive-hero-inner {
    position: relative;
}

.dzw-t-archive-icon {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 16px;
}

.dzw-t-archive-title {
    font-size: 30px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 12px;
    line-height: 1.2;
}

.dzw-t-archive-desc {
    font-size: 15px;
    color: rgba(255,255,255,0.6);
    margin: 0 auto;
    max-width: 650px;
    line-height: 1.6;
}

/* Секции */
.dzw-t-section {
    margin-bottom: 48px;
}

.dzw-t-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 20px;
}

.dzw-t-section-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dzw-t-dot-active   { background: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,0.2); }
.dzw-t-dot-open     { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.2); }
.dzw-t-dot-finished { background: #d97706; box-shadow: 0 0 0 3px rgba(217,119,6,0.2); }

/* Сетка карточек */
.dzw-t-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.dzw-t-cards-grid-finished {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* Карточка турнира */
.dzw-t-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none;
    transition: box-shadow 0.2s, transform 0.18s, border-color 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.dzw-t-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,0.1);
    transform: translateY(-3px);
    border-color: #c7d2fe;
}

.dzw-t-card-active {
    border-color: #c7d2fe;
    box-shadow: 0 4px 16px rgba(79,70,229,0.1);
}

/* Обложка карточки */
.dzw-t-card-cover {
    position: relative;
    height: 160px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    overflow: hidden;
    flex-shrink: 0;
}

.dzw-t-card-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.dzw-t-card:hover .dzw-t-card-cover-img {
    transform: scale(1.04);
}

.dzw-t-card-cover-dim {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.5) 100%);
}

.dzw-t-card-cover-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 52px;
    opacity: 0.3;
}

/* Бейдж статуса */
.dzw-t-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.dzw-badge-active   { background: #eef2ff; color: #4f46e5; }
.dzw-badge-open     { background: #f0fdf4; color: #16a34a; }
.dzw-badge-finished { background: #fffbeb; color: #d97706; }
.dzw-badge-draft    { background: #f1f5f9; color: #64748b; }
.dzw-badge-cancelled{ background: #fff1f2; color: #e11d48; }

.dzw-t-badge-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4f46e5;
    animation: dzw-pulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
}

/* Тело карточки */
.dzw-t-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.dzw-t-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px;
    line-height: 1.35;
}

.dzw-t-card-excerpt {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 12px;
}

/* Победитель */
.dzw-t-card-winner {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: #fffbeb;
    border-radius: 8px;
}

.dzw-t-card-winner-label {
    font-size: 11px;
    font-weight: 700;
    color: #d97706;
    white-space: nowrap;
    flex-shrink: 0;
}

.dzw-t-card-winner-book {
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Мета */
.dzw-t-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 14px;
}

.dzw-t-card-meta-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.dzw-t-card-meta-full {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.dzw-t-card-meta-label {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dzw-t-card-meta-val {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
}

.dzw-t-card-meta-prize {
    color: #d97706;
    font-size: 12px;
}

/* Прогресс записи */
.dzw-t-card-progress {
    margin-bottom: 14px;
}

.dzw-t-card-progress-track {
    height: 5px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 4px;
}

.dzw-t-card-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #818cf8);
    border-radius: 99px;
    transition: width 0.5s ease;
}

.dzw-t-card-progress-label {
    font-size: 11px;
    color: #94a3b8;
}

/* CTA */
.dzw-t-card-cta {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.dzw-t-card-cta-text {
    font-size: 13px;
    font-weight: 700;
    color: #4f46e5;
    transition: gap 0.15s;
}

.dzw-t-card:hover .dzw-t-card-cta-text {
    color: #4338ca;
}

/* Пустой список */
.dzw-t-empty {
    text-align: center;
    padding: 80px 24px;
}

.dzw-t-empty-icon {
    font-size: 52px;
    margin-bottom: 16px;
    line-height: 1;
    opacity: 0.4;
}

.dzw-t-empty-title {
    font-size: 20px;
    font-weight: 700;
    color: #334155;
    margin: 0 0 8px;
}

.dzw-t-empty-text {
    font-size: 14px;
    color: #94a3b8;
    margin: 0;
}

/* ==========================================================================
   25. ТЁМНАЯ ТЕМА — АРХИВ
   ========================================================================== */

html.dark .dzw-t-section-title,
body.dzw-dark .dzw-t-section-title { color: #f1f5f9; }

html.dark .dzw-t-card,
body.dzw-dark .dzw-t-card {
    background: #1e293b;
    border-color: #334155;
}

html.dark .dzw-t-card:hover,
body.dzw-dark .dzw-t-card:hover { border-color: #6366f1; }

html.dark .dzw-t-card-title,
body.dzw-dark .dzw-t-card-title { color: #f1f5f9; }

html.dark .dzw-t-card-excerpt,
body.dzw-dark .dzw-t-card-excerpt { color: #94a3b8; }

html.dark .dzw-t-card-meta-val,
body.dzw-dark .dzw-t-card-meta-val { color: #cbd5e1; }

html.dark .dzw-t-card-cta,
body.dzw-dark .dzw-t-card-cta { border-color: #334155; }

html.dark .dzw-t-card-cover,
body.dzw-dark .dzw-t-card-cover { background: linear-gradient(135deg, #0f172a, #020617); }

html.dark .dzw-t-card-progress-track,
body.dzw-dark .dzw-t-card-progress-track { background: #334155; }

html.dark .dzw-t-card-winner,
body.dzw-dark .dzw-t-card-winner { background: #1c1a0f; }

html.dark .dzw-badge-active,
body.dzw-dark .dzw-badge-active { background: #1e2050; color: #a5b4fc; }

html.dark .dzw-badge-open,
body.dzw-dark .dzw-badge-open { background: #052e16; color: #4ade80; }

html.dark .dzw-badge-finished,
body.dzw-dark .dzw-badge-finished { background: #1c150a; color: #fbbf24; }

html.dark .dzw-badge-draft,
body.dzw-dark .dzw-badge-draft { background: #1e293b; color: #64748b; }

/* ==========================================================================
   26. МОБИЛКА — АРХИВ
   ========================================================================== */

@media (max-width: 640px) {
    .dzw-t-archive-hero {
        padding: 36px 20px;
        border-radius: 16px;
    }

    .dzw-t-archive-title { font-size: 22px; }
    .dzw-t-archive-desc  { font-size: 13px; }

    .dzw-t-cards-grid,
    .dzw-t-cards-grid-finished {
        grid-template-columns: 1fr;
    }

    .dzw-t-card-cover { height: 130px; }
}

/* ==========================================================================
   27. SEO-ТЕКСТ (архив турниров)
   ========================================================================== */

.dzw-t-seo-block {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #e2e8f0;
}

.dzw-t-seo-inner {
    max-width: 820px;
    color: #475569;
    font-size: 15px;
    line-height: 1.8;
}

.dzw-t-seo-inner p {
    margin: 0 0 16px;
}

.dzw-t-seo-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px;
    line-height: 1.3;
}

.dzw-t-seo-lead {
    font-size: 15px;
    color: #6366f1;
    font-weight: 600;
    margin: 0 0 20px !important;
}

.dzw-t-seo-h3 {
    font-size: 16px;
    font-weight: 700;
    color: #334155;
    margin: 28px 0 12px;
}

.dzw-t-seo-list {
    margin: 0 0 20px;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dzw-t-seo-list li {
    color: #475569;
    line-height: 1.7;
}

.dzw-t-seo-cta {
    font-weight: 600;
    color: #334155 !important;
    margin-top: 8px;
}

/* Тёмная тема */
html.dark .dzw-t-seo-block,
body.dzw-dark .dzw-t-seo-block { border-color: #1e293b; }

html.dark .dzw-t-seo-inner,
body.dzw-dark .dzw-t-seo-inner { color: #94a3b8; }

html.dark .dzw-t-seo-title,
body.dzw-dark .dzw-t-seo-title { color: #f1f5f9; }

html.dark .dzw-t-seo-h3,
body.dzw-dark .dzw-t-seo-h3 { color: #cbd5e1; }

html.dark .dzw-t-seo-cta,
body.dzw-dark .dzw-t-seo-cta { color: #cbd5e1 !important; }