* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background:
        radial-gradient(circle at 75% 8%, rgba(120, 50, 110, 0.55) 0%, transparent 45%),
        radial-gradient(circle at 8% 92%, rgba(30, 130, 110, 0.45) 0%, transparent 45%),
        linear-gradient(160deg, #0d1f28 0%, #0a1419 55%, #0c1a22 100%);
    background-attachment: fixed;
    font-family: 'Inter', -apple-system, 'Helvetica Neue', system-ui, sans-serif;
    font-weight: 500;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.screen-content {
    text-align: center;
    padding: 32px;
    max-width: 400px;
    width: 100%;
}

.screen-content h1 {
    font-size: 2.4rem;
    letter-spacing: -1px;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff, #ccc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 12px;
    word-break: break-word;
}

.screen-content p.sub {
    font-size: 0.8rem;
    font-weight: 500;
    color: #f97316;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 32px;
}

.btn {
    background: linear-gradient(180deg, #2fa860 0%, #1f8b4c 100%);
    border: none;
    padding: 16px 32px;
    border-radius: 60px;
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 10px 24px rgba(31,139,76,0.45);
    width: 100%;
}

.btn:active {
    transform: scale(0.96);
    filter: brightness(0.92);
}

.rules-text {
    text-align: left;
    background: rgba(255,255,255,0.05);
    border-radius: 24px;
    padding: 20px;
    margin: 20px 0;
    color: #ddd;
    font-size: 0.85rem;
    line-height: 1.5;
    max-height: 60vh;
    overflow-y: auto;
}

.rules-text h3 {
    color: #f97316;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.rules-text p { margin-bottom: 10px; }
.rules-text ul { padding-left: 20px; margin-bottom: 10px; }
.rules-text li { margin-bottom: 6px; }

.name-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 16px;
    border-radius: 60px;
    color: white;
    text-align: center;
    font-size: 1rem;
    outline: none;
}

.app {
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
    background: rgba(20, 28, 36, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    padding: 20px 20px 28px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.08);
    transition: opacity 0.3s;
}

.game-header {
    text-align: center;
    margin-bottom: 28px;
    padding: 0 8px;
}

.game-header h1 {
    font-size: 2rem;
    letter-spacing: -0.5px;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff, #ccc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 6px;
}

.game-header p {
    font-size: 0.7rem;
    font-weight: 500;
    color: #f97316;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.players-section {
    margin-bottom: 28px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 16px;
}

.players-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    padding: 0 4px;
}

.players-header h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.add-player-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #eee;
    cursor: pointer;
}

