/* ============================================
   MIMMA'S MAGICAL GARDEN - Premium Stylesheet
   ============================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --grass-1: #4d9a3d;
    --grass-2: #437f35;
    --grass-3: #56a847;
    --grass-edge: #3a7230;
    --path: #c9b07a;
    --path-dark: #a69060;
    --path-light: #dcc896;
    --fence: #7a5a1a;
    --fence-dark: #5c4210;
    --fence-light: #a07830;
    --water: #3f9ce0;
    --water-light: #60baff;
    --water-deep: #2878b8;
    --tree-trunk: #5e3a1a;
    --tree-top: #2a7518;
    --tree-light: #3c9828;
    --tree-shadow: #1c5a10;
    --gold: #ffd700;
    --gold-dark: #c8a400;
    --gold-soft: #ffe66d;
    --parchment: #faf0d7;
    --parchment-dark: #e6d5aa;
    --text-dark: #2c1810;
    --text-light: #fff8e7;
    --text-muted: #a09080;
    --rare-glow: #c77dff;
    --common-glow: #69db7c;
    --pink-accent: #ff6b9d;
    --pink-dark: #d44a7a;
    --font-pixel: 'Press Start 2P', cursive;
    --font-body: 'Quicksand', sans-serif;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    background: #0d0d1a;
}

.hidden {
    display: none !important;
}

/* ===== WELCOME SCREEN ===== */
#welcome-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: radial-gradient(ellipse at 50% 30%, #2e1065 0%, #1a0a3e 40%, #0d0520 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#welcome-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.welcome-particle {
    position: absolute;
    font-size: 20px;
    opacity: 0;
    animation: floatUp 6s linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
    }

    85% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-50px) rotate(360deg);
        opacity: 0;
    }
}

.welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 1;
    animation: fadeSlideIn 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 20px;
    max-width: 560px;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.welcome-frame {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    padding: 3px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.25), 0 0 80px rgba(255, 215, 0, 0.1);
    animation: portraitGlow 4s ease-in-out infinite alternate;
}

@keyframes portraitGlow {
    from {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.25);
    }

    to {
        box-shadow: 0 0 50px rgba(255, 215, 0, 0.4), 0 0 100px rgba(255, 215, 0, 0.15);
    }
}

.welcome-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    filter: brightness(1.05) saturate(1.1);
}

.welcome-text-box {
    text-align: center;
    width: 100%;
}

.welcome-title {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 2px 2px 0 rgba(0, 0, 0, 0.8);
    margin-bottom: 18px;
    line-height: 2;
    letter-spacing: 1px;
}

.dialogue-box {
    background: rgba(10, 5, 30, 0.75);
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 8px;
    padding: 20px 22px;
    position: relative;
    margin-bottom: 18px;
    min-height: 80px;
    text-align: left;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: inset 0 1px 0 rgba(255, 215, 0, 0.1), 0 8px 32px rgba(0, 0, 0, 0.4);
}

.dialogue-box p {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-light);
    line-height: 1.7;
    letter-spacing: 0.3px;
}

.dialogue-cursor {
    position: absolute;
    bottom: 6px;
    right: 10px;
    color: var(--gold);
    animation: blink 0.8s steps(2) infinite;
    font-size: 10px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.pixel-btn {
    font-family: var(--font-pixel);
    font-size: 9px;
    padding: 14px 32px;
    letter-spacing: 0.5px;
    background: linear-gradient(180deg, var(--pink-accent), var(--pink-dark));
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    box-shadow: 0 4px 0 #a83a5e, 0 4px 20px rgba(255, 107, 157, 0.3);
    transition: all 0.15s;
}

.pixel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #a83a5e, 0 6px 28px rgba(255, 107, 157, 0.4);
}

.pixel-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #a83a5e;
}

/* ===== GAME VIEWPORT ===== */
#viewport {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #1a3a10;
    display: none;
}

#viewport.active {
    display: block;
}

