/* ============================================================
   DrawPro — Premium Tournament CSS
   Design: UCL-inspired dark theme, glassmorphism, neon accents
   Fonts: Teko (headings) + Outfit (body)
   ============================================================ */

:root {
    /* --- Backgrounds --- */
    --bg-deep:    #03050c;
    --bg-surface: #070a14;
    --bg-raised:  #0a0f1e;

    /* --- Cards / Glass --- */
    --card-bg:     rgba(7, 10, 20, 0.65);
    --card-border: rgba(0, 240, 255, 0.25);
    --glass-shine: rgba(255, 255, 255, 0.08);

    /* --- Brand Accents --- */
    --primary:        #00f0ff;   /* neon cyan — CTAs */
    --primary-hover:  #4dffff;
    --accent:         #d900ff;   /* magenta — highlights */
    --accent-2:       #7a00ff;   /* deep violet — secondary glow */
    --error:          #ff0055;
    --gold:           #fbbf24;

    /* --- Glows --- */
    --glow-primary: rgba(0, 240, 255, 0.45);
    --glow-accent:  rgba(217, 0, 255, 0.40);
    --glow-violet:  rgba(122, 0, 255, 0.35);
    --glow-gold:    rgba(251, 191, 36,  0.35);

    /* --- Text --- */
    --text-main:  #f8fafc;
    --text-muted: #94a3b8;
    --text-soft:  #cbd5e1;

    /* --- Shape --- */
    --radius-xl: 20px;
    --radius-lg: 14px;
    --radius-md: 9px;
    --radius-sm: 6px;

    /* --- Wheel colours --- */
    --wheel-color-1: #00f0ff;
    --wheel-color-2: #d900ff;
    --wheel-color-3: #ff0055;
    --wheel-color-4: #7a00ff;
    --wheel-color-5: #0088ff;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body.rtl {
    font-family: 'Cairo', 'Outfit', sans-serif;
}

/* Animated dark atmosphere background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background: url('../assets/stadium_bg.png') no-repeat center center;
    background-size: cover;
    opacity: 0.4; /* Dim the image so UI is readable */
}

/* Floating light particles overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        radial-gradient(1px 1px at 10% 20%, rgba(0, 240, 255, 0.5), transparent),
        radial-gradient(1px 1px at 30% 65%, rgba(217, 0, 255, 0.4), transparent),
        radial-gradient(1.5px 1.5px at 50% 10%, rgba(255, 224, 130, 0.6), transparent),
        radial-gradient(1px 1px at 70% 40%, rgba(0, 240, 255, 0.4), transparent),
        radial-gradient(1px 1px at 85% 75%, rgba(217, 0, 255, 0.3), transparent),
        radial-gradient(1.5px 1.5px at 20% 85%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(1px 1px at 60% 90%, rgba(0, 240, 255, 0.3), transparent),
        radial-gradient(1px 1px at 95% 25%, rgba(255, 224, 130, 0.4), transparent),
        radial-gradient(1.5px 1.5px at 40% 45%, rgba(122, 0, 255, 0.4), transparent),
        radial-gradient(1px 1px at 15% 55%, rgba(255, 255, 255, 0.3), transparent);
    background-size: 200% 200%;
    animation: floatParticles 25s linear infinite;
    pointer-events: none;
    opacity: 0.8;
}

@keyframes floatParticles {
    0%   { background-position: 0% 0%; }
    25%  { background-position: 50% 25%; }
    50%  { background-position: 100% 50%; }
    75%  { background-position: 50% 75%; }
    100% { background-position: 0% 100%; }
}

/* ============================================================
   Global Form Elements
   ============================================================ */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    border-radius: var(--radius-md);
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 202, 255, 0.12), 0 0 12px rgba(0, 202, 255, 0.08);
    background: rgba(0, 0, 0, 0.5);
}

/* Hide number spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; direction: ltr; }

textarea { resize: vertical; min-height: 100px; }

select option { background: var(--bg-raised); }

label {
    display: block;
    margin-bottom: 0.45rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-soft);
}

/* ============================================================
   App Shell
   ============================================================ */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem 2.5rem;
}

