/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
}

/* ===== NAVBAR ===== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #16213e;
    border-bottom: 2px solid #0f3460;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #e94560;
}

.nav-brand-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 204, 0, 0.55);
    box-shadow: 0 0 12px rgba(255, 204, 0, 0.25);
}

.nav-brand-text {
    line-height: 1.1;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: #e0e0e0;
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background: #0f3460;
    color: #fff;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #e94560;
    color: #fff;
}

.btn-primary:hover {
    background: #c73550;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #0f3460;
    color: #fff;
}

.btn-secondary:hover {
    background: #1a4a8a;
}

.btn-success {
    background: #2ecc71;
    color: #fff;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: #fff;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #b0b0b0;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid #0f3460;
    border-radius: 8px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #e94560;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.3rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.create-game-limits-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.create-game-limits-row .form-group {
    min-width: 0;
}

.create-game-round-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.create-game-round-row .form-group {
    min-width: 0;
}

.participate-stage-timer {
    text-align: center;
    color: #f39c12;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(243, 156, 18, 0.12);
    border: 1px solid rgba(243, 156, 18, 0.35);
}

/* ===== CARDS ===== */
.game-card {
    background: #16213e;
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.game-card:hover {
    transform: translateX(4px);
}

.game-card.future {
    border-left-color: #2ecc71;
}

.game-card.active {
    border-left-color: #f39c12;
}

.game-card.finished {
    border-left-color: #e74c3c;
}

.game-card-info h3 {
    margin-bottom: 0.3rem;
    color: #fff;
}

.game-name-heading {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
}

.game-name-editable {
    cursor: pointer;
}

.game-name-editable:hover .game-name-edit-icon {
    opacity: 1;
}

.game-name-text {
    word-break: break-word;
}

.game-name-edit-icon {
    font-size: 0.85em;
    color: var(--accent, #ffcc00);
    opacity: 0.55;
    flex-shrink: 0;
    line-height: 1;
}

.game-name-inline-input {
    font: inherit;
    color: inherit;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 204, 0, 0.45);
    border-radius: 6px;
    padding: 0.15rem 0.45rem;
    min-width: 8rem;
    max-width: min(100%, 420px);
}

.results-page-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0;
}

.results-title-label {
    color: #fff;
}

