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

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: radial-gradient(circle at 50% -20%, #001A2E, #05050A);
    background-color: #05050A;
    color: #FFFFFF;
    min-height: 100vh;
    overflow-x: hidden;
}

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

.header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 1s ease-out;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
    margin-bottom: 15px;
}

.header-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.main-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
}

.scenario-sidebar {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.scenario-sidebar h3 {
    margin-bottom: 15px;
    color: #FFD700;
}

.scenario-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scenario-sidebar .scenario-card {
    padding: 15px;
}

.scenario-sidebar .scenario-card h4 {
    font-size: 1em;
}

.scenario-sidebar .scenario-card p {
    font-size: 0.85em;
    margin-bottom: 8px;
}

.scenario-sidebar .difficulty {
    font-size: 0.9em;
}

.game-board {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin-bottom: 30px;
}

.hand-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.analysis-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.ukeire-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.ukeire-tile-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ukeire-grid .tile {
    width: 36px;
    height: 50px;
    font-size: 36px;
    margin: 0;
    line-height: 1;
}

.ukeire-count {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 500;
}

.ukeire-stats {
    font-size: 0.9em;
    color: #cbd5e1;
    text-align: right;
}

.tiles-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
    justify-content: center;
    min-height: 80px;
}

.tile {
    width: 50px;
    height: 70px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 2px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 54px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
    font-family: "Noto Sans CJK", "MS Gothic", "NSimSun", "SimSun", monospace;
    padding: 0;
    line-height: 1;
}

.tile.fallback {
    font-size: 14px;
    background: linear-gradient(145deg, #e0e0e0, #d0d0d0);
}

.tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.tile.selected {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border-color: #4CAF50;
}

.tile.tsumo-tile {
    margin-left: 40px;
}

.controls {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(45deg, #FF6B6B, #FF8E53);
    color: white;
}

.btn-secondary {
    background: linear-gradient(45deg, #4ECDC4, #44A08D);
    color: white;
}

.btn-info {
    background: linear-gradient(45deg, #A8E6CF, #7FCDCD);
    color: #333;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.yaku-analysis {
    margin-top: 20px;
}

.yaku-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.yaku-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.yaku-name {
    font-weight: bold;
    font-size: 14px;
}

.yaku-probability {
    font-size: 12px;
    opacity: 0.8;
}

.yaku-value {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #333;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 12px;
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 5px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.loading {
    animation: pulse 1.5s infinite;
}

.wall-tiles {
    display: grid;
    grid-template-columns: repeat(17, 1fr);
    gap: 2px;
    margin: 10px 0;
}

.wall-tile {
    width: 20px;
    height: 28px;
    background: #8B4513;
    border: 1px solid #654321;
    border-radius: 2px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.scenario-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.scenario-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
    border-color: #FFD700;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.scenario-card h4 {
    color: #FFD700;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.scenario-card p {
    opacity: 0.9;
    margin-bottom: 15px;
    line-height: 1.4;
}

.difficulty {
    font-size: 1.2em;
    text-align: right;
}

/* Toast Notifications */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: toastSlide 0.3s ease-out;
    max-width: 300px;
    word-wrap: break-word;
}

.toast-success {
    border-left: 4px solid #4CAF50;
}

.toast-error {
    border-left: 4px solid #f44336;
}

.toast-info {
    border-left: 4px solid #2196F3;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Enhanced Interactive Elements */
.tile.highlighted {
    background: linear-gradient(145deg, #FFD700, #FFA500);
    color: #333;
    border-color: #FF6B6B;
    animation: pulse 1s infinite;
}

.tile.dangerous {
    background: linear-gradient(145deg, #ff4444, #cc3333);
    color: white;
    border-color: #ff0000;
}

.tile.safe {
    background: linear-gradient(145deg, #44ff44, #33cc33);
    color: #333;
    border-color: #00ff00;
}

/* Scientific Display Enhancement */
.scientific-insight {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
}

.research-badge {
    display: inline-block;
    background: linear-gradient(45deg, #FF6B6B, #FF8E53);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 10px;
}

.confidence-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin: 5px 0;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #FFD700, #FF6B6B);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #FFD700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .scenario-sidebar {
        position: static;
        order: 2;
        width: 100%;
        height: auto;
        overflow-y: visible;
    }

    .game-board {
        grid-template-columns: 1fr;
        order: 1;
    }

    .tile {
        width: 40px;
        height: 56px;
        font-size: 40px;
    }

    .header h1 {
        font-size: 2em;
    }

    .header-controls {
        flex-direction: column;
        align-items: center;
    }

    .header-controls .btn {
        width: 80%;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 20px;
    }

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

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        margin: 5px 0;
    }
}

/* Active Training Buttons */
.btn-success {
    background: linear-gradient(45deg, #4CAF50, #81C784);
    color: white;
}

.btn:disabled {
    background: #cccccc;
    color: #666666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}