/* css/dragan.css */
#dragan-view {
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.dragan-wrapper {
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: calc(90vh - 250px);
    /* Fill most of the viewport height */
    min-height: 500px;
}

#dragan-canvas-container {
    touch-action: none; /* Prevents scroll interference on mobile */
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 900px) {
    #dragan-view {
        padding: 8px;
    }

    .dragan-wrapper {
        padding: 8px;
        height: calc(100vh - 150px); /* Account for mobile header + bottom nav */
        min-height: 350px;
        border-radius: var(--radius-md);
    }

    #dragan-canvas-container {
        width: 100%;
        flex: 1;
        min-height: 300px;
        border-radius: var(--radius-md);
    }

    #dragan-canvas-container canvas {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;
    }

    .dragan-controls-overlay {
        bottom: 15px;
        gap: 14px;
    }

    .dragan-menu-btn img {
        width: 42px;
        height: 42px;
    }

    .dragan-main-play-btn {
        padding: 8px 30px;
        font-size: 20px;
        border-radius: 12px;
    }

    .dragan-panel {
        width: 92%;
        max-width: 380px;
        padding: 16px;
        max-height: 80vh;
        overflow-y: auto;
    }

    .dragan-panel-header h3 {
        font-size: 1.05rem;
    }

    .level-card {
        padding: 8px 12px;
    }

    .level-card .level-name {
        font-size: 0.9rem;
    }

    .level-card .level-desc {
        font-size: 0.65rem;
    }

    .quick-bets {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .quick-bet-btn {
        padding: 5px 0;
        font-size: 0.8rem;
    }

    .win-popup-content {
        padding: 24px;
        max-width: 92%;
        border-radius: 20px;
    }

    .congrats-text {
        font-size: 1.6rem;
    }

    .win-fish-display img {
        width: 150px;
    }

    .win-value-display {
        font-size: 2.2rem;
    }

    .win-rarity {
        font-size: 1rem;
        padding: 5px 22px;
    }
}

@media (max-width: 480px) {
    .dragan-wrapper {
        padding: 4px;
        height: calc(100vh - 140px);
        min-height: 280px;
    }

    .dragan-controls-overlay {
        bottom: 10px;
        gap: 10px;
    }

    .dragan-menu-btn img {
        width: 34px;
        height: 34px;
    }

    .dragan-main-play-btn {
        padding: 6px 22px;
        font-size: 16px;
        border-radius: 10px;
    }

    .dragan-panel {
        width: 95%;
        max-width: none;
        padding: 12px;
    }

    .level-card {
        padding: 6px 10px;
    }

    .congrats-text {
        font-size: 1.3rem;
    }

    .win-fish-display img {
        width: 120px;
    }

    .win-value-display {
        font-size: 1.8rem;
    }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    .dragan-wrapper {
        height: calc(100vh - 80px);
        min-height: auto;
        padding: 4px;
    }

    .win-popup-content {
        padding: 16px;
        max-width: 70%;
    }

    .win-fish-display img {
        width: 100px;
    }

    .congrats-text {
        font-size: 1.2rem;
        margin: 0 0 8px 0;
    }

    .win-value-display {
        font-size: 1.5rem;
    }
}

#dragan-canvas-container {
    width: 100%;
    flex: 1;
    /* Allow the canvas to fill the remaining wrapper height */
    background: #000;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
}

/* Character canvas should stay responsive */
#dragan-canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

/* Game Menu Overlay */
.dragan-controls-overlay {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 25px;
    z-index: 100;
}

.dragan-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s ease, filter 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dragan-menu-btn img {
    width: 55px;
    height: 55px;
}

.dragan-menu-btn:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.dragan-menu-btn:active {
    transform: scale(0.95);
}

/* 3D Play Button */
.dragan-main-play-btn {
    background-color: #006459;
    border: none;
    border-radius: 15px;
    padding: 10px 45px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    color: #9dfadb;
    font-size: 24px;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    /* 3D Look */
    box-shadow: 0 6px 0 #003d36, 0 8px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.1s ease;
    outline: none;
}

