:root {
    --primary-color: #FF006E;
    --secondary-color: #FB5607;
    --accent-color: #FFBE0B;
    --purple-color: #8338EC;
    --blue-color: #3A86FF;
    --bg-dark: #0a0a0a;
    --bg-card: #1a1a1a;
    --text-light: #ffffff;
    --text-gray: #cccccc;
    --border-color: #333;
    --success-color: #00ff88;
    --error-color: #ff4444;
}

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

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

.header {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--primary-color);
    box-shadow: 0 0 20px rgba(255, 0, 110, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.5rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(255, 0, 110, 0.5);
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(255, 0, 110, 0.6);
}

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

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(131, 56, 236, 0.6);
}

.btn-danger {
    background: linear-gradient(45deg, var(--error-color), #cc0000);
    color: white;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(255, 68, 68, 0.6);
}

.main-content {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

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

.content-section.active {
    display: block;
}

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

.game-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-info {
    display: flex;
    justify-content: space-between;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 20px rgba(255, 190, 11, 0.2);
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-gray);
}

#timer, #completed-blocks, #total-blocks {
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

.kakuro-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 12px;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 30px rgba(255, 0, 110, 0.3);
    max-width: 100%;
    margin: 0 auto;
}

.kakuro-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    min-height: 50px;
}

.cell-black {
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    color: var(--accent-color);
    font-size: 0.7rem;
    border: 1px solid #444;
}

.cell-empty {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--border-color);
    cursor: pointer;
    font-size: 1.2rem;
}

.cell-empty:hover {
    border-color: var(--blue-color);
    box-shadow: 0 0 15px rgba(58, 134, 255, 0.4);
}

.cell-empty.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(255, 190, 11, 0.6);
    background: rgba(255, 190, 11, 0.1);
}

.cell-filled {
    background: rgba(58, 134, 255, 0.2);
    border: 2px solid var(--blue-color);
    color: white;
    font-size: 1.2rem;
    text-shadow: 0 0 10px rgba(58, 134, 255, 0.8);
}

.cell-group-complete {
    border-color: var(--success-color) !important;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5) !important;
}

.cell-group-error {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.5) !important;
}

.hint-panel {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid var(--purple-color);
    box-shadow: 0 0 25px rgba(131, 56, 236, 0.4);
    animation: slideUp 0.3s ease-out;
}

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

.hint-panel h3 {
    color: var(--purple-color);
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(131, 56, 236, 0.5);
}

.hint-combinations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.hint-combination {
    background: rgba(131, 56, 236, 0.2);
    padding: 0.5rem;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--purple-color);
    font-family: monospace;
}

.stats-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid var(--secondary-color);
    box-shadow: 0 0 25px rgba(251, 86, 7, 0.3);
}

.stats-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--secondary-color);
    text-shadow: 0 0 15px rgba(251, 86, 7, 0.5);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(251, 86, 7, 0.1);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--secondary-color);
    box-shadow: 0 0 15px rgba(251, 86, 7, 0.2);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary-color);
    text-shadow: 0 0 10px rgba(251, 86, 7, 0.5);
}

.stat-label {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.rules-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid var(--blue-color);
    box-shadow: 0 0 25px rgba(58, 134, 255, 0.3);
}

.rules-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--blue-color);
    text-shadow: 0 0 15px rgba(58, 134, 255, 0.5);
}

.rules-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.rule-item {
    background: rgba(58, 134, 255, 0.1);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--blue-color);
}

.rule-item h3 {
    color: var(--blue-color);
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(58, 134, 255, 0.5);
}

.rule-item ul {
    list-style: none;
    padding-left: 0;
}

.rule-item li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.rule-item li::before {
    content: "▶";
    position: absolute;
    left: 0;
    color: var(--blue-color);
}

.faq-section {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 25px rgba(255, 190, 11, 0.3);
    margin-top: 2rem;
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--accent-color);
    text-shadow: 0 0 15px rgba(255, 190, 11, 0.5);
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 190, 11, 0.1);
}

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

.faq-question:hover {
    background: rgba(255, 190, 11, 0.2);
}

.faq-icon {
    color: var(--accent-color);
    font-weight: bold;
    transition: transform 0.3s ease;
}

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

.faq-answer {
    padding: 0 1rem 1rem 1rem;
    color: var(--text-gray);
    line-height: 1.6;
    animation: fadeIn 0.3s ease-in-out;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem;
    border-top: 2px solid var(--primary-color);
    box-shadow: 0 -5px 20px rgba(255, 0, 110, 0.3);
    z-index: 1000;
}

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

.nav-item.active {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(255, 0, 110, 0.5);
    background: rgba(255, 0, 110, 0.1);
}

.nav-item:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

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

.nav-item span {
    font-size: 0.7rem;
    font-weight: bold;
}

.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-gray);
    font-size: 0.8rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .kakuro-grid {
        padding: 0.5rem;
        gap: 1px;
    }
    
    .kakuro-cell {
        min-height: 45px;
        font-size: 1rem;
    }
    
    .cell-black {
        font-size: 0.6rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .rules-container, .stats-container, .faq-section {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .game-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .kakuro-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .kakuro-cell {
        min-height: 40px;
    }
    
    .hint-combinations {
        grid-template-columns: repeat(2, 1fr);
    }
}
