/* CSS Variables & Reset */
:root {
    --color-cream: #FFE9D1;
    --color-pink: #F4B5B0;
    --color-brown: #C09471;
    --color-peach: #FAC59D;
    --color-lavender: #E6D5F5;
    --color-mint: #C8F4E6;
    --color-yellow: #FFF4B8;
    --color-blue: #D4E5F7;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 
                 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, var(--color-cream) 0%, var(--color-peach) 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Header */
.site-header {
    background: var(--color-pink);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

/* Pet Neko Text */
.pet-neko-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-brown);
    margin-bottom: 0.5rem;
    text-align: center;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1rem;
}

.page-title {
    text-align: center;
    font-size: 1.75rem;
    color: var(--color-brown);
    margin: 2rem 0;
    font-weight: 700;
}

/* Wheel Container */
.wheel-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    background: white;
    padding: 1.5rem 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Neko Cat */
.neko-cat-container {
    text-align: center;
    order: -1;
}

.neko-cat {
    width: 180px;
    height: auto;
    display: block;
    margin: 0 auto;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.neko-cat:hover {
    transform: scale(1.05);
}

.neko-cat:active {
    transform: scale(0.95);
}

.neko-cat.waving {
    animation: wave 0.5s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.cat-label {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-brown);
    font-weight: 600;
    display: none; /* Hidden on mobile to save space */
}

/* Wheel */
.wheel-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    transform: scale(1.15) translateX(20px);
    transform-origin: center;
}

.wheel-pointer {
    position: absolute;
    top: -65px; /* Position pointer above wheel */
    left: 50%;
    transform: translateX(-50%);
    font-size: 6rem; /* 3x bigger */
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-peach) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
    line-height: 1;
    z-index: 2;
}

#wheelCanvas {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
}

#wheelCanvas:hover {
    transform: scale(1.02);
}

#wheelCanvas.spinning {
    cursor: not-allowed;
}

.spin-button {
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-peach) 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    min-width: 200px;
    min-height: 56px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spin-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

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

/* Input Container */
.input-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.input-label {
    font-weight: 600;
    color: var(--color-brown);
    font-size: 1rem;
    text-align: center;
}

.name-textarea {
    width: 100%;
    max-width: 400px;
    height: 500px;
    padding: 1rem;
    border: 2px solid var(--color-peach);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
    background: #fafafa;
}

.name-textarea:focus {
    outline: none;
    border-color: var(--color-pink);
    background: white;
    box-shadow: 0 0 0 3px rgba(244, 181, 176, 0.1);
}

.name-textarea::placeholder {
    color: #C09471;
    opacity: 0.6;
    font-style: italic;
    line-height: 1.5;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.name-count {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
}

.secondary-button {
    background: white;
    color: var(--color-brown);
    border: 2px solid var(--color-peach);
    padding: 0.5rem 1.1rem 0.5rem 0.7rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    min-width: 110px;
    flex: 1 1 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-content: flex-start;
    text-align: left;
}

.secondary-button:hover {
    background: var(--color-cream);
    border-color: var(--color-pink);
}

.secondary-button:active {
    transform: scale(0.98);
}

.clear-button {
    background: white;
    color: #e74c3c;
    border: 2px solid #e74c3c;
}

.clear-button:hover {
    background: #fee;
    border-color: #c0392b;
}

/* Share Dropdown Styles */
.share-container {
    position: relative;
    display: inline-block;
}

.share-main-button {
    position: relative;
}

.share-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 140px;
    background: white;
    border: 2px solid var(--color-pink);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: hidden;
    margin-top: 5px;
}

.share-container.active .share-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.share-option {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: white;
    color: var(--color-brown);
    text-align: left;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.share-option svg {
    flex-shrink: 0;
    vertical-align: middle;
}

.share-option:last-child {
    border-bottom: none;
}

.share-option:hover {
    background: var(--color-cream);
    color: var(--color-pink);
}

.share-option:active {
    background: #f0f0f0;
}

.share-option:focus {
    outline: 2px solid var(--color-pink);
    outline-offset: -2px;
}

/* Close dropdown when clicking outside */
.share-dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    background: transparent;
}

