:root {
    --bg-color: #fff0f0;
    --text-color: #2d3436;
    --apple-color: #ff4757;
    --apple-text: #ffffff;
    --apple-bg: #ffffff;
    --apple-border: #ffd1d1;
    --apple-hover-border: #ff7f50;
    --apple-selected: #ff6b81;
    --apple-cleared: transparent;
    --grid-bg: #fff;
    --board-shadow: 0 10px 40px rgba(255, 71, 87, 0.15);
    --primary-btn: #ff4757;
    --primary-btn-hover: #ff6b81;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    -webkit-tap-highlight-color: transparent;
}

.page-container {
    max-width: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.seo-header {
    text-align: center;
    background: #fff;
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: var(--board-shadow);
    width: 100%;
}

.seo-header h1 {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--apple-color);
    margin-bottom: 10px;
}

.seo-header p {
    font-size: 1.1rem;
    color: #636e72;
    line-height: 1.5;
}

.game-wrapper {
    background: var(--grid-bg);
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--board-shadow);
    position: relative;
    width: 100%;
}

.game-ui {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 700;
}

.score-board, .timer-board {
    background: #f1f2f6;
    padding: 10px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.value {
    color: var(--apple-color);
    margin-left: 8px;
    font-weight: 900;
    font-size: 1.4rem;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-gap: 4px;
    width: 100%;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 12px;
    position: relative;
    touch-action: none; 
}

.apple {
    background: var(--apple-bg);
    border: 2px solid var(--apple-border);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1rem, 4vw, 1.4rem);
    font-weight: 900;
    color: var(--text-color);
    cursor: pointer;
    transition: transform 0.15s, background-color 0.2s, opacity 0.3s;
    aspect-ratio: 1/1;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.apple:hover {
    border-color: var(--apple-hover-border);
}

.apple.selected {
    background: var(--apple-selected);
    color: #fff;
    border-color: var(--apple-selected);
    transform: scale(0.85);
    box-shadow: inset 0 3px 5px rgba(0,0,0,0.2);
}

.apple.cleared {
    opacity: 0;
    /* We don't use pointer-events: none so that dragging over cleared spaces continues correctly */
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.4s ease-in-out;
}

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

.overlay-content {
    text-align: center;
    background: #fff;
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-overlay.hidden .overlay-content {
    transform: translateY(20px);
}

.overlay-content h2 {
    font-size: 2.5rem;
    color: var(--apple-color);
    margin-bottom: 10px;
}

.overlay-content p {
    font-size: 1.5rem;
    margin-bottom: 30px;
    font-weight: 700;
    color: #2d3436;
}

.btn-primary {
    background: var(--primary-btn);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 900;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 8px 15px rgba(255, 71, 87, 0.3);
}

.btn-primary:active {
    transform: scale(0.95);
    box-shadow: 0 4px 10px rgba(255, 71, 87, 0.2);
}

.btn-primary:hover {
    background: var(--primary-btn-hover);
}

.seo-article {
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--board-shadow);
    width: 100%;
    line-height: 1.7;
}

.seo-article h2 {
    font-size: 1.6rem;
    margin-bottom: 20px;
    color: var(--text-color);
}

.seo-article ul {
    list-style-position: inside;
    color: #636e72;
}

.seo-article li {
    margin-bottom: 12px;
}
