/* ===================================
   CIPHER MASTER - VIP STYLING
   Dark elegant theme with gold/silver accents
   =================================== */

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --bg-primary: #0f0f1e;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252538;
    --border-color: rgba(212, 175, 55, 0.2);
    
    /* Accent Colors */
    --gold: #ffd700;
    --silver: #c0c0c0;
    --blue-accent: #00d4ff;
    
    /* Feedback Colors */
    --gold-glow: rgba(255, 215, 0, 0.3);
    --silver-glow: rgba(192, 192, 192, 0.3);
    
    /* Status Colors */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    /* Typography */
    --font-primary: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body {
    font-family: var(--font-primary);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Help Button === */
.help-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-accent), #0099cc);
    border: 2px solid rgba(0, 212, 255, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.help-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 25px rgba(0, 212, 255, 0.5);
}

.help-btn svg {
    width: 24px;
    height: 24px;
}

/* === Modal Styles === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-normal);
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: var(--spacing-xl);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn var(--transition-normal);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--silver);
    font-size: 2rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--gold);
    transform: rotate(90deg);
}

.modal-content h2 {
    color: var(--gold);
    margin-bottom: var(--spacing-lg);
    font-size: 2rem;
    text-align: center;
}

.modal-content h3 {
    color: var(--blue-accent);
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    font-size: 1.3rem;
}

.help-section {
    margin-bottom: var(--spacing-lg);
}

.help-section p,
.help-section li {
    line-height: 1.6;
    color: #d0d0d0;
    margin-bottom: var(--spacing-xs);
}

.help-section ul,
.help-section ol {
    padding-left: var(--spacing-lg);
}

.help-section li {
    margin-bottom: var(--spacing-xs);
}

.help-section strong {
    color: var(--gold);
}

.help-section span {
    color: var(--blue-accent);
    font-weight: 600;
}

/* Feedback Examples */
.feedback-examples {
    background: var(--bg-primary);
    border-radius: 10px;
    padding: var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.feedback-example {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.feedback-example:last-child {
    margin-bottom: 0;
}

.indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
}

.indicator.gold {
    background: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

.indicator.silver {
    background: var(--silver);
    box-shadow: 0 0 10px var(--silver-glow);
}

.indicator.empty {
    background: transparent;
    border: 2px solid rgba(192, 192, 192, 0.3);
}

.help-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.help-footer label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    color: var(--silver);
}

.help-footer input[type="checkbox"] {
    cursor: pointer;
}

/* === Game Container === */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* === Header === */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.header-left h1 {
    color: var(--gold);
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
    text-shadow: 0 0 20px var(--gold-glow);
}

.subtitle {
    color: var(--silver);
    font-size: 0.9rem;
    font-style: italic;
}

.header-right {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.stat-box {
    background: var(--bg-tertiary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    text-align: center;
    min-width: 100px;
}

.stat-label {
    display: block;
    color: var(--silver);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: bold;
}

/* === Game Board === */
.game-board {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: var(--spacing-xl);
    border: 2px solid var(--border-color);
    min-height: 500px;
}

/* === Mode Selection === */
.mode-selection h2 {
    color: var(--gold);
    text-align: center;
    margin-bottom: var(--spacing-lg);
    font-size: 2rem;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.mode-card {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-primary));
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
}

.mode-card:hover {
    transform: translateY(-5px);
    border-color: var(--gold);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.2);
}

.mode-card h3 {
    color: var(--blue-accent);
    margin-bottom: var(--spacing-sm);
    font-size: 1.3rem;
}

.mode-card p {
    color: #b0b0b0;
    margin-bottom: var(--spacing-sm);
    font-size: 0.95rem;
}

.mode-difficulty {
    display: inline-block;
    background: rgba(255, 215, 0, 0.1);
    color: var(--gold);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-top: var(--spacing-xs);
}

/* === Difficulty Selector === */
.difficulty-selector,
.symbol-type-selector {
    margin-bottom: var(--spacing-xl);
}

.difficulty-selector h3,
.symbol-type-selector h3 {
    color: var(--silver);
    text-align: center;
    margin-bottom: var(--spacing-md);
    font-size: 1.2rem;
}

.difficulty-buttons,
.type-buttons {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.btn-difficulty,
.btn-type {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    color: #d0d0d0;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1rem;
    font-weight: 500;
}

.btn-difficulty:hover,
.btn-type:hover {
    border-color: var(--blue-accent);
    background: rgba(0, 212, 255, 0.1);
}

.btn-difficulty.active,
.btn-type.active {
    background: linear-gradient(135deg, var(--gold), #d4af37);
    border-color: var(--gold);
    color: var(--bg-primary);
    font-weight: bold;
}

/* === Active Game === */
.active-game {
    animation: fadeIn var(--transition-normal);
}

.guess-section {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.guess-section h3 {
    color: var(--blue-accent);
    margin-bottom: var(--spacing-md);
    font-size: 1.3rem;
}

.current-guess {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.guess-slot {
    width: 70px;
    height: 70px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.guess-slot:hover {
    border-color: var(--blue-accent);
    transform: scale(1.05);
}

.guess-slot.filled {
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.guess-slot.selected {
    border-color: var(--blue-accent);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    transform: scale(1.1);
}

/* === Symbol Selector === */
.symbol-selector {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.symbol-option {
    width: 60px;
    height: 60px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.symbol-option:hover {
    border-color: var(--gold);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.symbol-option.used {
    opacity: 0.3;
    cursor: not-allowed;
}

.symbol-option.used:hover {
    transform: none;
    border-color: var(--border-color);
    box-shadow: none;
}

/* Color symbols */
.symbol-option[data-value="red"] { background: #ef4444; }
.symbol-option[data-value="blue"] { background: #3b82f6; }
.symbol-option[data-value="green"] { background: #10b981; }
.symbol-option[data-value="yellow"] { background: #f59e0b; }
.symbol-option[data-value="purple"] { background: #a855f7; }
.symbol-option[data-value="orange"] { background: #f97316; }
.symbol-option[data-value="cyan"] { background: #06b6d4; }
.symbol-option[data-value="pink"] { background: #ec4899; }

/* === Submit Button === */
.btn-submit {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, var(--gold), #d4af37);
    border: none;
    border-radius: 12px;
    color: var(--bg-primary);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.3);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.5);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #666;
}

/* === Guess History === */
.guess-history {
    margin-top: var(--spacing-xl);
}

.guess-history h3 {
    color: var(--silver);
    margin-bottom: var(--spacing-md);
    text-align: center;
    font-size: 1.2rem;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: var(--spacing-sm);
}

.empty-state {
    text-align: center;
    color: #808080;
    font-style: italic;
    padding: var(--spacing-lg);
}

.history-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideInHistory 0.4s ease;
}

@keyframes slideInHistory {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.history-guess {
    display: flex;
    gap: var(--spacing-xs);
}

.history-slot {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 1px solid var(--border-color);
}

.history-feedback {
    display: flex;
    gap: 5px;
    align-items: center;
}

.feedback-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.feedback-indicator.gold {
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

.feedback-indicator.silver {
    background: var(--silver);
    box-shadow: 0 0 8px var(--silver-glow);
}

/* === Game Controls === */
.game-controls {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
    flex-wrap: wrap;
}

/* === Buttons === */
.btn-primary,
.btn-secondary {
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 2px solid;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), #d4af37);
    border-color: var(--gold);
    color: var(--bg-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: #d0d0d0;
}

.btn-secondary:hover {
    border-color: var(--blue-accent);
    background: rgba(0, 212, 255, 0.1);
}

/* === Footer === */
.game-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    color: var(--silver);
}

/* Back to Home Link */
.back-home {
    display: inline-block;
    margin-top: var(--spacing-lg);  /* Changed from spacing-md to spacing-lg for more space */
    color: var(--silver);  /* Changed to silver for better visibility */
    text-decoration: none;
    font-size: 1rem;
    transition: all var(--transition-fast);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 5px;
}

.back-home:hover {
    color: var(--gold);
    background: rgba(192, 192, 192, 0.15);
    transform: translateX(-3px);
}

/* === Win/Lose Modals === */
.win-content,
.lose-content {
    text-align: center;
}

.celebration {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    animation: bounce 0.6s ease infinite alternate;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-20px);
    }
}

.win-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.win-stat {
    background: var(--bg-primary);
    padding: var(--spacing-md);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.win-label {
    display: block;
    color: var(--silver);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.win-value {
    display: block;
    color: var(--gold);
    font-size: 1.8rem;
    font-weight: bold;
}

.secret-code-reveal {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background: var(--bg-primary);
    border-radius: 10px;
}

.secret-code-reveal p {
    color: var(--silver);
    margin-bottom: var(--spacing-sm);
}

.revealed-code {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.revealed-slot {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 2px solid var(--gold);
    animation: revealPulse 1s ease infinite;
}

@keyframes revealPulse {
    0%, 100% {
        box-shadow: 0 0 10px var(--gold-glow);
    }
    50% {
        box-shadow: 0 0 25px var(--gold-glow);
    }
}

.win-actions,
.lose-actions {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    flex-wrap: wrap;
}

.lose-message {
    color: #d0d0d0;
    font-size: 1.1rem;
    margin-bottom: var(--spacing-lg);
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        text-align: center;
    }
    
    .header-left h1 {
        font-size: 2rem;
    }
    
    .header-right {
        width: 100%;
        justify-content: center;
    }
    
    .mode-grid {
        grid-template-columns: 1fr;
    }
    
    .guess-slot {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .symbol-option {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .modal-content {
        width: 95%;
        padding: var(--spacing-lg);
    }
    
    .help-footer {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: var(--spacing-sm);
    }
    
    .game-board {
        padding: var(--spacing-md);
    }
    
    .guess-slot {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .symbol-option {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .history-slot {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* === Scrollbar Styling === */
.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}
