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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 5px;
    font-weight: bold;
}

.puzzle-date {
    color: #7f8c8d;
    font-size: 1.1em;
    margin-bottom: 10px;
    font-weight: 500;
}

.game-description {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.nyt-comparison {
    display: none !important;
}

.free-badge {
    background: white;
    color: #27ae60;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.vs-text {
    color: white;
    font-weight: 600;
    font-size: 14px;
    text-decoration: line-through;
    opacity: 0.9;
}

/* NYT Mini Comparison Section */
.nyt-mini-comparison {
    display: none !important;
}

.nyt-mini-comparison h2 {
    color: #2c3e50;
    font-size: 1.8em;
    margin-bottom: 25px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.comparison-item {
    padding: 20px;
    border-radius: 10px;
    text-align: left;
}

.comparison-item.free {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: 3px solid #229954;
}

.comparison-item.paid {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    opacity: 0.8;
}

.comparison-item h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
    text-align: center;
}

.comparison-item.free h3 {
    color: white;
}

.comparison-item.paid h3 {
    color: #6c757d;
}

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

.comparison-item li {
    margin-bottom: 8px;
    padding: 5px 0;
    font-size: 0.95em;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.comparison-item.paid li {
    border-bottom: 1px solid #dee2e6;
    color: #6c757d;
}

.comparison-cta {
    font-size: 1.1em;
    color: #27ae60;
    font-weight: 600;
    margin-top: 20px;
}

.next-puzzle {
    color: #27ae60;
    font-weight: 600;
    margin-top: 10px;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #95a5a6;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

#timer {
    font-size: 1.4em;
    font-weight: bold;
    color: #e74c3c;
    font-family: 'Monaco', 'Consolas', monospace;
    background: #fff;
    padding: 8px 16px;
    border-radius: 5px;
    border: 2px solid #e74c3c;
}

.feedback-message {
    background: #f39c12;
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: bold;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.feedback-message.show {
    opacity: 1;
    transform: translateY(0);
}

.game-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.crossword-section {
    display: flex;
    justify-content: center;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.crossword-grid {
    display: grid;
    gap: 2px;
    background-color: #34495e;
    padding: 2px;
    border-radius: 5px;
    width: min(300px, 80vw);
    height: min(300px, 80vw);
    max-width: 400px;
    max-height: 400px;
}

/* Mobile-specific crossword sizing */
.mobile-layout .crossword-grid {
    width: min(250px, 60vw, calc(100vh - 220px));
    height: min(250px, 60vw, calc(100vh - 220px));
    max-width: 320px;
    max-height: 320px;
}

.cell {
    position: relative;
    background: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.cell.blocked {
    background: #2c3e50;
    cursor: default;
}

.cell:not(.blocked):hover {
    background: #ecf0f1;
}

.cell.selected {
    background: #3498db !important;
    color: white;
}

.cell.highlighted {
    background: #87ceeb !important;
    transition: background-color 0.2s ease;
}

.cell.correct {
    background: #27ae60 !important;
    color: white;
}

.cell.incorrect {
    background: #e74c3c !important;
    color: white;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.cell-number {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 10px;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1;
}

.cell.selected .cell-number {
    color: white;
}

.cell-input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: inherit;
    outline: none;
    text-transform: uppercase;
    caret-color: transparent;
}

.clues-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.clues-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.clues-column h3 {
    font-size: 1.4em;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #3498db;
}

.clues-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clue {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #3498db;
    transition: all 0.2s ease;
    cursor: pointer;
}

.clue:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.clue.active {
    background: #3498db;
    color: white;
    border-left-color: #2980b9;
    transform: translateX(5px);
}

.clue-number {
    font-weight: bold;
    color: #2c3e50;
    margin-right: 8px;
    min-width: 20px;
    display: inline-block;
}

.completion-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.completion-message.hidden {
    display: none;
}

.message-content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: celebrationPop 0.6s ease-out;
}

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

.message-content h2 {
    color: #27ae60;
    font-size: 2.5em;
    margin-bottom: 15px;
}

.message-content p {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 25px;
}

.completion-stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 1em;
}

.completion-stats div {
    margin-bottom: 5px;
}

.completion-stats strong {
    color: #2c3e50;
}

.social-sharing {
    margin: 20px 0;
    padding: 15px;
    background: #ecf0f1;
    border-radius: 8px;
}

.social-sharing h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.social-sharing .btn {
    margin: 5px;
}

.btn-share {
    background: #27ae60;
}

.btn-share:hover {
    background: #229954;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px;
    border-bottom: 2px solid #ecf0f1;
}

.modal-header h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 1.5em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.modal-body {
    padding: 20px 25px 25px;
}

.shortcut-grid {
    display: grid;
    gap: 15px;
}

.shortcut-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 15px;
    align-items: start;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #3498db;
}

.shortcut-key {
    font-weight: bold;
    color: #2c3e50;
    background: white;
    padding: 6px 10px;
    border-radius: 4px;
    text-align: center;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    border: 1px solid #dee2e6;
}

.shortcut-desc {
    color: #555;
    line-height: 1.4;
}

/* Mobile Interface Styles */
.mobile-interface {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    z-index: 100;
}

.mobile-interface.hidden {
    display: none;
}

.mobile-clues-container {
    background: #87ceeb;
    padding: 8px 12px;
    border-bottom: 1px solid #5dade2;
}

.mobile-clue-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    gap: 4px;
}

.clue-navigation {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 350px;
}

.mobile-timer {
    color: white;
    font-size: 12px;
    font-weight: bold;
    font-family: 'Monaco', 'Consolas', monospace;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-btn {
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid white;
    color: white;
    padding: 4px 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.nav-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.7);
}

.action-key {
    background: #e74c3c !important;
    color: white !important;
    font-weight: bold;
    font-size: 16px;
    text-transform: uppercase;
    min-width: 70px;
}

.action-key:hover {
    background: #c0392b !important;
    transform: translateY(-1px);
}

.action-key:active {
    background: #a93226 !important;
    transform: translateY(0);
}

#mobile-clue-text {
    color: white;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    flex: 1;
    line-height: 1.2;
    padding: 0 6px;
}

