/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #007AFF;
    --success-color: #34C759;
    --danger-color: #FF3B30;
    --warning-color: #FF9500;
    --bg-color: #F2F2F7;
    --card-bg: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #8E8E93;
    --border-color: #E5E5EA;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --card-bg: #1C1C1E;
        --text-primary: #FFFFFF;
        --text-secondary: #AEAEB2;
        --border-color: #38383A;
        --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 40px 0;
}

.logo h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 60px 20px;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 60px 0;
}

.feature-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
}

/* How It Works */
.how-it-works {
    margin: 60px 0;
}

.how-it-works h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
}

.steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.steps li {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.step-number {
    background: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.step-content h3 {
    margin-bottom: 0.5rem;
}

.step-content p {
    color: var(--text-secondary);
}

/* CTA Section */
.cta {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: 16px;
    margin: 60px 0;
}

.cta h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.app-store-badge img {
    height: 50px;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
}

.privacy-note {
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Game Page Specific Styles */
.game-page {
    background: var(--bg-color);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.game-header h1 {
    font-size: 1.5rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.active {
    background-color: var(--success-color);
}

.status-dot.offline {
    background-color: var(--text-secondary);
    animation: none;
}

.status-dot.completed {
    background-color: var(--warning-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error State */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.error-state h2 {
    margin-bottom: 10px;
}

.error-state p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.button {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.button:hover {
    opacity: 0.8;
}

/* Game Info */
.game-info {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.label {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Scores Section */
.scores-section {
    margin-bottom: 40px;
}

.scores-section h2 {
    margin-bottom: 20px;
}

.player-scores {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.player-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.player-card:hover {
    transform: translateX(4px);
}

.player-card.leader {
    border: 2px solid var(--warning-color);
}

.player-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.player-card.leader .player-rank {
    background: var(--warning-color);
    color: white;
}

.player-info {
    flex: 1;
}

.player-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.leader-badge {
    font-size: 0.85rem;
    color: var(--warning-color);
    margin-top: 4px;
}

.player-score {
    font-size: 1.5rem;
    font-weight: bold;
}

.player-score.positive {
    color: var(--success-color);
}

.player-score.negative {
    color: var(--danger-color);
}

/* Hands Section */
.hands-section {
    margin-bottom: 40px;
}

.hands-section h2 {
    margin-bottom: 20px;
}

.hands-toggle {
    margin-bottom: 16px;
}

.toggle-button {
    width: 100%;
    padding: 12px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.toggle-button:hover {
    background: var(--border-color);
}

.hand-history {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.hand-history.collapsed {
    max-height: 0;
}

.hand-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hand-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.hand-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.hand-number {
    font-weight: 600;
}

.hand-result {
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.hand-result.won {
    background: rgba(52, 199, 89, 0.2);
    color: var(--success-color);
}

.hand-result.lost {
    background: rgba(255, 59, 48, 0.2);
    color: var(--danger-color);
}

.hand-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Completed Banner */
.completed-banner {
    background: var(--warning-color);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-top: 30px;
}

.completed-banner h3 {
    margin-bottom: 8px;
}

/* No Data State */
.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    background: var(--card-bg);
    border-radius: 12px;
}

.small-text {
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h2 {
        font-size: 2rem;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .game-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .player-score {
        font-size: 1.25rem;
    }
}
