/* =========================================
   Universal Setup (Tailwind Base)
   ========================================= */
body {
    color: #111;
    font-family: 'Noto Sans JP', sans-serif;
    /* Avatar Tile Background Pattern (Base) */
    background-color: #FAFAFA;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23AAE179' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.font-pop {
    font-family: 'M PLUS Rounded 1c', sans-serif;
}

/* =========================================
   "Pattern B" Design Tokens
   ========================================= */

/* Pop Shadows */
.shadow-pop {
    box-shadow: 4px 4px 0px 0px #111;
}

.shadow-pop-sm {
    box-shadow: 2px 2px 0px 0px #111;
}

.shadow-pop-lg {
    box-shadow: 8px 8px 0px 0px #111;
}

.shadow-pop-active {
    box-shadow: 0px 0px 0px 0px #111;
}

.shadow-pop-hover:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px 0px #111;
}

/* Diagonal Stripes Utility */
.bg-stripes {
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
    background-size: 20px 20px;
}

/* Button Press Effect */
.btn-press {
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-press:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px 0px #111 !important;
}

/* Bubble Tail */
.bubble-tail::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    z-index: 10;
}

.bubble-tail-border::before {
    content: '';
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 12px 12px 0;
    border-style: solid;
    border-color: #111 transparent transparent transparent;
    z-index: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-left: 1px solid #ddd;
}

::-webkit-scrollbar-thumb {
    background: #ec6620;
    border-radius: 5px;
    border: 2px solid #f1f1f1;
}

::-webkit-scrollbar-thumb:hover {
    background: #c95518;
}

/* =========================================
   "Mitsubishi Kids Style" Renewal Tokens
   (Organic Shapes & Animations)
   ========================================= */

/* Wavy Divider (Bottom) */
.wavy-bottom {
    position: relative;
    padding-bottom: 60px;
}

.wavy-bottom::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 1200 120' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none'%3E%3Cpath d='M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z' fill='%23ffffff' opacity='1' /%3E%3C/svg%3E");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-image: radial-gradient(circle, transparent 70%, #fff 70%);
    background-size: 40px 40px;
    background-position: center bottom;
    transform: rotate(180deg);
}

/* Wavy Divider (Top) */
.wavy-top {
    position: relative;
    padding-top: 60px;
}

.wavy-top::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background-image: radial-gradient(circle, #fff 70%, transparent 70%);
    background-size: 40px 40px;
    background-position: center top;
}

