/* ================================
   WORDLE FUN - COMPLETE STYLES
   ================================ */

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

:root {
    --color-correct: #6aaa64;
    --color-present: #c9b458;
    --color-absent: #787c7e;
    --color-empty: #d3d6da;
    --color-bg: #ffffff;
    --color-text: #1a1a1b;
    --color-border: #d3d6da;
    --color-key-bg: #d3d6da;
    --color-primary: #6aaa64;
    --gap: 5px;
    --tile-size: 62px;
    --border-radius: 4px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
.header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
}

.header h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 14px;
    color: #787c7e;
}

/* Game Container */
.game-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.game-main {
    width: 100%;
}

@media (min-width: 1024px) {
    .game-container {
        grid-template-columns: 1fr 300px;
        max-width: 900px;
    }
}

/* Categories - NOW ON TOP */
.categories {
    margin: 0 0 30px 0;
    text-align: center;
    order: -1;
}

.categories h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #787c7e;
}

.category-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.category-btn {
    padding: 12px 8px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: white;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.category-btn:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
}

.category-btn.active {
    background: var(--color-correct);
    color: white;
    border-color: var(--color-correct);
}

/* Game Board */
.board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: var(--gap);
    margin: 20px auto;
    width: fit-content;
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--gap);
}

.tile {
    width: var(--tile-size);
    height: var(--tile-size);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    text-transform: uppercase;
    background: white;
    color: var(--color-text);
    transition: all 0.3s ease;
}

.tile.filled {
    border-color: #878a8c;
    animation: pop 0.1s ease-in-out;
}

.tile.correct {
    background: var(--color-correct);
    border-color: var(--color-correct);
    color: white;
}

.tile.present {
    background: var(--color-present);
    border-color: var(--color-present);
    color: white;
}

