* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-color: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    position: relative;
    transition: background-image 1.5s ease-in-out;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    z-index: -1;
}

body.morning-bg {
    background-image: url('anime-backgrounds/morning.png');
}

body.afternoon-bg {
    background-image: url('anime-backgrounds/afternoon.png');
}

body.evening-bg {
    background-image: url('anime-backgrounds/evening.png');
}

body.night-bg {
    background-image: url('anime-backgrounds/night.png');
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

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

.header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header h2 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

/* Auto Random Button */
.btn-auto-random {
    position: absolute;
    top: 5px;
    right: 0;
    padding: 8px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    white-space: nowrap;
}

.btn-auto-random:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-auto-random:active {
    transform: translateY(0);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Menu Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 450px;
    margin: 0 auto;
}

.main-btn {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 20px 25px;
    font-size: 1.1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.main-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

.main-btn .icon {
    font-size: 1.6rem;
}

.main-btn .text {
    flex: 1;
    text-align: left;
    font-weight: 600;
}

/* Team Setup */
.team-setup {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    margin-bottom: 30px;
    align-items: center;
}

.team-config {
    background: var(--surface-color);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.team-config.highlight {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(16, 185, 129, 0.15) 100%);
    border-color: var(--success-color);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    transform: scale(1.02);
}

.team-config h3 {
    text-align: center;
    margin-bottom: 18px;
    color: var(--primary-color);
    font-size: 1.3rem;
    transition: color 0.3s ease;
}

.team-config.highlight h3 {
    color: var(--success-color);
}

.vs-divider {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-secondary);
    text-align: center;
}

.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 0.95rem;
}

/* Team Selector */
.team-selector-container {
    margin: 15px 0;
}

.btn-toggle-teams {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn-toggle-teams:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.5);
}

.btn-toggle-teams.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.team-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 12px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.team-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.team-option-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
}

.team-option-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    padding: 5px;
}

.team-option-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    line-height: 1.2;
}

.team-option-country {
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 2px 8px;
    border-radius: 4px;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.difficulty-selector button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.difficulty-selector button:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: scale(1.05);
}

.difficulty-selector span {
    font-size: 1.5rem;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
    color: var(--primary-color);
    background: var(--bg-color);
    padding: 8px 16px;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
}

.difficulty-bar {
    width: 100%;
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 8px;
}

.difficulty-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--warning-color), var(--danger-color));
    transition: width 0.3s ease;
}

/* Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    padding: 15px 35px;
    font-size: 1.1rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: var(--surface-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    animation: buttonPulse 2s ease-in-out infinite;
}

.btn-small:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.5);
    animation: none;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    }
    50% {
        box-shadow: 0 2px 12px rgba(37, 99, 235, 0.6);
    }
}

/* Match Screen */
.match-header {
    background: var(--surface-color);
    padding: 25px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.match-header h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.scoreboard {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
}

.team-score {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.2rem;
}

.team-score:last-child {
    flex-direction: row-reverse;
}

.score {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 50px;
    text-align: center;
}

.time {
    background: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
}

/* Match Content */
.match-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.match-log-container {
    background: var(--surface-color);
    border-radius: 15px;
    border: 2px solid var(--border-color);
    overflow: hidden;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid var(--border-color);
}

.log-header h3 {
    color: var(--text-color);
}

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

.match-log {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
}

.log-entry {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: var(--bg-color);
    border-left: 4px solid var(--border-color);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.log-entry.goal {
    border-left-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.log-entry.warning {
    border-left-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

.log-entry.important {
    border-left-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.log-entry.commentary {
    border-left-color: #ec4899;
    background: rgba(236, 72, 153, 0.1);
    font-style: italic;
    border-left-width: 5px;
}

.log-entry.commentary em {
    color: #f9a8d4;
}

.log-time {
    color: var(--text-secondary);
    font-weight: bold;
    margin-right: 10px;
}

/* Stats Panel */
.stats-panel {
    display: none;
    background: var(--surface-color);
    border-radius: 15px;
    border: 2px solid var(--border-color);
    overflow: hidden;
}

.stats-panel.active {
    display: block;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid var(--border-color);
}

.stats-content {
    padding: 20px;
}

.stat-row {
    margin-bottom: 20px;
}

.stat-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.stat-bar-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
}

.stat-bar {
    height: 25px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.stat-bar.reverse {
    display: flex;
    justify-content: flex-end;
}

.stat-value {
    min-width: 40px;
    text-align: center;
    font-weight: bold;
    color: var(--primary-color);
}

/* Settings */
.settings-info-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.info-item {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.info-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.info-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

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

.info-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
    text-transform: uppercase;
    font-weight: 600;
}

.info-value {
    font-size: 0.95rem;
    color: var(--primary-color);
    font-weight: bold;
}

.settings-stats-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 20px auto;
    max-width: 500px;
}

.stats-card {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.stats-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
}

.stats-icon {
    font-size: 1.8rem;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 8px;
}

.stats-info {
    flex: 1;
}

.stats-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.stats-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.settings-content {
    max-width: 500px;
    margin: 0 auto;
}

.setting-item {
    background: var(--surface-color);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    margin-bottom: 15px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.setting-item select {
    width: 100%;
    padding: 10px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.95rem;
    cursor: pointer;
}

/* Tournament Setup */
.setup-mode-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.mode-btn {
    flex: 1;
    max-width: 250px;
    padding: 18px 35px;
    font-size: 1.1rem;
    border-radius: 12px;
    border: 3px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mode-btn:hover {
    background: var(--border-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    transform: scale(1.05);
}

.random-button-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
    flex-wrap: wrap;
}

.btn-random, .btn-update-realtime {
    padding: 15px 40px;
    font-size: 1.1rem;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-random {
    border: 3px solid var(--warning-color);
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.btn-random:hover {
    background: linear-gradient(135deg, #d97706, var(--warning-color));
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.btn-random:active {
    transform: translateY(-1px) scale(1.02);
}

.btn-update-realtime {
    border: 3px solid var(--success-color);
    background: linear-gradient(135deg, var(--success-color), #059669);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-update-realtime:hover {
    background: linear-gradient(135deg, #059669, var(--success-color));
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.btn-update-realtime:active {
    transform: translateY(-1px) scale(1.02);
}

.changelog-container {
    max-width: 900px;
    margin: 0 auto 30px;
    background: var(--surface-color);
    border-radius: 15px;
    border: 2px solid var(--border-color);
    overflow: hidden;
    animation: fadeIn 0.3s ease-in;
}

.changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-color);
    border-bottom: 2px solid var(--border-color);
}

.changelog-header h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin: 0;
}

.btn-close-changelog {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-changelog:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

.changelog-content {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.changelog-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
    font-style: italic;
}

.changelog-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    margin-bottom: 12px;
    background: var(--bg-color);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s;
}

.changelog-item:hover {
    background: var(--border-color);
    transform: translateX(5px);
}

.changelog-item.level-up {
    border-left-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

.changelog-item.level-down {
    border-left-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

.changelog-item.level-stable {
    border-left-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.05);
}

.changelog-icon {
    font-size: 1.8rem;
    min-width: 40px;
    text-align: center;
}

.changelog-details {
    flex: 1;
}

.changelog-team-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 5px;
}

.changelog-level-change {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: 600;
}

.level-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: bold;
}

.level-badge.old-level {
    background: var(--border-color);
    color: var(--text-secondary);
}

.level-badge.new-level {
    background: var(--primary-color);
    color: white;
}

.level-arrow {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.changelog-reason {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
    margin-top: 5px;
}

.changelog-timestamp {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 8px;
    font-style: italic;
}

.tournament-teams-setup {
    max-width: 1100px;
    margin: 0 auto 30px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.tournament-team-input {
    background: var(--surface-color);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.tournament-team-input:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.tournament-team-input h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-align: center;
    font-weight: 700;
}

.tournament-team-input input {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.tournament-team-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.team-select {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.team-select:hover {
    border-color: var(--primary-color);
}

.team-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.team-select option {
    background: var(--surface-color);
    color: var(--text-color);
    padding: 10px;
}

.difficulty-label {
    text-align: center;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 5px;
    padding: 5px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 6px;
}

/* Team Logo Section */
.team-logo-section {
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.btn-show-logo {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
    min-width: 140px;
    justify-content: center;
}

.btn-show-logo:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.5);
}

.btn-show-logo:active:not(.disabled) {
    transform: translateY(0);
}

.btn-show-logo.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    box-shadow: none;
}

.btn-show-logo.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.btn-show-logo .logo-icon {
    font-size: 1.1rem;
}

.btn-show-logo .logo-text {
    font-size: 0.9rem;
}

.team-logo-display {
    width: 80px;
    height: 80px;
    margin: 10px auto 0;
    display: none;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    background: rgba(255,255,255,0.05);
    border: 3px solid var(--primary-color);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.team-logo-display.show {
    display: flex !important;
    opacity: 1;
    transform: scale(1);
}

.team-logo-display img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Tournament */
.tournament-bracket {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--surface-color);
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.bracket-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bracket-column h3 {
    text-align: center;
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.matches {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    justify-content: center;
}

.match-card {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    transition: all 0.3s ease;
}

.match-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.3);
}

.match-card.completed {
    opacity: 0.75;
}

.match-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    margin: 2px 0;
    background: var(--surface-color);
    border-radius: 5px;
    min-height: 32px;
}

.match-team.winner {
    background: rgba(16, 185, 129, 0.2);
    font-weight: bold;
    color: var(--success-color);
}

.match-team.loser {
    opacity: 0.6;
    background: rgba(100, 100, 100, 0.15);
}

.match-team.pending-team {
    opacity: 0.5;
    font-style: italic;
    color: var(--text-secondary);
}

.match-team-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}

.team-name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.team-logo-small {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
}

.match-team-score {
    font-weight: bold;
    font-size: 1rem;
    min-width: 35px;
    text-align: center;
    flex-shrink: 0;
}

.match-status {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-view-stats {
    padding: 4px 8px;
    font-size: 0.85rem;
    border-radius: 5px;
    border: 1px solid var(--primary-color);
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-view-stats:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: scale(1.1);
}

.btn-view-stats:active {
    transform: scale(0.95);
}

.champion-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 30px;
}

.champion-display.has-winner {
    border-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

.champion-trophy {
    font-size: 4rem;
    margin-bottom: 15px;
}

.champion-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--warning-color);
    margin-bottom: 10px;
}

.champion-label {
    color: var(--text-secondary);
}

.tournament-controls {
    margin-top: 20px;
}

.tournament-status {
    text-align: center;
    padding: 15px;
    background: var(--surface-color);
    border-radius: 10px;
    border: 2px solid var(--border-color);
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 1.1rem;
}

.tournament-log-section {
    margin: 20px 0;
    background: var(--surface-color);
    border-radius: 15px;
    border: 2px solid var(--border-color);
    overflow: hidden;
}

.tournament-log-section h3 {
    padding: 20px;
    margin: 0;
    color: var(--text-color);
}

.log-header-tournament {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    padding: 15px;
    gap: 10px;
}

.log-header-tournament h3 {
    flex: 1;
}

.btn-auto-scroll {
    padding: 8px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-auto-scroll:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.btn-auto-scroll.disabled {
    background: var(--surface-color);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-log-action {
    padding: 8px 14px;
    font-size: 0.85rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.btn-log-action:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.btn-log-action:active {
    transform: scale(0.95);
}

.tournament-log {
    height: 300px;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-color);
}

.tournament-log-entry {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: var(--surface-color);
    border-left: 4px solid var(--border-color);
    animation: slideIn 0.3s ease;
}

.tournament-log-entry.match-start {
    border-left-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.tournament-log-entry.match-end {
    border-left-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.tournament-log-entry.round-change {
    border-left-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
    font-weight: bold;
}

.tournament-log-entry.goal {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    font-weight: bold;
    font-size: 1.05rem;
    animation: goalPulse 0.5s ease;
}

@keyframes goalPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.tournament-log-entry.save {
    border-left-color: #06b6d4;
    background: rgba(6, 182, 212, 0.1);
}

.tournament-log-entry.chance {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.tournament-log-entry.pass {
    border-left-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.08);
}

.tournament-log-entry.yellow-card {
    border-left-color: #eab308;
    background: rgba(234, 179, 8, 0.15);
    font-weight: 600;
}

.tournament-log-entry.red-card {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
    font-weight: bold;
    border-left-width: 5px;
}

.tournament-log-entry.foul {
    border-left-color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.tournament-log-entry.corner {
    border-left-color: #14b8a6;
    background: rgba(20, 184, 166, 0.1);
}

.tournament-log-entry.offside {
    border-left-color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
}

.tournament-log-entry.substitution {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.12);
}

.tournament-log-entry.halftime {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    font-weight: bold;
    text-align: center;
}

.tournament-log-entry.commentary {
    border-left-color: #ec4899;
    background: rgba(236, 72, 153, 0.1);
    font-style: italic;
    border-left-width: 5px;
}

.tournament-log-entry.commentary em {
    color: #f9a8d4;
}

.live-match-display {
    background: var(--surface-color);
    border-radius: 15px;
    border: 2px solid var(--primary-color);
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

.live-match-display h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.live-match-info {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 10px;
}

.live-team {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: bold;
}

.live-team:last-child {
    flex-direction: row-reverse;
}

.live-team-logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.live-score {
    font-size: 2rem;
    color: var(--success-color);
    min-width: 50px;
    text-align: center;
}

.live-time {
    background: var(--danger-color);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    animation: pulse 2s infinite;
}

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

.live-events {
    max-height: 150px;
    overflow-y: auto;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 10px;
}

.live-event {
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 6px;
    background: var(--surface-color);
    border-left: 3px solid var(--border-color);
    font-size: 0.95rem;
}

.live-event.goal {
    border-left-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    font-weight: bold;
}

.live-event.warning {
    border-left-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

.tournament-stats-section {
    margin: 20px 0;
    background: var(--surface-color);
    border-radius: 15px;
    border: 2px solid var(--border-color);
    overflow: hidden;
}

.tournament-stats-section h3 {
    padding: 20px;
    margin: 0;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-color);
    text-align: center;
}

.tournament-stats {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.tournament-stats.collapsed {
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

.stats-header-collapsible {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 2px solid var(--border-color);
    user-select: none;
    transition: background 0.2s;
}

.stats-header-collapsible:hover {
    background: rgba(37, 99, 235, 0.1);
}

.stats-header-collapsible h3 {
    margin: 0;
    color: var(--text-color);
}

.btn-collapse {
    background: var(--border-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.3s ease, background 0.2s ease;
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-collapse:hover {
    background: var(--primary-color);
}

.btn-collapse.rotated {
    transform: rotate(180deg);
}

.match-stats-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 10px;
}

.match-stats-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.stats-subtitle {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.man-of-match {
    text-align: center;
    padding: 15px;
    margin: 15px 0;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-radius: 12px;
    border: 3px solid #ffaa00;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.motm-icon {
    font-size: 1.8rem;
    animation: pulse 2s infinite;
}

.motm-label {
    font-weight: bold;
    color: #333;
    font-size: 1.1rem;
}

.motm-name {
    font-weight: bold;
    color: #000;
    font-size: 1.2rem;
}

.motm-rating {
    color: #555;
    font-size: 0.95rem;
    font-style: italic;
}

.stats-grid {
    display: grid;
    gap: 12px;
}

.stat-item {
    background: var(--bg-color);
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-values {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 15px;
    align-items: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.stat-values > span:first-child {
    text-align: right;
    color: var(--success-color);
}

.stat-values > span:last-child {
    text-align: left;
    color: var(--danger-color);
}

.stat-bar-mini {
    width: 100px;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    grid-column: 1 / -1;
    margin-top: 5px;
}

.stat-bar-fill-mini {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--primary-color));
    transition: width 0.3s ease;
}

.tournament-settings {
    max-width: 600px;
    margin: 0 auto 30px;
}

/* Event Animations */
.event-animations-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.event-animation {
    position: absolute;
    left: 50%;
    top: 30%;
    transform: translate(-50%, -50%);
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    animation: eventPop 2.5s ease-out forwards;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    max-width: 90%;
    word-wrap: break-word;
}

.event-animation.goal {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: 4px solid #34d399;
    animation: goalAnimation 3s ease-out forwards;
}

.event-animation.assist {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: 4px solid #60a5fa;
}

.event-animation.yellow-card {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    border: 4px solid #fcd34d;
}

.event-animation.red-card {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: 4px solid #f87171;
}

.event-animation.save {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
    border: 4px solid #22d3ee;
}

.event-animation.miss {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: 4px solid #fbbf24;
}

.event-animation.foul {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    border: 4px solid #fb923c;
}

@keyframes goalAnimation {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        transform: translate(-50%, -50%) scale(1.3) rotate(5deg);
        opacity: 1;
    }
    20% {
        transform: translate(-50%, -50%) scale(1) rotate(-5deg);
    }
    30% {
        transform: translate(-50%, -50%) scale(1.1) rotate(3deg);
    }
    40% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    70% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8) rotate(0deg);
        opacity: 0;
    }
}

@keyframes eventPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    15% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    25% {
        transform: translate(-50%, -50%) scale(1);
    }
    75% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    animation: slideInUp 0.4s ease-out;
}

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

.scroll-to-top:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.7);
    border-color: rgba(255, 255, 255, 0.4);
}

.scroll-to-top:active {
    transform: translateY(-2px) scale(1.05);
}

/* Footer */
footer {
    width: 100%;
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    margin-top: auto;
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer-greeting {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 16px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(37, 99, 235, 0.25);
}

.greeting-icon {
    font-size: 1.2rem;
}

.greeting-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.footer-top {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.visitor-separator {
    color: var(--border-color);
    font-weight: bold;
}

.visitor-counter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(37, 99, 235, 0.15);
    padding: 3px 10px;
    border-radius: 16px;
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: var(--text-color);
    font-size: 0.85rem;
}

.visitor-counter #visitorCount {
    font-weight: bold;
    color: var(--primary-color);
}

.footer-links {
    margin: 10px 0;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: inline-block;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    font-size: 0.85rem;
}

.footer-link:hover {
    background: rgba(37, 99, 235, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.footer-copyright {
    margin: 10px 0 5px 0;
    font-weight: 600;
    color: var(--text-color);
}

.footer-copyright p {
    margin: 0;
    font-size: 0.85rem;
}

/* Scrollbar */
.match-log::-webkit-scrollbar {
    width: 8px;
}

.match-log::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.match-log::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.match-log::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Responsive Mobile */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 10px;
    }
    
    .header {
        margin-bottom: 15px;
    }
    
    .header h1 {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }
    
    .header h2 {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }
    
    /* Auto Random Button Mobile */
    .btn-auto-random {
        position: static;
        display: block;
        width: auto;
        max-width: 150px;
        margin: 10px auto 0;
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .team-setup {
        grid-template-columns: 1fr auto 1fr;
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .vs-divider {
        transform: none;
        margin: 0;
        font-size: 1.1rem;
        padding: 0 4px;
    }
    
    .team-config {
        padding: 10px;
    }
    
    .team-config h3 {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    .input-group {
        margin-bottom: 8px;
    }
    
    .input-group label {
        font-size: 0.65rem;
        margin-bottom: 4px;
    }
    
    .input-group input {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .difficulty-selector {
        gap: 6px;
        margin-bottom: 6px;
    }
    
    .difficulty-selector button {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
    
    .difficulty-selector span {
        font-size: 0.95rem;
        padding: 4px 10px;
    }
    
    .btn-toggle-teams {
        padding: 6px 8px;
        font-size: 0.7rem;
    }
    
    .btn-show-logo {
        padding: 5px 10px !important;
        font-size: 0.65rem !important;
        margin: 5px auto !important;
    }
    
    .team-logo-display {
        width: 50px;
        height: 50px;
        margin: 6px auto 0;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-buttons .btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    .difficulty-bar {
        height: 5px;
        margin-top: 4px;
    }
    
    .difficulty-label {
        font-size: 0.65rem;
        margin-top: 3px;
    }
    
    .team-selector-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
        padding: 10px;
        max-height: 250px;
    }
    
    .team-selector-container {
        margin: 10px 0;
    }
    
    .team-option-btn {
        padding: 8px 5px;
        gap: 6px;
    }
    
    .team-option-logo {
        width: 40px;
        height: 40px;
    }
    
    .team-option-name {
        font-size: 0.65rem;
    }
    
    .team-option-country {
        font-size: 0.6rem;
        padding: 1px 6px;
    }
    
    .btn-toggle-teams {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .scoreboard {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .team-score {
        justify-content: space-between;
        font-size: 1rem;
    }
    
    .team-score:last-child {
        flex-direction: row;
    }
    
    .score {
        font-size: 2rem;
    }
    
    .header h1 {
        font-size: 1.6rem;
    }
    
    .header h2 {
        font-size: 1.4rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    .main-btn {
        font-size: 1rem;
        padding: 15px 18px;
    }
    
    .main-btn .icon {
        font-size: 1.4rem;
    }
    
    /* Tournament Bracket Mobile */
    .tournament-bracket {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .bracket-column h3 {
        font-size: 1rem;
    }
    
    .match-card {
        padding: 8px;
    }
    
    .match-team {
        padding: 5px 6px;
        min-height: 28px;
    }
    
    .team-logo-small {
        width: 12px;
        height: 12px;
    }
    
    .team-name-text {
        font-size: 0.85rem;
    }
    
    .match-team-score {
        font-size: 0.95rem;
        min-width: 30px;
    }
    
    .match-status {
        font-size: 0.75rem;
    }
    
    /* Settings Info Panel Mobile */
    .settings-info-panel {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        margin-bottom: 12px;
        padding: 0 5px;
    }
    
    .info-item {
        padding: 8px 6px;
        gap: 4px;
        flex-direction: column;
        text-align: center;
    }
    
    .info-icon {
        font-size: 1.2rem;
    }
    
    .info-label {
        font-size: 0.6rem;
        line-height: 1.2;
    }
    
    .info-value {
        font-size: 0.75rem;
    }
    
    /* Settings Stats Panel Mobile */
    .settings-stats-panel {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        margin: 12px 5px;
    }
    
    .stats-card {
        padding: 10px 6px;
        gap: 6px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .stats-icon {
        font-size: 1.5rem;
        width: auto;
        height: auto;
    }
    
    .stats-info {
        flex: 1;
        text-align: center;
    }
    
    .stats-label {
        font-size: 0.65rem;
        line-height: 1.2;
    }
    
    .stats-value {
        font-size: 1.2rem;
    }
    
    .settings-content {
        padding: 0 5px;
    }
    
    .setting-item {
        padding: 8px 10px;
        margin-bottom: 6px;
    }
    
    .setting-item label {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }
    
    .setting-item select {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    
    /* Stats Header Mobile */
    .stats-header-collapsible {
        padding: 10px 15px;
    }
    
    .stats-header-collapsible h3 {
        font-size: 0.95rem;
    }
    
    .btn-collapse {
        font-size: 0.8rem;
        min-width: 28px;
        height: 28px;
        padding: 3px 6px;
    }
    
    /* Tournament Log Mobile */
    .tournament-log {
        height: 250px;
        padding: 15px;
    }
    
    .tournament-log-entry {
        padding: 10px 12px;
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
    
    .tournament-log-entry.goal {
        font-size: 0.95rem;
    }
    
    .tournament-log-section h3 {
        padding: 15px;
        font-size: 1rem;
    }
    
    /* Live Match Display Mobile */
    .live-match-display {
        padding: 15px;
        margin: 15px 0;
    }
    
    .live-match-display h3 {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .live-match-info {
        padding: 15px;
        gap: 10px;
    }
    
    .live-team {
        font-size: 0.9rem;
        gap: 8px;
    }
    
    .live-team-logo {
        width: 20px;
        height: 20px;
    }
    
    .live-score {
        font-size: 1.5rem;
        min-width: 40px;
    }
    
    .live-time {
        padding: 8px 15px;
        font-size: 1.1rem;
    }
    
    .live-events {
        max-height: 120px;
        padding: 12px;
    }
    
    .live-event {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    /* Stats Mobile */
    .tournament-stats-section h3 {
        padding: 15px;
        font-size: 1rem;
    }
    
    .match-stats-header h4 {
        font-size: 1.1rem;
    }
    
    .stats-subtitle {
        font-size: 0.8rem;
    }
    
    .stats-grid {
        gap: 10px;
    }
    
    .stat-item {
        padding: 10px 12px;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
    
    .stat-values {
        font-size: 0.95rem;
        gap: 10px;
    }
    
    /* Tournament Status Mobile */
    .tournament-status {
        padding: 12px;
        font-size: 0.95rem;
    }
    
    /* Champion Display Mobile */
    .champion-trophy {
        font-size: 3rem;
    }
    
    .champion-name {
        font-size: 1.2rem;
    }
    
    .champion-label {
        font-size: 0.9rem;
    }
    
    /* AI vs AI Match Log */
    .match-log {
        height: 40vh;
        max-height: 300px;
    }
    
    .match-header {
        padding: 15px;
    }
    
    .match-header h2 {
        font-size: 1.3rem;
    }
    
    .time {
        padding: 10px 20px;
        font-size: 1.2rem;
    }
}

/* Extra Small Mobile (≤480px) */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.4rem;
    }
    
    .header h2 {
        font-size: 1.2rem;
    }
    
    .container {
        padding: 8px;
    }
    
    /* Tournament Bracket - Stack Vertically */
    .live-match-info {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }
    
    .live-team {
        justify-content: space-between;
        font-size: 0.85rem;
        gap: 6px;
    }
    
    .live-team:last-child {
        flex-direction: row;
    }
    
    .live-team-logo {
        width: 18px;
        height: 18px;
    }
    
    .live-score {
        font-size: 1.3rem;
    }
    
    .live-time {
        padding: 8px 12px;
        font-size: 1rem;
    }
    
    .match-log {
        height: 35vh;
        max-height: 250px;
        padding: 12px;
    }
    
    .log-entry {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    /* Tournament Match Cards - Smaller */
    .match-card {
        padding: 8px;
    }
    
    .match-team {
        padding: 4px 6px;
        min-height: 26px;
    }
    
    .team-logo-small {
        width: 12px;
        height: 12px;
    }
    
    .team-name-text {
        font-size: 0.8rem;
    }
    
    .match-team-score {
        font-size: 0.85rem;
        min-width: 28px;
    }
    
    .match-status {
        font-size: 0.7rem;
        padding: 4px 0;
    }
    
    .btn-view-stats {
        padding: 3px 6px;
        font-size: 0.7rem;
    }
    
    /* Buttons */
    .menu-buttons {
        gap: 10px;
        max-width: 100%;
    }
    
    .main-btn {
        padding: 12px 15px;
        font-size: 0.9rem;
        gap: 10px;
    }
    
    .main-btn .icon {
        font-size: 1.2rem;
    }
    
    .btn, .btn-secondary {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    
    .btn-small {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    /* Champion Display */
    .champion-trophy {
        font-size: 2.5rem;
    }
    
    .champion-name {
        font-size: 1.1rem;
    }
    
    .champion-label {
        font-size: 0.9rem;
    }
    
    /* Tournament Setup Mobile */
    .setup-mode-selector {
        flex-direction: row !important;
        gap: 8px;
        padding: 8px;
        justify-content: center;
    }
    
    .mode-btn {
        flex: 1;
        max-width: 48%;
        padding: 12px 10px;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .btn-random, .btn-update-realtime {
        flex: 1;
        padding: 10px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .random-button-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap;
        gap: 8px;
        justify-content: center;
    }
    
    .scroll-to-top {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
        bottom: 20px;
        right: 20px;
    }
    
    .changelog-container {
        margin: 0 15px 20px;
    }
    
    .changelog-header {
        padding: 15px;
    }
    
    .changelog-header h3 {
        font-size: 1rem;
    }
    
    .changelog-content {
        padding: 15px;
        max-height: 400px;
    }
    
    .changelog-item {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    
    .changelog-icon {
        font-size: 1.5rem;
    }
    
    .changelog-team-name {
        font-size: 1rem;
    }
    
    .changelog-level-change {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .tournament-teams-setup {
        padding: 10px 5px;
    }
    
    .teams-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .tournament-team-input {
        padding: 10px;
    }
    
    .tournament-team-input h3 {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }
    
    .tournament-team-input input {
        padding: 6px 8px;
        font-size: 0.75rem;
        margin-bottom: 8px;
    }
    
    .difficulty-slider-container {
        gap: 6px;
        padding: 5px 0;
    }
    
    .difficulty-value {
        font-size: 0.9rem;
        padding: 3px 8px;
    }
    
    .tournament-team-input .difficulty-slider {
        height: 8px;
        padding: 8px 0;
    }
    
    .tournament-team-input .difficulty-slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
        cursor: pointer;
    }
    
    .tournament-team-input .difficulty-slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
        cursor: pointer;
    }
    
    .tournament-team-input .difficulty-label {
        font-size: 0.65rem;
        margin-top: 4px;
    }
    
    .tournament-team-input select {
        padding: 6px 8px;
        font-size: 0.7rem;
        margin-bottom: 8px;
    }
    
    /* Action Buttons Mobile */
    .action-buttons {
        flex-direction: column;
        gap: 8px;
        margin-top: 15px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        width: 100%;
    }
    
    /* Log Controls Mobile */
    .log-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 15px;
    }
    
    .log-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        width: 100%;
    }
    
    .btn-log-action {
        padding: 6px 10px;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .btn-auto-scroll {
        padding: 6px 10px;
        font-size: 0.75rem;
        grid-column: span 2;
    }
    
    .btn-small {
        grid-column: span 2;
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    /* Event Animations Mobile */
    .event-animation {
        font-size: 1.3rem;
        padding: 15px 25px;
        max-width: 85%;
    }
    
    /* Footer Mobile */
    footer {
        padding: 15px 10px;
    }
    
    .footer-content {
        font-size: 0.8rem;
    }
    
    .footer-greeting {
        padding: 6px 12px;
        margin-bottom: 10px;
        gap: 6px;
    }
    
    .greeting-icon {
        font-size: 1rem;
    }
    
    .greeting-text {
        font-size: 0.8rem;
    }
    
    .footer-top {
        flex-direction: column;
        gap: 4px;
    }
    
    .visitor-separator {
        display: none;
    }
    
    .visitor-counter {
        font-size: 0.75rem;
        padding: 3px 10px;
    }
    
    .footer-link {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    .footer-copyright p {
        font-size: 0.8rem;
    }
    
    .footer-disclaimer p {
        font-size: 0.75rem;
        line-height: 1.5;
    }
}