.results-game-name.game-name-editable {
    color: var(--accent, #ffcc00);
}

.game-card-info p {
    font-size: 0.85rem;
    color: #888;
}

.game-card-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.game-card-meta span {
    font-size: 0.85rem;
    color: #b0b0b0;
    background: #1a1a2e;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    background: #16213e;
    color: #888;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #0f3460;
    color: #e0e0e0;
}

.tab-btn.active {
    background: #e94560;
    color: #fff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== GAME LIST ===== */
.games-list {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #fff;
    border-bottom: 2px solid #0f3460;
    padding-bottom: 0.5rem;
}

/* ===== CREATE GAME PAGE ===== */
.create-game-page {
    max-width: 700px;
    margin: 2rem auto;
    padding: 2rem;
    background: #16213e;
    border-radius: 12px;
}

.create-game-page h2 {
    margin-bottom: 1.5rem;
    color: #e94560;
}

/* ===== PARTICIPATE PAGE ===== */
.participate-page {
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem;
}

.participate-page h2 {
    margin-bottom: 1rem;
    color: #e94560;
}

.options-list {
    margin: 1.5rem 0;
}

.option-item {
    background: #16213e;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #0f3460;
}

.option-item .youtube-embed {
    width: 200px;
    height: 112px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.option-item .youtube-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.option-info {
    flex: 1;
    margin: 0 1rem;
}

.option-info h4 {
    color: #fff;
    margin-bottom: 0.3rem;
}

.option-info a {
    color: #e94560;
    font-size: 0.85rem;
}

.option-actions {
    display: flex;
    gap: 0.5rem;
}

.add-option-form {
    background: #16213e;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: 1px dashed #0f3460;
}

.add-option-form h3 {
    margin-bottom: 1rem;
    color: #fff;
}

/* ===== VOTING PAGE ===== */
.voting-page {
    max-width: 100%;
    padding: 1rem;
}

.voting-header {
    text-align: center;
    margin-bottom: 1rem;
}

.voting-header h2 {
    color: #e94560;
    margin-bottom: 0.5rem;
}

.voting-progress {
    font-size: 0.9rem;
    color: #888;
}

.voting-timer {
    font-size: 1.2rem;
    color: #f39c12;
    font-weight: bold;
    margin-top: 0.3rem;
}

.voting-pair-selector {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.pair-btn {
    padding: 0.4rem 0.8rem;
    border: 2px solid #0f3460;
    border-radius: 6px;
    background: #16213e;
    color: #888;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.pair-btn:hover {
    border-color: #e94560;
    color: #e0e0e0;
}

.pair-btn.active {
    background: #e94560;
    border-color: #e94560;
    color: #fff;
}

.pair-btn.voted {
    background: #2ecc71;
    border-color: #2ecc71;
    color: #fff;
}

.voting-arena {
    display: flex;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 500px;
}

.voting-option {
    flex: 1;
    background: #16213e;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.voting-option:hover {
    border-color: #e94560;
    transform: scale(1.02);
}

.voting-option.selected {
    border-color: #2ecc71;
    box-shadow: 0 0 30px rgba(46, 204, 113, 0.5);
}

.voting-option.winner-flash {
    animation: winnerPulse 1s ease-in-out;
}

.voting-option .vs-divider {
    position: absolute;
    right: -1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    font-weight: bold;
    color: #e94560;
    z-index: 10;
}

.voting-option:last-child .vs-divider {
    display: none;
}

.voting-option h3 {
    margin-bottom: 1rem;
    text-align: center;
    color: #fff;
}

.voting-option .video-container {
    width: 100%;
    max-width: none;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.voting-option .video-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.voting-page .video-container,
.results-page .video-container {
    width: 100% !important;
    max-width: none !important;
    aspect-ratio: 16/9 !important;
    height: auto !important;
    min-height: 0;
}

.voting-page .voting-arena {
    max-width: 98vw !important;
}

.voting-page #voting-stage-body > div {
    max-width: 98vw !important;
}

.voting-page .voting-option {
    min-width: 0;
}

.video-container.youtube-playing {
    aspect-ratio: 16/9 !important;
    height: auto !important;
    overflow: hidden;
}

.youtube-player-frame {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.youtube-player-frame iframe {
    width: 100% !important;
    height: 100% !important;
    display: block;
    border: 0;
}

.voting-option .play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s;
}

.voting-option .play-btn:hover {
    color: #e94560;
    transform: translate(-50%, -50%) scale(1.2);
}

.voting-controls {
    text-align: center;
    margin-top: 1.5rem;
}

.vote-btn {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    border-radius: 12px;
}

.voting-lucky-notice {
    text-align: center;
    padding: 1rem;
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid #f39c12;
    border-radius: 8px;
    color: #f39c12;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.voting-finished {
    text-align: center;
    padding: 3rem;
}

.voting-finished h2 {
    color: #2ecc71;
    margin-bottom: 1rem;
}

.voting-finished .btn {
    margin: 0.5rem;
}

/* ===== RESULTS PAGE ===== */
.results-page {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 1rem 1.25rem 2rem;
}

.results-page-title {
    color: #fff;
}

.results-title-label {
    color: var(--accent, #ffcc00);
}

.results-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 204, 0, 0.22);
    padding-bottom: 0.65rem;
    flex-wrap: wrap;
}

.results-panel,
.results-overview-section {
    background: rgba(8, 8, 8, 0.92);
    border: 1px solid rgba(255, 204, 0, 0.18);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
}

.results-overview {
    display: grid;
    gap: 1.25rem;
}

.results-overview-section h3 {
    margin: 0 0 0.85rem;
    color: var(--accent, #ffcc00);
    font-size: 1.05rem;
}

.results-overview-rules {
    color: #ece6cf;
    line-height: 1.55;
    white-space: pre-wrap;
}

.results-overview-period {
    color: #fff;
    font-size: 1.05rem;
    margin: 0;
}

.results-overview-empty,
.results-muted {
    color: #888;
}

.results-participants-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.results-participants-list li {
    margin: 0;
}

.results-final-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.results-final-card {
    background: rgba(255, 204, 0, 0.04);
    border: 1px solid rgba(255, 204, 0, 0.2);
    border-radius: 14px;
    overflow: hidden;
}

.results-final-header {
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid rgba(255, 204, 0, 0.12);
}

.results-final-place {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 800;
    color: #050505;
    background: var(--accent, #ffcc00);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    margin-bottom: 0.55rem;
}

.results-final-title {
    margin: 0 0 0.35rem;
    color: #fff;
    font-size: 1.15rem;
}

.results-final-author {
    color: #b8b09a;
    font-size: 0.9rem;
}

.results-final-media {
    padding: 0.75rem 1.25rem 1.25rem;
}

.results-media-box,
.results-final-media .video-container {
    width: 100%;
    min-height: 360px;
    max-height: 520px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-media-box img,
.results-media-box video,
.results-final-media .video-container img,
.results-final-media .video-container video {
    width: 100%;
    height: 100%;
    max-height: 520px;
    object-fit: contain;
}

.results-media-empty {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    border: 1px dashed rgba(255, 204, 0, 0.2);
    border-radius: 10px;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    color: #fff;
}

.results-table th,
.results-table td {
    padding: 0.85rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 204, 0, 0.12);
}

.results-table th {
    color: var(--accent, #ffcc00);
    font-weight: 700;
}

.results-place-cell {
    font-weight: 700;
    color: var(--accent, #ffcc00);
}

.results-player-cell {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.results-player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent, #ffcc00);
    color: #050505;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
}

.results-score-total {
    font-weight: 800;
    color: var(--accent, #ffcc00);
}

.results-score-wins {
    color: #c8f7c5;
}

.results-score-votes {
    color: #d6e4ff;
}

.results-empty-cell {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.results-footnote {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #888;
}

.results-pair-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 1rem;
    background: rgba(255, 204, 0, 0.04);
    border: 1px solid rgba(255, 204, 0, 0.15);
    border-radius: 12px;
    padding: 1rem;
}

.results-pair-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--accent, #ffcc00);
}

.results-pair-option {
    padding: 0.85rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 204, 0, 0.1);
}

.results-pair-option.is-winner {
    border-color: rgba(255, 204, 0, 0.45);
    box-shadow: 0 0 0 1px rgba(255, 204, 0, 0.15);
}

.results-pair-option-title {
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.35rem;
}

.results-pair-option-author {
    font-size: 0.85rem;
    color: #b8b09a;
    margin-bottom: 0.5rem;
}

.results-pair-voters {
    margin-top: 0.65rem;
    padding: 0.6rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.35);
}

.results-voters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.mini-profile-trigger {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--accent, #ffcc00);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.mini-profile-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    vertical-align: middle;
}

.mini-profile-inline-name {
    text-decoration: underline;
    text-decoration-color: rgba(255, 204, 0, 0.35);
    text-underline-offset: 2px;
}

.mini-profile-trigger:hover .mini-profile-inline-name {
    color: #fff;
    text-decoration-color: var(--accent, #ffcc00);
}

.mini-profile-chip {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    flex: 0 0 1.5rem;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 204, 0, 0.35);
    background: rgba(255, 204, 0, 0.12);
    font-size: 0.72rem;
    font-weight: 700;
    color: #ffcc00;
}

.mini-profile-chip-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    background: transparent;
}

.results-player-cell .mini-profile-trigger,
.results-author-trigger.mini-profile-trigger {
    display: inline-flex;
    align-items: center;
}

.results-voters-list .mini-profile-trigger.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem 0.25rem 0.35rem;
}

.mini-profile-trigger:hover {
    color: #fff;
    text-decoration-color: var(--accent, #ffcc00);
}

button.mini-profile-trigger.btn {
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.public-option-author.mini-profile-trigger {
    display: inline-block;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
}

.voting-option-author {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: #b8b09a;
}

.voting-author-trigger {
    color: var(--accent, #ffcc00);
}

.results-stage-media-box,
.results-pair-option .results-stage-media-box {
    width: 100%;
    min-height: 180px;
    max-height: 280px;
    margin-top: 0.5rem;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-stage-media-box img,
.results-stage-media-box video {
    width: 100%;
    height: 100%;
    max-height: 280px;
    object-fit: contain;
}

.results-stage-media-empty {
    min-height: 80px;
}

.results-final-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 204, 0, 0.15);
}

.results-final-page-info {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    margin: 0.65rem 0 0;
}

.results-stage-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    justify-content: center;
}

.results-stage-title {
    text-align: center;
    color: var(--accent, #ffcc00);
    margin: 0 0 1rem;
}

.results-stage-pairs {
    display: grid;
    gap: 1.25rem;
}

.place-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.85rem;
}

.place-badge.gold {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.place-badge.silver {
    background: rgba(192, 192, 192, 0.2);
    color: #c0c0c0;
}

.place-badge.bronze {
    background: rgba(205, 127, 50, 0.2);
    color: #cd7f32;
}

/* ===== NOTIFICATION ===== */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    background: #16213e;
    border: 2px solid #e94560;
    color: #fff;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.notification.success {
    border-color: #2ecc71;
}

.notification.error {
    border-color: #e74c3c;
}

.notification.info {
    border-color: #3498db;
}

.notification.hidden {
    display: none;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal {
    background: #16213e;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 1rem;
    color: #e94560;
}

.modal-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #888;
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes winnerPulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
    50% { box-shadow: 0 0 0 20px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .voting-arena {
        flex-direction: column;
    }
    
    .voting-option .vs-divider {
        right: 50%;
        top: auto;
        bottom: -1rem;
        transform: translateX(50%);
    }
    
    .form-row {
        flex-direction: column;
    }

    .create-game-limits-row,
    .create-game-round-row {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
}

/* ===== ROUND RESULTS OVERLAY ===== */
.round-results-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 25, 0.95);
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

.round-results-title {
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 2rem;
    text-shadow: 0 0 15px rgba(233, 69, 96, 0.6);
}

.round-results-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 600px;
    width: 100%;
}

.result-card {
    background: #16213e;
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #0f3460;
    position: relative;
    overflow: hidden;
}

.result-card.winner-side {
    border-left: 4px solid #2ecc71;
}

.result-card.loser-side {
    border-left: 4px solid #e74c3c;
    opacity: 0.7;
}

.result-info h4 {
    color: #fff;
    margin-bottom: 0.3rem;
}

.result-vote-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e94560;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.result-emoji {
    font-size: 3.5rem;
    display: block;
    margin: 0.5rem 0;
}

.result-emoji.happy {
    animation: emojiHappy 1.2s ease infinite;
}

.result-emoji.sad {
    animation: emojiSad 0.6s ease 3;
    filter: grayscale(0.8);
}

@keyframes emojiHappy {
    0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 10px #2ecc71); }
    25% { transform: scale(1.15) rotate(-10deg); }
    50% { transform: scale(1.2) rotate(10deg); }
    75% { transform: scale(1.1) rotate(-5deg); }
}

@keyframes emojiSad {
    0%, 100% { transform: translateY(0) rotate(0); opacity: 0.8; }
    20% { transform: translateY(-5px) rotate(-5deg); }
    40% { transform: translateY(5px) rotate(5deg); }
    60% { transform: translateY(-3px) rotate(-3deg); }
    80% { transform: translateY(3px) rotate(3deg); }
}

.round-results-controls {
    margin-top: 2.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-results {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
}

.empty-round-notice {
    text-align: center;
    color: #888;
    padding: 3rem;
    font-style: italic;
}

/* Профиль */
.profile-avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #0f3460;
    margin: 0 auto 1rem;
}

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

/* Navbar improvements */
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

#nav-auth-container {
    display: flex;
    align-items: center;
}

/* ===== YELLOW / BLACK REDESIGN ===== */
:root {
    --bg: #070707;
    --bg-soft: #0d0d0d;
    --surface: #141414;
    --surface-2: #1d1a10;
    --surface-3: #24200f;
    --border: rgba(255, 204, 0, 0.22);
    --border-strong: rgba(255, 204, 0, 0.55);
    --yellow: #ffcc00;
    --yellow-2: #ffdf4d;
    --yellow-dark: #b88900;
    --text: #f5f1df;
    --muted: #a79f82;
    --danger: #ff4d4d;
    --success: #64d86b;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

body {
    background:
        radial-gradient(circle at 18% 0%, rgba(255, 204, 0, 0.22), transparent 34rem),
        radial-gradient(circle at 88% 14%, rgba(255, 178, 0, 0.12), transparent 28rem),
        linear-gradient(180deg, #050505 0%, #151106 48%, #050505 100%);
    color: var(--text);
    letter-spacing: 0.01em;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 204, 0, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 204, 0, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent 78%);
    z-index: -1;
}

.navbar {
    background: rgba(8, 8, 8, 0.92);
    border-bottom: 1px solid var(--border-strong);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
}

.nav-brand {
    color: var(--yellow);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-shadow: 0 0 18px rgba(255, 204, 0, 0.35);
}

.nav-brand-avatar {
    border-color: rgba(255, 204, 0, 0.7);
}

.nav-link {
    color: var(--muted);
    border: 1px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 204, 0, 0.10);
    border-color: var(--border);
    color: var(--yellow-2);
}

.btn {
    border-radius: 999px;
    border: 1px solid transparent;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary,
.btn-warning {
    background: linear-gradient(135deg, var(--yellow), #f0a900);
    color: #101010;
    border-color: rgba(255, 240, 150, 0.35);
}

.btn-primary:hover,
.btn-warning:hover {
    background: linear-gradient(135deg, var(--yellow-2), var(--yellow));
    color: #000;
}

.btn-secondary {
    background: #171717;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: #23200f;
    color: var(--yellow-2);
    border-color: var(--border-strong);
}

.btn-success {
    background: rgba(100, 216, 107, 0.16);
    color: #a7ffad;
    border-color: rgba(100, 216, 107, 0.45);
}

.btn-success:hover {
    background: rgba(100, 216, 107, 0.25);
}

.btn-danger {
    background: rgba(255, 77, 77, 0.14);
    color: #ff9d9d;
    border-color: rgba(255, 77, 77, 0.42);
}

.btn-danger:hover {
    background: rgba(255, 77, 77, 0.22);
}

.games-list,
.participate-page,
.create-game-page,
.results-page,
.voting-page {
    color: var(--text);
}

.games-list {
    max-width: 1180px;
}

.create-game-page,
.modal,
.game-card,
.option-item,
.add-option-form,
.result-card,
.voting-option,
.results-page [style*="background:#16213e"],
.participate-page [style*="background:#16213e"],
.admin-panel [style*="background:#16213e"] {
    background: linear-gradient(180deg, rgba(26, 26, 26, 0.96), rgba(14, 14, 14, 0.96)) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow);
}

.create-game-page,
.game-card,
.option-item,
.add-option-form,
.voting-option,
.modal {
    border: 1px solid var(--border);
}

.game-card {
    border-left: 4px solid var(--yellow) !important;
    border-radius: 18px;
}

.game-card:hover,
.voting-option:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong) !important;
    box-shadow: 0 18px 60px rgba(255, 204, 0, 0.11), var(--shadow);
}

.game-card-info h3,
.option-info h4,
.section-title,
.create-game-page h2,
.participate-page h2,
.voting-header h2,
.results-page h2 {
    color: var(--yellow-2) !important;
}

.section-title {
    border-bottom-color: var(--border);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.game-card-info p,
.game-card-meta span,
.form-hint,
.voting-progress,
.option-info a,
.voting-page small,
.results-page small {
    color: var(--muted) !important;
}

.game-card-meta span,
.participate-page span[style*="background:#0f3460"],
.voting-page span[style*="background:rgba(15,52,96"],
.results-page div[style*="background:#0f3460"],
.participate-page div[style*="background:#0f3460"] {
    background: rgba(255, 204, 0, 0.08) !important;
    border: 1px solid rgba(255, 204, 0, 0.16);
    color: var(--text) !important;
}

.form-group label {
    color: var(--yellow-2);
}

.form-group input,
.form-group textarea,
.form-group select {
    background: #101010;
    border-color: var(--border);
    color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.14);
}

.tab-btn,
.pair-btn {
    background: #121212;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.tab-btn:hover,
.pair-btn:hover {
    background: rgba(255, 204, 0, 0.10);
    color: var(--yellow-2);
    border-color: var(--border-strong);
}

.tab-btn.active,
.pair-btn.active:not(.voted) {
    background: var(--yellow);
    color: #080808;
    border-color: var(--yellow);
}

.pair-btn.voted {
    background: rgba(100, 216, 107, 0.28) !important;
    border-color: rgba(100, 216, 107, 0.85) !important;
    color: #d8ffe0 !important;
    box-shadow: 0 0 16px rgba(100, 216, 107, 0.35);
}

.pair-btn.voted.active {
    background: rgba(100, 216, 107, 0.45) !important;
    border-color: #64d86b !important;
    color: #ffffff !important;
}

.voting-arena {
    gap: 1.25rem;
}

.voting-option {
    border-radius: 22px;
    padding: 1.25rem;
    overflow: visible;
}

.voting-option.selected {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 1px rgba(100, 216, 107, 0.4), 0 18px 70px rgba(100, 216, 107, 0.18);
}

.video-container,
.youtube-player-frame {
    border: 1px solid rgba(255, 204, 0, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03), 0 18px 55px rgba(0,0,0,0.35);
}

.voting-timer {
    color: var(--yellow) !important;
}

.notification {
    background: #111;
    color: var(--text);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
}

.modal-overlay {
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
}

.modal {
    border-radius: 22px;
}

.mini-profile-modal {
    max-width: 440px;
}

.mini-profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.mini-profile-header h3 {
    margin: 0 0 0.25rem;
    color: var(--yellow-2);
}

.mini-profile-username {
    color: var(--muted);
    font-size: 0.9rem;
}

.mini-profile-avatar {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    background: linear-gradient(135deg, rgba(255,204,0,0.22), rgba(255,204,0,0.05));
    flex-shrink: 0;
    box-shadow: 0 12px 34px rgba(255, 204, 0, 0.12);
}

.mini-profile-avatar-img,
.mini-profile-avatar-fallback {
    width: 100%;
    height: 100%;
}

.mini-profile-avatar-img {
    display: block;
    object-fit: cover;
}

.mini-profile-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #101010;
    background: linear-gradient(135deg, var(--yellow), var(--yellow-dark));
    font-size: 2rem;
    font-weight: 800;
}

.mini-profile-stats {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.mini-profile-stats-stack {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.mini-profile-stat-row,
.mini-profile-stats > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: rgba(255, 204, 0, 0.07);
    border: 1px solid rgba(255, 204, 0, 0.16);
}

.mini-profile-stat-row span,
.mini-profile-stats span {
    color: var(--muted);
    flex: 1;
}

.mini-profile-stat-row strong,
.mini-profile-stats strong {
    color: var(--text);
    text-align: right;
    flex-shrink: 0;
    min-width: 2.5rem;
}

.profile-role-card {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--border) !important;
    border-radius: 16px;
    background: rgba(255, 204, 0, 0.07) !important;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.profile-role-card > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.profile-role-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.profile-role-card strong {
    color: var(--yellow-2);
}

.create-game-panel {
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--border) !important;
    border-left: 4px solid var(--yellow) !important;
    background: rgba(255, 204, 0, 0.07) !important;
    box-shadow: 0 14px 42px rgba(0, 0, 0, 0.28);
}

.create-game-panel-title,
.create-game-checkbox {
    color: var(--yellow-2) !important;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: block;
}

.create-game-checkbox {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.create-game-help {
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.create-game-help strong {
    color: var(--yellow-2);
}

.create-game-help ol {
    margin: 0.5rem 0 0 1.5rem;
    color: var(--muted);
}

.kostik-media {
    width: 100%;
    max-width: none;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
    border-radius: 8px;
}

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

.games-search-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.25rem;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.games-search-bar input,
.games-status-filter {
    flex: 1;
    min-width: 180px;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #101010;
    color: var(--text);
    font-size: 0.95rem;
}

.games-status-filter {
    flex: 0 0 220px;
    cursor: pointer;
    padding-right: 2.5rem;
    appearance: none;
    -webkit-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 fill='%23ffcc00' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px 8px;
}

.games-search-bar input:focus,
.games-status-filter:focus {
    outline: none;
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.14);
}

.history-subtitle {
    color: var(--muted);
    margin: -0.75rem 0 1.25rem;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.history-stats > div {
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 204, 0, 0.07);
    box-shadow: 0 14px 42px rgba(0, 0, 0, 0.28);
}

.history-stats span {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.history-stats strong {
    color: var(--yellow-2);
    font-size: 1.65rem;
}

.history-list {
    display: grid;
    gap: 1rem;
}

.archive-page .section-title {
    margin-bottom: 1rem;
}

.archive-list {
    display: grid;
    gap: 0.55rem;
}

.archive-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(14, 14, 14, 0.92);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.archive-item.expanded {
    border-color: rgba(255, 204, 0, 0.42);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.archive-item-header {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.archive-item-header:hover {
    background: rgba(255, 204, 0, 0.06);
}

.archive-item-name {
    font-weight: 700;
    color: var(--text);
}

.archive-item-meta {
    color: var(--muted);
    font-size: 0.85rem;
}

.archive-item-chevron {
    color: var(--yellow-2);
    font-size: 0.95rem;
    width: 1.2rem;
    text-align: center;
}

.archive-item-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.archive-item-media {
    width: 100%;
    max-width: 920px;
}

.archive-media-box {
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 320px;
    border-radius: 12px;
    overflow: hidden;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.archive-media-box img,
.archive-media-box video,
.archive-media-box iframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: 0;
}

.archive-media-empty {
    padding: 2rem;
    color: var(--muted);
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    text-align: center;
}

.archive-item-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

.archive-item-actions .btn {
    min-width: 200px;
}

.results-final-card-focus {
    outline: 2px solid rgba(255, 204, 0, 0.75);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(255, 204, 0, 0.12);
}

.slot-modal-wide {
    max-width: 720px !important;
    width: min(720px, 96vw);
}

.slot-modal-preview {
    margin-bottom: 0.75rem;
}

.slot-modal-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.slot-modal-media video,
.slot-modal-media iframe,
.slot-modal-media .youtube-player-frame {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

.slot-modal-drop-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 204, 0, 0.22);
    background: rgba(255, 204, 0, 0.06);
}

.slot-modal-drop-status {
    color: var(--muted);
    font-size: 0.9rem;
    flex: 1;
    min-width: 180px;
}

.drop-media-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    width: 100%;
}

.drop-media-actions {
    display: flex;
    justify-content: center;
}

.drop-jump-btn {
    min-width: 180px;
}

@media (max-width: 720px) {
    .archive-item-header {
        grid-template-columns: 1fr auto;
    }

    .archive-item-meta {
        grid-column: 1 / -1;
        order: 3;
    }

    .archive-media-box {
        min-height: 200px;
    }

    .archive-item-actions .btn {
        width: 100%;
        max-width: 320px;
    }
}

.status-badge {
    border: 1px solid transparent !important;
    font-weight: 800;
}

.status-registration {
    background: rgba(255, 204, 0, 0.13) !important;
    border-color: rgba(255, 204, 0, 0.38) !important;
    color: var(--yellow-2) !important;
}

.status-submission {
    background: rgba(100, 216, 107, 0.13) !important;
    border-color: rgba(100, 216, 107, 0.38) !important;
    color: #a7ffad !important;
}

.status-voting {
    background: rgba(255, 122, 0, 0.14) !important;
    border-color: rgba(255, 122, 0, 0.42) !important;
    color: #ffbc70 !important;
}

.status-finished {
    background: rgba(180, 180, 180, 0.10) !important;
    border-color: rgba(180, 180, 180, 0.28) !important;
    color: #d7d7d7 !important;
}

.game-rules-panel {
    margin-bottom: 1.5rem;
    padding: 1.15rem 1.25rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 204, 0, 0.22);
    background: linear-gradient(180deg, rgba(26, 26, 26, 0.96), rgba(14, 14, 14, 0.96));
    box-shadow: var(--shadow);
}

.game-rules-title {
    margin: 0 0 0.75rem;
    color: var(--gold);
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.game-rules-content {
    color: var(--text);
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.public-options-section,
.voting-stages-panel {
    margin-top: 2rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 204, 0, 0.06);
}

.public-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.public-option-card {
    border-radius: 16px;
    border: 1px solid rgba(255, 204, 0, 0.16);
    background: rgba(10, 10, 10, 0.72);
    overflow: hidden;
}

.public-option-media {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
    position: relative;
}

.public-option-media img,
.public-option-media video,
.public-option-media iframe {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    border: 0;
}

.participate-advance-block {
    background: #16213e;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 204, 0, 0.2);
}

.game-admin-panel {
    background: rgba(10, 10, 10, 0.78);
    border: 1px solid rgba(255, 204, 0, 0.22);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.game-admin-title {
    color: var(--yellow-2);
    margin: 0 0 0.35rem;
}

.game-admin-hint {
    color: var(--muted);
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.game-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.public-option-author {
    display: block;
    color: var(--yellow-2);
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
}

.global-admin-toggle-wrap {
    align-items: center;
}

.global-admin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    user-select: none;
    color: var(--muted);
    font-size: 0.85rem;
}

.global-admin-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.global-admin-toggle-track {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--border);
    position: relative;
    transition: background 0.2s ease;
}

.global-admin-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.global-admin-toggle input:checked + .global-admin-toggle-track {
    background: rgba(255, 204, 0, 0.35);
    border-color: rgba(255, 204, 0, 0.55);
}

.global-admin-toggle input:checked + .global-admin-toggle-track::after {
    transform: translateX(18px);
}

.game-admin-participant-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.game-admin-participants label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--muted);
}

.global-admin-users-panel {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 204, 0, 0.18);
}

.global-admin-users-panel h3 {
    color: var(--yellow-2);
    margin-bottom: 0.5rem;
}

.global-admin-users-hint {
    display: block;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.global-admin-users-search {
    margin-top: 0.25rem;
    margin-bottom: 1.25rem;
}

.admin-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-user-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.public-option-admin-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.65rem;
}

.public-option-media a {
    display: block;
    width: 100%;
    height: 100%;
    color: var(--yellow-2);
    text-decoration: none;
}

.public-option-media a span {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    border: 1px solid var(--border);
    font-size: 0.8rem;
}

.public-option-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.public-option-info {
    padding: 0.8rem;
}

.public-option-info strong {
    color: var(--text);
    font-size: 1rem;
}

.password-modal {
    max-width: 440px;
}

.password-modal h3 {
    color: var(--yellow-2);
    margin-bottom: 0.5rem;
}

.game-view-tabs {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.participate-badge {
    background: rgba(255, 204, 0, 0.08);
    border: 1px solid rgba(255, 204, 0, 0.22);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--muted);
}

.participate-join-block {
    background: rgba(255, 204, 0, 0.08);
    border: 1px solid rgba(255, 204, 0, 0.22);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 1.5rem;
}

.participate-join-block p {
    color: var(--text);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.game-tabs-root {
    margin-top: 0.5rem;
}

.voting-phase-banner {
    background: rgba(255, 204, 0, 0.1);
    border: 1px solid rgba(255, 204, 0, 0.28);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.voting-phase-banner strong {
    color: var(--yellow-2);
    display: block;
    margin-bottom: 0.35rem;
}

.voting-phase-banner p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.voting-stages-grid {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.stage-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255, 204, 0, 0.25);
}

.stage-chip-future {
    background: rgba(255, 255, 255, 0.04);
    color: #777;
    border-color: rgba(255, 255, 255, 0.08);
    cursor: not-allowed;
}

.stage-chip-active {
    background: rgba(255, 204, 0, 0.16);
    color: var(--yellow-2);
}

.stage-chip-done {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.option-slot {
    background: rgba(10, 10, 10, 0.72);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid rgba(255, 204, 0, 0.16);
}

.option-slot-filled {
    border-color: rgba(255, 204, 0, 0.45);
}

.option-slot-empty {
    border-style: dashed;
    opacity: 0.85;
}

.option-slot-label,
.option-slot-title {
    color: var(--text);
    font-weight: 600;
}

.option-slot-link {
    font-size: 0.85rem;
    color: var(--yellow-2);
}

.option-slot-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.voting-page-title {
    color: var(--yellow-2);
    margin-bottom: 0.5rem;
}

.voting-progress-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-weight: 700;
}

.voting-progress-chip-done {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid #2ecc71;
    color: #2ecc71;
}

.voting-progress-chip-pending {
    background: rgba(255, 204, 0, 0.1);
    border: 1px solid rgba(255, 204, 0, 0.35);
    color: var(--yellow-2);
}

.voting-progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
}

.voting-progress-dot.is-on {
    background: #2ecc71;
    box-shadow: 0 0 12px #2ecc71;
}

.game-tab-content {
    display: none;
}

.game-tab-content.active {
    display: block;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #080808;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--yellow), var(--yellow-dark));
    border-radius: 999px;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.9rem 1rem;
        align-items: flex-start;
    }

    .nav-links {
        gap: 0.6rem;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .games-list,
    .participate-page,
    .create-game-page,
    .results-page {
        padding: 1rem;
    }

    .games-search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .games-status-filter {
        flex: 1;
        width: 100%;
    }

    .history-stats {
        grid-template-columns: 1fr;
    }
}

/* ===== CONFIRM DIALOG ===== */
.confirm-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.confirm-dialog-overlay-visible {
    opacity: 1;
}

.confirm-dialog-overlay-leave {
    opacity: 0;
}

.confirm-dialog {
    width: min(100%, 420px);
    padding: 1.75rem 1.5rem 1.5rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 204, 0, 0.28);
    background:
        radial-gradient(circle at top right, rgba(255, 204, 0, 0.12), transparent 42%),
        linear-gradient(180deg, rgba(21, 17, 6, 0.98) 0%, rgba(8, 8, 8, 0.98) 100%);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    text-align: center;
    transform: translateY(8px) scale(0.98);
    transition: transform 0.18s ease;
}

