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

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

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

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
}

.instructions {
    font-size: 14px;
    color: #666;
}

.main-content {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 20px;
    min-height: 800px;

}

/* Left Section */
.left-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tile-selection {
    background: white;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 15px;
    max-height: 550px;
    max-width: 1200px;
    overflow-y: auto;
}

.tile-selection h2 {
    font-size: 16px;
    margin-bottom: 15px;
    font-weight: bold;
}

.tiles-container {
    display: flex;
    gap: 20px;
}

.tile-column {
    flex: 1;
}

.tile-group {
    margin-bottom: 15px;
}

.tile-group h3 {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
    padding: 5px;
    background: #f0f0f0;
    border-radius: 4px;
}

.tile-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tile-btn {
    width: 50px;
    height: 70px;
    border: 2px solid #999;
    border-radius: 4px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-color: white;
    transition: transform 0.1s, box-shadow 0.1s;
}

.tile-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.tile-btn:active {
    transform: scale(0.95);
}

/* Wind Grid (NEWS layout) */
.wind-grid {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 70px);
    gap: 4px;
    justify-content: center;
}

.wind-grid .tile-btn:nth-child(1) { grid-column: 2; grid-row: 1; } /* North */
.wind-grid .tile-btn:nth-child(2) { grid-column: 1; grid-row: 2; } /* West */
.wind-grid .tile-btn:nth-child(3) { grid-column: 3; grid-row: 2; } /* East */
.wind-grid .tile-btn:nth-child(4) { grid-column: 2; grid-row: 3; } /* South */

/* Your Hand */
.your-hand {
    background: white;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 15px;
    flex-shrink: 0;
    max-width: 1500px;
}

.your-hand h2 {
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: bold;
}

.hand-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 100px;
    max-height: 160px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    background: #fafafa;
    border-radius: 4px;
    margin-bottom: 10px;
}

.hand-tile {
    width: 50px;
    height: 70px;
    border: 2px solid #999;
    border-radius: 4px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-color: white;
    position: relative;
    flex-shrink: 0;
    transition: transform 0.1s;
}

.hand-tile:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.clear-btn {
    background: #ff9800;
    color: black;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.clear-btn:hover {
    background: #fb8c00;
}

/* Right Section */
.right-section {
    background: white;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.right-section h2 {
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: bold;
}

.analyze-btn {
    background: #2196F3;
    color: black;
    border: none;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 15px;
    transition: background 0.2s;
}

.analyze-btn:hover {
    background: #1976D2;
}

.results {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #fafafa;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    line-height: 1.6;
    width:100%;
    min-width: 0;
    word-break: break-word;
}

.placeholder {
    color: #999;
    text-align: center;
    padding: 40px 20px;
    font-family: Arial, sans-serif;
}

/* Colored text for suits */
.bamboo-text { color: #2E7D32; font-weight: bold; }
.character-text { color: #C62828; font-weight: bold; }
.dot-text { color: #212121; font-weight: bold; }

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 3fr 1fr;
    }
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .right-section {
        min-height: 400px;
    }
}