/* Simulation Chat Interface */
:root {
    --chat-bg: #0f172a;
    --chat-bubble-sent: #3b82f6;
    --chat-bubble-received: #1e293b;
    --chat-text: #f8fafc;
}

.sim-container {
    max-width: 400px;
    height: 600px;
    background: var(--chat-bg);
    border-radius: 20px;
    border: 8px solid #334155;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Menu Overlay */
.sim-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    z-index: 10;
    padding: 20px;
    overflow-y: auto;
}

.sim-title {
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

.sim-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding-bottom: 40px;
    /* More space for scrolling */
}

.scenario-card {
    background: #1e293b;
    border-radius: 12px;
    padding: 15px 5px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.scenario-card:hover {
    transform: translateY(-3px);
    background: #334155;
}

.scenario-icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 5px;
}

.scenario-title {
    font-size: 0.7rem;
    color: #cbd5e1;
    line-height: 1.2;
    word-wrap: break-word;
}

/* In-Game Header */
.sim-header {
    background: #1e293b;
    padding: 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #334155;
}

.sim-avatar {
    width: 40px;
    height: 40px;
    background: #475569;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 1.2rem;
}

.sim-meta {
    flex: 1;
}

.sim-name {
    display: block;
    font-weight: bold;
    font-size: 0.9rem;
}

.sim-status {
    font-size: 0.7rem;
    color: #4ade80;
}

/* Chat Area */
.sim-chat {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sim-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sim-msg.received {
    background: var(--chat-bubble-received);
    color: var(--chat-text);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.sim-msg.sent {
    background: var(--chat-bubble-sent);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

/* Typing Indicator */
.typing {
    background: var(--chat-bubble-received);
    align-self: flex-start;
    padding: 10px;
    border-radius: 12px;
    display: flex;
    gap: 4px;
    width: fit-content;
}

.dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: pulse 1.4s infinite;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Controls */
.sim-controls {
    padding: 15px;
    background: #1e293b;
    border-top: 1px solid #334155;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sim-choice-btn {
    background: #334155;
    border: none;
    color: white;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
    text-align: left;
}

.sim-choice-btn:hover {
    background: #475569;
}

/* Results */
.result-box {
    text-align: center;
    padding: 20px;
    animation: popIn 0.5s;
}

.rank-badge {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(45deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.rank-s {
    background: linear-gradient(45deg, #22c55e, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-msg {
    color: #cbd5e1;
    margin-bottom: 30px;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

/* Rank Badge on Tile */
.tile-rank {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #334155;
    border: 2px solid var(--chat-bg);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.tile-rank.s {
    background: linear-gradient(135deg, #fcd34d, #f59e0b);
    color: black;
}

.tile-rank.a {
    background: #3b82f6;
}

.tile-rank.b {
    background: #06b6d4;
}

/* Cyan */
.tile-rank.c {
    background: #10b981;
}

/* Emerald */
.tile-rank.d {
    background: #eab308;
    color: black;
}

/* Yellow */
.tile-rank.e {
    background: #f97316;
}

/* Orange */
.tile-rank.f {
    background: #ef4444;
}