@import url('https://fonts.googleapis.com/css2?family=Russo+One&display=swap');
:root { --bg-color: #121212; --card-bg: #1e1e1e; --accent: #2e8b57; --accent-hover: #3cb371; --text-main: #f0f0f0; --border: #333; --loss-color: #d9534f; --gold: #ffd700; --silver: #c0c0c0; --bronze: #cd7f32; --info: #17a2b8; }
body { font-family: 'Segoe UI', Tahoma, sans-serif; background: var(--bg-color); color: var(--text-main); margin: 0; padding: 20px; }

header { border-bottom: 3px solid var(--accent); padding-bottom: 15px; margin-bottom: 20px; }
.header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }

/* HEADER LOGO */
.header-logo { height: 120px; width: auto; vertical-align: middle; margin-right: 15px; }
.header-top h1 {
    margin: 0;
    font-family: 'Russo One', sans-serif;
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #ffffff; 
    -webkit-text-stroke: 2px #000000; 
    text-shadow: 4px 4px 0px #000000;
}

/* Tournament Bar */
.tournament-bar { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; border-bottom: 1px solid #333; margin-bottom: 20px; align-items: center; }
.t-item { display: flex; align-items: center; background: #333; border: 1px solid #555; border-radius: 4px; padding: 0 10px; white-space: nowrap; }
.t-item.active { background: var(--accent); border-color: var(--accent); }
.t-btn { background: none; border: none; color: inherit; padding: 8px 5px; cursor: pointer; }
.t-close { background: none; border: none; color: #aaa; cursor: pointer; font-weight: bold; margin-left: 5px; font-size: 1rem; }
.t-close:hover { color: #fff; }
.t-btn-new { background: transparent; border: 1px dashed var(--accent); color: var(--accent); padding: 8px 15px; cursor: pointer; }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropbtn { background-color: #333; color: white; padding: 8px 15px; border: 1px solid #555; border-radius: 4px; cursor: pointer; }
.dropbtn:hover { background-color: #444; }
.dropdown-content { display: none; position: absolute; right: 0; background-color: #252525; min-width: 300px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.8); z-index: 100; border: 1px solid #444; border-radius: 4px; }
.dropdown-content.show { display: block; }
.archive-search { padding: 10px; border-bottom: 1px solid #444; }
.archive-search input { width: 100%; padding: 8px; box-sizing: border-box; background: #111; border: 1px solid #444; color: white; }
.archive-list { max-height: 300px; overflow-y: auto; }
.archive-item { padding: 10px; border-bottom: 1px solid #333; cursor: pointer; display: flex; justify-content: space-between; font-size: 0.9rem; }
.archive-item:hover { background-color: #333; }
.archive-date { font-size: 0.75rem; color: #888; }

/* Modals */
#modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 1000; align-items: center; justify-content: center; }
.modal { background: var(--card-bg); padding: 30px; border-radius: 8px; width: 400px; border: 1px solid var(--accent); }

#archive-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 2000; align-items: center; justify-content: center; }
.archive-modal {
    background: var(--card-bg); padding: 30px; border-radius: 8px; width: 90%; max-width: 1400px; height: 90%; overflow-y: hidden; 
    border: 1px solid var(--accent); box-shadow: 0 0 50px rgba(0,0,0,0.8); display: flex; flex-direction: column;
}

input, select { padding: 10px; background: #2a2a2a; border: 1px solid #444; color: white; border-radius: 4px; width: 100%; box-sizing: border-box; margin-bottom: 10px; }
.btn-action { padding: 10px 15px; background: var(--accent); color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; }

/* START BUTTON FÜR TEAMS */
.btn-team-start {
    width: 100%;
    background-color: var(--accent);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: background-color 0.2s, transform 0.1s;
}
.btn-team-start:hover { background-color: var(--accent-hover); }
.btn-team-start:active { transform: translateY(2px); }

/* Setup & Bracket */
#player-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 15px 0; }
.player-item { background: #333; padding: 8px 12px; border-radius: 4px; display: flex; align-items: center; gap: 10px; border: 1px solid #444; }
.player-actions button { background: none; border: none; cursor: pointer; font-size: 1rem; color: #aaa; padding: 0 2px; }

/* --- GAME AREA (Sidebar + Bracket) --- */
.game-area { display: flex; align-items: flex-start; gap: 20px; width: 100%; height: 100%; }

/* Sidebar Styles */
.sidebar {
    width: 250px; min-width: 250px; background: var(--card-bg); border: 1px solid var(--accent); border-radius: 8px; padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); position: sticky; top: 20px; max-height: 90vh; overflow-y: auto;
}
.sidebar h3 { margin-top: 0; border-bottom: 2px solid var(--accent); padding-bottom: 10px; margin-bottom: 15px; font-size: 1.1rem; }
.sidebar-player { background: #333; margin-bottom: 8px; padding: 10px; border-radius: 4px; cursor: grab; border: 1px solid transparent; transition: background 0.2s; user-select: none; color: white; }
.sidebar-player:hover { background: #444; border-color: #555; }
.sidebar-player:active { cursor: grabbing; }

/* Drop Zones */
.drop-zone { min-height: 100px; background: #111; border: 1px dashed #555; border-radius: 4px; padding: 10px; transition: border-color 0.2s; }
.drop-zone:hover { border-color: var(--accent); }

/* Bracket Styles */
.bracket-container { display: block; flex: 1; overflow-x: auto; padding-bottom: 50px; }
.tree-title { color: var(--accent); border-bottom: 1px solid #444; padding-bottom: 5px; margin-top: 40px; margin-bottom: 20px; font-size: 1.5rem; }
.bracket-row { display: flex; gap: 50px; min-width: 100%; }
.round-column { display: flex; flex-direction: column; justify-content: space-around; min-width: 260px; }
.round-header { text-align: center; color: #888; margin-bottom: 15px; font-weight: bold; text-transform: uppercase; font-size: 0.8rem; }

.match-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 15px; padding: 0; position: relative; box-shadow: 0 4px 8px rgba(0,0,0,0.4); width: 100%; }
.match-meta { display: flex; justify-content: space-between; align-items: center; background: #252525; padding: 5px 10px; border-bottom: 1px solid #333; font-size: 0.75rem; color: #aaa; }
.table-select { background: transparent; color: var(--accent); border: none; font-size: 0.75rem; cursor: pointer; font-weight: bold; }
.player-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid #333; background: var(--card-bg); gap: 5px; }
.player-row:last-child { border-bottom: none; }
.p-name { flex: 1; color: white; font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-score { width: 28px; height: 24px; background: #111; border: 1px solid #444; color: white; text-align: center; border-radius: 3px; font-size: 0.9rem; padding: 0; -moz-appearance: textfield; display:inline-block; line-height:24px; }
.p-score::-webkit-outer-spin-button, .p-score::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.btn-win { font-size: 0.7rem; padding: 0 8px; height: 24px; line-height: 24px; background: #333; border: 1px solid #444; color: #ccc; cursor: pointer; border-radius: 3px; text-transform: uppercase; font-weight: bold; }
.btn-win:hover { background: var(--accent); color: white; border-color: var(--accent); }
.won .p-name { color: var(--accent); font-weight: bold; }
.won { background: rgba(46, 139, 87, 0.1); }
.lost .p-name { color: #666; text-decoration: line-through; }
.lost { opacity: 0.7; }
.p-right { display: flex; align-items: center; gap: 5px; }

/* Ranking */
#ranking-section { margin-top: 50px; max-width: 600px; } 
table.ranking { width: 100%; border-collapse: collapse; background: #1a1a1a; border-radius: 8px; overflow: hidden; }
table.ranking th { background: #252525; color: var(--accent); text-transform: uppercase; font-size: 0.9rem; padding: 12px; text-align: left; }
table.ranking td { padding: 12px; border-bottom: 1px solid #333; }
.rank-1 { color: var(--gold); font-weight: bold; font-size: 1.3rem; }
.rank-2 { color: var(--silver); font-weight: bold; font-size: 1.2rem; }
.rank-3 { color: var(--bronze); font-weight: bold; font-size: 1.1rem; }

#status-indicator { font-size: 0.8rem; color: #666; }
.pulse { color: var(--accent) !important; }

/* Read Only Mode Tweaks */
.readonly .btn-win, .readonly select { display: none; }
.readonly input { pointer-events: none; border: none; background: transparent; }

@media (max-width: 800px) {
    .game-area { flex-direction: column; }
    .sidebar { width: 100%; min-width: 0; box-sizing: border-box; position: static; max-height: none; }
    .archive-modal { overflow-y: auto; }
}

