:root {
    --primary-color: #FF006E;
    --secondary-color: #FB5607;
    --accent-color: #FFBE0B;
    --purple-color: #8338EC;
    --blue-color: #3A86FF;
    --bg-dark: #0a0a0a;
    --bg-medium: #1a1a1a;
    --bg-light: #2a2a2a;
    --text-light: #ffffff;
    --text-medium: #cccccc;
    --text-dark: #888888;
    --success-color: #00ff88;
    --error-color: #ff3366;
    --warning-color: #ffaa00;
}

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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
    color: var(--text-light);
    min-height: 100vh;
    padding-bottom: 80px;
    overflow-x: hidden;
}

body.classic-theme {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    color: #333;
}

header {
    text-align: center;
    padding: 20px;
    background: linear-gradient(45deg, var(--primary-color), var(--purple-color));
    box-shadow: 0 4px 20px rgba(255, 0, 110, 0.3);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

header h1 {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-bottom: 5px;
    position: relative;
    z-index: 1;
}

header p {
    font-size: 1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

main {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.section.active {
    display: block;
}

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

/* Game Styles */
.game-container {
    background: var(--bg-light);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.game-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.difficulty {
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

.btn-primary, .btn-secondary, .btn-danger {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(255, 0, 110, 0.3);
}

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

.btn-secondary {
    background: linear-gradient(45deg, var(--purple-color), var(--blue-color));
    color: white;
    box-shadow: 0 4px 15px rgba(131, 56, 236, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(131, 56, 236, 0.4);
}

.btn-danger {
    background: linear-gradient(45deg, var(--error-color), #ff6b6b);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 51, 102, 0.4);
}

.puzzle-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding: 10px;
}

.puzzle-grid {
    display: grid;
    gap: 2px;
    background: var(--bg-dark);
    padding: 10px;
    border-radius: 10px;
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.5);
    max-width: 100%;
}

.puzzle-cell {
    width: 40px;
    height: 40px;
    background: var(--bg-light);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 1.2rem;
    position: relative;
}

.puzzle-cell:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.puzzle-cell.selected {
    background: var(--accent-color);
    color: var(--bg-dark);
    box-shadow: 0 0 20px rgba(255, 190, 11, 0.6);
    transform: scale(1.1);
}

.puzzle-cell.conflict {
    background: var(--error-color);
    color: white;
    box-shadow: 0 0 20px rgba(255, 51, 102, 0.6);
    animation: pulse 1s infinite;
}

.puzzle-cell.hint {
    background: var(--success-color);
    color: var(--bg-dark);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
    animation: glow 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.6); }
    50% { box-shadow: 0 0 30px rgba(0, 255, 136, 0.9); }
}

.puzzle-cell.given {
    background: var(--blue-color);
    color: white;
    cursor: not-allowed;
}

.puzzle-cell::before {
    content: attr(data-region);
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 8px;
    opacity: 0.6;
    pointer-events: none;
}

.region-counters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
}

.region-counter {
    background: var(--bg-medium);
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.region-counter.complete {
    background: var(--success-color);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.game-status {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: var(--bg-medium);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-item {
    display: flex;
    gap: 5px;
    align-items: center;
}

.status-item span:last-child {
    font-weight: bold;
    color: var(--accent-color);
}

/* Tutorial Styles */
.tutorial-container {
    background: var(--bg-light);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-container h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    text-shadow: 0 0 20px rgba(255, 0, 110, 0.5);
}

.tutorial-section {
    margin-bottom: 30px;
}

.tutorial-section h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.3);
}

.rule-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-medium);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.rule-number {
    background: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.4);
}

.rule-content {
    flex: 1;
    line-height: 1.6;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--bg-medium);
    border-radius: 8px;
}

.instruction-item i {
    color: var(--blue-color);
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    padding: 10px;
    margin-bottom: 10px;
    background: var(--bg-medium);
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    position: relative;
    padding-left: 40px;
}

.tips-list li::before {
    content: '💡';
    position: absolute;
    left: 10px;
    top: 10px;
}

/* FAQ Styles */
.faq-container {
    background: var(--bg-light);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.faq-container h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    text-shadow: 0 0 20px rgba(255, 0, 110, 0.5);
}

.faq-item {
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.faq-question {
    width: 100%;
    padding: 20px;
    background: var(--bg-medium);
    color: var(--text-light);
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: rgba(255, 255, 255, 0.1);
}

.faq-question[aria-expanded="true"] {
    background: var(--primary-color);
    color: white;
}

.faq-icon {
    font-size: 1.5rem;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 20px;
    background: var(--bg-dark);
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-answer.show {
    padding: 20px;
    max-height: 200px;
}

.faq-answer p {
    line-height: 1.6;
    color: var(--text-medium);
}

/* Settings Styles */
.settings-container {
    background: var(--bg-light);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-container h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    text-shadow: 0 0 20px rgba(255, 0, 110, 0.5);
}

.setting-group {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-medium);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-group h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.3);
}

.setting-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.setting-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.setting-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-medium);
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
}

.setting-option input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary-color);
    background: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.4);
}

.setting-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.option-label {
    font-size: 1rem;
    color: var(--text-light);
}

.setting-toggle {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-dark);
    transition: 0.4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.4);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.data-management {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.stats-display {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--bg-dark);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
    color: var(--text-medium);
}

.stat-value {
    color: var(--accent-color);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.3);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: var(--text-medium);
    transition: all 0.3s ease;
    padding: 10px;
    border-radius: 10px;
    min-width: 60px;
}

.nav-item:hover, .nav-item.active {
    color: var(--primary-color);
    background: rgba(255, 0, 110, 0.1);
    transform: translateY(-2px);
}

.nav-item i {
    font-size: 1.5rem;
}

.nav-item span {
    font-size: 0.8rem;
    font-weight: 500;
}

.nav-item.active i {
    text-shadow: 0 0 15px rgba(255, 0, 110, 0.6);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-dark);
    font-size: 0.9rem;
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 480px) {
    main {
        padding: 15px;
    }
    
    .game-header {
        gap: 10px;
    }
    
    .game-controls {
        justify-content: center;
    }
    
    .btn-primary, .btn-secondary, .btn-danger {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .puzzle-cell {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .game-status {
        flex-direction: column;
        text-align: center;
    }
    
    .tutorial-container, .faq-container, .settings-container {
        padding: 20px;
    }
    
    .rule-item {
        flex-direction: column;
        text-align: center;
    }
    
    .data-management {
        flex-direction: column;
    }
}

@media (min-width: 768px) {
    .puzzle-cell {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
    }
    
    .game-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .setting-options {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .stats-display {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .data-management {
        justify-content: center;
    }
}

/* Success Animation */
.puzzle-complete {
    animation: celebrate 2s ease-in-out;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.05); }
    50% { transform: scale(1.1); }
    75% { transform: scale(1.05); }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: var(--bg-dark);
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: var(--error-color);
    color: white;
    box-shadow: 0 4px 20px rgba(255, 51, 102, 0.3);
}

.toast.warning {
    background: var(--warning-color);
    color: var(--bg-dark);
    box-shadow: 0 4px 20px rgba(255, 170, 0, 0.3);
}