.confirm-dialog-overlay-visible .confirm-dialog {
    transform: translateY(0) scale(1);
}

.confirm-dialog-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 204, 0, 0.24);
    background: rgba(255, 204, 0, 0.08);
    color: var(--accent, #ffdf4d);
}

.confirm-dialog-icon svg {
    width: 28px;
    height: 28px;
}

.confirm-dialog-icon-warning {
    color: #ffb020;
    border-color: rgba(255, 176, 32, 0.35);
    background: rgba(255, 176, 32, 0.12);
}

.confirm-dialog-icon-danger {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.35);
    background: rgba(255, 107, 107, 0.12);
}

.confirm-dialog-title {
    margin: 0 0 0.65rem;
    color: #fff;
    font-size: 1.15rem;
}

.confirm-dialog-message {
    margin: 0 0 1.25rem;
    color: rgba(245, 241, 223, 0.82);
    line-height: 1.55;
}

.confirm-dialog-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.participate-finished-banner {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 204, 0, 0.22);
    background: rgba(255, 204, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.participate-finished-banner p {
    margin: 0;
    color: rgba(245, 241, 223, 0.88);
}

.voting-stages-admin-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 204, 0, 0.14);
}

.leaderboard-self-gap td {
    height: 1.25rem;
    padding: 0;
    border: none;
    background: transparent;
}