.dragan-main-play-btn:hover {
    background-color: #007a6d;
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #003d36, 0 10px 20px rgba(0, 0, 0, 0.5);
}

.dragan-main-play-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #003d36, 0 5px 10px rgba(0, 0, 0, 0.3);
}

/* --- Settings Panel --- */
.dragan-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 420px;
    background: rgba(10, 20, 20, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(157, 250, 219, 0.2);
    border-radius: 20px;
    z-index: 200;
    color: #fff;
    padding: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Poppins', sans-serif;
}

.dragan-panel.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -45%) scale(0.9);
}

.dragan-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(157, 250, 219, 0.1);
    padding-bottom: 10px;
}

.dragan-panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: #9dfadb;
    letter-spacing: 1px;
}

.dragan-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.dragan-close-btn:hover {
    opacity: 1;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group label {
    display: block;
    font-size: 0.75rem;
    color: #9dfadb;
    margin-bottom: 8px;
    opacity: 0.8;
    font-weight: 600;
}

.level-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.level-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(157, 250, 219, 0.1);
    border-radius: 12px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.level-info {
    flex: 1;
}

.level-card:hover {
    background: rgba(157, 250, 219, 0.05);
    border-color: rgba(157, 250, 219, 0.4);
}

.level-card.active {
    background: rgba(157, 250, 219, 0.15);
    border-color: #9dfadb;
    box-shadow: 0 0 20px rgba(157, 250, 219, 0.15);
}

.level-card .level-name {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: #9dfadb;
}

.level-card .level-desc {
    display: block;
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Bet Selection Styling */
.bet-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bet-input-main {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(157, 250, 219, 0.2);
    border-radius: 12px;
    padding: 5px 15px;
}

.currency-symbol {
    color: #9dfadb;
    font-weight: 700;
    margin-right: 8px;
}

#dragan-bet-input {
    background: none;
    border: none;
    color: #fff;
    width: 100%;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 8px 0;
    outline: none;
    font-family: 'Poppins', sans-serif;
}

/* Remove Arrows from Number Input */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quick-bets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.quick-bet-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(157, 250, 219, 0.2);
    border-radius: 8px;
    color: #fff;
    padding: 6px 0;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.85rem;
}

.quick-bet-btn:hover {
    background: rgba(157, 250, 219, 0.2);
    border-color: #9dfadb;
}

.settings-actions {
    margin-top: 5px;
}

/* --- Eye Blink Animation --- */
.dragan-eyelids {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Allows interaction beneath when open */
    z-index: 500;
    /* Stays above all game UI and canvas */
    display: flex;
    flex-direction: column;
}

.eyelid-top,
.eyelid-bottom {
    flex: 1;
    background: #000;
    width: 100%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.eyelid-top {
    transform: translateY(-100%);
}

.eyelid-bottom {
    transform: translateY(100%);
}

/* Class to trigger blink state - eyelids meet in the middle */
.dragan-eyelids.blinking .eyelid-top,
.dragan-eyelids.blinking .eyelid-bottom {
    transform: translateY(0);
}

/* --- Loading Screen Overlay (Fixed over canvas) --- */
.dragan-loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 600;
    /* Over everything */
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url('../assets/dragan/loadbackground.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.dragan-loading-screen .loader-bg {
    display: none;
    /* Removed the extra div for simplicity */
}

.dragan-loading-screen .loader-content {
    position: relative;
    z-index: 601;
}

.dragan-loading-screen .loader-fish {
    width: 65px;
    height: auto;
    animation: draganSpin 2.5s linear infinite;
}

@keyframes draganSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.dragan-loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

/* Hide controls while loading */
#dragan-loader:not(.hidden)~.dragan-controls-overlay {
    display: none !important;
}

/* --- Win Celebration Popup --- */
.dragan-win-popup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    transition: opacity 0.5s ease, visibility 0.5s;
}