/* Content Sections */
.section-title {
    font-size: 1.75rem;
    color: var(--color-brown);
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.how-to-section,
.content-section,
.faq-section {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.instruction-list {
    list-style: none;
    counter-reset: instruction-counter;
    padding-left: 0;
}

.instruction-list li {
    counter-increment: instruction-counter;
    position: relative;
    padding-left: 3rem;
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.instruction-list li::before {
    content: counter(instruction-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-peach) 100%);
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.content-section p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

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

/* FAQ Section */
.faq-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-question {
    font-size: 1.1rem;
    color: var(--color-brown);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.faq-answer p {
    line-height: 1.8;
    color: #555;
}

/* AdSense Placeholders */
.ad-container {
    margin: 2rem auto;
    text-align: center;
}

.ad-placeholder {
    background: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: var(--radius-md);
    padding: 2rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-label {
    color: #999;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.desktop-ad {
    display: none;
}

.mobile-ad {
    display: block;
}

@media (min-width: 768px) {
    .desktop-ad {
        display: block;
    }
    .mobile-ad {
        display: none;
    }
}

/* Footer */
.site-footer {
    background: var(--color-pink);
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
    margin-top: 3rem;
}

.footer-nav {
    margin-bottom: 1rem;
}

.footer-nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem;
}

.footer-nav a:hover {
    color: var(--color-cream);
}

.separator {
    margin: 0 0.5rem;
    opacity: 0.5;
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

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

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 90%;
    width: 400px;
    position: relative;
    animation: slideUp 0.3s ease;
}

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

.confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

#confettiCanvas {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 9999;
    pointer-events: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.modal-title {
    font-size: 2rem;
    color: var(--color-brown);
    margin-bottom: 1rem;
}

.winner-text {
    font-size: 1.75rem;
    color: var(--color-pink);
    font-weight: 700;
    margin-bottom: 2rem;
    word-break: break-word;
}

.modal-button {
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-peach) 100%);
    color: white;
    border: none;
    padding: 0.75rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    min-height: 48px;
}

.modal-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-button-remove {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.modal-button-remove:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-brown);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    z-index: 2000;
    transition: bottom 0.3s ease;
}

.toast.show {
    bottom: 2rem;
}

/* Responsive Design */

/* Mobile-first: Default styles above are for mobile */

/* Tablet and Desktop (768px and up) */
@media (min-width: 768px) {
    .site-header {
        padding: 1.25rem 1.5rem;
    }
    
    .site-title {
        font-size: 1.75rem;
    }
    
    .main-content {
        padding: 2rem 1.5rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .wheel-container {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 2rem;
        align-items: start;
        padding: 2rem;
        position: relative;
    }
    
    .neko-cat-container {
        order: 0;
        position: absolute;
        left: 30px;
        top: 120px;
    }
    
    .neko-cat {
        width: 216px;
    }
    
    .cat-label {
        display: block; /* Show on desktop */
    }
    
    .pet-neko-text {
        font-size: 1rem;
    }
    
    .wheel-wrapper {
        order: 0;
        grid-column: 2;
    }
    
    .input-container {
        order: 0;
        grid-column: 3;
        padding: 0;
    }
    
    .name-textarea {
        width: 280px;
        max-width: none;
    }
}

/* Small mobile adjustments */
@media (max-width: 375px) {
    .site-header {
        padding: 0.75rem 1rem;
    }
    
    .site-title {
        font-size: 1.25rem;
    }
    
    .main-content {
        padding: 0.75rem 0.75rem;
    }
    
    .wheel-container {
        padding: 1rem 0.75rem;
    }
    
    .neko-cat {
        width: 110px;
    }
    
    .pet-neko-text {
        font-size: 0.85rem;
    }
    
    .how-to-section,
    .content-section,
    .faq-section {
        padding: 1.5rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .input-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .button-group {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.3rem;
    }
    
    .secondary-button {
        flex: 1 1 0;
        min-width: 0;
        font-size: 0.75rem;
        padding: 0.5rem 0.3rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Mobile share dropdown adjustments */
    .share-container {
        flex: 1 1 auto;
    }
    
    .share-dropdown {
        left: 0;
        right: 0;
        min-width: 100%;
        margin-top: 5px;
    }
    
    .share-option {
        padding: 1rem;
        font-size: 1rem;
        text-align: center;
        justify-content: center;
    }
}

/* Mobile-specific layout fixes (all mobile devices up to tablet) */
@media (max-width: 767px) {
    /* Position Neko in top-left */
    .neko-cat-container {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding-left: 30px;
        padding-top: 20px;
        margin-bottom: 30px;
        width: 100%;
    }
    
    /* Adjust Neko size on mobile (180px from base style) */
    .neko-cat {
        width: 180px;
        margin: 0;
    }
    
    .pet-neko-text {
        text-align: left;
        margin-left: 0;
    }
    
    /* Center the wheel properly on mobile */
    .wheel-wrapper {
        transform: scale(1) translateX(0) !important;
        margin: 0 auto;
        width: 100%;
        max-width: 100%;
    }
    
    /* Ensure wheel container is centered */
    .wheel-container {
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
        padding: 1rem 0.5rem;
    }
    
    /* Make wheel large and fill mobile screen */
    #wheelCanvas {
        width: 85vw !important;
        max-width: 350px !important;
        height: auto !important;
    }
    
    /* Adjust spin button for mobile */
    .spin-button {
        width: 85vw;
        max-width: 350px;
        padding: 0.875rem 2rem;
        font-size: 1.1rem;
    }
    
    /* Center input container on mobile */
    .input-container {
        padding: 0 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus {
    outline: 2px solid var(--color-pink);
    outline-offset: 2px;
}

button:focus,
a:focus,
textarea:focus {
    outline: 2px solid var(--color-pink);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .ad-container,
    .spin-button,
    .secondary-button,
    .modal {
        display: none;
    }
}
