/* ============================================
   MY SINGING MONSTERS - LOCAL CLONE
   ============================================ */

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

body {
    font-family: 'Segoe UI', 'Arial Rounded MT Bold', 'Comic Sans MS', sans-serif;
    background: #0a1a05;
    color: #fff;
    height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* ---------- Splash Screen ---------- */

#splash {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #1a3520 0%, #0a1a05 70%);
    gap: 16px;
}

#splash-img {
    max-width: 85%;
    max-height: 40vh;
    object-fit: contain;
    filter: drop-shadow(0 8px 32px rgba(100, 200, 80, 0.3));
}

#splash h1 {
    font-size: 2.2rem;
    background: linear-gradient(135deg, #8aca5e, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

#splash p {
    color: #8aca5e;
    font-size: 1rem;
    opacity: 0.8;
}

#start-btn {
    margin-top: 12px;
    padding: 14px 48px;
    font-size: 1.4rem;
    font-weight: bold;
    border-radius: 50px;
    background: linear-gradient(135deg, #ff8c00, #ffbb33);
    color: #3a2000;
    border: 3px solid #ffe080;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: btn-pulse 2s ease-in-out infinite;
    letter-spacing: 1px;
}

#start-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 30px rgba(255, 187, 51, 0.5);
}

/* ---------- iOS Install Hint ---------- */

#ios-install-hint {
    position: relative;
    margin-top: 20px;
    max-width: 320px;
    padding: 14px 36px 14px 18px;
    border-radius: 14px;
    background: rgba(10, 26, 5, 0.85);
    border: 1px solid #8aca5e;
    color: #e8ffd6;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: center;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#ios-install-hint p { margin: 2px 0; color: inherit; opacity: 1; font-size: inherit; }
#ios-install-hint strong { color: #ffd700; }
#ios-install-hint em { color: #fff; font-style: normal; font-weight: bold; }
#ios-install-hint .ios-share {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: #2d5016;
    color: #fff;
}

#ios-install-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: transparent;
    border: 0;
    color: #8aca5e;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

/* ---------- Game Layout ---------- */

#game {
    display: none;
    flex-direction: column;
    height: 100vh;
}

/* ---------- Top Bar ---------- */

#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: linear-gradient(180deg, #2d5016 0%, #1a3a0a 100%);
    border-bottom: 2px solid #4a7a2e;
    flex-shrink: 0;
    gap: 8px;
    flex-wrap: wrap;
}

#island-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex-shrink: 1;
    min-width: 0;
}

#island-tabs::-webkit-scrollbar { height: 0; }

.island-tab {
    padding: 5px 14px;
    border-radius: 20px;
    border: 2px solid #3a6020;
    background: rgba(255, 255, 255, 0.07);
    color: #b0d890;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
    flex-shrink: 0;
}

.island-tab:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #6aaa3e;
}

.island-tab.active {
    background: linear-gradient(135deg, #4a7a2e, #6aaa3e);
    border-color: #8aca5e;
    color: #fff;
    box-shadow: 0 0 12px rgba(138, 202, 94, 0.3);
}

#controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#currency span {
    font-weight: bold;
    font-size: 0.85rem;
    margin-left: 8px;
}

#volume-control {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
}

#volume-slider {
    width: 70px;
    accent-color: #8aca5e;
    cursor: pointer;
}

/* ---------- Island View ---------- */

#island-view {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 200px;
}

#sky-layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s;
}

#island-platform {
    position: absolute;
    width: 94%;
    height: 92%;
    left: 50%;
    top: 48%;
    transform: translate(-50%, -50%);
    border-radius: 44% 44% 46% 46%;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s;
    z-index: 1;
    overflow: visible;
    box-shadow:
        inset 0 -8px 25px rgba(0, 0, 0, 0.15),
        inset 0 4px 15px rgba(255, 255, 255, 0.06),
        0 6px 0 #8B7332,
        0 12px 0 #6B5522,
        0 18px 0 #5A4418,
        0 22px 0 #4A3612,
        0 26px 40px rgba(0, 0, 0, 0.5);
}

#monsters-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
}

/* ---------- Placed Monsters ---------- */

.placed-monster {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    text-align: center;
    animation: bounce-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: filter 0.15s, transform 0.15s;
    z-index: 2;
}

