:root {
    --primary: #3498db;
    --dark-blue: #2980b9;
    --milky: #fdfaf5;
    --border: #e5eef5;
    --danger: #e74c3c;
    --warning: #f39c12;
    --text-muted: #6b7280;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--milky);
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 96px;
    color: #2c3e50;
}

.game-page {
    width: 100%;
    max-width: 700px;
    padding: 16px;
}

.breadcrumbs {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.5;
}

.breadcrumbs a {
    text-decoration: none;
    color: var(--primary);
}

.breadcrumbs span {
    margin: 0 4px;
}

.page-topbar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin: 0 0 12px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
}

.back-link:hover {
    color: var(--dark-blue);
}

.content-block,
.faq-block,
.seo-accordion,
.how-to-play {
    width: 100%;
    margin: 0 0 24px;
    padding: 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.content-block h1,
.content-block h2,
.faq-block h2,
.seo-accordion h2,
.how-to-play h2 {
    margin: 0 0 12px;
    color: var(--dark-blue);
    font-size: 16px;
    text-transform: uppercase;
}

.content-block p,
.faq-item p,
.seo-details-content p,
.how-to-play li {
    margin: 0 0 12px;
    line-height: 1.65;
    font-size: 14px;
}

.intro-block {
    margin-top: 6px;
}

#game-controls-area {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.diff-picker {
    display: flex;
    gap: 4px;
    width: 100%;
}

.diff-picker button {
    flex: 1;
    padding: 6px 8px;
    font-size: 10px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
}

.diff-picker button.active {
    background: var(--primary);
    color: white;
}

.stat-badge {
    background: white;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 38px;
    min-width: 80px;
}

.stat-badge .label {
    font-size: 9px;
    color: #95a5a6;
    text-transform: uppercase;
}

.stat-badge #stat-steps {
    font-size: 16px;
    font-weight: bold;
    color: var(--dark-blue);
}

.action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    text-transform: uppercase;
    font-size: 12px;
}

.action-btn.undo {
    background: var(--warning);
}

.action-btn.reset {
    background: var(--danger);
}

.action-btn.action-btn-primary {
    background: var(--primary);
    width: 160px;
    flex: 0 0 auto;
    align-self: center;
}

#game-canvas-wrapper {
    position: relative;
    margin: 20px auto 24px;
    width: fit-content;
    max-width: 100%;
}

#game-canvas-area {
    margin: 0 auto;
    border: 2px solid var(--primary);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.05);
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.game-grid {
    display: grid;
    width: 100%;
    height: 100%;
}

.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    font-weight: bold;
    color: #95a5a6;
    line-height: 1;
    background-color: rgba(0, 0, 0, 0.04);
    outline: none;
}

.cell.valid-move {
    background-color: transparent;
    cursor: pointer;
    color: var(--dark-blue);
}

.cell.risky-move {
    background-color: rgba(231, 76, 60, 0.10);
    color: #c0392b;
}

.cell.valid-move:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
}

.cell.last-move {
    background-color: rgba(52, 152, 219, 0.25);
    color: var(--dark-blue);
}

#game-message-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s;
    text-align: center;
    padding: 20px;
}

.overlay-hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-visible {
    opacity: 1;
    pointer-events: auto;
    backdrop-filter: blur(4px);
}

.msg-container {
    background: white;
    padding: 30px;
    border-radius: 16px;
    border: 2px solid var(--primary);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.msg-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--dark-blue);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.msg-body {
    font-size: 14px;
    color: #7f8c8d;
    line-height: 1.5;
}

.overlay-actions {
    margin: 0;
}

.seo-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.65;
}

.seo-list li {
    margin-bottom: 8px;
}

.seo-details {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    overflow: hidden;
}

.seo-details summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.seo-details summary::-webkit-details-marker {
    display: none;
}

.seo-details summary::after {
    content: "+";
    float: right;
    font-size: 20px;
    line-height: 1;
}

.seo-details[open] summary::after {
    content: "−";
}

.seo-details-content {
    padding: 0 16px 16px;
}

.faq-item {
    margin-bottom: 18px;
}

.faq-item:last-child {
    margin-bottom: 0;
}

.faq-item h3 {
    margin: 0 0 8px;
    font-size: 18px;
    line-height: 1.35;
}

.ad-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(253, 250, 245, 0.95);
    backdrop-filter: blur(5px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

@media (max-width: 640px) {
    .game-page {
        padding: 12px;
    }

    .breadcrumbs {
        font-size: 13px;
    }

    .faq-item h3 {
        font-size: 17px;
    }

    .seo-details summary {
        padding: 13px 14px;
    }

    .seo-details-content {
        padding: 0 14px 14px;
    }
}

@media (max-width: 520px) {
    .control-row {
        gap: 8px;
    }

    .msg-container {
        max-width: 92%;
        padding: 22px;
    }

    .msg-title {
        font-size: 20px;
    }
}
