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

body {
    background: #0f172a;
    color: #ffffff;
    font-family: 'Roboto', sans-serif;
    padding: 0;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Mobile message - hidden by default */
.mobile-message {
    display: none;
}

/* Hide all game content on screens under 1025px */
@media (max-width: 1024px) {
    body {
        overflow: auto;
    }
    
    .mobile-message {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100vh;
        width: 100%;
        padding: 2rem;
        text-align: center;
    }
    
    .mobile-message h2 {
        font-size: 2rem;
        font-weight: 700;
        color: #ffffff;
        margin-bottom: 1rem;
    }
    
    .mobile-message p {
        font-size: 1.125rem;
        color: #cbd5e1;
        line-height: 1.6;
    }
    
    /* Hide all game content */
    .mode-selector-overlay,
    .game-content,
    .modal-overlay {
        display: none !important;
    }
}

.container {
    margin: 0 auto;
    position: relative;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
    box-sizing: border-box;
    overflow: hidden;
    width: 100%;
    max-width: none;
}

h1 {
    text-align: center;
    color: #ffffff;
    font-size: 3rem;
    font-weight: 700;
}

.instructions-heading {
    text-align: center;
    margin: 0.5rem 0 1rem 0;
    font-size: 1.5rem;
    color: #cbd5e1;
    font-weight: 400;
}

.game-area {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0.75rem;
    flex: 1;
    min-height: 0;
    overflow: visible;
    max-height: 100%;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
}

.bottom-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}

.reset-grid-wrapper {
    text-align: center;
}

.rules-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 300px;
    flex-shrink: 0;
    margin: 0 0.75rem;
    align-items: stretch;
}

.grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 1 auto;
    min-height: 0;
    overflow: visible;
    justify-content: center;
    min-width: 520px;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    margin: 0 0.75rem;
    padding: 0;
    border: none;
    border-radius: 1rem;
    overflow: hidden;
    height: 100%;
    aspect-ratio: 1;
    flex-shrink: 0;
}

.number-square {
    background-color: #ffffff;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    border: 1px solid #e5e7eb;
    position: relative;
    z-index: 2;
    border-radius: 1rem;
    cursor: pointer;
    aspect-ratio: 1;
}

.number-square::before,
.number-square::after {
    z-index: 0;
}

.number-square:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.number-square.shaded-group-a {
    background-color: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.number-square.shaded-group-b {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.number-square.shaded-group-c {
    background-color: #fbbf24;
    color: #111827;
    border-color: #fbbf24;
}

.number-square.shaded-group-d {
    background-color: #10b981;
    color: #ffffff;
    border-color: #10b981;
}

.number-square.shaded-group-e {
    background-color: #a855f7;
    color: #ffffff;
    border-color: #a855f7;
}

.number-square.crossed-out {
    position: relative;
}

.number-square.crossed-out::before,
.number-square.crossed-out::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 4px;
    background-color: #ef4444;
    z-index: 10;
    transform-origin: center;
}

.number-square.crossed-out::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.number-square.crossed-out::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.rule-item {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: visible;
}

.rule-item.unrevealed {
    border: 2px dashed #64748b;
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.rule-item.unrevealed:hover {
    border-color: #2563eb;
    background-color: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.rule-item:hover:not(.applied):not(.unrevealed) {
    border-color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transform: translateY(-2px);
}

.rule-item.active {
    border-color: #2563eb;
    background-color: rgba(239, 246, 255, 0.95);
}

.rule-item.applied {
    border-color: #94a3b800;
    background-color: rgba(255, 255, 255, 0.952);
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.rule-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 70px 70px 0;
    border-top-color: transparent;
    border-right-color: #f59e0b;
    border-bottom-color: transparent;
    border-left-color: transparent;
    border-top-right-radius: 1rem;
    border-bottom-left-radius: 1rem;
    z-index: 10;
    box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.15);
}

.reveal-text {
    color: #64748b;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    font-style: italic;
}

.rule-name {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #111827;
    font-size: 2.25rem;
    line-height: 1.4;
    text-align: center;
}

.apply-btn {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 0.2s;
    width: auto;
    align-self: flex-end;
    margin-top: auto;
}

.apply-btn:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.apply-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

.target-display {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 1rem;
    background-color: #1e293b;
    border-radius: 1rem;
    border: 2px solid #2563eb;
    margin: 0.5rem 0;
}

.target-label {
    font-size: 1rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.target-value {
    color: #2563eb;
    font-size: 2rem;
}

.target-instruction {
    text-align: center;
    font-size: 0.875rem;
    color: #cbd5e1;
    margin: 0;
    font-style: italic;
    width: 100%;
    min-height: 20px;
    visibility: hidden;
}

.target-instruction.show {
    visibility: visible;
}

.top-logo {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    padding: 1rem;
}

.top-logo a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #ffffff;
}

.top-logo img {
    height: 32px;
    width: auto;
}

.top-logo h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Roboto', sans-serif;
}

.top-logo #boxtext {
    color: #ffffff;
    font-weight: 300;
}

