:root {
    --bg-color: #0f172a; /* Slate 900 */
    --surface-color: #1e293b; /* Slate 800 */
    --primary-color: #3b82f6; /* Blue 500 */
    --primary-hover: #2563eb; /* Blue 600 */
    --secondary-color: #475569; /* Slate 600 */
    --secondary-hover: #334155; /* Slate 700 */
    --success-color: #10b981; /* Emerald 500 */
    --error-color: #ef4444; /* Red 500 */
    --warning-color: #f59e0b; /* Amber 500 */
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #cbd5e1; /* Slate 300 */
    --font-ui: 'Inter', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.15), transparent 400px),
                      radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent 400px);
}

#app-container {
    background-color: var(--surface-color);
    width: 100%;
    max-width: 480px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: 30px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Screens */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

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

/* Typografie & UI */
h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 5px;
    background: linear-gradient(to right, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 20px;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 30px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.intro-text {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.5;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

input[type="text"] {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-size: 1.1rem;
    text-align: center;
    transition: all 0.2s ease;
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 15px;
    font-family: var(--font-ui);
}

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

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.btn-warning {
    background-color: transparent;
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
    font-size: 0.9rem;
    padding: 10px;
    margin-top: 10px;
}

.btn-warning:hover {
    background-color: rgba(245, 158, 11, 0.1);
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.stats {
    display: flex;
    gap: 15px;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.stats span {
    display: inline-block;
}

.morse-container {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px 15px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
    overflow-x: auto;
}

.morse-text {
    font-family: var(--font-mono);
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    font-weight: 700;
    letter-spacing: 3px;
    word-spacing: 15px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

.input-container {
    display: flex;
    gap: 10px;
}

.input-container input {
    margin-bottom: 0;
    text-transform: uppercase;
}

.input-container button {
    margin-bottom: 0;
    width: auto;
    padding: 0 25px;
}

.hint-container {
    margin-top: 20px;
    text-align: center;
    min-height: 45px;
}

.hint-text {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    letter-spacing: 5px;
    color: var(--warning-color);
}

/* Results Screen */
.result-summary {
    background-color: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.result-item .label {
    color: var(--text-muted);
}

.result-item .value {
    font-weight: 800;
    font-size: 1.1rem;
}

.sync-status {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    min-height: 18px;
}

/* Leaderboard */
.table-container {
    background-color: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    font-size: 0.95rem;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

td {
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

tr:last-child td {
    border-bottom: none;
}

tr:nth-child(1) td { color: #fbbf24; font-weight: bold; } /* Gold */
tr:nth-child(2) td { color: #94a3b8; font-weight: bold; } /* Silver */
tr:nth-child(3) td { color: #b45309; font-weight: bold; } /* Bronze */

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: var(--success-color);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background-color: var(--error-color);
}