.mobile-keyboard {
    padding: 16px 8px 20px;
    background: #f8f9fa;
    min-height: 280px;
}

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

.keyboard-row:last-child {
    margin-bottom: 0;
}

.key {
    background: white;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 14px 8px;
    font-size: 20px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    min-width: 42px;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    user-select: none;
}

.key:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.key:active {
    transform: translateY(0);
    background: #dee2e6;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.key.wide-key {
    padding: 14px 18px;
    font-size: 16px;
    min-width: 80px;
}

#backspace-key {
    font-size: 24px;
    min-width: 60px;
}

/* Desktop/Mobile Layout Toggle */
.desktop-layout .mobile-interface {
    display: none;
}

.mobile-layout .clues-section {
    display: none;
}

.mobile-layout #show-shortcuts {
    display: none;
}

.mobile-layout #new-puzzle {
    display: none;
}

.mobile-layout #check-answers {
    display: none;
}

.mobile-layout #timer {
    display: none;
}

.mobile-layout .controls {
    display: none;
}

.mobile-layout header {
    padding: 10px;
    margin-bottom: 15px;
}

.mobile-layout h1 {
    font-size: 1.5em;
    margin-bottom: 0;
}

.mobile-layout .game-container {
    grid-template-columns: 1fr;
    padding-bottom: 140px; /* Further reduced space with cleaner interface */
    gap: 15px;
}

.mobile-layout .crossword-section {
    display: flex;
    justify-content: center;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .crossword-grid {
        width: min(280px, 75vw);
        height: min(280px, 75vw);
    }
    
    .mobile-layout .crossword-grid {
        width: min(220px, 55vw, calc(100vh - 200px));
        height: min(220px, 55vw, calc(100vh - 200px));
    }
    
    .clues-container {
        flex-direction: row;
    }
    
    .clues-column {
        flex: 1;
    }
    
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    /* Enable mobile interface on tablets */
    .mobile-interface.hidden {
        display: block;
    }
    
    .clues-section {
        display: none;
    }
    
    .game-container {
        padding-bottom: 140px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .crossword-grid {
        width: min(240px, 70vw);
        height: min(240px, 70vw);
    }
    
    .mobile-layout .crossword-grid {
        width: min(200px, 50vw, calc(100vh - 180px));
        height: min(200px, 50vw, calc(100vh - 180px));
    }
    
    .clues-container {
        flex-direction: column;
    }
    
    .cell-input {
        font-size: 18px;
    }
    
    .key {
        min-width: 38px;
        min-height: 48px;
        padding: 12px 6px;
        font-size: 18px;
    }
    
    .keyboard-row {
        gap: 4px;
    }
    
    .mobile-keyboard {
        padding: 12px 5px 16px;
        min-height: 260px;
    }
}

/* Footer Styles */
.site-footer {
    display: none !important;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-section h3 {
    color: #3498db;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.footer-section p {
    line-height: 1.6;
    color: #ecf0f1;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section li {
    margin-bottom: 8px;
    color: #ecf0f1;
    position: relative;
    padding-left: 20px;
}

.footer-section li:before {
    content: "→";
    color: #3498db;
    position: absolute;
    left: 0;
}

.footer-bottom {
    border-top: 1px solid #34495e;
    margin-top: 30px;
    padding-top: 20px;
    text-align: center;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
}

.footer-links a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #5dade2;
}

/* Very small screens */
@media (max-width: 360px) {
    .crossword-grid {
        width: min(220px, 65vw);
        height: min(220px, 65vw);
    }
    
    .mobile-layout .crossword-grid {
        width: min(180px, 45vw, calc(100vh - 160px));
        height: min(180px, 45vw, calc(100vh - 160px));
    }
    
    .key {
        min-width: 32px;
        min-height: 44px;
        padding: 10px 4px;
        font-size: 16px;
    }
    
    .keyboard-row {
        gap: 3px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
}