.players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.player-card {
    border-radius: 40px;
    padding: 6px 12px 6px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.08);
    transition: all 0.15s;
    width: calc(50% - 6px);
    min-width: 140px;
    background: rgba(255,255,255,0.04);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.player-card.active.level-1 {
    background: linear-gradient(180deg, #2fa860, #1f8b4c);
    border-color: transparent;
}
.player-card.active.level-2 {
    background: linear-gradient(180deg, #ef9d24, #d97706);
    border-color: transparent;
}
.player-card.active.level-3 {
    background: linear-gradient(180deg, #f04646, #dc2626);
    border-color: transparent;
}

.player-card.inactive.level-1 { background: #2a5a3a; opacity: 0.7; }
.player-card.inactive.level-2 { background: #9e5a10; opacity: 0.7; }
.player-card.inactive.level-3 { background: #9b2c2c; opacity: 0.7; }

.player-card.finished {
    opacity: 0.5;
    filter: grayscale(0.5);
    cursor: default;
    pointer-events: none;
}

.player-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0e0e0;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-stats {
    font-size: 0.7rem;
    background: rgba(0,0,0,0.3);
    padding: 2px 8px;
    border-radius: 30px;
    white-space: nowrap;
    color: white;
}

.player-card.active .player-name,
.player-card.active .player-stats {
    color: #0a0a0c;
    background: transparent;
    font-weight: 700;
}

.player-delete {
    background: rgba(0,0,0,0.3);
    border-radius: 30px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    margin-left: 4px;
}

.add-player-form {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    background: rgba(255,255,255,0.04);
    padding: 6px;
    border-radius: 44px;
}

.add-player-form input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: none;
    padding: 10px 16px;
    border-radius: 44px;
    color: white;
}

.add-player-form button {
    background: #f97316;
    border: none;
    padding: 0 22px;
    border-radius: 44px;
    font-weight: 600;
    color: black;
    cursor: pointer;
}

.card-wrapper {
    margin: 12px 0 28px;
}

.card {
    background: linear-gradient(160deg, #2fa860 0%, #1f8b4c 100%);
    border-radius: 28px;
    padding: 2rem 1.8rem;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    transition: background 0.3s ease;
}

.card-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -0.3px;
    text-transform: uppercase;
    color: white;
}

.card-description {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.4;
    max-width: 90%;
    color: rgba(255,255,255,0.9);
}

.card.level-1 { background: linear-gradient(160deg, #2fa860 0%, #1f8b4c 100%); }
.card.level-2 { background: linear-gradient(160deg, #ef9d24 0%, #d97706 100%); }
.card.level-3 { background: linear-gradient(160deg, #f04646 0%, #dc2626 100%); }

.level-chip {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.5);
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
}

.action-row {
    display: flex;
    gap: 12px;
    margin: 16px 0 20px;
}

.action-btn {
    flex: 1;
    border: none;
    padding: 16px 0;
    border-radius: 60px;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0,0,0,0.35);
    text-transform: uppercase;
    transition: transform 0.1s ease, filter 0.2s;
}

.action-btn:active {
    transform: translateY(2px);
    filter: brightness(0.92);
}

.btn-green  { background: linear-gradient(180deg, #2fa860 0%, #1f8b4c 100%); }
.btn-yellow { background: linear-gradient(180deg, #ef9d24 0%, #d97706 100%); }
.btn-red    { background: linear-gradient(180deg, #f04646 0%, #dc2626 100%); }

.stats-bar {
    background: rgba(10, 16, 22, 0.55);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 60px;
    padding: 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 10px 0 12px;
}

.level-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    padding: 5px 14px 5px 18px;
    border-radius: 40px;
}

.level-text {
    font-weight: 600;
    color: #fff;
    font-size: 0.8rem;
}

.progress-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    background: #3a3a44;
    border-radius: 10px;
    transition: all 0.2s;
}

.dot.active.level-1 { background: #2fa860; width: 20px; }
.dot.active.level-2 { background: #ef9d24; width: 20px; }
.dot.active.level-3 { background: #f04646; width: 20px; }

.green-counter {
    background: linear-gradient(180deg, #2fa860 0%, #1f8b4c 100%);
    padding: 6px 14px;
    border-radius: 40px;
    font-weight: bold;
    font-size: 0.8rem;
    color: white;
}

.reset-link {
    text-align: right;
    margin-top: 8px;
}

.reset-btn {
    background: none;
    border: none;
    color: #777;
    font-size: 0.65rem;
    text-decoration: underline;
    cursor: pointer;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 31, 0.85);
    backdrop-filter: blur(8px);
    padding: 10px 20px;
    border-radius: 40px;
    color: #f97316;
    font-weight: 600;
    font-size: 0.8rem;
    z-index: 200;
    opacity: 0;
    transition: 0.2s;
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.1);
}

.final-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s;
    opacity: 0;
    visibility: hidden;
}

.final-screen.show {
    opacity: 1;
    visibility: visible;
}

.final-content {
    text-align: center;
    color: white;
    padding: 20px;
}

.final-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #f97316, #ffd700);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.final-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

@media (max-width: 500px) {
    body { padding: 10px; }

    .app {
        padding: 16px 14px 18px;
        border-radius: 24px;
    }

    .game-header { margin-bottom: 16px; }
    .game-header h1 { font-size: 1.6rem; margin-bottom: 2px; }
    .game-header p { font-size: 0.6rem; letter-spacing: 1.5px; }

    .players-section {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    .players-header { margin-bottom: 8px; }
    .players-header h3 { font-size: 0.65rem; }

    .add-player-btn {
        padding: 6px 12px;
        font-size: 0.65rem;
    }

    .player-card {
        width: 100%;
        min-width: 0;
        padding: 5px 10px 5px 14px;
    }
    .player-name { font-size: 0.8rem; }
    .player-stats { font-size: 0.65rem; }

    .card-wrapper { margin: 8px 0 16px; }

    .card {
        min-height: 220px;
        padding: 1.2rem 1rem;
        border-radius: 22px;
    }
    .card-title {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }
    .card-description {
        font-size: 0.85rem;
        line-height: 1.35;
    }

    .level-chip {
        top: 12px;
        right: 12px;
        font-size: 0.6rem;
        padding: 3px 10px;
    }

    .action-row {
        gap: 8px;
        margin: 10px 0 14px;
    }
    .action-btn {
        font-size: 0.7rem;
        padding: 12px 0;
    }

    .stats-bar {
        padding: 8px 14px;
        gap: 8px;
        margin: 8px 0;
    }
    .level-text { font-size: 0.7rem; }
    .green-counter { font-size: 0.7rem; padding: 4px 10px; }

    .dot { width: 8px; height: 8px; }
    .dot.active.level-1,
    .dot.active.level-2,
    .dot.active.level-3 { width: 16px; }

    .screen-content h1 { font-size: 1.8rem; }
}