#world {
    position: absolute;
    width: 2400px;
    height: 1800px;
    background-color: var(--grass-1);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(86, 168, 71, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(67, 127, 53, 0.3) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 80%, rgba(86, 168, 71, 0.25) 0%, transparent 40%),
        radial-gradient(circle, var(--grass-2) 1px, transparent 1px),
        radial-gradient(circle, var(--grass-3) 0.8px, transparent 0.8px),
        radial-gradient(circle, rgba(100, 180, 70, 0.3) 0.6px, transparent 0.6px);
    background-size: 100% 100%, 100% 100%, 100% 100%, 20px 20px, 14px 14px, 32px 32px;
    background-position: 0 0, 0 0, 0 0, 0 0, 7px 7px, 3px 15px;
    image-rendering: auto;
}

/* World ambient warm sunlight overlay */
#world::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(255, 245, 180, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(255, 220, 150, 0.08) 0%, transparent 40%);
    z-index: 50;
}

/* Subtle vignette */
#world::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(0, 20, 0, 0.15) 100%);
    z-index: 50;
}

/* ===== TILES ===== */
.tile-path {
    position: absolute;
    background-color: var(--path);
    background-image:
        radial-gradient(ellipse at 25% 25%, var(--path-light) 0%, transparent 45%),
        radial-gradient(ellipse at 75% 75%, var(--path-dark) 0%, transparent 35%),
        radial-gradient(circle at 15% 60%, rgba(180, 160, 120, 0.4) 2px, transparent 2px),
        radial-gradient(circle at 55% 30%, rgba(160, 140, 100, 0.3) 3px, transparent 3px),
        radial-gradient(circle at 80% 80%, rgba(170, 150, 110, 0.35) 2px, transparent 2px),
        radial-gradient(circle at 40% 85%, rgba(190, 170, 130, 0.25) 1.5px, transparent 1.5px);
    background-size: 100% 100%, 100% 100%, 60px 60px, 80px 80px, 45px 45px, 55px 55px;
    box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.15), inset 0 -2px 6px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}

.tile-fence {
    position: absolute;
    z-index: 5;
    background: linear-gradient(180deg, var(--fence-light) 0%, var(--fence) 40%, var(--fence-dark) 100%);
    background-image:
        repeating-linear-gradient(90deg, transparent, transparent 22px, rgba(0, 0, 0, 0.08) 22px, rgba(0, 0, 0, 0.08) 24px),
        linear-gradient(180deg, var(--fence-light) 0%, var(--fence) 40%, var(--fence-dark) 100%);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 4px 8px rgba(0, 0, 0, 0.25);
    border-radius: 4px;
}

.tile-fence::before,
.tile-fence::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--fence-dark);
}

.tile-fence::before {
    top: 35%;
}

.tile-fence::after {
    top: 65%;
}

.tile-water {
    position: absolute;
    border-radius: 40% 50% 45% 55% / 50% 40% 55% 45%;
    z-index: 2;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 35% 30%, rgba(120, 200, 255, 0.3) 0%, transparent 50%),
        linear-gradient(135deg, var(--water-deep), var(--water), var(--water-light));
    box-shadow: inset 0 3px 15px rgba(0, 0, 0, 0.25), inset 0 -2px 8px rgba(96, 186, 255, 0.15), 0 0 24px rgba(63, 156, 224, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
    animation: waterShimmer 4s ease-in-out infinite alternate;
}

.tile-water::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 40%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: ripple 3s ease-in-out infinite;
}

@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(0.7);
        opacity: 0.6;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

.tile-water::after {
    content: '🍃';
    position: absolute;
    top: 20%;
    left: 30%;
    font-size: 16px;
    animation: lilypad 6s ease-in-out infinite;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

@keyframes lilypad {

    0%,
    100% {
        transform: translate(0, 0) rotate(0);
    }

    50% {
        transform: translate(5px, 3px) rotate(10deg);
    }
}

@keyframes waterShimmer {
    0% {
        filter: brightness(0.95);
    }

    100% {
        filter: brightness(1.08);
    }
}

.tile-tree {
    position: absolute;
    width: 80px;
    height: 96px;
    z-index: 8;
}

.tile-tree .trunk {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 32px;
    background: linear-gradient(90deg, #4a2e10, var(--tree-trunk), #7a4e28, #5e3a1a);
    border-radius: 3px 3px 4px 4px;
    box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.35);
}

/* Ground shadow beneath tree */
.tile-tree::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 10px;
    background: radial-gradient(ellipse, rgba(0, 30, 0, 0.25) 0%, transparent 70%);
    border-radius: 50%;
}

