/* CSS Variables for repeated colors */
:root {
    --color-dark-blue: #1a1a2e;
    --color-text-dark: #2c3e50;
    --color-brown-light: #8b7355;
    --color-brown-dark: #654321;
    --color-brown-border: #d4a574;
    --color-success: #27ae60;
    --color-success-bg: rgba(46, 204, 113, 0.2);
    --color-error: #e74c3c;
    --color-error-bg: rgba(231, 76, 60, 0.2);
    --color-info: #3498db;
    --color-info-bg: rgba(52, 152, 219, 0.2);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

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

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    background: var(--color-dark-blue);
}

body.gifting-page {
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 249, 230, 0.98) 100%);
}

#canvas-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Shared hidden class - consolidated from 5 duplicate definitions */
.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Decoration Panel */
#decoration-panel {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 100;
    min-width: 300px;
    transition: opacity var(--transition-normal);
}

#decoration-panel h3 {
    margin-bottom: 15px;
    color: var(--color-text-dark);
    text-align: center;
    font-size: 18px;
}

#decoration-items {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.decoration-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
    cursor: grab;
    transition: transform var(--transition-fast), background var(--transition-fast);
    user-select: none;
}

.decoration-item:hover {
    transform: translateY(-5px);
    background: rgba(0, 0, 0, 0.05);
}

.decoration-item:active {
    cursor: grabbing;
}

.decoration-item.dragging {
    opacity: 0.5;
}

.decoration-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ornament-red {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.ornament-blue {
    background: linear-gradient(135deg, #5dade2, #3498db); /* Brighter blue */
}

.ornament-gold {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.ornament-white {
    background: linear-gradient(135deg, #ffffff, #ecf0f1);
    border: 1px solid #bdc3c7;
}

.star {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.light {
    background: linear-gradient(135deg, #e74c3c, #f39c12);
    border-radius: 5px;
}

.candy-cane {
    background: linear-gradient(90deg, #e74c3c 50%, #ffffff 50%);
    border-radius: 5px;
}

.decoration-item span {
    font-size: 12px;
    color: var(--color-text-dark);
    font-weight: 500;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

#candy {
    overflow: hidden;
    display: flex;
    opacity: 0;
    margin: calc(50vh - 150px) auto 0 auto;
    width: 100px;
    height: 300px;
    border-radius: 100px;
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 0px;
    background-color: #000000;
    box-shadow: 40px 20px 15px -30px rgba(255, 0, 0, 0.1);
    transform: rotate(90deg);
    animation: PARTY 8s cubic-bezier(0.87, -0.41, 0.19, 1.44) infinite;
}

#candy-loader {
    height: 100%;
    width: 100%;
    z-index: 1;
    display: flex;
    align-items: center;
    align-self: flex-end;
    box-shadow: 0px 0px 10px rgba(255, 50, 0, 0.8) inset;
    background: #D33144;
    background: repeating-linear-gradient(45deg,
                #FFFFEE,
                #FFFFEE 15px,
                #D33144 15px,
                #D33144 30px);
    animation: load 8s ease-in infinite;
}

#candy-loader::after {
    content: "";
    background-color: #000000;
    width: 50px;
    height: 270px;
    border-radius: 50px;
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 0px;
    display: flex;
    align-self: flex-end;
}

#candy-loader::before {
    content: "";
    background-color: #000000;
    width: 25px;
    height: 210px;
    display: flex;
    align-self: flex-end;
}

@keyframes load {
    0% {
        height: 0%;
    }
    50% {
        height: 100%;
    }
}

@keyframes PARTY {
    5% {
        opacity: 1;
    }
    50% {
        transform: rotate(90deg) scale(1);
    }
    60% {
        transform: rotate(-10deg) scale(1);
    }
    70% {
        transform: rotate(20deg) scale(1);
    }
    80% {
        transform: rotate(-10deg) scale(1);
    }
    90% {
        transform: rotate(30deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: rotate(-180deg) scale(0);
        opacity: 0;
    }
}


/* Cursor styles */
body.dragging {
    cursor: grabbing !important;
}

/* Shared right-side panel positioning - consolidated from 3 duplicate definitions */
#radio-notepad,
#dice-game-panel,
#deer-race-panel,
#shell-game-panel {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

#radio-notepad.hidden,
#dice-game-panel.hidden,
#deer-race-panel.hidden,
#shell-game-panel.hidden {
    transform: translateY(-50%) translateX(20px);
}

/* Notepad Container */
.notepad-container {
    width: 350px;
    min-height: 400px;
    background: #f5f5dc;
    background-image: 
        repeating-linear-gradient(
            transparent,
            transparent 31px,
            rgba(0, 0, 0, 0.1) 31px,
            rgba(0, 0, 0, 0.1) 32px
        );
    border-left: 3px solid var(--color-brown-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    padding: 20px 30px 20px 40px;
    position: relative;
    border-radius: 2px;
}

/* Removed redundant .notepad-container::before - border-left already provides the visual */

.notepad-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background-image: 
        repeating-linear-gradient(
            transparent,
            transparent 31px,
            rgba(139, 115, 85, 0.15) 31px,
            rgba(139, 115, 85, 0.15) 32px
        );
    border-radius: 2px;
}

.notepad-content {
    position: relative;
    z-index: 1;
    font-family: 'Kalam', cursive;
}

.notepad-content h3 {
    color: var(--color-brown-dark);
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    font-family: 'Arial', sans-serif; /* Override handwritten font for h3 */
}

#song-name-input {
    width: 100%;
    padding: 8px 0;
    margin-bottom: 20px;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 18px;
    font-family: 'Kalam', cursive; /* Handwritten font */
    color: var(--color-text-dark);
    box-shadow: none;
    transition: none;
    line-height: 32px; /* Match line spacing */
}

#song-name-input:focus {
    outline: none;
    border: none;
    box-shadow: none;
    background: transparent;
}

#song-name-input::placeholder {
    color: rgba(139, 115, 85, 0.4);
    font-style: italic;
}

/* Shared button base styles - consolidated from duplicate #check-song-button and .dice-game-button */
#check-song-button,
.dice-game-button {
    padding: 12px 24px;
    background: var(--color-brown-light);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    font-family: 'Arial', sans-serif; /* Same font as h3 */
    cursor: pointer;
    transition: background var(--transition-normal), transform 0.1s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#check-song-button:hover,
.dice-game-button:hover {
    background: var(--color-brown-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#check-song-button:active,
.dice-game-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#check-song-button {
    width: 100%;
    font-size: 16px;
}

.dice-game-button {
    padding: 12px 20px;
    font-size: 14px;
}

.dice-game-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Shared feedback base styles - consolidated from duplicate #song-feedback and #dice-game-feedback */
#song-feedback,
#dice-game-feedback,
.feedback {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
    min-height: 20px;
    transition: opacity var(--transition-normal);
}

#song-feedback:empty,
#dice-game-feedback:empty {
    display: none;
}

#song-feedback.correct,
#dice-game-feedback.correct {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 2px solid var(--color-success);
}

#song-feedback.incorrect,
#dice-game-feedback.incorrect {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 2px solid var(--color-error);
}

#dice-game-feedback.info {
    background: var(--color-info-bg);
    color: var(--color-info);
    border: 2px solid var(--color-info);
}