.placed-monster:hover {
    filter: brightness(1.25);
    z-index: 10;
    transform: translate(-50%, -50%) scale(1.1);
}

.placed-monster:active {
    transform: translate(-50%, -50%) scale(0.9);
}

.placed-monster img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.count-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff8c00;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.6rem;
    font-weight: bold;
    line-height: 18px;
    text-align: center;
    border: 1px solid #ffd700;
}

/* ---------- Loading Overlay ---------- */

#loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 26, 5, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(4px);
}

#loading-content {
    text-align: center;
}

#loading-text {
    font-size: 1rem;
    color: #8aca5e;
    margin-bottom: 12px;
}

#loading-bar-container {
    width: 220px;
    height: 16px;
    background: #1a3a0a;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #3a6020;
    margin: 0 auto;
}

#loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4a7a2e, #8aca5e, #c0ff70);
    border-radius: 8px;
    transition: width 0.2s;
}

#loading-percent {
    font-size: 0.8rem;
    margin-top: 6px;
    color: #6aaa3e;
}

/* ---------- Monster Bar ---------- */

#monster-bar {
    background: linear-gradient(180deg, #152a08 0%, #0a1a05 100%);
    padding: 8px 12px 10px;
    border-top: 2px solid #3a6020;
    flex-shrink: 0;
}

#bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

#bar-title {
    font-size: 0.72rem;
    color: #6aaa3e;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bar-btn {
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid #3a6020;
    background: rgba(255, 255, 255, 0.07);
    color: #b0d890;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
}

.bar-btn:hover {
    background: rgba(138, 202, 94, 0.2);
    border-color: #8aca5e;
}

#bar-hint {
    font-size: 0.6rem;
    color: #4a7a2e;
}

#monster-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0 4px;
    scroll-behavior: smooth;
}

#monster-list::-webkit-scrollbar {
    height: 4px;
}

#monster-list::-webkit-scrollbar-track {
    background: #1a3a0a;
    border-radius: 2px;
}

#monster-list::-webkit-scrollbar-thumb {
    background: #3a6020;
    border-radius: 2px;
}

.monster-card {
    flex-shrink: 0;
    width: 68px;
    text-align: center;
    cursor: pointer;
    border-radius: 10px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s;
    position: relative;
}

.monster-card:hover:not(.placed) {
    border-color: #8aca5e;
    background: rgba(138, 202, 94, 0.12);
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(138, 202, 94, 0.2);
}

/* (monster cards always clickable - duplicates allowed) */

.monster-card img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 6px;
}

.monster-card-name {
    font-size: 0.55rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #b0d890;
    margin-top: 2px;
}

.monster-card-elements {
    font-size: 0.65rem;
    line-height: 1;
    margin-top: 1px;
}

/* (placed-badge removed - grid system) */

/* ---------- Help Tooltip ---------- */

#help-tooltip {
    position: absolute;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 58, 10, 0.95);
    border: 2px solid #8aca5e;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 0.8rem;
    color: #b0d890;
    text-align: center;
    z-index: 15;
    max-width: 320px;
    backdrop-filter: blur(8px);
    animation: fade-in 0.5s;
    line-height: 1.5;
}

#help-tooltip .close-help {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 16px;
    background: #4a7a2e;
    border: none;
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    font-size: 0.75rem;
}

/* ---------- Mute All Button ---------- */

#mute-all-btn {
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #3a6020;
    background: rgba(255, 255, 255, 0.07);
    color: #b0d890;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}

#mute-all-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

#mute-all-btn.muted {
    background: rgba(255, 50, 50, 0.2);
    border-color: #a04040;
    color: #ff8080;
}

/* ---------- UI Animations ---------- */

@keyframes btn-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 187, 51, 0.2); }
    50% { transform: scale(1.03); box-shadow: 0 0 25px rgba(255, 187, 51, 0.4); }
}

@keyframes bounce-in {
    0% { transform: translate(-50%, -200%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -45%) scale(1.15); opacity: 1; }
    70% { transform: translate(-50%, -55%) scale(0.95); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes tap-bounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes float-up {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-35px); }
}