.app-container.knockout-active {
    max-width: 100%;
    padding: 1rem;
}

/* ============================================================
   Header
   ============================================================ */
.header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.header-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.header h1 {
    font-family: 'Teko', sans-serif;
    font-size: clamp(3rem, 6vw, 5.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 50%, var(--accent-2) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 25px var(--glow-primary));
}

.header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

/* Lang toggle */
.lang-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-soft);
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}

.lang-toggle:hover {
    background: rgba(0, 202, 255, 0.08);
    border-color: rgba(0, 202, 255, 0.3);
    color: var(--accent);
}

/* RTL overrides */
body.rtl { direction: rtl; }
body.rtl .header h1 { flex-direction: row-reverse; }
body.rtl .btn i { transform: scaleX(-1); }
body.rtl .standings-table tr.qualified {
    border-left: none;
    border-right: 4px solid var(--primary);
    background: linear-gradient(-90deg, rgba(0, 240, 255, 0.12), transparent);
}
body.rtl .standings-table th:first-child,
body.rtl .standings-table td:first-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
body.rtl .standings-table th:last-child,
body.rtl .standings-table td:last-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 2rem 2.25rem;
    box-shadow:
        0 1px 0 var(--glass-shine) inset,
        0 15px 50px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(0, 240, 255, 0.08);
    position: relative;
    overflow: hidden;
}

/* Card top shimmer line */
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 240, 255, 0.6) 30%,
        rgba(217, 0, 255, 0.6) 60%,
        transparent 100%);
}

.card h2 {
    font-family: 'Teko', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(90deg, var(--text-main), var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
}

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

/* Primary — neon cyan */
.btn-primary {
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid var(--primary);
    color: var(--primary);
    box-shadow: 0 0 12px var(--glow-primary), inset 0 0 8px var(--glow-primary);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    background: rgba(0, 240, 255, 0.2);
    color: #ffffff;
    box-shadow: 0 0 25px var(--glow-primary), inset 0 0 15px var(--glow-primary);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

/* Secondary — magenta glass */
.btn-secondary {
    background: rgba(217, 0, 255, 0.06);
    border: 1px solid rgba(217, 0, 255, 0.35);
    color: var(--accent);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(217, 0, 255, 0.15);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 0 20px var(--glow-accent);
    transform: translateY(-2px);
}

/* Danger */
.btn-danger {
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--error);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(244, 63, 94, 0.15);
    border-color: var(--error);
    box-shadow: 0 0 16px rgba(244, 63, 94, 0.25);
    transform: translateY(-2px);
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    margin-top: 1rem;
}

.btn-small {
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
}

/* Pulsing spin button */
.btn-pulse {
    animation: btnPulse 2.5s ease-in-out infinite;
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 12px var(--glow-primary), inset 0 0 8px var(--glow-primary); }
    50%       { box-shadow: 0 0 30px var(--glow-primary), 0 0 0 8px rgba(0, 240, 255, 0.1), inset 0 0 15px var(--glow-primary); }
}

/* ============================================================
   Phase Transitions
   ============================================================ */
.phase { animation: fadeSlideUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }

.hidden { display: none !important; }

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

/* ============================================================
   Setup Phase
   ============================================================ */
.setup-card { max-width: 820px; margin: 0 auto; }

/* Tournament Templates */
.tournament-templates {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 640px) {
    .tournament-templates { grid-template-columns: repeat(2, 1fr); }
}

.template-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.template-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 50% 0%, rgba(0, 240, 255, 0.1), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.template-card:hover::before { opacity: 1; }

.template-card i {
    width: 34px;
    height: 34px;
    margin-bottom: 0.85rem;
    color: var(--text-muted);
    transition: color 0.3s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.template-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-main);
    letter-spacing: 0.02em;
}

.template-card p {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.template-card:hover {
    background: rgba(0, 240, 255, 0.06);
    border-color: rgba(0, 240, 255, 0.4);
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(0, 240, 255, 0.1);
}

.template-card:hover i {
    color: var(--primary);
    transform: scale(1.15) rotate(-5deg);
}

.template-card.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), rgba(217, 0, 255, 0.06));
    border-color: var(--primary);
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.2), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.template-card.active i { color: var(--primary); }
.template-card.active h3 { color: var(--primary); }

