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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: url('assets/CN_ScreenAsset.svg') no-repeat center center fixed;
    background-size: cover;
    background-color: #0f172a;
    color: #fff;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    touch-action: none;
    position: fixed;
    width: 100%;
}

/* Frost Border Overlay - Canvas rendered in JS */
.frost-border {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.frost-border canvas {
    width: 100%;
    height: 100%;
}

/* Title Script Text */
.title-script {
    position: relative;
    display: inline-block;
    margin-bottom: clamp(5px, 1vh, 10px);
    font-family: 'Great Vibes', cursive;
}

.title-main {
    font-size: clamp(2rem, 8vw, 3rem);
    background: linear-gradient(135deg, #ffd700 0%, #ffec8b 25%, #ffd700 50%, #daa520 75%, #ffd700 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    animation: shimmer 3s linear infinite;
    margin-bottom: 0;
    line-height: 1.1;
}

.title-sub {
    font-size: clamp(1.4rem, 5vw, 2rem);
    background: linear-gradient(135deg, #ffd700 0%, #f4a460 30%, #ffd700 50%, #daa520 70%, #ffd700 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    animation: shimmer 3s linear infinite;
    animation-delay: 0.3s;
    margin-top: -5px;
}

/* Hidden admin trigger area on title */
.admin-trigger {
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 100%;
    cursor: pointer;
    /* Uncomment below to debug the click area */
    /* background: rgba(255, 0, 0, 0.2); */
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 40px);
    padding-top: clamp(40px, 8vh, 80px);
    padding-bottom: clamp(20px, 4vh, 40px);
    position: relative;
    z-index: 1;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: clamp(10px, 2vh, 20px);
    animation: slideDown 0.5s ease-out;
    flex-shrink: 0;
}

h1 {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    margin-bottom: clamp(5px, 1vh, 10px);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.date-display {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-block;
}

/* Navigation */
.game-nav {
    display: flex;
    gap: 10px;
    margin-bottom: clamp(10px, 2vh, 20px);
    flex-shrink: 0;
}

.nav-btn {
    flex: 1;
    padding: clamp(8px, 2vw, 12px);
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    transition: all 0.3s;
    white-space: nowrap;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.4);
    font-weight: bold;
}

/* Game Views */
.game-view {
    display: none;
    animation: fadeIn 0.3s ease-in;
    flex: 1;
    min-height: 0;
}

.game-view.active {
    display: flex;
    flex-direction: column;
}

/* Snow Globe */
.snow-globe-container {
    text-align: center;
    padding: clamp(5px, 1vw, 15px);
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: visible;
}

/* Globe instructions */
.globe-instructions {
    text-align: center;
    margin-top: clamp(10px, 2vh, 20px);
    padding: 0 20px;
    flex-shrink: 0;
}

.instruction-main {
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    margin-bottom: 6px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.instruction-sub {
    font-size: clamp(0.85rem, 3vw, 1rem);
    color: rgba(255, 215, 0, 0.9);
    font-style: italic;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Pre-sale message (before Dec 12) */
.pre-sale-message {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.pre-sale-message.hidden {
    display: none;
}

.pre-sale-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: clamp(25px, 5vw, 40px);
    max-width: 350px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1);
}

.pre-sale-content h2 {
    font-size: clamp(1.5rem, 5vw, 2rem);
    color: #ffd700;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.pre-sale-content p {
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.6;
    margin-bottom: 12px;
}

.pre-sale-content strong {
    color: #ffd700;
}

.pre-sale-game {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Holiday message at bottom */
.holiday-message {
    text-align: center;
    padding: clamp(10px, 2vh, 20px) 0;
    flex-shrink: 0;
    position: relative;
    font-family: 'Great Vibes', cursive;
}

.holiday-top {
    font-size: clamp(1.7rem, 6vw, 2.4rem);
    background: linear-gradient(135deg, #ffd700 0%, #f4a460 30%, #ffd700 50%, #daa520 70%, #ffd700 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    text-shadow: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    animation: shimmer 3s linear infinite;
}

.holiday-brand {
    font-size: clamp(2.4rem, 8vw, 3.3rem);
    font-weight: normal;
    background: linear-gradient(135deg, #ffd700 0%, #ffec8b 25%, #ffd700 50%, #daa520 75%, #ffd700 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
    letter-spacing: 1px;
    animation: shimmer 3s linear infinite;
    animation-delay: 0.5s;
}

@keyframes shimmer {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

/* Sparkle effect */
.sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.sparkles::before,
.sparkles::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #fff 0%, #ffd700 40%, transparent 70%);
    border-radius: 50%;
    animation: sparkle 2s ease-in-out infinite;
}

.sparkles::before {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.sparkles::after {
    top: 60%;
    right: 15%;
    animation-delay: 0.7s;
}

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

/* Additional sparkle elements via box-shadow */
.holiday-message::before,
.holiday-message::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px rgba(255, 215, 0, 0.8);
    animation: sparkle 2.5s ease-in-out infinite;
}

.holiday-message::before {
    top: 30%;
    right: 5%;
    animation-delay: 0.3s;
}

.holiday-message::after {
    bottom: 30%;
    left: 8%;
    animation-delay: 1.2s;
}

.snow-globe {
    /* Responsive size based on viewport, capped at reasonable max */
    width: min(280px, 70vw, 38vh);
    height: min(280px, 70vw, 38vh);
    border-radius: 15px;
    position: relative;
    cursor: grab;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
                0 0 30px rgba(100, 150, 255, 0.15);
    overflow: hidden;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

.snow-globe.revealed {
    transform: scale(1.2);
}

.snow-globe:active {
    cursor: grabbing;
}

.snow-globe canvas {
    display: block;
    border-radius: 15px;
}

/* Deal Overlay */
.deal-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    width: 280px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.deal-overlay.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
}

.deal-overlay.revealed {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
    animation: dealReveal 0.6s ease-out;
}

@keyframes dealReveal {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) rotate(-5deg);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
}

.deal-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 245, 255, 0.98) 100%);
    color: #1e3c72;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 0 0 3px rgba(255, 215, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 1);
    text-align: center;
}

.deal-card h2 {
    color: #7e22ce;
    margin-bottom: 12px;
    font-size: 1.3rem;
    text-shadow: 0 1px 2px rgba(126, 34, 206, 0.2);
}

.deal-card .deal-description {
    margin: 15px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #475569;
}

.deal-code-box {
    background: linear-gradient(135deg, #7e22ce 0%, #9333ea 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 4px 15px rgba(126, 34, 206, 0.4);
}

.deal-code-box span {
    font-size: 0.8rem;
    opacity: 0.9;
}

.deal-code-box strong {
    font-size: 1.4rem;
    letter-spacing: 3px;
    font-weight: 700;
}

.hidden {
    display: none;
}

/* Tree emoji styling */
.tree-right {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Hidden Admin Panel */
.admin-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    padding: 20px;
    z-index: 2000;
    width: min(300px, 90vw);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6),
                0 0 0 2px rgba(255, 215, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

.admin-panel.hidden {
    display: none;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-header h3 {
    color: #ffd700;
    margin: 0;
    font-size: 1.2rem;
}

.admin-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.admin-close:hover {
    color: #fff;
}

.admin-controls label {
    display: block;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.9);
}

.admin-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
}

.admin-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.admin-toggle span {
    font-size: 0.95rem;
}

.admin-controls select {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: #1a1a2e;
    cursor: pointer;
}

.admin-controls button {
    padding: 10px 20px;
    margin-right: 10px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

#applyTestDay {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

#applyTestDay:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

#resetToToday {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

#resetToToday:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Deal Popup Modal */
.deal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.deal-modal.hidden {
    display: none;
}

.deal-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.deal-modal-content {
    position: relative;
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 50%, #1a472a 100%);
    border-radius: 20px;
    padding: clamp(20px, 4vw, 30px);
    max-width: 90%;
    width: min(350px, 85vw);
    max-height: 85vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 0 3px rgba(255, 215, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.deal-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 28px;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.deal-modal-close:hover {
    color: #fff;
}

.deal-modal-header {
    margin-bottom: 15px;
}

.deal-day-badge {
    background: linear-gradient(135deg, #c41e3a 0%, #8b0000 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.4);
}

.deal-modal-content h2 {
    color: #ffd700;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.deal-modal-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    line-height: 1.5;
    margin-bottom: 20px;
}

.deal-modal-image {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 10px;
    margin-top: 15px;
}

.deal-modal-image img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
    max-height: 40vh;
    object-fit: contain;
}

/* Budtender Rush Game Fullscreen */
.game-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 500;
    background: #000;
}

.game-fullscreen iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.back-to-deals {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    left: max(20px, env(safe-area-inset-left, 20px));
    z-index: 600;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    padding: 10px 18px;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.back-to-deals:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.back-to-deals .back-icon {
    font-size: 1.2rem;
}

.back-to-deals .back-text {
    font-weight: 500;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    75% { transform: translateX(10px) rotate(5deg); }
}

@keyframes fall {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateY(280px) translateX(var(--x-offset, 0));
    }
}

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

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

/* Small phones */
@media (max-width: 380px) {
    h1 {
        font-size: 1.1rem;
    }

    .nav-btn {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
}

/* Large screens / tablets */
@media (min-width: 768px) {
    .container {
        max-width: 550px;
    }

    .snow-globe {
        width: min(350px, 45vh);
        height: min(350px, 45vh);
    }

    .snow-globe.revealed {
        transform: scale(1.15);
    }
}

/* Very tall screens (reduce globe to leave room) */
@media (min-height: 900px) {
    .snow-globe {
        width: min(320px, 40vh);
        height: min(320px, 40vh);
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        padding: 8px;
        flex-direction: row;
        flex-wrap: wrap;
        max-width: 100%;
    }

    header {
        width: 100%;
        margin-bottom: 8px;
    }

    header h1 {
        font-size: 1.1rem;
        margin-bottom: 4px;
    }

    .date-display {
        padding: 4px 10px;
        font-size: 0.85rem;
    }

    .game-nav {
        width: 100%;
        margin-bottom: 8px;
    }

    .snow-globe {
        width: min(200px, 35vh);
        height: min(200px, 35vh);
    }

    .snow-globe.revealed {
        transform: scale(1.1);
    }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}