#dice-game-feedback {
    font-family: 'Kalam', cursive; /* Handwritten font */
    font-size: 14px;
}

#song-feedback {
    font-family: 'Kalam', cursive; /* Handwritten font */
    font-size: 16px;
    color: var(--color-text-dark);
    background: transparent;
    border: none;
    padding: 5px 0;
}

/* Dice Game Panel */
#dice-game-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

/* Deer Race Game Panel */
#deer-race-note {
    margin: 0;
}

#deer-race-note p {
    width: 100%;
    padding: 8px 0;
    margin: 0 0 20px 0;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 18px;
    font-family: 'Kalam', cursive; /* Handwritten font - matches radio input */
    color: var(--color-text-dark);
    box-shadow: none;
    transition: none;
    line-height: 32px; /* Match line spacing */
}

/* Chest Lock Game Panel */
#chest-lock-note {
    margin: 0;
}

#chest-lock-note p {
    width: 100%;
    padding: 8px 0;
    margin: 0 0 10px 0;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 18px;
    font-family: 'Kalam', cursive; /* Handwritten font - matches radio input */
    color: var(--color-text-dark);
    box-shadow: none;
    transition: none;
    line-height: 32px; /* Match line spacing */
}


/* Crosshair */
#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
    transition: opacity var(--transition-fast);
    opacity: 0;
}

#crosshair:not(.hidden) {
    opacity: 1;
}

/* Gift Code Dialog Bubble */
.gift-code-dialog {
    position: fixed;
    z-index: 1000;
    pointer-events: auto;
    animation: giftDialogAppear 0.3s ease-out;
}

@keyframes giftDialogAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -100%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1);
    }
}