/* Form Groups */
.form-group { margin-bottom: 1.5rem; }

.team-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: right;
    letter-spacing: 0.02em;
}

/* ============================================================
   Dashboard Grid (Draw + Match phases)
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    align-items: start;
}

.dashboard-3col {
    grid-template-columns: 320px 1fr 320px;
    gap: 2rem;
}

@media (max-width: 1200px) {
    .dashboard-3col {
        grid-template-columns: 280px 1fr 280px;
        gap: 1.5rem;
    }
}

@media (max-width: 992px) {
    .dashboard-3col { grid-template-columns: 1fr; }
}

@media (max-width: 1080px) {
    .dashboard-grid:not(.dashboard-3col) { grid-template-columns: 1fr; }
}

/* Side Panels */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ============================================================
   Wheel
   ============================================================ */
.center-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-top: 1rem;
}

.wheel-header-text {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.wheel-header-text h3 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--accent);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.wheel-header-text h1 {
    font-size: 4rem;
    font-family: 'Teko', sans-serif;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #ffffff;
    line-height: 1;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.press-to-spin-badge {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: transparent;
    border: 2px solid var(--accent);
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3), inset 0 0 10px rgba(0, 240, 255, 0.2);
    letter-spacing: 0.05em;
    margin: 0 auto;
}

.wheel-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wheel-container {
    position: relative;
    width: min(580px, 100%);
    aspect-ratio: 1 / 1;
    margin: 0 auto 2rem auto;
}

/* Glow ring behind wheel */
.wheel-container::before {
    content: '';
    position: absolute;
    inset: -30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.12), rgba(217, 0, 255, 0.08) 40%, transparent 70%);
    animation: wheelGlowPulse 3s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes wheelGlowPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.06); }
}

canvas#roulette-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transition: box-shadow 0.3s;
}

canvas#roulette-wheel.spinning {
    box-shadow:
        0 0 60px rgba(0, 240, 255, 0.25),
        0 20px 60px rgba(0, 0, 0, 0.9);
}

.wheel-blur { filter: blur(1px); transition: filter 0.1s; }

/* Pointer — large glowing gold triangle */
.wheel-pointer {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 42px solid #ffe082;
    z-index: 10;
    filter:
        drop-shadow(0 0 12px rgba(255, 224, 130, 0.8))
        drop-shadow(0 0 30px rgba(251, 191, 36, 0.4))
        drop-shadow(0 4px 8px rgba(0, 0, 0, 0.9));
    transform-origin: top center;
    transition: transform 0.05s ease-out;
}

.wheel-pointer.flicking-left {
    transform: translateX(-50%) rotate(-22deg);
    filter:
        drop-shadow(0 0 20px rgba(255, 224, 130, 1))
        drop-shadow(0 0 45px rgba(251, 191, 36, 0.5))
        drop-shadow(0 4px 8px rgba(0, 0, 0, 0.9));
}

.wheel-pointer.flicking-right {
    transform: translateX(-50%) rotate(22deg);
    filter:
        drop-shadow(0 0 20px rgba(255, 224, 130, 1))
        drop-shadow(0 0 45px rgba(251, 191, 36, 0.5))
        drop-shadow(0 4px 8px rgba(0, 0, 0, 0.9));
}

/* Draw controls */
.draw-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    width: 100%;
}

.draw-controls .btn { flex: 1; }

/* ============================================================
   Winner Modal
   ============================================================ */
.winner-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 310px;
    background: rgba(6, 9, 18, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: var(--radius-xl);
    box-shadow:
        0 0 50px rgba(0, 240, 255, 0.2),
        0 20px 60px rgba(0, 0, 0, 0.8);
    z-index: 100;
    overflow: hidden;
    animation: winnerPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.winner-modal.hidden { display: none !important; }

@keyframes winnerPopIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(-3deg); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
}