.dragan-win-popup.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.win-popup-content {
    background-image: url('../assets/dragan/popupbackground.png');
    background-size: cover;
    background-position: center;
    border: 3px solid #9dfadb;
    border-radius: 30px;
    padding: 40px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 0 50px rgba(157, 250, 219, 0.4);
    animation: popupAppear 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popupAppear {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.congrats-text {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.8);
    /* Crisp shadow, no glow */
    margin: 0 0 20px 0;
    letter-spacing: 2px;
}

.win-fish-display {
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
}

.win-fish-display img {
    width: 220px;
    height: auto;
    filter: none;
    /* Removed Glow */
    animation: fishFloat 3s ease-in-out infinite;
}

@keyframes fishFloat {

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

    50% {
        transform: translateY(-15px) rotate(2deg);
    }
}

.win-rarity {
    display: inline-block;
    padding: 6px 30px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.2rem;
    text-transform: uppercase;
    margin-bottom: 25px;
    color: #fff;
    letter-spacing: 1px;
}

/* Rarity Colors */
.win-rarity.common {
    background: #7f8c8d;
}

.win-rarity.uncommon {
    background: #27ae60;
}

.win-rarity.rare {
    background: #2980b9;
}

.win-rarity.epic {
    background: #8e44ad;
}

.win-rarity.legendary {
    background: #f39c12;
    color: #000;
}

.win-value-display {
    font-size: 3.2rem;
    font-weight: 900;
    color: #9dfadb;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    /* Crisp shadow, no glow */
}

.win-currency {
    font-size: 1.4rem;
    opacity: 0.8;
    margin-left: 5px;
}

/* ========================================
   BAIT SHOP
   ======================================== */

.baitshop-subtitle {
    font-size: 0.85rem;
    color: #8fa8b8;
    margin-bottom: 15px;
    line-height: 1.4;
}

.bait-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.bait-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(157, 250, 219, 0.3);
}

.bait-card.equipped {
    border-color: #00e5a0;
    background: rgba(0, 229, 160, 0.08);
    box-shadow: 0 0 15px rgba(0, 229, 160, 0.15);
}

.bait-card-img {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 8px;
}

.bait-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bait-card-info {
    flex: 1;
    min-width: 0;
}

.bait-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px 0;
}

.bait-desc {
    font-size: 0.75rem;
    color: #8fa8b8;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.bait-price {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bait-price-label {
    font-size: 0.75rem;
    color: #8fa8b8;
}

.bait-price-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: #9dfadb;
}

.bait-price-multiplier {
    font-size: 0.7rem;
    color: #5a7a8a;
}

.bait-buy-btn {
    flex-shrink: 0;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: #00896e;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 1px;
}

.bait-buy-btn:hover {
    background: #00b894;
    transform: translateY(-1px);
}

.bait-buy-btn.shrimp {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.bait-buy-btn.shrimp:hover {
    background: linear-gradient(135deg, #f1c40f, #e67e22);
}

.bait-buy-btn.equipped-btn {
    background: #2d3436;
    color: #00e5a0;
    border: 1px solid #00e5a0;
}

.active-bait-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 229, 160, 0.1);
    border: 1px solid rgba(0, 229, 160, 0.3);
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 10px;
}

.active-bait-label {
    font-size: 0.8rem;
    color: #8fa8b8;
}

.active-bait-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #00e5a0;
    flex: 1;
}

.bait-remove-btn {
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: #ff4757;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bait-remove-btn:hover {
    background: rgba(255, 71, 87, 0.3);
}

@media (max-width: 900px) {
    .bait-card {
        flex-direction: column;
        text-align: center;
    }

    .bait-card-img {
        width: 60px;
        height: 60px;
    }

    .bait-buy-btn {
        width: 100%;
        min-height: 44px;
    }

    .active-bait-indicator {
        flex-direction: column;
        text-align: center;
    }
}