.leaderboard-self-label td {
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
    color: rgba(255, 204, 0, 0.85);
    background: rgba(255, 204, 0, 0.06);
    border-top: 1px solid rgba(255, 204, 0, 0.18);
    border-bottom: 1px solid rgba(255, 204, 0, 0.18);
}

.leaderboard-self-row {
    background: rgba(255, 204, 0, 0.08);
}

.leaderboard-self-row td {
    border-color: rgba(255, 204, 0, 0.22);
}

.results-author-unknown {
    font-style: italic;
    color: rgba(245, 241, 223, 0.55);
    cursor: default;
}

.backend-version-warning {
    position: sticky;
    top: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, #8b0000, #b45309);
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

.backend-version-warning strong {
    color: #ffdf4d;
}

/* ===== Реакции / эмодзи / оверлей ===== */
.voting-reaction-bar {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.voting-reaction-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.voting-reaction-actions .btn:disabled {
    opacity: 0.65;
    cursor: default;
}

.voting-reaction-status {
    min-height: 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.voting-spectator-banner {
    text-align: center;
    margin: 0 auto 1rem;
    max-width: 720px;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 204, 0, 0.28);
    background: rgba(255, 204, 0, 0.08);
    color: var(--muted);
}

.voting-comment-modal {
    max-width: 480px;
    width: min(480px, 94vw);
}

.voting-comment-modal textarea {
    width: 100%;
    resize: vertical;
    min-height: 90px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    padding: 0.75rem;
    font: inherit;
}

.voting-emoji-picker {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 12000;
    width: min(360px, calc(100vw - 2rem));
    max-height: min(420px, 70vh);
    overflow: auto;
    padding: 0.85rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 204, 0, 0.28);
    background: rgba(12, 12, 12, 0.96);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.voting-emoji-picker-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
}

.voting-emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.35rem;
}

