/* Custom Game Challenge Styles */

:root {
    --color-primary: #FF6B9D;
    --color-secondary: #C084FC;
    --color-accent: #38BDF8;
    --color-gold: #FCD34D;
    --color-ruby: #F43F5E;
    --color-bg-light: #FFF0F5;
}

body {
    font-family: 'Nunito', 'Kanit', sans-serif;
    background-color: var(--color-bg-light);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 107, 157, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(192, 132, 252, 0.05) 0%, transparent 40%);
    overflow-x: hidden;
}

.currency-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 1.15em;
    height: 1.15em;
    min-width: 1.15em;
    border-radius: 9999px;
    border: 1px solid currentColor;
    font-family: 'Nunito', 'Kanit', sans-serif;
    font-size: 0.78em;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-transform: uppercase;
    vertical-align: -0.14em;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        inset 0 -2px 0 rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(88, 28, 135, 0.12);
}

.currency-icon > span {
    position: relative;
    z-index: 2;
}

.currency-icon--gold {
    color: #92400E;
    border-color: #F59E0B;
    background:
        radial-gradient(circle at 34% 28%, #FFFBEB 0 16%, transparent 17%),
        linear-gradient(145deg, #FEF3C7 0%, #FCD34D 45%, #F59E0B 100%);
}

.currency-icon--coin {
    color: #334155;
    border-color: #94A3B8;
    background:
        radial-gradient(circle at 34% 28%, #FFFFFF 0 15%, transparent 16%),
        linear-gradient(145deg, #F8FAFC 0%, #CBD5E1 46%, #64748B 100%);
}

.currency-icon--ruby {
    color: transparent;
    border-color: #FB7185;
    border-radius: 0.18em;
    clip-path: polygon(50% 0%, 96% 36%, 78% 100%, 22% 100%, 4% 36%);
    background:
        linear-gradient(125deg, rgba(255, 255, 255, 0.9) 0 13%, transparent 14% 100%),
        linear-gradient(155deg, #FFE4E6 0%, #FB7185 38%, #E11D48 72%, #9F1239 100%);
}

.currency-icon--ruby > span {
    display: none;
}

.currency-icon--ruby::before,
.currency-icon--ruby::after {
    content: "";
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

.currency-icon--ruby::before {
    left: 25%;
    right: 25%;
    top: 8%;
    bottom: 42%;
    border-left: 1px solid rgba(255, 255, 255, 0.58);
    border-right: 1px solid rgba(255, 255, 255, 0.34);
    transform: skewX(-14deg);
}

.currency-icon--ruby::after {
    left: 16%;
    right: 16%;
    top: 38%;
    height: 1px;
    background: rgba(255, 255, 255, 0.42);
    box-shadow: 0 0.24em 0 rgba(255, 255, 255, 0.16);
}

.currency-icon--line-coin {
    color: #064E3B;
    border-color: #059669;
    background:
        radial-gradient(circle at 34% 28%, #ECFDF5 0 14%, transparent 15%),
        radial-gradient(circle at 72% 76%, rgba(6, 78, 59, 0.18) 0 18%, transparent 19%),
        linear-gradient(145deg, #D1FAE5 0%, #34D399 42%, #059669 72%, #064E3B 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.88),
        inset 0 0 0 0.16em rgba(255, 255, 255, 0.22),
        inset 0 -2px 0 rgba(6, 78, 59, 0.22),
        0 1px 3px rgba(6, 78, 59, 0.22);
}

.currency-icon--sm {
    width: 1rem;
    height: 1rem;
    min-width: 1rem;
    font-size: 0.58rem;
    vertical-align: -0.12em;
}

.currency-icon--md {
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    font-size: 0.68rem;
}

.currency-icon--lg {
    width: 1.5rem;
    height: 1.5rem;
    min-width: 1.5rem;
    font-size: 0.78rem;
}

.currency-icon--xl {
    width: 1.75rem;
    height: 1.75rem;
    min-width: 1.75rem;
    font-size: 0.9rem;
}

/* Profile cosmetic frame system */
.profile-avatar-stage {
    --profile-avatar-size: 5rem;
    --profile-frame-scale: 1.6;
    --profile-frame-size: 8rem;
    position: relative;
    display: flex;
    width: var(--profile-frame-size);
    height: var(--profile-frame-size);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: visible;
}

.profile-avatar-stage--lg {
    --profile-avatar-size: 6rem;
    --profile-frame-size: 9.6rem;
}

.profile-avatar-stage--sm {
    --profile-avatar-size: 4rem;
    --profile-frame-size: 6.4rem;
}

.profile-avatar-shell {
    width: var(--profile-avatar-size) !important;
    height: var(--profile-avatar-size) !important;
}

.profile-avatar-frame-art {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 20;
    width: var(--profile-frame-size) !important;
    height: var(--profile-frame-size) !important;
    transform: translate(-50%, -50%);
    object-fit: contain;
    pointer-events: none;
}

[data-preview-crown] {
    display: none !important;
}

.profile-avatar-crown {
    top: calc((var(--profile-frame-size) - var(--profile-avatar-size)) / 2 - 0.35rem);
}

.profile-avatar-level {
    bottom: calc((var(--profile-frame-size) - var(--profile-avatar-size)) / 2 - 0.5rem);
}

.profile-card-background-art,
.profile-preview-background-art,
.profile-modal-background-art {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    pointer-events: none;
}

.profile-card-background-fade,
.profile-preview-background-fade,
.profile-modal-background-fade {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.8) 100%);
    pointer-events: none;
}

.profile-preview-background-art.hidden + .profile-preview-background-fade,
.profile-modal-background-art.hidden + .profile-modal-background-fade {
    display: none;
}

.profile-preview-card--profile {
    isolation: isolate;
    overflow: visible !important;
}

/* Let the artwork continue beneath the profile-card border, then redraw that border above it. */
.profile-preview-card--profile .profile-preview-background-art,
.profile-preview-card--profile .profile-preview-background-fade {
    inset: -3px;
    width: calc(100% + 6px);
    height: calc(100% + 6px);
    border-radius: 1rem;
}

.profile-preview-card--profile::after {
    position: absolute;
    inset: 0;
    z-index: 2;
    box-sizing: border-box;
    border: 3px solid #ffffff;
    border-radius: 1rem;
    content: '';
    pointer-events: none;
}

.profile-modal-background-art,
.profile-modal-background-fade {
    border-radius: 1.5rem;
}

/* Avoid an expensive translucent backdrop composite in the iOS LINE browser. */
body.ios-profile-modal-active #memberProfileModalOverlay {
    background-color: #2e1065;
    transition-duration: 0ms !important;
}

body.ios-profile-modal-active #memberProfileCardContainer {
    transition-duration: 0ms !important;
    will-change: transform, opacity;
}

body.ios-profile-modal-active .glass-panel {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

.home-action-grid {
    position: relative;
    z-index: 10;
}

.home-action-grid > a,
.home-action-grid > button {
    --home-action-surface: #FDF2F8;
    --home-action-line: #F9A8D4;
    --home-action-text: #BE185D;
    min-height: 4.35rem;
    background: linear-gradient(180deg, #FFFFFF 0%, var(--home-action-surface) 100%) !important;
    border: 2px solid var(--home-action-line) !important;
    color: var(--home-action-text) !important;
    box-shadow:
        0 12px 24px rgba(88, 28, 135, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.home-action-grid > .bg-purple-100 {
    --home-action-surface: #F5F3FF;
    --home-action-line: #C4B5FD;
    --home-action-text: #6D28D9;
}

.home-action-grid > .bg-sky-100 {
    --home-action-surface: #EFF6FF;
    --home-action-line: #93C5FD;
    --home-action-text: #0369A1;
}

.home-action-grid > .bg-emerald-100 {
    --home-action-surface: #ECFDF5;
    --home-action-line: #6EE7B7;
    --home-action-text: #047857;
}

.home-action-grid > .bg-violet-100 {
    --home-action-surface: #F5F3FF;
    --home-action-line: #C4B5FD;
    --home-action-text: #7C3AED;
}

.home-action-grid > .bg-red-100 {
    --home-action-surface: #FEF2F2;
    --home-action-line: #FCA5A5;
    --home-action-text: #DC2626;
}

.home-action-grid > .bg-amber-50 {
    --home-action-surface: #FFFBEB;
    --home-action-line: #FCD34D;
    --home-action-text: #B45309;
}

.home-action-grid > a:hover,
.home-action-grid > button:hover {
    background: linear-gradient(180deg, #FFFFFF 0%, var(--home-action-surface) 100%) !important;
    box-shadow:
        0 16px 28px rgba(88, 28, 135, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
    transform: translateY(-1px);
}

.home-action-grid > a > span:first-child,
.home-action-grid > button > span:first-child {
    display: inline-flex;
    width: 2.15rem;
    height: 2.15rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 -1px 0 rgba(88, 28, 135, 0.08);
    font-size: 1.15rem;
    line-height: 1;
}

.home-action-grid > a > span:not(:first-child),
.home-action-grid > button > span:not(:first-child) {
    line-height: 1.2;
}

.home-action-grid > button:disabled {
    opacity: 0.78 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88) !important;
}

/* Glassmorphism containers */
.glass-panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px 0 rgba(255, 107, 157, 0.1);
}

.glass-panel-dark {
    background: rgba(30, 27, 75, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Soft cozy action buttons shared across the project */
.btn-game-primary,
.btn-game-secondary,
.btn-game-accent,
.btn-game-success,
.btn-game-gold,
.btn-game-danger,
button[class*="bg-gradient-to-"],
a[class*="bg-gradient-to-"],
button[class*="bg-pink-4"],
a[class*="bg-pink-4"],
button[class*="bg-pink-5"],
a[class*="bg-pink-5"],
button[class*="bg-rose-4"],
a[class*="bg-rose-4"],
button[class*="bg-rose-5"],
a[class*="bg-rose-5"],
button[class*="bg-red-4"],
a[class*="bg-red-4"],
button[class*="bg-red-5"],
a[class*="bg-red-5"],
button[class*="bg-amber-4"],
a[class*="bg-amber-4"],
button[class*="bg-yellow-4"],
a[class*="bg-yellow-4"],
button[class*="bg-sky-4"],
a[class*="bg-sky-4"],
button[class*="bg-blue-4"],
a[class*="bg-blue-4"],
button[class*="bg-green-4"],
a[class*="bg-green-4"],
button[class*="bg-emerald-4"],
a[class*="bg-emerald-4"],
button[class*="bg-purple-5"],
a[class*="bg-purple-5"] {
    --soft-action-bg: #FCE7F3;
    --soft-action-hover: #FBCFE8;
    --soft-action-text: #BE185D;
    --soft-action-border: #FBCFE8;
    background: var(--soft-action-bg) !important;
    background-image: none !important;
    border: 1px solid var(--soft-action-border) !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 1px 2px rgba(88, 28, 135, 0.08) !important;
    color: var(--soft-action-text) !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    text-shadow: none !important;
    transform: none;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease !important;
}

.btn-game-primary:hover,
.btn-game-secondary:hover,
.btn-game-accent:hover,
.btn-game-success:hover,
.btn-game-gold:hover,
.btn-game-danger:hover,
button[class*="bg-gradient-to-"]:hover,
a[class*="bg-gradient-to-"]:hover,
button[class*="bg-pink-4"]:hover,
a[class*="bg-pink-4"]:hover,
button[class*="bg-pink-5"]:hover,
a[class*="bg-pink-5"]:hover,
button[class*="bg-rose-4"]:hover,
a[class*="bg-rose-4"]:hover,
button[class*="bg-rose-5"]:hover,
a[class*="bg-rose-5"]:hover,
button[class*="bg-red-4"]:hover,
a[class*="bg-red-4"]:hover,
button[class*="bg-red-5"]:hover,
a[class*="bg-red-5"]:hover,
button[class*="bg-amber-4"]:hover,
a[class*="bg-amber-4"]:hover,
button[class*="bg-yellow-4"]:hover,
a[class*="bg-yellow-4"]:hover,
button[class*="bg-sky-4"]:hover,
a[class*="bg-sky-4"]:hover,
button[class*="bg-blue-4"]:hover,
a[class*="bg-blue-4"]:hover,
button[class*="bg-green-4"]:hover,
a[class*="bg-green-4"]:hover,
button[class*="bg-emerald-4"]:hover,
a[class*="bg-emerald-4"]:hover,
button[class*="bg-purple-5"]:hover,
a[class*="bg-purple-5"]:hover {
    background: var(--soft-action-hover) !important;
    background-image: none !important;
    color: var(--soft-action-text) !important;
    filter: none !important;
    opacity: 1 !important;
}

.btn-game-primary:active,
.btn-game-secondary:active,
.btn-game-accent:active,
.btn-game-success:active,
.btn-game-gold:active,
.btn-game-danger:active,
button[class*="bg-gradient-to-"]:active,
a[class*="bg-gradient-to-"]:active,
button[class*="bg-pink-4"]:active,
a[class*="bg-pink-4"]:active,
button[class*="bg-pink-5"]:active,
a[class*="bg-pink-5"]:active,
button[class*="bg-rose-4"]:active,
a[class*="bg-rose-4"]:active,
button[class*="bg-rose-5"]:active,
a[class*="bg-rose-5"]:active,
button[class*="bg-red-4"]:active,
a[class*="bg-red-4"]:active,
button[class*="bg-red-5"]:active,
a[class*="bg-red-5"]:active,
button[class*="bg-amber-4"]:active,
a[class*="bg-amber-4"]:active,
button[class*="bg-yellow-4"]:active,
a[class*="bg-yellow-4"]:active,
button[class*="bg-sky-4"]:active,
a[class*="bg-sky-4"]:active,
button[class*="bg-blue-4"]:active,
a[class*="bg-blue-4"]:active,
button[class*="bg-green-4"]:active,
a[class*="bg-green-4"]:active,
button[class*="bg-emerald-4"]:active,
a[class*="bg-emerald-4"]:active,
button[class*="bg-purple-5"]:active,
a[class*="bg-purple-5"]:active {
    transform: scale(0.95) !important;
}

.btn-game-secondary,
button[class*="from-purple"],
a[class*="from-purple"],
button[class*="to-purple"],
a[class*="to-purple"],
button[class*="bg-purple-5"],
a[class*="bg-purple-5"] {
    --soft-action-bg: #F3E8FF;
    --soft-action-hover: #E9D5FF;
    --soft-action-text: #7E22CE;
    --soft-action-border: #E9D5FF;
}

.btn-game-accent,
button[class*="from-sky"],
a[class*="from-sky"],
button[class*="to-sky"],
a[class*="to-sky"],
button[class*="from-blue"],
a[class*="from-blue"],
button[class*="to-blue"],
a[class*="to-blue"],
button[class*="bg-sky-4"],
a[class*="bg-sky-4"],
button[class*="bg-blue-4"],
a[class*="bg-blue-4"] {
    --soft-action-bg: #E0F2FE;
    --soft-action-hover: #BAE6FD;
    --soft-action-text: #0369A1;
    --soft-action-border: #BAE6FD;
}

.btn-game-success,
button[class*="from-green"],
a[class*="from-green"],
button[class*="to-green"],
a[class*="to-green"],
button[class*="from-emerald"],
a[class*="from-emerald"],
button[class*="to-emerald"],
a[class*="to-emerald"],
button[class*="bg-green-4"],
a[class*="bg-green-4"],
button[class*="bg-emerald-4"],
a[class*="bg-emerald-4"] {
    --soft-action-bg: #D1FAE5;
    --soft-action-hover: #A7F3D0;
    --soft-action-text: #047857;
    --soft-action-border: #A7F3D0;
}

.btn-game-gold,
button[class*="from-amber"],
a[class*="from-amber"],
button[class*="to-amber"],
a[class*="to-amber"],
button[class*="from-yellow"],
a[class*="from-yellow"],
button[class*="to-yellow"],
a[class*="to-yellow"],
button[class*="bg-amber-4"],
a[class*="bg-amber-4"],
button[class*="bg-yellow-4"],
a[class*="bg-yellow-4"] {
    --soft-action-bg: #FFFBEB;
    --soft-action-hover: #FEF3C7;
    --soft-action-text: #B45309;
    --soft-action-border: #FDE68A;
}

.btn-game-danger,
button[class*="from-red"],
a[class*="from-red"],
button[class*="to-red"],
a[class*="to-red"],
button[class*="from-rose"],
a[class*="from-rose"],
button[class*="to-rose"],
a[class*="to-rose"],
button[class*="bg-red-4"],
a[class*="bg-red-4"],
button[class*="bg-red-5"],
a[class*="bg-red-5"],
button[class*="bg-rose-4"],
a[class*="bg-rose-4"],
button[class*="bg-rose-5"],
a[class*="bg-rose-5"] {
    --soft-action-bg: #FEE2E2;
    --soft-action-hover: #FECACA;
    --soft-action-text: #DC2626;
    --soft-action-border: #FECACA;
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

@keyframes float-slow {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(-3deg); }
}

@keyframes pulse-subtle {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.95; }
}

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

@keyframes rotate-bg {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

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

.animate-pulse-subtle {
    animation: pulse-subtle 3s ease-in-out infinite;
}

/* Custom card frames */
.game-card-frame {
    border: 3px solid #FFF;
    outline: 3px solid var(--color-primary);
    border-radius: 1rem;
    position: relative;
    box-shadow: 
        0 10px 25px -5px rgba(255, 107, 157, 0.15),
        0 8px 10px -6px rgba(255, 107, 157, 0.1);
}

.game-card-title {
    background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
    color: white;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem 0.5rem 0 0;
}

/* Custom scrollbars */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg-light);
}
::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #FF528B;
}

/* Banner overlay styles */
.banner-text-glow {
    text-shadow: 0 2px 10px rgba(255, 107, 157, 0.8), 0 0 20px rgba(192, 132, 252, 0.6);
}

.hero-banner-copy {
    width: 320px;
    max-width: calc(100% - 2rem);
}

.hero-banner-copy h2,
.hero-banner-copy p {
    overflow-wrap: anywhere;
    white-space: normal;
}

.hero-banner-copy p {
    word-break: normal;
}

@media (min-width: 768px) {
    .hero-banner-copy {
        width: 36rem;
        max-width: calc(100% - 6rem);
    }
}

/* Sparkle element styles */
.sparkle-particle {
    position: absolute;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23FCD34D'><path d='M12 0l3 9 9 3-9 3-3 9-3-9-9-3 9-3z'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
    animation: sparkle 1.5s ease-in-out infinite;
}

/* Bottom Nav bar Active State */
.nav-bottom-item.active {
    color: var(--color-primary);
    transform: translateY(-5px);
}

.nav-bottom-item.active .icon-container {
    background: linear-gradient(to bottom, #FFEDF3, #FFD6E4);
    box-shadow: 0 4px 10px rgba(255, 107, 157, 0.3);
    border: 2px solid var(--color-primary);
}

/* Modal Popup Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.2s ease-out forwards;
}
.animate-fade-out {
    animation: fadeOut 0.2s ease-in forwards;
}
.animate-scale-in {
    animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Accessibility baseline */
html {
    scroll-padding-top: 5rem;
    scroll-padding-bottom: calc(6rem + env(safe-area-inset-bottom));
}

:focus-visible {
    outline: 3px solid #6D28D9 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 5px #6D28D9 !important;
}

#mobileMenuDrawer {
    background-color: #FFFFFF !important;
    opacity: 1;
}

@media (pointer: coarse) {
    button,
    input[type="button"],
    input[type="submit"],
    input[type="reset"],
    [role="button"] {
        min-width: 44px;
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }

    .sparkle-particle {
        display: none !important;
    }
}
