
/* Logo Image */
.logo-img {
    max-width: 500px;
    height: auto;
    margin: 0 auto -25px auto;
    display: block;
}

header .subtitle {
    margin-top: 0;
}

/* Logo theme switching */
.logo-light {
    display: none;
}

.logo-dark {
    display: block;
}

body[data-theme="light"] .logo-dark {
    display: none;
}

body[data-theme="light"] .logo-light {
    display: block;
}

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

html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Scroll performance optimizations */
.game-container,
.puzzle-board,
.clue-item,
.cell {
    will-change: auto;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

body {
    overflow-x: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1446 50%, #2d1b4e 100%);
    background-attachment: fixed;
    color: #e0e0e0;
    min-height: 100vh;
    padding: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Focus States for Accessibility */
*:focus {
    outline: 2px solid #00d4ff;
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #00d4ff;
    outline-offset: 2px;
}

.game-container {
    max-width: 100%;
    margin: 0 auto;
    background: rgba(15, 20, 40, 0.95);
    border-radius: 20px;
    padding: 15px 20px;
    box-shadow: 0 0 50px rgba(100, 50, 200, 0.3);
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #5a4fcf;
}

h1 {
    font-size: 3em;
    background: linear-gradient(45deg, #00d4ff, #9d4edd, #ff006e);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(157, 78, 221, 0.5);
}

.subtitle {
    color: #8b8b8b;
    font-size: 1.1em;
    font-style: italic;
}

.game-info {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: rgba(30, 35, 60, 0.6);
    border-radius: 15px;
    align-items: center;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.button-row {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.info-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 20px;
    background: rgba(50, 55, 90, 0.5);
    border-radius: 10px;
    border: 1px solid #5a4fcf;
}

.label {
    color: #9d9d9d;
    font-weight: bold;
}

.value {
    color: #00d4ff;
    font-family: 'Poppins', sans-serif;
    font-size: 1.2em;
    font-weight: bold;
}

#puzzle-select {
    background: rgba(30, 35, 60, 0.8);
    color: #e0e0e0;
    border: 1px solid #5a4fcf;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

#puzzle-select:hover {
    background: rgba(50, 55, 90, 0.8);
    border-color: #7d6fe8;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn:not(:disabled):active {
    transform: translateY(1px);
}

.btn-hint {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-hint:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(240, 147, 251, 0.4);
}

.btn-check {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(79, 172, 254, 0.4);
}

.btn-reset {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #000;
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(250, 112, 154, 0.4);
}

.main-content {
    display: grid;
    grid-template-columns: 420px auto;
    gap: 15px;
    margin-bottom: 30px;
    align-items: stretch;
    justify-content: center;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.clues-panel {
    background: rgba(30, 35, 60, 0.6);
    padding: 15px 20px;
    border-radius: 15px;
    border: 2px solid #5a4fcf;
    max-height: 600px;
    overflow-y: auto;
}

.clues-panel h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 1.4em;
}

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

.clue-item {
    background: rgba(50, 55, 90, 0.7);
    padding: 12px;
    border-radius: 10px;
    border-left: 4px solid #9d4edd;
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: center;
    font-size: 1em;
}

.clue-item:hover {
    background: rgba(60, 65, 100, 0.8);
    border-left-color: #ff006e;
    transform: translateX(5px);
}

.clue-item.used {
    opacity: 0.5;
}

.clue-item.marked {
    text-decoration: line-through;
    opacity: 0.6;
    position: relative;
}

.clue-item.marked::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: #ff006e;
    transform: translateY(-50%);
}

.clue-verbal {
    font-size: 0.95em;
    line-height: 1.5;
    color: #e0e0e0;
    display: block;
}

body[data-theme="light"] .clue-verbal {
    color: #1a237e;
}

.clue-icons {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.clue-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 2px;
}

body[data-theme="light"] .clue-icon {
    background: rgba(25, 118, 210, 0.15);
}

.clue-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 5px;
    flex-shrink: 0;
}

.clue-symbol {
    font-size: 1.6em;
    font-weight: bold;
    color: #00d4ff;
}

.clue-text {
    font-size: 1.2em;
    font-weight: bold;
    color: #00d4ff;
    padding: 0 4px;
}

/* NOT_NEXT_TO special symbol */
.clue-not-next-to {
    position: relative;
    display: inline-block;
    padding: 0 8px;
}

.clue-not-next-to .base-symbol {
    position: relative;
    z-index: 1;
}

.clue-not-next-to .prohibition-symbol {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
    color: #ff006e;
    z-index: 2;
}

.puzzle-board {
    background: rgba(30, 35, 60, 0.6);
    padding: 15px 20px;
    border-radius: 15px;
    border: 3px solid #5a4fcf;
    box-shadow: 0 4px 20px rgba(90, 79, 207, 0.3);
}

.puzzle-board h3 {
    color: #00d4ff;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.grid-labels {
    margin-bottom: 10px;
}

.label-row {
    display: grid;
    /* grid-template-columns set dynamically via JavaScript */
    gap: 10px;
    text-align: center;
}

.label-row span {
    padding: 8px;
    background: rgba(93, 79, 207, 0.3);
    border-radius: 8px;
    font-weight: bold;
    color: #00d4ff;
}

.grid {
    display: grid;
    gap: 12px;
}

.grid-row {
    display: grid;
    /* grid-template-columns set dynamically via JavaScript */
    gap: 10px;
}

.row-label {
    grid-column: 1 / -1;
    text-align: center;
    padding: 10px;
    background: rgba(157, 78, 221, 0.2);
    border-radius: 8px;
    font-weight: bold;
    color: #9d4edd;
    margin-bottom: 5px;
}

.cell {
    aspect-ratio: 1;
    background: rgba(50, 55, 90, 0.4);
    border: 2px solid #5a4fcf;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 6px;
    min-width: 115px;
    min-height: 115px;
}

.cell:hover {
    background: rgba(60, 65, 100, 0.6);
    border-color: #7d6fe8;
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(125, 111, 232, 0.3);
}

.cell:active {
    transform: scale(0.95);
    transition: all 0.1s;
}

.cell.known {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #00d4ff;
    border-width: 3px;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

/* Locked cells (pre-filled starting cells) */
.cell.locked {
    background: linear-gradient(135deg, #ffa500 0%, #ff8c00 100%);
    border-color: #ffd700;
    border-width: 3px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    cursor: not-allowed;
}

.cell.locked:hover {
    background: linear-gradient(135deg, #ffa500 0%, #ff8c00 100%);
    border-color: #ffd700;
    transform: none;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
}

.cell.locked:active {
    transform: none;
}

/* Only animate newly-selected cells, not all known cells on re-render */
.cell.known.just-selected {
    animation: cellReveal 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes cellReveal {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(0deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.cell.eliminated {
    background: rgba(40, 40, 40, 0.5);
    opacity: 0.4;
    border-color: #ff006e;
}

.cell.eliminated::before {
    content: '✗';
    position: absolute;
    font-size: 3em;
    color: #ff006e;
    opacity: 0.6;
}

.cell-icon {
    font-size: 3em;
    margin-bottom: 5px;
}

.cell-image {
    width: 95%;
    height: 95%;
    object-fit: contain;
    max-width: 150px;
    max-height: 150px;
}

.possibilities-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    width: 98%;
    height: 98%;
    padding: 2px;
    align-content: center;
}

/* 2 items: centered with same size as 2x2 */
.possibilities-grid-2 {
    grid-template-columns: repeat(2, 1fr);
    justify-content: center;
    align-content: center;
}

/* 3 items: 2 columns (2 on top, 1 centered below) with same size as 2x2 */
.possibilities-grid-3 {
    grid-template-columns: repeat(2, 1fr);
    justify-items: center;
}

/* 4 items: 2x2 grid */
.possibilities-grid-4 {
    grid-template-columns: repeat(2, 1fr);
}

.possibility-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.75;
    transition: all 0.3s;
    cursor: pointer;
    border-radius: 4px;
}

.possibility-image:hover {
    opacity: 1;
    transform: scale(1.1);
    background: rgba(157, 78, 221, 0.2);
}

.cell-label {
    font-size: 0.85em;
    text-align: center;
    color: #b0b0b0;
}

.cell.known .cell-label {
    color: #00d4ff;
    font-weight: bold;
}

.instructions {
    background: rgba(30, 35, 60, 0.6);
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #5a4fcf;
}

.instructions h3 {
    color: #00d4ff;
    margin-bottom: 8px;
    font-size: 1.2em;
}

.instructions h4 {
    color: #00d4ff;
    margin-top: 12px;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 8px;
}

.instructions li {
    padding: 5px 0;
    padding-left: 22px;
    position: relative;
    line-height: 1.4;
}

.instructions li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #9d4edd;
    font-size: 1.2em;
}

.instructions strong {
    color: #00d4ff;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(0px);
    transition: all 0.3s ease;
    opacity: 0;
}

.modal:not(.hidden) {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    opacity: 1;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #1a1446 0%, #2d1b4e 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    border: 3px solid #9d4edd;
    box-shadow: 0 0 50px rgba(157, 78, 221, 0.5);
    animation: modalSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalSlideIn {
    0% {
        transform: scale(0.7) translateY(-50px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #00d4ff, #9d4edd, #ff006e);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-content p {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: #b0b0b0;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin: 10px;
}

/* Share Section Styles */
.share-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(157, 78, 221, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(157, 78, 221, 0.4);
}

.share-label {
    font-size: 0.95em;
    color: #b0b0b0;
    margin-bottom: 12px;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-share {
    padding: 12px;
    font-size: 0.9em;
    border-radius: 50%;
    font-weight: 600;
    transition: all 0.3s;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-share svg {
    flex-shrink: 0;
}

.btn-twitter {
    background: #000;
    color: #fff;
}

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

.btn-facebook {
    background: #1877f2;
    color: #fff;
}

.btn-facebook:hover {
    background: #166fe5;
    transform: translateY(-2px);
}

.btn-tiktok {
    background: #000;
    color: #fff;
}

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

.btn-instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff;
}

.btn-instagram:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(225, 48, 108, 0.4);
}

.btn-copy {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Light mode share section */
body[data-theme="light"] .share-section {
    background: rgba(25, 118, 210, 0.1);
    border: 1px solid rgba(25, 118, 210, 0.3);
}

body[data-theme="light"] .share-label {
    color: #1a237e;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(30, 35, 60, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #5a4fcf;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7d6fe8;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .clues-panel {
        max-height: 400px;
    }

    h1 {
        font-size: 2em;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.cell.hint {
    animation: pulse 0.5s ease-in-out 3;
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

/* Undo/Redo Buttons */
.btn-undo, .btn-redo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-undo:hover:not(:disabled), .btn-redo:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-undo:disabled, .btn-redo:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Random Button */
.btn-random {
    background: linear-gradient(135deg, #9c27b0 0%, #e91e63 100%);
    color: white;
}

.btn-random:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(156, 39, 176, 0.4);
}

/* Settings Button */
.btn-settings {
    background: linear-gradient(135deg, #607d8b 0%, #455a64 100%);
    color: white;
}

.btn-settings:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(96, 125, 139, 0.4);
}

/* Achievement Notification */
.achievement-notification {
    position: fixed;
    top: -120px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 300px;
    z-index: 2000;
    transition: top 0.3s ease-out;
}

.achievement-notification.show {
    top: 20px;
}

.achievement-icon {
    font-size: 3em;
}

.achievement-content {
    flex: 1;
}

.achievement-title {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 5px;
}

.achievement-description {
    font-size: 1em;
    color: #e0e0e0;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1446 50%, #2d1b4e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

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

.loading-content {
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.loading-logo {
    font-size: 8em;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

.loading-title {
    font-size: 3em;
    background: linear-gradient(45deg, #00d4ff, #9d4edd, #ff006e);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.loading-spinner {
    margin: 30px auto;
    width: 60px;
    height: 60px;
}

.spinner {
    width: 100%;
    height: 100%;
    border: 6px solid rgba(157, 78, 221, 0.2);
    border-top-color: #9d4edd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 1.2em;
    color: #8b8b8b;
    animation: fadeInOut 1.5s ease-in-out infinite;
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 20px rgba(157, 78, 221, 0.5));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 40px rgba(157, 78, 221, 0.8));
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Settings Modal */
.settings-modal-content {
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.settings-scroll-container {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding-right: 10px;
    margin-bottom: 15px;
}

.settings-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.settings-scroll-container::-webkit-scrollbar-track {
    background: rgba(157, 78, 221, 0.1);
    border-radius: 10px;
}

.settings-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(157, 78, 221, 0.5);
    border-radius: 10px;
}

.settings-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(157, 78, 221, 0.7);
}

.settings-section {
    margin: 25px 0;
    padding: 15px 20px;
    background: rgba(157, 78, 221, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(157, 78, 221, 0.3);
}

.settings-section h3 {
    margin: 0 0 15px 0;
    color: #00d4ff;
    font-size: 1.2em;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
}

.setting-item label {
    font-size: 1.1em;
    color: #e0e0e0;
}

.toggle-btn {
    padding: 8px 20px;
    border: 2px solid #9d4edd;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 70px;
}

.toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.5);
}

.toggle-btn.off {
    background: #555;
    border-color: #777;
}

.stats-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.stats-display p {
    margin: 10px 0;
    font-size: 1.1em;
    color: #e0e0e0;
    display: flex;
    justify-content: space-between;
}

.stats-display span {
    color: #00d4ff;
    font-weight: bold;
}

.btn-danger {
    background: linear-gradient(135deg, #ff006e 0%, #c90055 100%);
    border-color: #ff006e;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c90055 0%, #a00044 100%);
}

/* Light Theme - Primary Colors */
body[data-theme="light"] {
    background: #e3f2fd;
    color: #000;
}

body[data-theme="light"] .game-container {
    background: #fff;
    box-shadow: 0 4px 20px rgba(25, 118, 210, 0.2);
}

body[data-theme="light"] h1 {
    background: linear-gradient(45deg, #1565c0, #1976d2, #d32f2f);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body[data-theme="light"] .subtitle,
body[data-theme="light"] .label,
body[data-theme="light"] .value,
body[data-theme="light"] p,
body[data-theme="light"] li {
    color: #1a237e;
}

body[data-theme="light"] .clues-panel {
    background: #fff;
    border: 3px solid #1976d2;
}

body[data-theme="light"] .puzzle-board {
    background: #bbdefb;
    border: 3px solid #1976d2;
}

body[data-theme="light"] .clues-panel h3 {
    color: #1565c0;
}

body[data-theme="light"] .game-info {
    background: #1976d2;
    border-radius: 10px;
    padding: 15px;
    border: 3px solid #0d47a1;
}

body[data-theme="light"] .game-info .label {
    color: #bbdefb;
}

body[data-theme="light"] .game-info .value {
}

body[data-theme="light"] .game-info .info-item {
    background: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #0d47a1;
}

body[data-theme="light"] .game-info .info-item .label,
body[data-theme="light"] .game-info .info-item .value {
    color: #1565c0;
}

body[data-theme="light"] .puzzle-board h3 {
    color: #0d47a1;
}

body[data-theme="light"] .clue-item {
    background: #e3f2fd;
    border: 2px solid #1976d2;
    border-left: 4px solid #ec407a;
    color: #000;
    font-weight: 500;
}

body[data-theme="light"] .clue-image {
    background: #fff;
    border: 2px solid #1976d2;
    border-radius: 4px;
}

body[data-theme="light"] .clue-item,
body[data-theme="light"] .clue-item * {
    color: #1a237e !important;
}

body[data-theme="light"] .clue-item:hover {
    background: #bbdefb;
    border-color: #1565c0;
}

body[data-theme="light"] .cell {
    background: #fff;
    border: 3px solid #1976d2;
}

body[data-theme="light"] .cell:hover {
    border-color: #0d47a1;
    box-shadow: 0 0 10px rgba(25, 118, 210, 0.4);
}

body[data-theme="light"] .cell.known {
    background: #fff59d;
    border-color: #f9a825;
}

body[data-theme="light"] .cell.locked {
    background: #64b5f6;
    border: 3px solid #1565c0;
    box-shadow: 0 0 10px rgba(25, 118, 210, 0.3);
}

body[data-theme="light"] .modal-content {
    background: #fff;
    color: #1a237e;
    border: 3px solid #1976d2;
}

body[data-theme="light"] .settings-section {
    background: #e3f2fd;
    border: 2px solid #1976d2;
}

body[data-theme="light"] .settings-section h3 {
    color: #1565c0;
}

body[data-theme="light"] .setting-item label,
body[data-theme="light"] .stats-display p {
    color: #1a237e;
}

body[data-theme="light"] .stats-display {
    background: #bbdefb;
}

body[data-theme="light"] .stats-display span {
    color: #1565c0;
}

body[data-theme="light"] .btn {
    background: #1976d2;
}

body[data-theme="light"] .btn:hover {
    background: #1565c0;
}

body[data-theme="light"] .btn-undo {
    background: #757575 !important;
    background-image: none !important;
}

body[data-theme="light"] .btn-undo:hover {
    background: #616161;
}

body[data-theme="light"] .btn-reset {
    background: #d32f2f !important;
    background-image: none !important;
}

body[data-theme="light"] .btn-reset:hover {
    background: #c62828;
}

body[data-theme="light"] .btn-check {
    background: #64b5f6 !important;
    background-image: none !important;
}

body[data-theme="light"] .btn-check:hover {
    background: #42a5f5;
}

    background: #1976d2;
}

body[data-theme="light"] .button-row .btn-random,
body[data-theme="light"] .btn-random {
    background: #fdd835 !important;
    background-image: none !important;
    color: #fff !important;
}

body[data-theme="light"] .button-row .btn-random:hover,
body[data-theme="light"] .btn-random:hover {
    background: #fbc02d !important;
    background-image: none !important;
}

body[data-theme="light"] .btn-settings {
    background: #455a64;
}

body[data-theme="light"] .btn-settings:hover {
    background: #37474f;
}

body[data-theme="light"] .instructions {
    background: #fff;
    border: 3px solid #1976d2;
}

body[data-theme="light"] .instructions h3,
body[data-theme="light"] .instructions h4 {
    color: #ec407a;
}

body[data-theme="light"] select {
    background: #fff;
    color: #1a237e;
    border: 2px solid #1976d2;
}

body[data-theme="light"] .grid-labels span {
    color: #1565c0;
}

body[data-theme="light"] .button-row .btn {
    color: #fff;
}

body[data-theme="light"] .button-row .btn.btn-random {
    background: #fdd835 !important;
    background-image: none !important;
    color: #fff !important;
}

body[data-theme="light"] .button-row .btn.btn-random:hover {
    background: #fbc02d !important;
    background-image: none !important;
}

/* Tutorial Modal */
.tutorial-modal-content {
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

#tutorial-content {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding-right: 10px;
    margin-bottom: 15px;
    text-align: left;
}

#tutorial-content::-webkit-scrollbar {
    width: 8px;
}

#tutorial-content::-webkit-scrollbar-track {
    background: rgba(157, 78, 221, 0.1);
    border-radius: 10px;
}

#tutorial-content::-webkit-scrollbar-thumb {
    background: rgba(157, 78, 221, 0.5);
    border-radius: 10px;
}

#tutorial-content::-webkit-scrollbar-thumb:hover {
    background: rgba(157, 78, 221, 0.7);
}

.tutorial-step {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid rgba(157, 78, 221, 0.3);
}

.tutorial-step:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.tutorial-step h3 {
    font-size: 2em;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #00d4ff, #9d4edd);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tutorial-step p {
    font-size: 1.15em;
    line-height: 1.8;
    margin-bottom: 20px;
    color: #d0d0d0;
    text-align: left;
}

.tutorial-step ul, .tutorial-step ol {
    margin: 20px 0;
    padding-left: 20px;
}

.tutorial-step li {
    font-size: 1.1em;
    line-height: 2;
    margin: 12px 0;
    color: #d0d0d0;
}

.tutorial-step strong {
    color: #00d4ff;
    font-weight: bold;
}

/* Tutorial Grid Example */
.tutorial-image-placeholder {
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

.tutorial-grid-example {
    display: flex;
    gap: 15px;
}

.tutorial-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tutorial-label {
    background: rgba(93, 79, 207, 0.3);
    padding: 10px 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    color: #00d4ff;
}

.tutorial-cell {
    width: 80px;
    height: 80px;
    background: rgba(50, 55, 90, 0.4);
    border: 2px solid #5a4fcf;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: #9d4edd;
}

/* Tutorial Actions */
.tutorial-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 30px 0;
}

.tutorial-action-item {
    background: rgba(157, 78, 221, 0.1);
    padding: 15px 20px;
    border-radius: 12px;
    border: 2px solid rgba(157, 78, 221, 0.3);
}

.tutorial-action-icon {
    font-size: 1.5em;
    font-weight: bold;
    color: #00d4ff;
    margin-bottom: 15px;
}

.tutorial-action-item p {
    font-size: 1em;
    margin: 0;
}

/* Tutorial Lists */
.tutorial-clue-list, .tutorial-tools-list, .tutorial-rules-list {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px 20px 20px 40px;
    border-radius: 12px;
    border-left: 4px solid #9d4edd;
}

.tutorial-highlight {
    background: rgba(0, 212, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #00d4ff;
    margin: 20px 0;
    font-size: 1.1em;
}

/* Tutorial Final Tips */
.tutorial-final-tips {
    background: rgba(157, 78, 221, 0.1);
    padding: 15px 20px;
    border-radius: 12px;
    margin: 20px 0;
}

.tutorial-final-tips h4 {
    color: #9d4edd;
    font-size: 1.3em;
    margin-bottom: 15px;
}

.tutorial-final-tips ul {
    list-style: none;
    padding-left: 0;
}

.tutorial-final-tips li {
    padding-left: 25px;
    position: relative;
}

.tutorial-final-tips li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #00d4ff;
    font-weight: bold;
}

/* Tutorial Navigation */
.tutorial-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 20px;
    border-top: 2px solid rgba(157, 78, 221, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #5a5a5a 0%, #3a3a3a 100%);
    color: white;
    margin: 5px;
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(90, 90, 90, 0.4);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

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

/* Responsive Tutorial */
@media (max-width: 768px) {
    .tutorial-actions {
        grid-template-columns: 1fr;
    }

    .tutorial-modal-content {
        padding: 25px;
    }

    .tutorial-step h3 {
        font-size: 1.6em;
    }

    .tutorial-navigation {
        justify-content: center;
    }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 640px) {
    body {
        padding: 10px;
    }

    .game-container {
        padding: 15px;
        border-radius: 15px;
        overflow-x: hidden;
        max-width: 100vw;
    }

    h1 {
        font-size: 1.8em !important;
    }

    .subtitle {
        font-size: 0.9em;
    }

    .game-info {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    .info-item {
        width: 100%;
        justify-content: space-between;
        padding: 10px 15px;
    }

    #puzzle-select {
        width: 100%;
        padding: 10px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9em;
        margin: 5px 0;
    }

    .button-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .button-row .btn {
        flex: 1 1 auto;
        min-width: 60px;
        width: auto;
        padding: 8px 10px;
        font-size: 0.8em;
    }

    body {
        overflow-x: hidden !important;
    }

    .game-container {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }

    header {
        width: 100% !important;
    }

    .daily-puzzles {
        flex-direction: column !important;
        width: 100% !important;
        box-sizing: border-box !important;
        align-items: stretch !important;
    }

    .btn-daily {
        width: 100% !important;
        box-sizing: border-box !important;
        margin: 5px 0 !important;
    }

    .logo-img {
        max-width: 80% !important;
        width: auto !important;
    }

    .game-info {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .button-row {
        width: 100% !important;
        justify-content: space-between !important;
    }

    .button-row .btn {
        flex: 1 !important;
        min-width: 0 !important;
        padding: 8px 5px !important;
        font-size: 0.75em !important;
    }

    .instructions {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .clues-panel {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .puzzle-board {
        width: 100% !important;
        overflow-x: scroll !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .main-content {
        width: 100% !important;
        overflow-x: visible !important;
    }

    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .clues-panel, .puzzle-board {
        padding: 15px;
    }

    .clues-panel h3, .puzzle-board h3 {
        font-size: 1.2em;
    }

    .clue-item {
        padding: 10px;
        font-size: 0.9em;
    }

    .clue-image {
        width: 40px;
        height: 40px;
    }

    .clue-symbol {
        font-size: 1.2em;
    }

    .label-row span {
        font-size: 0.8em;
        padding: 5px;
    }

    .cell {
        min-width: 45px;
        min-height: 45px;
        max-width: 45px;
        max-height: 45px;
        width: 45px;
        height: 45px;
        padding: 2px;
    }

    .cell-image {
        width: 32px;
        height: 32px;
    }

    .possibility-image {
        width: 90%;
        height: 90%;
    }

    .puzzle-board {
        overflow-x: auto;
        width: 100%;
    }

    .grid {
        gap: 4px;
    }

    .grid-row {
        gap: 3px;
    }

    .label-row {
        gap: 3px !important;
    }

    .label-row span {
        min-width: 45px;
        padding: 3px !important;
        font-size: 0.65em !important;
    }

    .row-label {
        padding: 4px;
        font-size: 0.75em;
    }

    .instructions {
        padding: 15px;
    }

    .instructions h3 {
        font-size: 1.1em;
    }

    .instructions li {
        font-size: 0.9em;
        padding: 8px 0;
        padding-left: 20px;
    }

    .modal-content {
        padding: 25px;
        max-width: 90%;
        margin: 20px;
    }

    .modal-content h2 {
        font-size: 1.8em;
    }

    .modal-content p {
        font-size: 1em;
    }

    .settings-modal-content {
        max-width: 95%;
    }

    .settings-section {
        padding: 15px;
        margin: 15px 0;
    }

    .tutorial-modal-content {
        max-width: 95%;
        padding: 15px 20px;
        max-height: 90vh;
    }

    .tutorial-step h3 {
        font-size: 1.4em;
    }

    .tutorial-step p, .tutorial-step li {
        font-size: 1em;
    }

    .tutorial-navigation {
        flex-wrap: wrap;
    }

    .tutorial-navigation button {
        flex: 1 1 45%;
    }

    #tutorial-progress {
        flex: 1 1 100%;
        text-align: center;
        margin: 10px 0;
    }

    .achievement-notification {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}

/* Extra Small Devices */
@media (max-width: 375px) {
    h1 {
        font-size: 1.5em !important;
    }

    .game-info {
        padding: 10px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.85em;
    }

    .clue-image {
        width: 35px;
        height: 35px;
    }

    .grid {
        gap: 8px;
    }

    .grid-row {
        gap: 5px;
    }

    .modal-content {
        padding: 15px 20px;
    }

    .tutorial-modal-content {
        padding: 15px;
    }
}

/* Landscape Mobile Optimization */
@media (max-height: 600px) and (orientation: landscape) {
    .game-container {
        padding: 10px;
    }

    h1 {
        font-size: 1.5em !important;
        margin-bottom: 5px;
    }

    .game-info {
        padding: 10px;
        margin-bottom: 15px;
    }

    .main-content {
        gap: 15px;
        margin-bottom: 15px;
    }

    .clues-panel {
        max-height: 250px;
    }

    .instructions {
        display: none; /* Hide instructions in landscape to save space */
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }

    .tutorial-modal-content {
        max-height: 85vh;
        padding: 15px;
    }
}


/* 1080p Laptop Screen Optimization */
@media (min-width: 1025px) and (max-height: 1000px) {
    .cell {
        min-width: 120px;
        min-height: 120px;
        max-width: 120px;
        max-height: 120px;
        width: 120px;
        height: 120px;
    }
    
    .puzzle-board {
        width: fit-content;
    }
}

/* Win Celebration Confetti */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9999;
    animation: confetti-fall linear forwards;
    pointer-events: none;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Win Modal Celebration */
#win-modal .modal-content {
    animation: winCelebrate 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes winCelebrate {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.15) rotate(10deg);
    }
    70% {
        transform: scale(0.95) rotate(-5deg);
    }
    85% {
        transform: scale(1.05) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Button Ripple Effect */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 200px;
    height: 200px;
}

/* Smooth Transitions for All Interactive Elements */
.clue-item, .possibility-image, .cell-image {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Hint Animation */
@keyframes hintPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px 10px rgba(255, 215, 0, 0);
    }
}

.cell.hint {
    animation: hintPulse 1s ease-in-out 3;
    border-color: #ffd700 !important;
}

/* Clue Highlight on Hover */
.clue-item:hover {
    background: rgba(60, 65, 100, 0.8);
    border-left-color: #ff006e;
    transform: translateX(5px);
    box-shadow: -5px 0 15px rgba(255, 0, 110, 0.3);
}

/* Daily Puzzle Buttons */
.daily-puzzles {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.btn-daily {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 8px 16px;
    font-size: 0.85em;
    text-transform: none;
    letter-spacing: 0;
}

.btn-daily:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(79, 172, 254, 0.4);
}

body[data-theme="light"] .btn-daily {
    background: #0288d1 !important;
    background-image: none !important;
}

body[data-theme="light"] .btn-daily:hover {
    background: #0277bd !important;
    background-image: none !important;
}