.voting-emoji-cell {
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: inherit;
}

.voting-emoji-cell:hover {
    border-color: rgba(255, 204, 0, 0.45);
    background: rgba(255, 204, 0, 0.1);
}

.voting-emoji-cell img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.reaction-overlay-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 8;
}

.video-container.youtube-playing {
    position: relative;
}

.video-container .youtube-player-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.auth-captcha-wrap {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
}

.auth-captcha-wrap.hidden {
    display: none !important;
}

.auth-local-captcha {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 204, 0, 0.35);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text, #f5f1df);
    cursor: pointer;
    user-select: none;
}

.auth-local-captcha input {
    width: 18px;
    height: 18px;
    accent-color: #ffcc00;
}

.audit-nick-filter {
    margin: 0.75rem 0 1rem;
}

.reaction-danmaku {
    position: absolute;
    left: 100%;
    white-space: nowrap;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    animation-name: reaction-danmaku-move;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    will-change: transform;
}

@keyframes reaction-danmaku-move {
    from { transform: translateX(0); }
    to { transform: translateX(var(--danmaku-travel, -120%)); }
}

.reaction-fall-emoji {
    position: absolute;
    top: -8%;
    font-size: 1.55rem;
    line-height: 1;
    animation-name: reaction-emoji-fall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
    will-change: transform;
}