@keyframes note-float {
    0%, 100% { transform: translateY(0) rotate(-10deg); opacity: 0.8; }
    50% { transform: translateY(-6px) rotate(10deg); opacity: 1; }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Monster Characteristic Animations ---------- */

/* Potbelly - belly sway while singing */
@keyframes belly-sway {
    0%, 100% { transform: scaleX(1) rotate(0deg); }
    25% { transform: scaleX(1.08) rotate(-2deg); }
    50% { transform: scaleX(0.97) rotate(0deg); }
    75% { transform: scaleX(1.05) rotate(2deg); }
}

/* Mammott - heavy fuzzy sway side to side */
@keyframes mammott-sway {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    20% { transform: translateX(-7px) rotate(-4deg); }
    50% { transform: translateX(0) rotate(0deg); }
    70% { transform: translateX(7px) rotate(4deg); }
}

/* Tweedle - rapid wing flap bobbing */
@keyframes wing-flap {
    0%, 100% { transform: translateY(0) rotate(0deg) scaleY(1); }
    15% { transform: translateY(-9px) rotate(-4deg) scaleY(0.95); }
    30% { transform: translateY(-3px) rotate(3deg) scaleY(1.03); }
    50% { transform: translateY(-10px) rotate(-2deg) scaleY(0.96); }
    70% { transform: translateY(-2px) rotate(4deg) scaleY(1.02); }
    85% { transform: translateY(-7px) rotate(-3deg) scaleY(0.97); }
}

/* Toe Jammer - jelly-like squish wobble */
@keyframes jelly-wobble {
    0%, 100% { transform: scaleX(1) scaleY(1); }
    20% { transform: scaleX(1.12) scaleY(0.88); }
    40% { transform: scaleX(0.92) scaleY(1.08); }
    60% { transform: scaleX(1.07) scaleY(0.93); }
    80% { transform: scaleX(0.96) scaleY(1.04); }
}

/* Noggin - rhythmic headbanging stomp */
@keyframes head-bang {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    12% { transform: translateY(-12px) rotate(-3deg); }
    24% { transform: translateY(4px) rotate(1deg); }
    36% { transform: translateY(0) rotate(0deg); }
    62% { transform: translateY(-10px) rotate(3deg); }
    74% { transform: translateY(3px) rotate(-1deg); }
    86% { transform: translateY(0) rotate(0deg); }
}

/* Furcorn/Fwog - happy bouncy hop */
@keyframes happy-hop {
    0%, 100% { transform: translateY(0) scaleY(1) scaleX(1); }
    15% { transform: translateY(4px) scaleY(0.88) scaleX(1.1); }
    35% { transform: translateY(-14px) scaleY(1.06) scaleX(0.96); }
    55% { transform: translateY(0) scaleY(0.92) scaleX(1.06); }
    70% { transform: translateY(-5px) scaleY(1.03) scaleX(0.98); }
    85% { transform: translateY(1px) scaleY(0.98) scaleX(1.02); }
}

/* Oaktopus/Scups - tentacle wave sway */
@keyframes wave-sway {
    0%, 100% { transform: rotate(0deg) skewX(0deg); }
    20% { transform: rotate(-4deg) skewX(3deg); }
    40% { transform: rotate(2deg) skewX(-2deg); }
    60% { transform: rotate(-3deg) skewX(2deg); }
    80% { transform: rotate(4deg) skewX(-3deg); }
}

/* Drumpler/Pummel - rhythmic drum pounding */
@keyframes drum-pound {
    0%, 100% { transform: translateY(0) scaleY(1); }
    10% { transform: translateY(-8px) scaleY(1.04); }
    20% { transform: translateY(3px) scaleY(0.94); }
    30% { transform: translateY(0) scaleY(1); }
    50% { transform: translateY(0) scaleY(1); }
    60% { transform: translateY(-7px) scaleY(1.03); }
    70% { transform: translateY(3px) scaleY(0.95); }
    80% { transform: translateY(0) scaleY(1); }
}

/* Dandidoo/Bowgart - graceful elegant sway */
@keyframes graceful-sway {
    0%, 100% { transform: rotate(0deg) translateY(0); }
    25% { transform: rotate(-5deg) translateY(-4px); }
    50% { transform: rotate(0deg) translateY(-1px); }
    75% { transform: rotate(5deg) translateY(-4px); }
}

/* Quibble - quick bounce bob */
@keyframes bounce-bob {
    0%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
    50% { transform: translateY(-2px); }
    70% { transform: translateY(-8px); }
}

/* Maw - chomping up-down */
@keyframes chomp-bounce {
    0%, 100% { transform: scaleY(1) translateY(0); }
    12% { transform: scaleY(1.12) translateY(-6px); }
    24% { transform: scaleY(0.82) translateY(4px); }
    36% { transform: scaleY(1.05) translateY(-3px); }
    48% { transform: scaleY(0.88) translateY(3px); }
    60% { transform: scaleY(1) translateY(0); }
}

/* Pango - sliding groove side to side */
@keyframes slide-groove {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-12px) rotate(-3deg); }
    50% { transform: translateX(0) rotate(0deg); }
    75% { transform: translateX(12px) rotate(3deg); }
}