.top-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
}

.help-btn {
    background-color: #64748b;
    color: #ffffff;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 700;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.help-btn:hover {
    background-color: #475569;
    transform: scale(1.05);
}

.new-challenge-btn {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #111827;
    border: none;
    padding: 1.125rem 2.25rem;
    border-radius: 0.875rem;
    cursor: pointer;
    font-size: 1.0625rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    letter-spacing: 0.025em;
}

.new-challenge-btn:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.new-challenge-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

.show-target-btn {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    padding: 1.5rem 3rem;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 0 auto;
    display: block;
    transition: all 0.2s;
}

.show-target-btn:hover {
    background-color: #1d4ed8;
}

.reset-grid-link {
    display: inline-block;
    text-align: center;
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
    cursor: pointer;
}

.reset-grid-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

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

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content {
    background-color: #ffffff;
    padding: 2.5rem;
    border-radius: 1rem;
    max-width: 600px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: scaleIn 0.3s ease-out;
}

#targetModal .modal-content {
    width: 400px;
    height: 400px;
    max-width: 400px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    box-sizing: border-box;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 0.375rem;
}

.modal-close:hover {
    color: #111827;
    background-color: #f3f4f6;
}

.modal-numbers {
    text-align: center;
    margin-bottom: 2rem;
    color: #111827;
    font-size: 1.75rem;
    line-height: 1.8;
}

#targetModal .modal-numbers {
    margin-bottom: 0;
    font-size: 1.5rem;
}

#modalNumbersList {
    font-size: 1.75rem;
    font-weight: 600;
}

.modal-numbers-label {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #374151;
    font-size: 1rem;
}

.modal-target {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e5e7eb;
}

#targetModal .modal-target {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
}

.modal-target-label {
    font-size: 1.125rem;
    color: #6b7280;
    margin-bottom: 1rem;
    font-weight: 600;
}

.modal-target-value {
    font-size: 10rem;
    font-weight: 700;
    color: #3b82f6;
    line-height: 1;
}

/* Help Modal Styles */
.help-modal-content {
    max-width: 520px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.help-content {
    color: #111827;
}

.help-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1.25rem;
    text-align: center;
}

.help-section {
    margin-bottom: 1rem;
    padding: 0;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #2563eb;
    margin-bottom: 0.375rem;
    display: inline-block;
}

.help-section p {
    font-size: 0.9375rem;
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
}

.mode-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    overflow-y: auto;
    box-sizing: border-box;
}

.mode-selector-overlay.hidden {
    display: none;
}

.mode-selector {
    text-align: center;
    padding: 2rem 2.5rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 1.5rem;
    border: 2px solid #334155;
    max-width: 550px;
    width: 90%;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    margin: auto;
}

/* Custom scrollbar for mode selector */
.mode-selector::-webkit-scrollbar {
    width: 8px;
}

.mode-selector::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
}

.mode-selector::-webkit-scrollbar-thumb {
    background: rgba(51, 65, 85, 0.8);
    border-radius: 4px;
}

.mode-selector::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 85, 105, 0.9);
}