.winner-header {
    background: linear-gradient(135deg, #00f0ff, #d900ff);
    padding: 0.85rem 1.2rem;
    text-align: center;
}

.winner-header h3 {
    margin: 0;
    font-family: 'Teko', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #060912;
}

.winner-body {
    padding: 1.75rem 1.5rem;
    text-align: center;
}

.winner-team-name {
    font-family: 'Teko', sans-serif;
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-main);
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
    margin-bottom: 0.4rem;
    line-height: 1.1;
}

.winner-group {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

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

/* ============================================================
   Groups / Feed / Participants
   ============================================================ */
.groups-card {
    min-height: 500px;
}

.participants-card {
    min-height: 500px;
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.undrawn-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
    flex-grow: 1;
}

.undrawn-team-item {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.undrawn-team-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Custom Scrollbar for lists */
.undrawn-list::-webkit-scrollbar,
.groups-container.feed-style::-webkit-scrollbar {
    width: 6px;
}
.undrawn-list::-webkit-scrollbar-thumb,
.groups-container.feed-style::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.groups-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.groups-header h2 {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.groups-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1rem;
}

.group-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.group-box:hover {
    border-color: rgba(0, 240, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.08);
}

.group-header {
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.12), rgba(217, 0, 255, 0.08));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.55rem 1rem;
    font-family: 'Teko', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
}

.group-teams { list-style: none; }

.team-slot {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    min-height: 44px;
    display: flex;
    align-items: center;
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 600;
    transition: background 0.2s;
}

.team-slot:last-child { border-bottom: none; }

.team-slot.draggable-slot { cursor: grab; }
.team-slot.draggable-slot:active { cursor: grabbing; }

.team-slot.dragging {
    opacity: 0.45;
    background: rgba(0, 240, 255, 0.08);
    border: 1px dashed var(--primary);
}

.team-slot.drag-over {
    background: rgba(0, 240, 255, 0.08);
    box-shadow: inset 0 0 0 2px var(--primary);
    transform: scale(1.01);
    position: relative;
    z-index: 5;
    border-radius: var(--radius-sm);
}

.team-slot.empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
}

.team-slot.just-added { animation: slotHighlight 1.8s ease; }

@keyframes slotHighlight {
    0%   { background: rgba(0, 240, 255, 0.35); }
    100% { background: transparent; }
}

/* Flying team animation */
.flying-team {
    position: fixed;
    z-index: 9999;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #060912;
    padding: 0.7rem 1.1rem;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 8px 30px var(--glow-primary);
    pointer-events: none;
    transition: all 1.1s cubic-bezier(0.25, 0.1, 0.25, 1);
    opacity: 1;
}

.flying-team.fly-arriving {
    transform: scale(0.7);
    opacity: 0.6;
}

/* ============================================================
   Match Simulator
   ============================================================ */
.matchup-block {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 0.85rem;
    transition: border-color 0.2s, background 0.2s;
}

.matchup-block:hover {
    background: rgba(0, 240, 255, 0.03);
    border-color: rgba(0, 240, 255, 0.15);
}

.match-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0;
}

.match-team {
    flex: 1;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-soft);
    transition: color 0.2s;
}

.match-score-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.score-input {
    width: 52px !important;
    text-align: center;
    padding: 0.4rem !important;
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    background: rgba(0, 0, 0, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.score-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.15) !important;
}

.score-divider {
    font-weight: 800;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ============================================================
   Standings Table
   ============================================================ */
.standings-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.standings-table th,
.standings-table td {
    padding: 0.75rem 0.6rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.standings-table th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.standings-table td.team-name-cell {
    text-align: left;
    font-weight: 700;
    font-size: 0.9rem;
}

.standings-table tbody tr {
    transition: background 0.15s;
}

.standings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

.winner-highlight {
    color: var(--primary) !important;
    text-shadow: 0 0 12px var(--glow-primary);
    font-weight: 800 !important;
}

.standings-table tr.qualified {
    background: rgba(0, 240, 255, 0.07);
    border-left: 3px solid var(--primary);
}

.standings-table th:first-child,
.standings-table td:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.standings-table th:last-child,
.standings-table td:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.pts-col {
    font-weight: 800;
    color: var(--accent);
}

.qualify-rank {
    color: var(--primary);
    font-weight: 800;
}

/* ============================================================
   Knockout Bracket
   ============================================================ */
#knockout-phase .bracket-card {
    background: transparent;
    border: none;
    box-shadow: none;
    width: 100%;
    padding: 0 1.5rem;
    overflow: visible;
}

#knockout-phase .bracket-card::before { display: none; }

#knockout-phase .bracket-card > div:first-child {
    max-width: 1440px;
    margin: 0 auto;
}