/* Cybop - robotic precise head bob */
@keyframes robot-bob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    15% { transform: translateY(-6px) rotate(0deg); }
    30% { transform: translateY(0) rotate(3deg); }
    45% { transform: translateY(-6px) rotate(0deg); }
    60% { transform: translateY(0) rotate(-3deg); }
    75% { transform: translateY(-6px) rotate(0deg); }
}

/* Thumpies - synchronized triple stomp */
@keyframes triple-stomp {
    0%, 100% { transform: translateY(0) scale(1); }
    8% { transform: translateY(-10px) scale(1.03); }
    16% { transform: translateY(4px) scale(0.96); }
    28% { transform: translateY(0) scale(1); }
    36% { transform: translateY(-8px) scale(1.02); }
    44% { transform: translateY(3px) scale(0.97); }
    56% { transform: translateY(0) scale(1); }
    64% { transform: translateY(-6px) scale(1.01); }
    72% { transform: translateY(2px) scale(0.98); }
    84% { transform: translateY(0) scale(1); }
}

/* Heavy bounce for triple-element monsters */
@keyframes heavy-bounce {
    0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    20% { transform: translateY(-6px) scale(1.03) rotate(-1deg); }
    35% { transform: translateY(5px) scale(0.96) rotate(1deg); }
    55% { transform: translateY(-4px) scale(1.01) rotate(-1deg); }
    75% { transform: translateY(3px) scale(0.98) rotate(0deg); }
}

/* Giant groove for quad-element monsters */
@keyframes giant-groove {
    0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    15% { transform: translateY(-5px) scale(1.02) rotate(-2deg); }
    30% { transform: translateY(4px) scale(0.97) rotate(1deg); }
    45% { transform: translateY(-3px) scale(1.01) rotate(1deg); }
    60% { transform: translateY(5px) scale(0.96) rotate(-1deg); }
    75% { transform: translateY(-4px) scale(1.02) rotate(-2deg); }
    90% { transform: translateY(2px) scale(0.99) rotate(1deg); }
}

/* Ethereal float - ghostly hovering with opacity */
@keyframes ethereal-float {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.8; filter: drop-shadow(0 4px 12px rgba(150, 100, 255, 0.3)); }
    25% { transform: translateY(-12px) scale(1.03); opacity: 1; filter: drop-shadow(0 8px 20px rgba(150, 100, 255, 0.5)); }
    50% { transform: translateY(-5px) scale(0.98); opacity: 0.85; filter: drop-shadow(0 4px 12px rgba(150, 100, 255, 0.3)); }
    75% { transform: translateY(-14px) scale(1.02); opacity: 0.95; filter: drop-shadow(0 10px 24px rgba(150, 100, 255, 0.6)); }
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
    #splash h1 { font-size: 1.5rem; }
    #start-btn { padding: 10px 32px; font-size: 1.1rem; }
    .island-tab { padding: 4px 10px; font-size: 0.7rem; }
    .placed-monster img { width: 80px; height: 80px; }
    .monster-card { width: 60px; }
    .monster-card img { width: 44px; height: 44px; }
    #top-bar { padding: 4px 8px; }
    #currency span { font-size: 0.75rem; }
}

@media (max-height: 500px) {
    #monster-bar { padding: 4px 8px; }
    .monster-card { width: 56px; }
    .monster-card img { width: 40px; height: 40px; }
    .placed-monster img { width: 70px; height: 70px; }
}