.game-content {
    display: none;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.game-content.show {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
}

.mode-selector h3 {
    color: #ffffff;
    margin-bottom: 1.75rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.steps-container {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    margin-bottom: 2rem;
    text-align: left;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    text-align: left;
}

.step-number {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.step-text {
    color: #e2e8f0;
    font-size: 1.0625rem;
    line-height: 1.6;
    padding-top: 0.375rem;
}

.mode-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #ffffff;
    cursor: pointer;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 2px solid #334155;
    transition: all 0.2s;
    background-color: #0f172a;
}

.mode-option:hover {
    border-color: #2563eb;
    background-color: #1e293b;
}

.mode-option input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: #3b82f6;
}

.mode-option label {
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.next-rule-btn {
    background-color: #fbbf24;
    color: #111827;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    margin: 1rem auto;
    display: block;
}

.next-rule-container {
    background-color: transparent;
    padding: 1.5rem;
    border-radius: 1rem;
    border: none;
    box-shadow: none;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.start-game-btn {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1rem;
    transition: all 0.2s;
    width: 100%;
}

.start-buttons-container {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    margin-top: 0;
}

.start-buttons-container .start-game-btn {
    margin-top: 0;
    padding: 1.25rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    flex: 1;
    transition: all 0.2s ease;
    border: none;
    color: #ffffff;
}

.start-buttons-container .start-game-btn:first-child {
    background: #3b82f6;
}

.start-buttons-container .start-game-btn:last-child {
    background: #60a5fa;
}

.start-buttons-container .start-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.3);
}

.start-buttons-container .start-game-btn:first-child:hover {
    background: #2563eb;
}

.start-buttons-container .start-game-btn:last-child:hover {
    background: #3b82f6;
}

.start-buttons-container .start-game-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

.mode-selector-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
    opacity: 1;
}

.mode-selector-footer img {
    height: 40px;
    width: auto;
}

.mode-selector-footer h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Roboto', sans-serif;
}

.mode-selector-footer #boxtext {
    color: #ffffff;
    font-weight: 300;
}

.start-game-btn:hover {
    background-color: #1d4ed8;
}

.next-rule-btn:hover {
    background-color: #f59e0b;
}

.next-rule-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