.reaction-emoji-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.voting-page .reaction-emoji-img,
.results-page .reaction-emoji-img {
    width: 44px;
    height: 44px;
}

.reaction-emoji-char {
    display: inline-block;
    font-size: 1.7rem;
    line-height: 1;
}

@keyframes reaction-emoji-fall {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(var(--emoji-fall, 140%)); opacity: 0.9; }
}

.admin-emoji-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-emoji-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
}

.admin-emoji-chip img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.avatar-cropper-overlay {
    z-index: 13000;
}

.avatar-cropper-modal {
    max-width: 420px;
    width: min(420px, 94vw);
}

.avatar-cropper-stage {
    position: relative;
    margin: 0.75rem auto;
    overflow: hidden;
    border-radius: 16px;
    background: #111;
    touch-action: none;
    cursor: grab;
}

.avatar-cropper-stage:active {
    cursor: grabbing;
}

.avatar-cropper-stage img {
    position: absolute;
    left: 50%;
    top: 50%;
    max-width: none;
    user-select: none;
    pointer-events: none;
}

.avatar-cropper-circle {
    position: absolute;
    left: 50%;
    top: 50%;
    border: 2px solid rgba(255, 204, 0, 0.95);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 2;
}

.emoji-manager-modal {
    max-width: 640px;
    width: min(640px, 96vw);
    max-height: 85vh;
    overflow: auto;
}

