* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Unbounded', sans-serif;
    background: linear-gradient(180deg, #23007C 0%, #000000 100%);
    min-height: 100vh;
    min-height: 100dvh;
    color: #ffffff;
    overflow-x: hidden;
    touch-action: none;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #0E1350;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
}

.logo-link {
    display: flex;
    align-items: center;
}

.site-logo {
    height: 36px;
    width: auto;
}

.nav-menu {
    display: flex;
    align-items: center;
}

.dropdown {
    position: relative;
}

.dropdown-button {
    background: transparent;
    border: none;
    color: #29FBCD;
    font-family: 'Unbounded', sans-serif;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    padding: 8px 16px;
    transition: opacity 0.2s ease;
}

.dropdown-button:hover {
    opacity: 0.8;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #0E1350;
    min-width: 180px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    overflow: visible;
    padding-top: 4px;
}

.dropdown-content::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 14px;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: #29FBCD;
    text-decoration: none;
    font-family: 'Unbounded', sans-serif;
    font-size: 13px;
    font-weight: 400;
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(41, 251, 205, 0.1);
}

.dropdown-item.active {
    background: rgba(41, 251, 205, 0.15);
}

.nav-link {
    color: #29FBCD;
    font-family: 'Unbounded', sans-serif;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    padding: 8px 16px;
    transition: opacity 0.2s ease;
}

.nav-link:hover {
    opacity: 0.8;
}

.title-row {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.hamburger-button {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #29FBCD;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.side-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1500;
}

.side-menu-overlay.open {
    display: block;
}

.side-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: #0E1350;
    z-index: 2000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

.side-menu.open {
    right: 0;
}

.side-menu-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 32px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    line-height: 1;
}

.side-menu-close:hover {
    opacity: 1;
}

.side-menu-logo {
    display: flex;
    align-items: center;
    margin-bottom: 32px;
    margin-top: 8px;
}

.side-menu-logo .site-logo {
    height: 32px;
}