.tile-tree .canopy {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 66px;
    height: 64px;
    border-radius: 45% 50% 42% 48% / 50% 45% 50% 48%;
    background: radial-gradient(circle at 38% 32%, var(--tree-light) 0%, var(--tree-top) 45%, var(--tree-shadow) 100%);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), inset 0 -10px 20px rgba(0, 0, 0, 0.12), inset 4px 4px 8px rgba(100, 200, 60, 0.15);
}

/* Canopy highlight spot */
.tile-tree .canopy::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 18px;
    width: 16px;
    height: 12px;
    background: radial-gradient(ellipse, rgba(120, 220, 80, 0.35) 0%, transparent 70%);
    border-radius: 50%;
}

.tile-flowerbed {
    position: absolute;
    border-radius: 18px;
    z-index: 1;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(90, 170, 60, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(50, 100, 35, 0.3) 0%, transparent 45%),
        linear-gradient(145deg, #3e7a2e, #4a8c38, #3d7530);
    box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.12), inset 0 -3px 8px rgba(0, 0, 0, 0.08), 0 0 0 3px rgba(58, 114, 48, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(90, 160, 70, 0.35);
}

.tile-flowerbed::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 14px;
    background: radial-gradient(circle at 50% 50%, rgba(80, 160, 50, 0.15) 0%, transparent 60%);
    border: 1px dashed rgba(100, 180, 70, 0.2);
    pointer-events: none;
}

.fountain {
    position: absolute;
    z-index: 3;
}

.fountain-base {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, rgba(200, 200, 200, 0.6) 0%, transparent 40%),
        linear-gradient(145deg, #c0c0c0, #a0a0a0 30%, #808080 70%, #606060);
    box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.35), inset 0 -2px 6px rgba(255, 255, 255, 0.1), 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 30px rgba(63, 156, 224, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(80, 80, 80, 0.3);
}

/* Outer ring detail */
.fountain-base::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    pointer-events: none;
}

.fountain-water {
    width: 55%;
    height: 55%;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, var(--water-light) 0%, var(--water) 60%, var(--water-deep) 100%);
    box-shadow: 0 0 20px rgba(96, 186, 255, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    animation: fountainPulse 2s ease-in-out infinite alternate;
}

@keyframes fountainPulse {
    from {
        transform: scale(1);
        box-shadow: 0 0 18px rgba(96, 186, 255, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    }

    to {
        transform: scale(1.06);
        box-shadow: 0 0 28px rgba(96, 186, 255, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    }
}

.garden-sign {
    position: absolute;
    z-index: 10;
    background: linear-gradient(180deg, #c4982a, var(--fence-light), var(--fence));
    border: 2px solid var(--fence-dark);
    border-radius: 8px;
    padding: 8px 16px;
    font-family: var(--font-pixel);
    font-size: 6px;
    color: var(--text-light);
    text-align: center;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 12px rgba(255, 215, 0, 0.08);
}

.garden-sign::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 10px;
    background: var(--fence-dark);
    border-radius: 0 0 2px 2px;
}

.garden-gate {
    position: absolute;
    z-index: 6;
    border: 3px solid var(--fence-dark);
    border-bottom: none;
    border-radius: 32px 32px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12px;
    background: linear-gradient(180deg, rgba(122, 90, 26, 0.5) 0%, rgba(122, 90, 26, 0.2) 40%, transparent 80%);
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.2), inset 0 2px 0 rgba(255, 215, 0, 0.15);
}

.garden-gate span {
    font-family: var(--font-pixel);
    font-size: 5px;
    color: var(--gold);
    text-shadow: 1px 1px 0 #000, 0 0 8px rgba(255, 215, 0, 0.5);
}

/* ===== CHARACTER ===== */
.character {
    position: absolute;
    z-index: 20;
    transition: left 0.06s linear, top 0.06s linear;
    pointer-events: none;
}

/* Character shadow on ground */
.character::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 8px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.25) 0%, transparent 70%);
    border-radius: 50%;
}