.admin-emoji-chip {
    gap: 0.45rem;
}

.admin-emoji-chip .btn {
    margin-left: auto;
}

.audit-layout {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 1rem;
    align-items: start;
}

.audit-games-pane,
.audit-logs-pane {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(14, 14, 14, 0.92);
    padding: 0.85rem;
    min-height: 320px;
}

.audit-games-list {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.75rem;
    max-height: 60vh;
    overflow: auto;
}

.audit-game-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    text-align: left;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
}

.audit-game-row:hover,
.audit-game-row.active {
    border-color: rgba(255, 204, 0, 0.4);
    background: rgba(255, 204, 0, 0.08);
}

.audit-game-row span {
    color: var(--muted);
    font-size: 0.8rem;
}

.audit-log-list {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.75rem;
    max-height: 65vh;
    overflow: auto;
}

.audit-log-row {
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.audit-log-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.audit-log-who {
    margin-top: 0.25rem;
    color: var(--yellow-2);
}

.audit-log-details {
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.85rem;
    word-break: break-word;
}

@media (max-width: 800px) {
    .audit-layout {
        grid-template-columns: 1fr;
    }
}

.avatar-cropper-controls {
    margin: 0.75rem 0 0.25rem;
}

.avatar-cropper-controls input[type="range"] {
    width: 100%;
    margin-top: 0.35rem;
}