:root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f242e;
    --border: #2a303c;
    --text: #e8eaf0;
    --muted: #9aa3b2;
    --primary: #4f7cff;
    --primary-dark: #3b62d4;
    --danger: #e5484d;
    --success: #46a758;
    --radius: 10px;
}

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

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }

.container { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 24px; background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

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

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}

.card h2 { font-size: 1.1rem; margin-bottom: 12px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

label { display: block; font-size: 0.9rem; margin-bottom: 6px; color: var(--muted); }

input, select {
    width: 100%; padding: 10px 12px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-size: 1rem; font-family: inherit;
}

input:focus, select:focus { outline: 2px solid var(--primary); border-color: transparent; }

.field { margin-bottom: 14px; }

.btn {
    display: inline-block; padding: 10px 20px; border: none; border-radius: var(--radius);
    background: var(--primary); color: #fff; font-size: 1rem; cursor: pointer;
    font-family: inherit; transition: background 0.15s;
}

.btn:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c73a3f; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #3a8c4a; }
.btn-lg { padding: 16px 32px; font-size: 1.15rem; width: 100%; }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; font-size: 0.9rem; }
.alert-error { background: rgba(229, 72, 77, 0.15); border: 1px solid var(--danger); }
.alert-success { background: rgba(70, 167, 88, 0.15); border: 1px solid var(--success); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.8rem; }
.badge-draft { background: var(--surface-2); color: var(--muted); }
.badge-live { background: rgba(70, 167, 88, 0.2); color: var(--success); }
.badge-ended { background: rgba(229, 72, 77, 0.15); color: var(--danger); }

.auth-box { max-width: 400px; margin: 8vh auto 0; }
.auth-box h1 { font-size: 1.4rem; margin-bottom: 20px; text-align: center; }

.stat-row { display: flex; gap: 24px; margin-bottom: 16px; }
.stat { flex: 1; }
.stat .value { font-size: 1.8rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 0.85rem; }

.effect-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; background: var(--surface-2); border-radius: var(--radius);
    margin-bottom: 10px; gap: 12px;
}
.effect-colors { display: flex; gap: 6px; }
.effect-colors span { width: 22px; height: 22px; border-radius: 6px; display: inline-block; }

.qr-box { text-align: center; padding: 16px; background: #fff; border-radius: var(--radius); display: inline-block; }
.join-code { font-size: 1.6rem; letter-spacing: 8px; font-weight: 700; text-align: center; direction: ltr; }

.actions-row { display: flex; gap: 10px; flex-wrap: wrap; }

.timeline { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding-right: 10px; border-right: 2px solid var(--border); }
.timeline-item {
    display: flex; align-items: center; gap: 10px; justify-content: space-between;
    background: var(--surface-2); border-radius: 8px; padding: 8px 12px;
    border-right: 3px solid var(--primary);
}

.modal {
    display: none; position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,0.7); align-items: center; justify-content: center;
}
.modal.open { display: flex; }
.modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; width: 320px; }

#preview-phone {
    width: 180px; height: 340px; margin: 0 auto; border-radius: 22px;
    border: 3px solid var(--border); overflow: hidden; position: relative; background: #000;
}
#preview-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 5rem; font-weight: 700; color: #fff; }