.gift-code-content {
    background: linear-gradient(135deg, #fff9e6 0%, #ffe6cc 100%);
    border: 3px solid #d4a574;
    border-radius: 15px;
    padding: 20px 25px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    min-width: 250px;
    max-width: 500px;
    position: relative;
    font-family: 'Kalam', cursive;
}

.gift-code-label {
    font-size: 16px;
    font-weight: 700;
    color: #8b4513;
    margin-bottom: 12px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.gift-code-text {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    background: rgba(255, 255, 255, 0.7);
    padding: 12px 15px;
    border-radius: 8px;
    border: 2px solid #d4a574;
    margin-bottom: 12px;
    word-break: break-all;
    text-align: center;
    user-select: all;
    cursor: text;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.gift-code-copy {
    width: 100%;
    padding: 10px 20px;
    background: #8b4513;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-normal), transform 0.1s ease;
    font-family: 'Arial', sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.gift-code-copy:hover {
    background: #654321;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gift-code-copy:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.gift-code-tail {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid #d4a574;
}

.gift-code-tail::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #ffe6cc;
}

/* Blur Overlay */
#blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.3);
    z-index: 500;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

#blur-overlay:not(.hidden) {
    pointer-events: auto;
}

/* Canvas blur when not authenticated */
#canvas-container.blurred {
    filter: blur(10px);
    transition: filter var(--transition-normal);
}

/* Discord Login Overlay */
#discord-login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 600;
    transition: opacity var(--transition-normal);
}

.discord-login-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.discord-login-container h2 {
    color: var(--color-text-dark);
    font-size: 24px;
    margin-bottom: 10px;
    font-weight: 600;
}

.discord-login-container p {
    color: #666;
    font-size: 16px;
    margin-bottom: 30px;
}

.discord-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: #5865F2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-normal), transform 0.1s ease;
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
    font-family: 'Arial', sans-serif;
}

.discord-button:hover {
    background: #4752C4;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(88, 101, 242, 0.5);
}

.discord-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.4);
}

.discord-button svg {
    width: 20px;
    height: 20px;
}

/* Gifting Page Styles */
.gifting-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 0;
}

.gifting-content {
    background: transparent;
    border-radius: 0;
    padding: 40px;
    box-shadow: none;
    border: none;
    position: relative;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.gifting-content::before {
    content: '❄';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    font-size: 40px;
    background: linear-gradient(135deg, #fff9e6 0%, #ffe6cc 100%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #d4a574;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    line-height: 1;
    margin-top: 40px;
}

.gifting-header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 60px;
    padding-bottom: 20px;
    border-bottom: 3px solid #d4a574;
}

.gifting-header h1 {
    font-size: 36px;
    color: #c0392b;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-family: 'Arial', sans-serif;
    margin: 0;
}

.gifting-intro {
    margin-bottom: 40px;
}

.intro-text {
    font-size: 18px;
    line-height: 1.8;
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: justify;
    font-family: 'Kalam', cursive;
}

.instructions-box {
    margin-bottom: 20px;
}

.instructions-box h2 {
    font-size: 22px;
    margin-bottom: 10px;
    font-family: 'Arial', sans-serif;
    color: #2c3e50;
}

.instructions-box p {
    color: #2c3e50;
    font-size: 18px;
    line-height: 1.8;
    margin: 0;
    font-family: 'Kalam', cursive;
    text-align: justify;
}

.instructions-box strong {
    font-weight: 700;
}

.delivery-note {
    margin-top: 20px;
}

.delivery-note p {
    color: #2c3e50;
    font-size: 18px;
    line-height: 1.8;
    margin: 0;
    font-family: 'Kalam', cursive;
    font-style: italic;
    text-align: justify;
}

.gifting-form {
    margin-top: 30px;
}

.form-section {
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 2px dashed #d4a574;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    color: #8b4513;
    font-size: 24px;
    margin-bottom: 20px;
    font-family: 'Arial', sans-serif;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 16px;
    font-family: 'Arial', sans-serif;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #d4a574;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Kalam', cursive;
    color: #2c3e50;
    background: rgba(255, 255, 255, 0.9);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #8b4513;
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(139, 115, 85, 0.6);
    font-style: italic;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b4513' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: rgba(139, 115, 85, 0.7);
    font-style: italic;
    font-family: 'Kalam', cursive;
}

.form-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
    text-align: center;
    font-family: 'Arial', sans-serif;
    transition: opacity var(--transition-normal);
}

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

.form-message.success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 2px solid var(--color-success);
}

.form-message.error {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 2px solid var(--color-error);
}

.submit-button {
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Arial', sans-serif;
    cursor: pointer;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.submit-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6);
}

.submit-button:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.4);
}

.submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gifting-content {
        padding: 30px 20px;
    }
    
    .gifting-header h1 {
        font-size: 28px;
    }
    
    .intro-text {
        font-size: 16px;
    }
    
    .form-section h3 {
        font-size: 20px;
    }
    
    .submit-button {
        font-size: 18px;
        padding: 14px 24px;
    }
}