:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --accent: #ff9800;
    --text-main: #e0e0e0;
    --text-dim: #a0a0a0;
    --success: #4caf50;
    --danger: #f44336;
    --twitch: #9146FF;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

.hidden { display: none !important; }
.screen { height: 100vh; width: 100vw; }

/* --- LOGIN SCREEN --- */
#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, #2a2a2a 0%, #000000 100%);
}

.login-box {
    background: var(--bg-panel);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    max-width: 400px;
}

.btn-twitch-login {
    display: inline-block;
    background: var(--twitch);
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: 0.2s;
    margin-top: 20px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-twitch-login:hover {
    background: #772ce8;
    transform: translateY(-2px);
}

/* --- APP LAYOUT --- */
#app-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

header {
    background: var(--bg-panel);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
    height: 53px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

header .btn-small {
    margin: 0;
    width: auto;
    padding: 5px 10px;
    font-size: 0.9rem;
}

.main-container {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 53px);
}

.column {
    padding: 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #333;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.right-col {
    border-right: none;
    border-left: 1px solid #333;
}

h2 {
    margin-top: 0;
    color: var(--accent);
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* --- CONTROLS --- */
input, select {
    width: 100%;
    padding: 8px;
    margin: 5px 0 15px;
    background: #2c2c2c;
    border: 1px solid #444;
    color: white;
    border-radius: 4px;
    box-sizing: border-box;
}

button {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-primary { background: #2196f3; color: white; }
.btn-success { background: var(--success); color: white; font-size: 1.1rem; }
.btn-danger { background: var(--danger); color: white; }
.btn-secondary { background: #555; color: white; }

.import-section {
    flex-shrink: 0;
    margin-bottom: 15px;
}

.import-section.hidden {
    display: none !important;
}

/* --- PARTICIPANTS LIST --- */
.participants-list {
    flex: 1;
    display: block;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.scroll-list {
    background: #151515;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 5px;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    overflow-y: auto;
    min-height: 0;
}

.participant-item {
    padding: 4px 8px;
    border-bottom: 1px solid #222;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}

/* --- WHEEL AREA --- */
.center-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #0a0a0a;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
}

.wheel-container {
    position: relative;
    width: min(700px, 85vh, 85vw);
    height: min(700px, 85vh, 85vw);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.pointer {
    position: absolute;
    top: 0px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 30px;
    color: var(--accent);
    z-index: 10;
    line-height: 1;
    /* Обводка и тень для контраста */
    -webkit-text-stroke: 2px #000000;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

canvas {
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    width: 100%;
    height: 100%;
    display: block;
}

.action-text {
    margin-top: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    text-align: center;
    min-height: 1.5em;
    flex-shrink: 0;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.3;
}

/* --- RIGHT COL --- */
.setting-group { margin-bottom: 15px; flex-shrink: 0; }
.mode-settings { flex-shrink: 0; }
.actions { margin-top: 20px; flex-shrink: 0; }

.log-box {
    font-family: monospace;
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 15px;
    background: #151515;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #333;
    flex: 1;
    overflow-y: auto;
    min-height: 150px;
    min-width: 0;
}

/* --- MODAL --- */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: var(--bg-panel);
    padding: 20px;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    top: 10px; right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-dim);
}

.close:hover { color: white; }

hr { border: 0; border-top: 1px solid #333; margin: 20px 0; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th, td {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid #333;
}

th { color: var(--accent); }