@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;600;800&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --primary-gradient: linear-gradient(135deg, #ec4899 0%, #f97316 100%);
    --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Heebo', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    direction: rtl;
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 480px; /* Mobile app feel */
    height: 100vh;
    max-height: 850px;
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Screen Transitions */
.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    animation: fadeIn 0.4s ease forwards;
}

.screen.active {
    display: flex;
}

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

/* Typography */
h1 {
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2rem;
    filter: drop-shadow(0 4px 15px rgba(236, 72, 153, 0.4));
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    text-align: center;
}

p {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Forms & Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 2rem;
    width: 100%;
}

input {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1.1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

input:focus {
    border-color: rgba(236, 72, 153, 0.5);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.2);
}

/* Buttons */
.btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 16px 24px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.btn:active {
    transform: scale(0.97);
}

.btn.primary {
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 10px 20px rgba(236, 72, 153, 0.3);
}

.btn.success {
    background: var(--success-gradient);
    border: none;
    height: 120px;
    font-size: 2rem;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

.btn.danger {
    background: var(--danger-gradient);
    border: none;
    height: 120px;
    font-size: 2rem;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

/* Setup Screen */
.teams-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.team-badge {
    background: var(--glass-bg);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--glass-border);
}

.remove-team {
    color: var(--danger-gradient);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Play Screen */
.timer-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.timer {
    font-size: 3.5rem;
    font-weight: 800;
    background: var(--glass-bg);
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.05);
    transition: all 0.3s;
}

.timer.warning {
    color: #ef4444;
    border-color: #ef4444;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.word-display {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
    perspective: 1000px;
}

.category-watermark {
    position: absolute;
    font-size: 15rem;
    opacity: 0.05;
    z-index: 0;
    pointer-events: none;
    transform: rotate(-15deg);
}

.current-word {
    font-size: 4.5rem;
    font-weight: 800;
    text-align: center;
    word-break: break-word;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #fff;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.3));
    padding: 20px;
}

/* Dynamic word gradients */
.word-grad-1 { background: linear-gradient(to right, #ff8a00, #e52e71); -webkit-background-clip: text; }
.word-grad-2 { background: linear-gradient(to right, #00f2fe, #4facfe); -webkit-background-clip: text; }
.word-grad-3 { background: linear-gradient(to right, #43e97b, #38f9d7); -webkit-background-clip: text; }
.word-grad-4 { background: linear-gradient(to right, #fa709a, #fee140); -webkit-background-clip: text; }
.word-grad-5 { background: linear-gradient(to right, #c471ed, #f64f59, #12c2e9); -webkit-background-clip: text; }
.word-grad-6 { background: linear-gradient(to right, #f83600, #f9d423); -webkit-background-clip: text; }

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 2rem;
}

/* Score Screen */
.score-summary {
    background: var(--glass-bg);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid var(--glass-border);
    margin-bottom: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.word-result {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--glass-border);
}

.word-result:last-child {
    border-bottom: none;
}

.word-result.correct { color: #10b981; }
.word-result.wrong { color: #ef4444; }

.team-standings {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.standing-row {
    display: flex;
    justify-content: space-between;
    background: var(--glass-bg);
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
}

.standing-row.highlight {
    border: 1px solid rgba(236, 72, 153, 0.5);
    background: rgba(236, 72, 153, 0.1);
}

/* Animations for words */
.pop-in {
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% { transform: scale(0.3) rotate(-10deg) translateZ(-100px); opacity: 0; filter: blur(10px); }
    50% { transform: scale(1.1) rotate(5deg) translateZ(50px); opacity: 1; filter: blur(0); }
    100% { transform: scale(1) rotate(var(--random-rot, 0deg)) translateZ(0); opacity: 1; filter: blur(0); }
}

/* Glass card layout helper */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