.character img {
    width: 48px;
    height: 64px;
    object-fit: cover;
    object-position: center top;
    border-radius: 50% 50% 40% 40%;
    filter: saturate(1.2) contrast(1.05) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    image-rendering: auto;
}

.character.walking img {
    animation: walk 0.25s steps(2) infinite;
}

@keyframes walk {

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

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

/* Direction facing — horizontal flip */
.character.face-left img {
    transform: scaleX(-1);
}

.character.face-right img {
    transform: scaleX(1);
}

.character.face-left.walking img {
    animation: walkLeft 0.25s steps(2) infinite;
}

.character.face-right.walking img {
    animation: walkRight 0.25s steps(2) infinite;
}

@keyframes walkLeft {

    0%,
    100% {
        transform: scaleX(-1) translateY(0);
    }

    50% {
        transform: scaleX(-1) translateY(-5px);
    }
}

@keyframes walkRight {

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

    50% {
        transform: scaleX(1) translateY(-5px);
    }
}

.character-name {
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-pixel);
    font-size: 5px;
    color: white;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8), 0 0 6px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* ===== FLOWERS (Premium) ===== */
.flower {
    position: absolute;
    z-index: 10;
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s;
    width: 62px;
}

.flower:hover {
    transform: scale(1.15);
    filter: brightness(1.12) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.flower.nearby {
    animation: flowerPulse 1.2s ease-in-out infinite;
}

@keyframes flowerPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

.flower-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.4s;
    filter: blur(10px);
}