.bracket-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2rem 1rem 3rem;
    gap: 1.5rem;
    min-height: 500px;
    position: relative;
    direction: ltr;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 240, 255, 0.2) transparent;
}

.bracket-container::-webkit-scrollbar { height: 5px; }
.bracket-container::-webkit-scrollbar-track { background: transparent; }
.bracket-container::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.2);
    border-radius: 4px;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-width: 195px;
}

.bracket-round-title {
    text-align: center;
    color: var(--accent);
    font-size: 0.72rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 800;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(6, 9, 18, 0.95), transparent);
    z-index: 10;
    padding: 0.5rem;
}

.bracket-matches-container {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex-grow: 1;
    gap: 1rem;
}

.bracket-match {
    background: linear-gradient(145deg, rgba(12, 17, 32, 0.9), rgba(6, 9, 18, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.bracket-match::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.3), transparent);
}

.bracket-match:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 240, 255, 0.15);
    border-color: rgba(0, 240, 255, 0.3);
}

.bracket-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: transparent;
    transition: background 0.2s;
}

.bracket-team:last-child { border-bottom: none; }

.bracket-team.winner {
    background: rgba(0, 240, 255, 0.1);
}

.bracket-team-name {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bracket-team-name::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: background 0.2s, box-shadow 0.2s;
}

.bracket-team.winner .bracket-team-name {
    color: var(--primary);
}

.bracket-team.winner .bracket-team-name::before {
    background: var(--primary);
    box-shadow: 0 0 8px var(--glow-primary);
}

input.bracket-score-input {
    width: 38px !important;
    height: 28px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 800;
    padding: 0 !important;
    margin-inline-start: 0.4rem;
    flex-shrink: 0;
    transition: border-color 0.2s, background 0.2s;
}

input.bracket-score-input:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.65);
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.15);
}