.side-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.side-menu-link {
    color: #29FBCD;
    font-family: 'Unbounded', sans-serif;
    font-size: 15px;
    font-weight: 400;
    text-decoration: none;
    padding: 14px 16px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.side-menu-link:hover,
.side-menu-link.active {
    background: rgba(41, 251, 205, 0.1);
}

@media (max-width: 768px) {
    .site-header {
        display: none;
    }

    .hamburger-button {
        display: flex;
    }
}

.back-button {
    position: fixed;
    top: 64px;
    left: 16px;
    z-index: 100;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Unbounded', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.back-button:hover {
    color: #29FBCD;
    background: rgba(41, 251, 205, 0.08);
}

@media (max-width: 768px) {
    .back-button {
        top: 10px;
    }
}

.video-embed {
    display: none;
    position: absolute;
    z-index: 15;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.video-embed.visible {
    display: block;
}

.video-embed iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 10px;
}

@media (max-width: 1024px) {
    .video-embed {
        display: none !important;
    }
}

.container {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

header {
    position: absolute;
    top: 62px; /* overridden by JS for dynamic centering */
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.title {
    font-size: 2rem;
    font-weight: 900;
    color: #29FBCD;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(41, 251, 205, 0.3);
}

.daily-info {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.daily-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #29FBCD;
}

.game-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

@media (max-width: 768px) {
    header {
        top: 8px;
    }
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.status-bar {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.status-message {
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 300;
    pointer-events: auto;
}

.play-again-inline {
    background: transparent;
    border: 2px solid #29FBCD;
    color: #29FBCD;
    font-family: 'Unbounded', sans-serif;
    font-size: 16px;
    font-weight: 500;
    padding: 10px 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.play-again-inline:hover {
    background: #29FBCD;
    color: #0a0a1a;
}

.gallery-link {
    margin-left: 12px;
    text-decoration: none;
}

.preview-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: #FFFFFF;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s, opacity 0.2s;
    opacity: 0.6;
}

.preview-button:hover {
    opacity: 1;
    border-color: #29FBCD;
}

.preview-button.active {
    opacity: 1;
    border-color: #29FBCD;
    background: rgba(41, 251, 205, 0.15);
}

.help-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: transparent;
    border: 3px solid #FFFFFF;
    color: #FFFFFF;
    font-family: 'Unbounded', sans-serif;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    z-index: 5;
    transition: transform 0.2s ease, background 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.help-button:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .help-button {
        bottom: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.help-overlay.show {
    display: flex;
}

.help-content {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px;
    margin: 20px;
    background: linear-gradient(135deg, #1E1E1E 0%, #2D2D2D 100%);
    border-radius: 16px;
    border: 2px solid #29FBCD;
    box-shadow: 0 0 40px rgba(41, 251, 205, 0.3);
    position: relative;
}

.help-content h2 {
    font-size: 1.5rem;
    color: #29FBCD;
    margin-bottom: 12px;
    margin-top: 20px;
}

.help-content h2:first-of-type {
    margin-top: 0;
}

.help-content p {
    color: #FFFFFF;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.help-content ul {
    color: #FFFFFF;
    font-size: 14px;
    line-height: 1.8;
    padding-left: 20px;
    margin-bottom: 16px;
}

.help-content li {
    margin-bottom: 8px;
}

.help-content strong {
    color: #29FBCD;
}

.help-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #FFFFFF;
    font-size: 28px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.help-close:hover {
    opacity: 1;
}

.win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.win-overlay.show {
    display: flex;
}

.win-content {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #1E1E1E 0%, #2D2D2D 100%);
    border-radius: 16px;
    border: 2px solid #29FBCD;
    box-shadow: 0 0 40px rgba(41, 251, 205, 0.3);
}

.win-content h2 {
    font-size: 2rem;
    font-weight: 900;
    color: #39FF1B;
    margin-bottom: 16px;
}

.win-content p {
    font-size: 1rem;
    font-weight: 300;
    color: #ffffff;
    margin-bottom: 8px;
}

.play-again-button {
    background: transparent;
    border: 2px solid #29FBCD;
    border-radius: 8px;
    padding: 12px 32px;
    color: #29FBCD;
    font-family: 'Unbounded', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    margin-top: 24px;
}

.play-again-button:hover {
    transform: translateY(-2px);
    background: rgba(41, 251, 205, 0.1);
}

.play-again-button:active {
    transform: translateY(0);
}

@media (max-width: 400px) {
    .title {
        font-size: 1.5rem;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .container {
        padding: 8px;
    }

    header {
        padding: 4px 0;
    }

    .title {
        font-size: 1.2rem;
    }
}

/* === Dedicated Puzzle Page Styles === */

.puzzle-description {
    max-width: 720px;
    margin: 24px auto 0;
    padding: 0 24px 40px;
}

.puzzle-description h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #29FBCD;
    margin-bottom: 16px;
    font-family: 'Unbounded', sans-serif;
}

.puzzle-description p {
    font-size: 0.9rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.8;
    margin-bottom: 16px;
    font-family: 'Unbounded', sans-serif;
}

.puzzle-details {
    display: flex;
    gap: 32px;
    justify-content: center;
    margin-top: 28px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.detail-label {
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Unbounded', sans-serif;
}

.detail-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: #29FBCD;
    font-family: 'Unbounded', sans-serif;
}

.more-puzzles {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px 48px;
}

.more-puzzles h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #29FBCD;
    text-align: center;
    margin-bottom: 24px;
    font-family: 'Unbounded', sans-serif;
}

.more-puzzles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.more-puzzle-card {
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, border-color 0.2s;
}

.more-puzzle-card:hover {
    transform: translateY(-3px);
    border-color: rgba(41, 251, 205, 0.3);
}

.more-puzzle-card img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
}

.more-puzzle-name {
    font-size: 0.78rem;
    font-weight: 500;
    color: #ffffff;
    padding: 10px 12px 2px;
    font-family: 'Unbounded', sans-serif;
}

.more-puzzle-pieces {
    font-size: 0.68rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.45);
    padding: 0 12px 10px;
    font-family: 'Unbounded', sans-serif;
}

@media (max-width: 600px) {
    .puzzle-details {
        gap: 16px;
        flex-wrap: wrap;
    }
    .more-puzzles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