.tile.absent {
    background: var(--color-absent);
    border-color: var(--color-absent);
    color: white;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.tile.flip {
    animation: flip 0.5s ease-in-out;
}

@keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

.row.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.row.win {
    animation: bounce 1s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

/* Message Display */
.message {
    text-align: center;
    padding: 10px;
    margin: 10px 0;
    border-radius: 8px;
    font-weight: 600;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message.show {
    background: #f3f4f6;
    animation: slideDown 0.3s ease-out;
}

.message.error {
    background: #fef2f2;
    color: #dc2626;
}

.message.success {
    background: #f0fdf4;
    color: #16a34a;
}

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

/* Keyboard */
.keyboard {
    margin: 20px auto;
    max-width: 500px;
}

.keyboard-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 8px;
}

.key {
    font-family: inherit;
    font-weight: 600;
    border: none;
    padding: 0;
    height: 58px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    background: var(--color-key-bg);
    color: var(--color-text);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    text-transform: uppercase;
    transition: all 0.1s ease;
    min-width: 0;
}

.key:hover {
    background: #bbbec1;
}

.key.wide {
    flex: 1.5;
    font-size: 12px;
}

.key.correct {
    background: var(--color-correct);
    color: white;
}

.key.present {
    background: var(--color-present);
    color: white;
}

.key.absent {
    background: var(--color-absent);
    color: white;
}

.key:active {
    transform: scale(0.95);
}

/* Game Actions */
.game-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: #5a9958;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-secondary {
    background: white;
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    background: #f3f4f6;
}

/* How to Play */
.how-to-play {
    margin: 40px 0;
    padding: 30px;
    background: #f9fafb;
    border-radius: 12px;
}

.how-to-play h3 {
    font-size: 20px;
    margin-bottom: 15px;
}

.how-to-play ul {
    margin: 15px 0 15px 30px;
}

.how-to-play li {
    margin: 8px 0;
}

.example-tiles {
    display: flex;
    gap: 5px;
    align-items: center;
    margin: 15px 0;
}

.tile-example {
    width: 40px;
    height: 40px;
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    background: white;
    border-radius: 4px;
}

.tile-example.correct {
    background: var(--color-correct);
    border-color: var(--color-correct);
    color: white;
}

.tile-example.present {
    background: var(--color-present);
    border-color: var(--color-present);
    color: white;
}

.tile-example.absent {
    background: var(--color-absent);
    border-color: var(--color-absent);
    color: white;
}

.example-tiles p {
    margin-left: 15px;
    font-size: 14px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    background: white;
    padding: 40px 30px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

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

.modal-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
    text-align: center;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    font-weight: 300;
    color: #787c7e;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--color-text);
}

/* Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 30px 0;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    color: #787c7e;
    margin-top: 5px;
}

.guess-distribution {
    margin-top: 20px;
}

.guess-bar {
    display: flex;
    align-items: center;
    margin: 8px 0;
}

.guess-number {
    font-weight: 700;
    margin-right: 10px;
    width: 15px;
}

.guess-bar-fill {
    background: var(--color-correct);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 20px;
    text-align: right;
    font-weight: 600;
    font-size: 14px;
}

/* Result Modal */
.result-message {
    font-size: 18px;
    text-align: center;
    margin: 15px 0;
}

.answer-reveal {
    text-align: center;
    font-size: 16px;
    margin: 20px 0;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

.answer-reveal strong {
    font-size: 24px;
    color: var(--color-correct);
}

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

/* ================================
   AD SPACES - CENTERED
   ================================ */

.ad-space {
    margin: 20px auto;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.ad-placeholder {
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    padding: 20px;
    color: #9ca3af;
    font-size: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
}

/* Top Banner Ad */
.ad-top {
    max-width: 728px;
}

.ad-top .ad-placeholder {
    width: 100%;
    max-width: 728px;
    height: 90px;
}

/* Sidebar Ad (Desktop only) */
.ad-sidebar {
    display: none;
}

@media (min-width: 1024px) {
    .ad-sidebar {
        display: flex;
        position: sticky;
        top: 20px;
        height: fit-content;
    }
    
    .ad-sidebar .ad-placeholder {
        width: 300px;
        height: 600px;
    }
}

/* Mid-content Ad */
.ad-mid-content {
    max-width: 336px;
}

.ad-mid-content .ad-placeholder {
    width: 100%;
    max-width: 336px;
    height: 280px;
}

/* Content Ad */
.ad-content {
    max-width: 336px;
}

.ad-content .ad-placeholder {
    width: 100%;
    max-width: 336px;
    height: 280px;
}

/* Footer Ad */
.ad-footer {
    max-width: 728px;
}

.ad-footer .ad-placeholder {
    width: 100%;
    max-width: 728px;
    height: 90px;
}

/* Mobile Ad Adjustments */
@media (max-width: 768px) {
    .ad-top {
        max-width: 320px;
    }
    
    .ad-top .ad-placeholder {
        max-width: 320px;
        height: 50px;
    }
    
    .ad-footer {
        max-width: 320px;
    }
    
    .ad-footer .ad-placeholder {
        max-width: 320px;
        height: 50px;
    }
    
    .ad-mid-content .ad-placeholder,
    .ad-content .ad-placeholder {
        max-width: 320px;
        height: 250px;
    }
}

/* Hide placeholder when real ads load */
.adsbygoogle:not(:empty) + .ad-placeholder {
    display: none;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 60px;
    border-top: 1px solid var(--color-border);
    font-size: 14px;
    color: #787c7e;
}

.footer p {
    margin: 8px 0;
}

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

.footer a:hover {
    text-decoration: underline;
}

.disclaimer {
    font-size: 12px;
    font-style: italic;
}

/* Content Page (Privacy Policy) */
.content-page {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.content-page article {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.content-page h2 {
    font-size: 24px;
    margin: 30px 0 15px 0;
}

.content-page h3 {
    font-size: 18px;
    margin: 20px 0 10px 0;
}

.content-page p {
    margin: 15px 0;
    line-height: 1.8;
}

.back-link {
    margin-top: 40px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 600px) {
    :root {
        --tile-size: 52px;
    }
    
    .header h1 {
        font-size: 28px;
    }
    
    .tile {
        font-size: 28px;
    }
    
    .key {
        height: 48px;
        font-size: 12px;
    }
    
    .category-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .category-btn {
        padding: 10px 6px;
        font-size: 13px;
    }
    
    .categories h3 {
        font-size: 16px;
    }
    
    .game-actions {
        flex-direction: column;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .content-page article {
        padding: 30px 20px;
    }
}

@media (max-width: 400px) {
    :root {
        --tile-size: 46px;
        --gap: 4px;
    }
    
    .tile {
        font-size: 24px;
    }
    
    .key {
        font-size: 11px;
    }
    
    .keyboard-row {
        gap: 4px;
    }
}