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

:root {
    --bg-primary: #0d1329;
    --bg-secondary: #1a2140;
    --bg-card: #252b4a;
    --accent-pink: #ff3b6f;
    --accent-pink-dark: #cc2f59;
    --accent-blue: #4a6cf7;
    --accent-green: #10b981;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --text-placeholder: #5a6380;
    --success: #4ade80;
    --error: #f87171;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(180deg, var(--bg-primary) 0%, #0a0f1f 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

.app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    padding: 40px 24px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

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

.title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
}

/* Back Button */
.btn-back {
    position: absolute;
    top: 40px;
    left: 24px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

/* Add Player Button */
.btn-add-player {
    background: transparent;
    border: 2px solid var(--accent-green);
    color: var(--text-primary);
    padding: 16px 40px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin: 0 auto 30px;
    display: block;
    transition: all 0.3s ease;
}

.btn-add-player:hover {
    background: var(--accent-green);
    transform: scale(1.02);
}

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

/* Players List */
.players-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    max-height: 300px;
}

.player-item {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.player-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 20px;
    background: var(--accent-green);
}

.player-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    outline: none;
}

.player-input::placeholder {
    color: var(--text-placeholder);
}

.player-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.player-remove:hover {
    color: var(--accent-pink);
}

/* Topic Section */
.topic-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.topic-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
}

.topic-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topic-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent-green);
}

.btn-refresh {
    background: var(--bg-secondary);
    border: none;
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: var(--accent-green);
    transform: rotate(180deg);
}

.btn-refresh:active {
    transform: scale(0.95) rotate(180deg);
}

/* Bottom Section */
.bottom-section {
    padding: 20px 0;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Play Button */
.btn-play {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
    border: none;
    color: white;
    padding: 18px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

.btn-play:active {
    transform: translateY(0);
}

.btn-play:disabled {
    background: var(--bg-card);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    width: 100%;
    background: transparent;
    border: 2px solid var(--text-secondary);
    color: var(--text-primary);
    padding: 16px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--text-primary);
}

/* Cards Screen */
#cards-screen {
    justify-content: center;
    align-items: center;
    padding-top: 60px;
}

.card-container {
    perspective: 1000px;
    width: 300px;
    height: 400px;
    margin: 20px 0;
}

.game-card {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.game-card.swiping {
    transition: transform 0.4s ease;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.game-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.card-front {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border: 2px solid var(--accent-green);
}

.card-back {
    background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
    transform: rotateY(180deg);
}

.card-title {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.card-player-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-green);
    margin-bottom: 30px;
}

.card-hint {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
}

.card-role {
    font-size: 28px;
    font-weight: 700;
    color: white;
    text-align: center;
    line-height: 1.4;
}

.card-role.rabbit {
    font-size: 24px;
}

.swipe-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.swipe-hint.visible {
    opacity: 1;
}

/* Words Screen */
.subtitle {
    text-align: center;
    color: var(--accent-green);
    font-size: 16px;
    margin-bottom: 30px;
}

.words-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.word-item {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    font-size: 16px;
    color: var(--text-primary);
    animation: fadeIn 0.3s ease;
}

/* Instructions Card */
.instructions-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    margin-bottom: 30px;
}

.instructions-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.instructions-text {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.instructions-text:last-child {
    margin-bottom: 0;
}

.instructions-text.highlight {
    color: var(--accent-green);
    font-weight: 600;
}

.instructions-text.small {
    font-size: 14px;
}

/* Player Order */
.player-order {
    flex: 1;
    overflow-y: auto;
}

.order-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-item {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px 16px;
    animation: slideIn 0.3s ease;
}

.order-number {
    width: 32px;
    height: 32px;
    background: var(--accent-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    margin-right: 14px;
}

.order-name {
    font-size: 16px;
    color: var(--text-primary);
}

/* Topic Reminder */
.topic-reminder {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.topic-reminder-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.topic-reminder-value {
    color: var(--accent-green);
    font-size: 18px;
    font-weight: 600;
}

/* Onboarding Screen */
.onboarding-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    align-items: center;
    padding-top: 40px;
}

.onboarding-slides {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.onboarding-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

.onboarding-slide.active {
    display: flex;
}

.slide-icon {
    font-size: 80px;
    margin-bottom: 30px;
}

.slide-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.slide-text {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 300px;
}

.onboarding-dots {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--accent-green);
    width: 30px;
    border-radius: 5px;
}

.onboarding-buttons {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 320px;
}

.btn-skip {
    flex: 1;
    background: transparent;
    border: 2px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 16px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-skip:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-next-slide {
    flex: 1.5;
    background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
    border: none;
    color: white;
    padding: 16px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.btn-next-slide:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

/* Responsive */
@media (max-height: 700px) {
    .screen {
        padding: 20px;
    }

    .title {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .card-container {
        width: 260px;
        height: 340px;
    }

    .card-player-name {
        font-size: 24px;
    }

    .card-role {
        font-size: 24px;
    }

    .players-list {
        max-height: 200px;
    }
}