.flower.nearby .flower-glow {
    opacity: 0.5;
    animation: glowPulse 1.8s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.65;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

.flower-pedestal {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flower-stem {
    width: 3px;
    height: 18px;
    background: linear-gradient(180deg, #5a9e4a, #3d7a2e);
    border-radius: 2px;
    position: relative;
}

/* Small leaf on stem */
.flower-stem::before {
    content: '🌱';
    position: absolute;
    bottom: 2px;
    left: 4px;
    font-size: 8px;
    transform: rotate(-30deg);
    opacity: 0.7;
}

.flower-head {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    order: -1;
    transition: box-shadow 0.3s;
}

.flower-emoji {
    font-size: 28px;
    display: block;
    animation: sway 3.5s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

@keyframes sway {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

.flower-label {
    font-family: var(--font-pixel);
    font-size: 5px;
    color: white;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8), 0 0 6px rgba(0, 0, 0, 0.5);
    margin-top: 4px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 8px;
}

.rare-sparkle {
    position: absolute;
    top: -4px;
    right: -4px;
    color: var(--gold);
    font-size: 12px;
    animation: sparkle 1.5s ease-in-out infinite;
    text-shadow: 0 0 6px var(--gold);
}

@keyframes sparkle {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(0.8);
    }

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

/* ===== MOBILE CONTROLS ===== */
#mobile-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    touch-action: none;
}

.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.dpad-mid {
    display: flex;
    gap: 3px;
}

.dpad-btn {
    width: 48px;
    height: 48px;
    background: rgba(15, 10, 30, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 215, 0, 0.35);
    border-radius: 10px;
    color: var(--gold);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: all 0.1s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dpad-btn:active {
    background: rgba(255, 215, 0, 0.25);
    transform: scale(0.92);
}

.dpad-center {
    background: rgba(255, 107, 157, 0.35);
    border-color: rgba(255, 107, 157, 0.5);
    color: var(--pink-accent);
}

.dpad-center:active {
    background: rgba(255, 107, 157, 0.5);
}

/* ===== FLOWER POPUP ===== */
#flower-popup {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.popup-card {
    position: relative;
    background: var(--parchment);
    border-radius: 16px;
    max-width: 460px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.15), 0 24px 64px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--gold-dark);
    animation: popupIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(16px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.popup-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-dark);
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.popup-close-btn:hover {
    background: #e74c3c;
    color: white;
    transform: scale(1.1);
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 22px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(180deg, rgba(255, 245, 220, 1), var(--parchment));
    border-radius: 16px 16px 0 0;
}

.popup-emoji {
    font-size: 44px;
    line-height: 1;
}

.popup-header h2 {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--text-dark);
    line-height: 1.6;
}

.rarity-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-family: var(--font-pixel);
    font-size: 6px;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.rarity-badge.common {
    background: linear-gradient(135deg, #69db7c, #27ae60);
    color: white;
}

.rarity-badge.rare {
    background: linear-gradient(135deg, #c77dff, #7b2ff2);
    color: white;
    box-shadow: 0 0 8px rgba(199, 125, 255, 0.3);
}

.popup-body {
    padding: 18px 22px 22px;
}

.popup-portrait-section {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.popup-portrait {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.speech-bubble {
    background: white;
    border-radius: 14px;
    padding: 12px 14px;
    position: relative;
    flex: 1;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.speech-bubble::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 18px;
    border: 7px solid transparent;
    border-right-color: white;
    border-left: none;
}

.speech-bubble p {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-dark);
}

.popup-fact {
    background: linear-gradient(135deg, #fff8e1, #fff3cd);
    border-radius: 10px;
    padding: 11px 14px;
    border-left: 3px solid var(--gold);
    font-size: 12px;
    color: var(--text-dark);
    line-height: 1.55;
}

.popup-fact::before {
    content: '💡 ';
}

/* ===== INTERACTION HINT ===== */
#interaction-hint {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 5, 30, 0.8);
    backdrop-filter: blur(8px);
    color: white;
    padding: 8px 18px;
    border-radius: 24px;
    font-family: var(--font-pixel);
    font-size: 7px;
    z-index: 50;
    animation: hintFloat 2s ease-in-out infinite;
    pointer-events: none;
    border: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

@keyframes hintFloat {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

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

#interaction-hint kbd {
    background: rgba(255, 215, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: var(--gold);
    margin: 0 2px;
}

/* ===== FLOATING PETALS ===== */
.petal {
    position: absolute;
    pointer-events: none;
    z-index: 15;
    opacity: 0;
    animation: petalFall linear infinite;
}

@keyframes petalFall {
    0% {
        transform: translateY(-20px) rotate(0deg) translateX(0);
        opacity: 0;
    }

    10% {
        opacity: 0.5;
    }

    85% {
        opacity: 0.3;
    }

    100% {
        transform: translateY(180px) rotate(720deg) translateX(60px);
        opacity: 0;
    }
}

/* ===== DECORATIVE DETAILS ===== */
.grass-tuft {
    animation: grassSway 4s ease-in-out infinite;
}

@keyframes grassSway {

    0%,
    100% {
        transform: rotate(-3deg);
    }

    50% {
        transform: rotate(3deg);
    }
}

@keyframes butterflyFloat {
    0% {
        transform: translate(0, 0) rotate(-5deg);
        opacity: 0.7;
    }

    25% {
        transform: translate(15px, -20px) rotate(5deg);
        opacity: 0.9;
    }

    50% {
        transform: translate(30px, -5px) rotate(-3deg);
        opacity: 0.8;
    }

    75% {
        transform: translate(10px, -25px) rotate(8deg);
        opacity: 0.9;
    }

    100% {
        transform: translate(-5px, -10px) rotate(-5deg);
        opacity: 0.7;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    #mobile-controls {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .welcome-frame {
        width: 110px;
        height: 110px;
    }

    .welcome-title {
        font-size: 9px;
    }

    .dialogue-box p {
        font-size: 13px;
    }

    .pixel-btn {
        font-size: 8px;
        padding: 12px 24px;
    }

    .popup-card {
        width: 94%;
        max-height: 80vh;
        border-radius: 12px;
    }

    .popup-header {
        padding: 16px;
    }

    .popup-emoji {
        font-size: 36px;
    }

    .popup-header h2 {
        font-size: 9px;
    }

    .popup-portrait-section {
        flex-direction: row;
        align-items: flex-start;
    }

    .popup-portrait {
        width: 44px;
        height: 44px;
    }

    #interaction-hint {
        bottom: 170px;
        white-space: nowrap;
        font-size: 6.5px;
        padding: 6px 14px;
    }

    .dpad-btn {
        width: 44px;
        height: 44px;
        font-size: 14px;
    }
}