/* Mobile-first responsive design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: #ffffff;
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

header {
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 24px;
    margin-bottom: 5px;
    color: #ffd700;
}

header p {
    font-size: 14px;
    color: #cccccc;
}

main {
    padding: 20px;
}

section {
    margin-bottom: 25px;
}

h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #ffd700;
}

h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #ffffff;
}

/* Card Slots */
.hole-cards {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.board-cards {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.card-slot {
    width: 60px;
    height: 85px;
    border: 2px dashed #666666;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.card-slot:hover {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
    transform: translateY(-2px);
}

.card-slot.selected {
    border: 2px solid #ffd700;
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
}

.card-slot .placeholder {
    font-size: 10px;
    color: #888888;
    text-align: center;
    line-height: 1.2;
}

.card-slot .card-display {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    line-height: 1.2;
}

.card-slot .card-display.red {
    color: #ff4444;
}

.card-slot .card-display.black {
    color: #ffffff;
}

/* Analysis Section */
.analysis {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hand-strength {
    margin-bottom: 20px;
}

#current-hand {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.explanation {
    font-size: 12px;
    color: #cccccc;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 4px;
    margin-top: 8px;
    font-style: italic;
}

.probabilities {
    margin-bottom: 20px;
}

.decision-helper {
    margin-bottom: 20px;
    background: rgba(0, 150, 255, 0.1);
    border: 1px solid rgba(0, 150, 255, 0.3);
    border-radius: 8px;
    padding: 12px;
}

#decision-advice {
    color: #87ceeb;
    font-size: 14px;
    line-height: 1.4;
}

.hand-rankings {
    margin-top: 20px;
    background: rgba(128, 0, 128, 0.1);
    border: 1px solid rgba(128, 0, 128, 0.3);
    border-radius: 8px;
    padding: 12px;
}

.rankings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.ranking-item {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #9966cc;
}

.rank-name {
    font-weight: bold;
    color: #dda0dd;
    font-size: 13px;
}

.rank-desc {
    font-size: 11px;
    color: #cccccc;
    margin-top: 2px;
}

#odds-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.odds-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

.label {
    color: #cccccc;
}

.outs-display {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 5px;
    padding: 8px;
    margin: 5px 0;
    font-size: 12px;
    color: #90ee90;
    line-height: 1.4;
}

.out-card {
    display: inline-block;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    padding: 2px 6px;
    margin: 2px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 11px;
}

.out-card.red {
    color: #cc0000;
}

.warnings {
    margin-bottom: 0;
}

#threats-display {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 5px;
    padding: 10px;
    font-size: 14px;
    color: #ffcccc;
}

/* Card Selector */
.card-selector {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 20px 120px 20px;
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
    max-height: 100vh;
    box-sizing: border-box;
}

/* Additional mobile viewport fixes */
@supports (height: 100dvh) {
    .card-selector {
        max-height: 100dvh;
    }
}

.selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-selector {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.close-selector:hover {
    background: rgba(255, 255, 255, 0.1);
}

.suits {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    overflow-y: visible;
    padding-bottom: 20px;
}

.suit-group h4 {
    font-size: 18px;
    margin-bottom: 10px;
    text-align: center;
}

.suit-group h4.spades, .suit-group h4.clubs {
    color: #ffffff;
}

.suit-group h4.hearts, .suit-group h4.diamonds {
    color: #ff4444;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 10px;
    max-width: 100%;
}

.card-option {
    width: 50px;
    height: 70px;
    border: 2px solid #666666;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 12px;
}

.card-option:hover {
    border-color: #ffd700;
    transform: scale(1.05);
}

.card-option.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.card-option.disabled:hover {
    transform: none;
    border-color: #666666;
}

.card-option.spades, .card-option.clubs {
    color: #000000;
}

.card-option.hearts, .card-option.diamonds {
    color: #cc0000;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #ffd700;
    color: #000000;
}

.btn-primary:hover {
    background: #ffed4a;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Tablet and larger screens */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
    }

    .card-slot {
        width: 70px;
        height: 100px;
    }

    .cards {
        grid-template-columns: repeat(13, 1fr);
    }

    .card-option {
        width: 60px;
        height: 80px;
    }
}