/* Tower Descent Simulation - Embedded Game Styles */
/* All styles scoped to .tds-game-container to avoid conflicts */

#embeddedGameContainer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tds-game-container {
    --tds-primary: #d4af37;
    --tds-accent: #ffd700;
    --tds-bg: #0a0a0f;
    --tds-surface: #1a1a2e;
    --tds-surface-elevated: #252540;
    --tds-text: #e8e8e8;
    --tds-text-muted: #a0a0a0;
    --tds-danger: #ff4444;
    --tds-success: #44ff88;
    --tds-warning: #ffaa00;
    
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--tds-bg);
    color: var(--tds-text);
    width: 720px;
    max-width: 95vw;
    height: 900px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    border: 2px solid var(--tds-primary);
    box-shadow: 0 0 60px rgba(212, 175, 55, 0.3);
}

/* Image Area */
.tds-game-container .tds-image-area {
    height: 280px;
    min-height: 200px;
    max-height: 300px;
    background: linear-gradient(180deg, var(--tds-surface) 0%, var(--tds-bg) 100%);
    position: relative;
    overflow: hidden;
    border-bottom: 2px solid var(--tds-primary);
}

.tds-game-container .tds-game-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

.tds-game-container .tds-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 1rem 1.5rem;
}

.tds-game-container .tds-zone-info {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--tds-primary);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.tds-game-container .tds-enemy-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tds-game-container .tds-enemy-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--tds-danger);
}

.tds-game-container .tds-enemy-level {
    font-size: 0.9rem;
    color: var(--tds-text-muted);
}

/* Text Area */
.tds-game-container .tds-text-area {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    background: var(--tds-bg);
    min-height: 0;
}

.tds-game-container .tds-text-content {
    max-width: 800px;
    margin: 0 auto;
}

.tds-game-container .tds-game-text {
    margin: 0.5rem 0;
    line-height: 1.6;
    color: var(--tds-text);
}

.tds-game-container .tds-game-text.title {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--tds-primary);
    text-align: center;
    margin: 1rem 0;
}

.tds-game-container .tds-game-text.subtitle {
    font-size: 1rem;
    color: var(--tds-text-muted);
    text-align: center;
}

.tds-game-container .tds-game-text.highlight {
    color: var(--tds-accent);
    font-weight: 600;
}

.tds-game-container .tds-game-text.success {
    color: var(--tds-success);
}

.tds-game-container .tds-game-text.warning {
    color: var(--tds-danger);
}

.tds-game-container .tds-game-text.separator_line hr {
    border: none;
    border-top: 1px solid var(--tds-primary);
    margin: 1rem 0;
}

/* Stats Bar */
.tds-game-container .tds-stats-bar {
    background: var(--tds-surface);
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--tds-primary);
    display: none;
}

.tds-game-container .tds-stats-bar.visible {
    display: block;
}

.tds-game-container .tds-char-name {
    font-weight: bold;
    color: var(--tds-primary);
    margin-bottom: 0.5rem;
}

.tds-game-container .tds-stat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0;
}

.tds-game-container .tds-stat-label {
    width: 30px;
    font-size: 0.85rem;
    color: var(--tds-text-muted);
}

.tds-game-container .tds-stat-bar {
    flex: 1;
    height: 20px;
    background: var(--tds-bg);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.tds-game-container .tds-stat-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.tds-game-container .tds-hp-fill {
    background: linear-gradient(90deg, #ff4444, #ff6666);
}

.tds-game-container .tds-energy-fill {
    background: linear-gradient(90deg, #4488ff, #66aaff);
}

.tds-game-container .tds-stat-text {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Input Area */
.tds-game-container .tds-input-area {
    background: var(--tds-surface);
    padding: 1rem 1.5rem;
    border-top: 2px solid var(--tds-primary);
}

.tds-game-container .tds-input-prompt {
    font-size: 0.9rem;
    color: var(--tds-text-muted);
    margin-bottom: 0.5rem;
}

.tds-game-container .tds-input-controls {
    display: flex;
    gap: 0.5rem;
}

.tds-game-container .tds-text-input {
    flex: 1;
    background: var(--tds-bg);
    border: 1px solid var(--tds-primary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--tds-text);
    font-size: 1rem;
    outline: none;
}

.tds-game-container .tds-text-input:focus {
    border-color: var(--tds-accent);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.tds-game-container .tds-submit-btn {
    background: var(--tds-primary);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    color: var(--tds-bg);
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.tds-game-container .tds-submit-btn:hover {
    background: var(--tds-accent);
}

.tds-game-container .tds-progress-bar {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--tds-text-muted);
}

/* Start Overlay */
.tds-game-container .tds-start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.tds-game-container .tds-start-overlay.hidden {
    display: none;
}

.tds-game-container .tds-start-content {
    text-align: center;
    padding: 2rem;
}

.tds-game-container .tds-start-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--tds-primary);
    margin-bottom: 0.5rem;
}

.tds-game-container .tds-start-subtitle {
    font-size: 1rem;
    color: var(--tds-text-muted);
    margin-bottom: 2rem;
}

.tds-game-container .tds-start-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0.75rem auto;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    border: 2px solid var(--tds-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: var(--tds-primary);
}

.tds-game-container .tds-start-btn:hover {
    background: var(--tds-primary);
    color: var(--tds-bg);
}

.tds-game-container .tds-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tds-game-container .tds-start-btn.secondary {
    border-color: var(--tds-text-muted);
    color: var(--tds-text-muted);
}

.tds-game-container .tds-start-btn.secondary:hover:not(:disabled) {
    background: var(--tds-text-muted);
    color: var(--tds-bg);
}

.tds-game-container .tds-start-info {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--tds-text-muted);
    line-height: 1.8;
}

/* Tutorial Overlay */
.tds-game-container .tds-tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.98);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 101;
    padding: 2rem;
}

.tds-game-container .tds-tutorial-content {
    background: var(--tds-surface);
    border: 2px solid var(--tds-primary);
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.tds-game-container .tds-tutorial-content h2 {
    color: var(--tds-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.tds-game-container .tds-tutorial-content h3 {
    color: var(--tds-accent);
    margin: 1.5rem 0 0.5rem;
}

.tds-game-container .tds-tutorial-content p {
    color: var(--tds-text);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* HP color classes */
.tds-game-container .hp_high { color: #44ff88; }
.tds-game-container .hp_medium { color: #ffaa00; }
.tds-game-container .hp_low { color: #ff4444; }

/* Author name styling */
.tds-game-container .author-name {
    color: #ff6b9d;
    font-weight: bold;
}

/* Fade in animation */
.tds-game-container .fade-in {
    animation: tds-fadeIn 0.3s ease-in;
}

@keyframes tds-fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hidden utility */
.tds-game-container .hidden {
    display: none !important;
}

/* Close button repositioned for popup */
#closeGameBtn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10001;
    background: var(--color-primary, #ff6b9d);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .tds-game-container {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .tds-game-container .tds-image-area {
        height: 25vh;
        min-height: 150px;
    }
    
    .tds-game-container .tds-start-title {
        font-size: 1.8rem;
    }
    
    .tds-game-container .tds-zone-info,
    .tds-game-container .tds-enemy-name {
        font-size: 1rem;
    }
}