/* Background Patterns */
.bg-dot-pattern {
    background-image: radial-gradient(#AAE179 20%, transparent 20%);
    background-position: 0 0;
    background-size: 24px 24px;
    opacity: 0.15;
}

.bg-grid-pattern {
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Scroll Animation Utilities */
@media (prefers-reduced-motion: no-preference) {
    .animate-on-scroll {
        opacity: 0;
        transform: translateY(30px);
        transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
            transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .animate-on-scroll.is-visible {
        opacity: 1;
        transform: translateY(0);
    }

    @keyframes bounce-in {
        0% {
            transform: scale(0.8);
            opacity: 0;
        }

        50% {
            transform: scale(1.05);
            opacity: 1;
        }

        70% {
            transform: scale(0.95);
        }

        100% {
            transform: scale(1);
            opacity: 1;
        }
    }

    .animate-bounce-in {
        opacity: 0;
        animation: bounce-in 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    }

    .animate-float {
        animation: float 6s ease-in-out infinite;
    }

    @keyframes float {

        0%,
        100% {
            transform: translateY(0px);
        }

        50% {
            transform: translateY(-10px);
        }
    }

    .delay-100 {
        transition-delay: 0.1s;
        animation-delay: 0.1s;
    }

    .delay-200 {
        transition-delay: 0.2s;
        animation-delay: 0.2s;
    }

    .delay-300 {
        transition-delay: 0.3s;
        animation-delay: 0.3s;
    }

    .delay-500 {
        transition-delay: 0.5s;
        animation-delay: 0.5s;
    }
}

@media (prefers-reduced-motion: reduce) {

    .animate-on-scroll,
    .animate-bounce-in {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }
}

/* =========================================
   Mobile Responsive Overrides (max-width: 767px)
   ========================================= */
@media (max-width: 767px) {

    /* --- Base Typography --- */
    body {
        font-size: 15px;
        line-height: 1.65;
    }

    h1,
    .text-2xl,
    .text-3xl {
        font-size: 20px !important;
        line-height: 1.3;
    }

    h2,
    .text-xl {
        font-size: 18px !important;
        line-height: 1.35;
    }

    h3,
    .text-lg {
        font-size: 16px !important;
        line-height: 1.4;
    }

    .font-pop.text-3xl,
    .font-pop.text-4xl,
    .font-pop.text-5xl {
        font-size: 22px !important;
        line-height: 1.3;
    }

    .font-pop.text-2xl {
        font-size: 18px !important;
    }

    .font-pop.text-xl {
        font-size: 16px !important;
    }

    .text-base {
        font-size: 14px !important;
        line-height: 1.6;
    }

    .text-sm {
        font-size: 13px !important;
        line-height: 1.5;
    }

    .text-xs {
        font-size: 11px !important;
        line-height: 1.4;
    }

    .text-\[9px\],
    .text-\[10px\] {
        font-size: 10px !important;
    }

    /* --- Section Spacing --- */
    .py-20 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    .py-16 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .py-12 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    .mb-16 {
        margin-bottom: 2rem !important;
    }

    .mb-12 {
        margin-bottom: 1.5rem !important;
    }

    /* --- Container & Card Padding (exclude header/drawer) --- */
    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .px-4:not(#header-inner):not(#header-inner *) {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .p-6:not(#drawer *):not(#header *) {
        padding: 14px !important;
    }

    .p-8:not(#header *) {
        padding: 16px !important;
    }

    .p-4:not(#header *) {
        padding: 10px !important;
    }

    .min-h-screen.p-4 {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* --- Card Roundness (exclude header) --- */
    .rounded-\[40px\]:not(#header-inner) {
        border-radius: 20px !important;
    }

    .rounded-3xl:not(#header *) {
        border-radius: 16px !important;
    }

    /* --- Card Border/Shadow (exclude header/drawer) --- */
    .border-\[3px\]:not(#header-inner):not(#header-inner *):not(#drawer *) {
        border-width: 2px !important;
    }

    .shadow-pop:not(#header-inner) {
        box-shadow: 3px 3px 0px 0px #111 !important;
    }

    .shadow-pop-sm:not(#header *) {
        box-shadow: 1px 1px 0px 0px #111 !important;
    }

    /* =============================================
       Header: Static band on mobile (not floating)
       ============================================= */
    #header {
        position: relative !important;
    }

    #header-inner {
        border-radius: 0 !important;
        margin-top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
        border-bottom: 3px solid #111 !important;
        padding: 8px 12px !important;
    }

    /* Hamburger button: preserve round shape */
    #menu-btn {
        border-radius: 9999px !important;
        padding: 8px 14px !important;
    }

    /* Logo size on mobile */
    #header-inner img {
        height: 32px !important;
    }

    /* Remove top padding offset (header is no longer fixed) */
    .pt-28,
    .pt-32 {
        padding-top: 1rem !important;
    }

    /* --- Prize Images: Full width, no cropping --- */
    .h-40.object-cover {
        height: auto !important;
        max-height: none !important;
        object-fit: contain !important;
    }

    /* --- Grid Gap Reduction --- */
    .gap-8 {
        gap: 1rem !important;
    }

    .gap-12 {
        gap: 1rem !important;
    }

    /* --- CTA Buttons --- */
    .px-12 {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }

    .py-5 {
        padding-top: 0.875rem !important;
        padding-bottom: 0.875rem !important;
    }

    .text-xl.font-pop {
        font-size: 16px !important;
    }

    /* --- Wavy Divider (reduce) --- */
    .wavy-bottom {
        padding-bottom: 30px;
    }

    .wavy-top {
        padding-top: 30px;
    }

    /* --- Division tab buttons --- */
    .rounded-t-2xl.font-pop {
        font-size: 13px !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }

    /* --- Badge spacing --- */
    .inline-block.border-2.border-black.rounded-full {
        font-size: 10px !important;
        padding: 2px 10px !important;
    }

    /* --- Mypage --- */
    .min-h-screen h1 {
        font-size: 20px !important;
    }

    .bg-white.rounded-xl.shadow-sm.border.border-gray-200.p-6 {
        padding: 14px !important;
    }

    .ranking-list-item .font-pop.text-2xl {
        font-size: 20px !important;
    }

    .rank-num {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}