/* Champion node */
.champion-node {
    text-align: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg,
        rgba(251, 191, 36, 0.12) 0%,
        rgba(218, 165, 32, 0.06) 100%);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: var(--radius-xl);
    box-shadow:
        0 0 40px rgba(251, 191, 36, 0.15),
        0 10px 40px rgba(0, 0, 0, 0.4);
    min-width: 220px;
    align-self: center;
    animation: championAppear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes championAppear {
    from { opacity: 0; transform: scale(0.6) rotate(-5deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}

.champion-node h3 {
    font-family: 'Teko', sans-serif;
    color: var(--gold);
    margin-bottom: 0.75rem;
    font-size: 1rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.champion-name {
    font-family: 'Teko', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-main);
    text-shadow: 0 0 20px var(--glow-gold);
    letter-spacing: 0.03em;
}

/* ============================================================
   Auth Modal
   ============================================================ */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-modal {
    background: rgba(12, 17, 32, 0.95);
    border: 1px solid rgba(0, 240, 255, 0.25);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    width: 420px;
    max-width: 92vw;
    box-shadow:
        0 0 60px rgba(0, 240, 255, 0.15),
        0 30px 80px rgba(0, 0, 0, 0.7);
    text-align: center;
    position: relative;
    animation: fadeSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.auth-modal::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.auth-modal h2 {
    font-family: 'Teko', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 1.75rem;
    background: linear-gradient(90deg, var(--text-main), var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-input {
    width: 100%;
    padding: 0.85rem 1rem;
    margin-bottom: 0.9rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    border-radius: var(--radius-md);
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.auth-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.15);
}

#auth-error {
    color: var(--error);
    margin-bottom: 0.9rem;
    font-size: 0.88rem;
    display: none;
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
}

/* ============================================================
   Lucide Icons
   ============================================================ */
.lucide { stroke-width: 2.5; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .app-container { padding: 1rem 1.25rem; }
    .card { padding: 1.25rem; }
    .wheel-container { width: min(380px, 90vw); height: min(380px, 90vw); }
    .header h1 { font-size: 2.8rem; }
    .dashboard-grid { gap: 1rem; }
    .draw-controls { flex-direction: column; }
}

@media (max-width: 480px) {
    .header-controls { justify-content: center; }
    .groups-container { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Summary Grid (Draw Finished)
   ============================================================ */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    perspective: 1000px;
}

.summary-grid .group-card {
    background: rgba(10, 15, 25, 0.7);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: summaryCardEntry 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes summaryCardEntry {
    from {
        opacity: 0;
        transform: translateY(30px) rotateX(-15deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

/* Stagger animation for 8 cards */
.summary-grid .group-card:nth-child(1) { animation-delay: 0.1s; }
.summary-grid .group-card:nth-child(2) { animation-delay: 0.2s; }
.summary-grid .group-card:nth-child(3) { animation-delay: 0.3s; }
.summary-grid .group-card:nth-child(4) { animation-delay: 0.4s; }
.summary-grid .group-card:nth-child(5) { animation-delay: 0.5s; }
.summary-grid .group-card:nth-child(6) { animation-delay: 0.6s; }
.summary-grid .group-card:nth-child(7) { animation-delay: 0.7s; }
.summary-grid .group-card:nth-child(8) { animation-delay: 0.8s; }

.summary-grid .group-card h3 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
    padding-bottom: 0.5rem;
    text-align: center;
}

.summary-grid .group-card ul {
    list-style: none;
    padding: 0;
}

.summary-grid .group-card li {
    font-size: 0.9rem;
    padding: 0.4rem 0;
    color: var(--text-soft);
    display: flex;
    align-items: center;
}

@media (max-width: 1200px) {
    .summary-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .summary-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Qualification Status Panel
   ============================================================ */
.qual-panel {
    background: rgba(10, 15, 25, 0.6);
    border: 1px solid rgba(0, 240, 255, 0.12);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-top: 1rem;
}

.qual-panel-title {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.qual-decided-notice {
    background: rgba(0, 200, 80, 0.08);
    border: 1px solid rgba(0, 200, 80, 0.25);
    border-radius: 7px;
    padding: 0.45rem 0.65rem;
    color: #00c850;
    font-size: 0.78rem;
    margin-bottom: 0.65rem;
    text-align: center;
}

.qual-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.qual-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.82rem;
}

.qual-row:last-child { border-bottom: none; }

.qual-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    flex-shrink: 0;
}

.qual-badge-q {
    background: rgba(0, 200, 80, 0.18);
    border: 1px solid rgba(0, 200, 80, 0.55);
    color: #00c850;
}

.qual-badge-e {
    background: rgba(255, 60, 60, 0.18);
    border: 1px solid rgba(255, 60, 60, 0.55);
    color: #ff4444;
}

.qual-badge-c {
    background: rgba(255, 180, 0, 0.12);
    border: 1px solid rgba(255, 180, 0, 0.45);
    color: #ffb400;
    font-size: 0.75rem;
}

.qual-team {
    flex: 1;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    overflow: hidden;
}

.qual-condition {
    font-size: 0.72rem;
    color: rgba(255, 180, 0, 0.85);
    font-style: italic;
    text-align: end;
    flex-shrink: 0;
    max-width: 55%;
}

.match-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.match-tag-decisive {
    background: rgba(255, 180, 0, 0.1);
    border: 1px solid rgba(255, 180, 0, 0.35);
    color: rgba(255, 180, 0, 0.85);
}

.match-tag-symbolic {
    background: rgba(150, 150, 150, 0.08);
    border: 1px solid rgba(150, 150, 150, 0.25);
    color: rgba(150, 150, 150, 0.65);
}

/* ============================================================
   Team Crest Icons (Real European Clubs)
   ============================================================ */
.team-crest {
    display: inline-block;
    width: 28px;
    height: 28px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

body.rtl .team-crest {
    margin-right: 0;
    margin-left: 0.5rem;
}

.winner-team-name .team-crest {
    width: 42px;
    height: 42px;
}