@media (max-width: 1024px) {
    .game-area {
        flex-direction: column;
        align-items: center;
    }
    
    .rules-side {
        width: 100%;
        max-width: 600px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .rules-side > * {
        flex: 1 1 calc(50% - 0.75rem);
        min-width: 280px;
    }
}

/* Responsive styles for mode selector on smaller screen heights */
@media (max-height: 700px) {
    .mode-selector {
        padding: 1.5rem 2rem;
        max-height: calc(100vh - 1rem);
    }
    
    .mode-selector h3 {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }
    
    .mode-selector-footer {
        margin-bottom: 1.25rem;
    }
    
    .steps-container {
        gap: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .start-buttons-container {
        gap: 0.875rem;
    }
    
    .start-buttons-container .start-game-btn {
        padding: 1.125rem 1.75rem;
        font-size: 1rem;
    }
}

@media (max-height: 600px) {
    .mode-selector {
        padding: 1.25rem 1.75rem;
    }
    
    .mode-selector h3 {
        font-size: 1.375rem;
        margin-bottom: 1rem;
    }
    
    .mode-selector-footer {
        margin-bottom: 1rem;
    }
    
    .mode-selector-footer img {
        height: 32px;
    }
    
    .mode-selector-footer h2 {
        font-size: 1.75rem;
    }
    
    .steps-container {
        gap: 1rem;
        margin-bottom: 1.25rem;
    }
    
    .step-number {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }
    
    .step-text {
        font-size: 1rem;
        padding-top: 0.25rem;
    }
    
    .start-buttons-container .start-game-btn {
        padding: 1rem 1.5rem;
        font-size: 0.9375rem;
    }
}

/* Responsive styles for main game content on smaller screen heights */
@media (max-height: 900px) {
    .container {
        padding: 0.75rem 1.25rem;
    }
    
    h1 {
        font-size: 2.5rem;
        margin-bottom: 0.25rem;
    }
    
    .instructions-heading {
        font-size: 1.25rem;
        margin: 0.25rem 0 0.75rem 0;
    }
    
    .rules-side {
        width: 280px;
        gap: 1rem;
        margin: 0 0.5rem;
    }
    
    .grid-container {
        flex: 1;
        min-height: 0;
    }
    
    .number-grid {
        height: 100%;
    }
    
    .number-square {
        font-size: 1.875rem;
    }
    
    .rule-item {
        flex: 1;
        min-height: 0;
    }
    
    .bottom-actions {
        margin-top: 0.25rem;
        margin-bottom: 1rem;
        gap: 0.5rem;
    }
    
    .show-target-btn {
        padding: 1.25rem 2.5rem;
        font-size: 1.25rem;
        margin-bottom: 0;
    }
}

@media (max-height: 800px) {
    .container {
        padding: 0.5rem 1rem;
    }
    
    h1 {
        font-size: 2.25rem;
    }
    
    .instructions-heading {
        font-size: 1.125rem;
        margin: 0.25rem 0 0.5rem 0;
    }
    
    .game-area {
        gap: 0.75rem;
    }
    
    .rules-side {
        width: 260px;
        gap: 0.875rem;
        margin: 0 0.375rem;
    }
    
    .grid-container {
        flex: 1;
        min-height: 0;
    }
    
    .number-grid {
        height: 100%;
    }
    
    .number-square {
        font-size: 1.75rem;
    }
    
    .rule-item {
        flex: 1;
        min-height: 0;
        padding: 1.25rem;
    }
    
    .rule-name {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .target-display {
        padding: 0.75rem;
        margin: 0.25rem 0;
    }
    
    .target-value {
        font-size: 1.75rem;
    }
    
    .bottom-actions {
        margin-bottom: 0.75rem;
    }
    
    .show-target-btn {
        padding: 1.125rem 2.25rem;
        font-size: 1.125rem;
        margin-bottom: 0;
    }
}

@media (max-height: 700px) {
    h1 {
        font-size: 2rem;
    }
    
    .instructions-heading {
        font-size: 1rem;
    }
    
    .game-area {
        gap: 0.5rem;
    }
    
    .rules-side {
        width: 240px;
        gap: 0.625rem;
        margin: 0 0.25rem;
    }
    
    .grid-container {
        flex: 1;
        min-height: 0;
    }
    
    .number-grid {
        height: 100%;
    }
    
    .number-square {
        font-size: 1.625rem;
    }
    
    .rule-item {
        flex: 1;
        min-height: 0;
        padding: 1rem;
    }
    
    .rule-name {
        font-size: 1.75rem;
        margin-bottom: 0.5rem;
    }
    
    .target-display {
        padding: 0.5rem;
    }
    
    .target-label {
        font-size: 0.9375rem;
        margin-bottom: 0.25rem;
    }
    
    .target-value {
        font-size: 1.5rem;
    }
    
    .top-logo {
        padding: 0.75rem;
    }
    
    .top-logo img {
        height: 28px;
    }
    
    .top-logo h2 {
        font-size: 1.25rem;
    }
    
    .top-buttons {
        gap: 0.375rem;
    }
    
    .help-btn, .new-challenge-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
}

/* Original Games Link Container */
.original-games-link-container {
    margin-top: 1.5rem;
    text-align: center;
    width: 100%;
}

.original-games-link {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-block;
}

.original-games-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Number Detectives Modal */
.number-detectives-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2005;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.number-detectives-modal.active {
    display: flex;
}

.number-detectives-modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 1.5rem;
    padding: 1.5rem 1.5rem;
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    border: 2px solid #334155;
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

.number-detectives-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.number-detectives-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.number-detectives-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #cbd5e1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
    line-height: 1;
}

.number-detectives-modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.number-detectives-links-container {
    overflow: visible;
    flex: 1;
    min-height: 0;
    box-sizing: border-box;
}

.number-detectives-link {
    display: block;
    padding: 0.75rem 1rem;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.number-detectives-link:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

/* Responsive styles for number detectives modal */
@media (max-width: 768px) {
    .number-detectives-modal-content {
        width: 98%;
        padding: 0.75rem;
        max-height: 95vh;
    }
    
    .number-detectives-modal-title {
        font-size: 1.25rem;
    }
    
    .number-detectives-links-container {
        overflow-y: auto;
    }
    
    .number-detectives-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 0.4rem !important;
        padding: 0.4rem !important;
        width: 100%;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    .number-detectives-link {
        font-size: 0.9rem !important;
        padding: 0.25rem !important;
        aspect-ratio: 1 !important;
        min-width: 0 !important;
        min-height: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 480px) {
    .number-detectives-modal-content {
        width: 100%;
        padding: 0.5rem;
        border-radius: 1rem;
    }
    
    .number-detectives-modal-header {
        margin-bottom: 0.5rem;
    }
    
    .number-detectives-modal-title {
        font-size: 1rem;
    }
    
    .number-detectives-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 0.3rem !important;
        padding: 0.3rem !important;
    }
    
    .number-detectives-link {
        font-size: 0.85rem !important;
        padding: 0.2rem !important;
        aspect-ratio: 1 !important;
    }
}