/**
 * Fishing Game - WordPress Plugin Styles
 * Все классы имеют префикс .fishing- для предотвращения конфликтов
 *
 * @version 1.0.0
 * @package Fishing_Game
 */

/* === КОНТЕЙНЕР ИГРЫ === */
.fishing-game-wrapper {
    /* КРИТИЧНО: static блокирует любое позиционирование! */
    position: static !important;
    background-color: transparent;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
    overflow: visible !important; /* Чтобы видеть элементы управления */
    box-sizing: border-box;
    max-width: 100%;
    margin: 20px auto !important; /* Отступы чтобы не обрезалось */
    /* Принудительный сброс позиционирования */
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    display: block !important;
}

/* Внутренний wrapper для position: relative (для absolute элементов) */
.fishing-game-inner {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 3/4 = 75% для aspect ratio 4:3 */
    height: 0;
    overflow: hidden;
    background-color: #0077be;
}

/* Полноэкранный режим */
.fishing-game-wrapper:fullscreen,
.fishing-game-wrapper:-webkit-full-screen,
.fishing-game-wrapper:-moz-full-screen,
.fishing-game-wrapper:-ms-fullscreen {
    position: fixed !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
}

.fishing-game-wrapper:fullscreen .fishing-game-header {
    position: relative;
}

.fishing-game-wrapper:fullscreen .fishing-game-inner,
.fishing-game-wrapper:-webkit-full-screen .fishing-game-inner,
.fishing-game-wrapper:-moz-full-screen .fishing-game-inner,
.fishing-game-wrapper:-ms-fullscreen .fishing-game-inner {
    width: 100vw;
    height: calc(100vh - 60px); /* Вычитаем высоту header */
    padding-bottom: 0;
}

.fishing-game-wrapper * {
    box-sizing: border-box;
}

/* === HEADER ПАНЕЛЬ === */
.fishing-game-header {
    position: relative;
    width: 100%;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.85) 100%);
    backdrop-filter: blur(20px);
    padding: 12px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 200;
    flex-wrap: wrap;
    gap: 10px;
}

.fishing-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 200px;
    min-width: 200px;
}

.fishing-header-score {
    font-size: 20px;
    font-weight: 800;
    color: #fbbf24;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.fishing-header-info {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

.fishing-header-depth,
.fishing-header-timer {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fishing-header-center {
    flex: 0 1 auto;
    text-align: center;
    white-space: nowrap;
}

.fishing-header-title {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

.fishing-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    justify-content: flex-end;
    flex-wrap: wrap;
    min-width: 0;
}

/* Когда header-right переносится на новую строку, занимает всю ширину */
@supports (width: min(100%, 1px)) {
    .fishing-header-right {
        flex-basis: max-content;
    }
}

/* === CANVAS === */
.fishing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
    z-index: 1;
}

/* === UI ПАНЕЛЬ (скрыта, только для JS) === */
.fishing-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 10;
}

.fishing-score {
    margin: 0;
    font-size: 28px;
    font-weight: bold;
    color: white;
}

.fishing-depth,
.fishing-timer {
    margin: 5px 0;
    opacity: 0.8;
    font-size: 16px;
    color: white;
}

.fishing-timer {
    font-size: 24px;
    font-weight: bold;
}

/* === КНОПКА УПРАВЛЕНИЯ ЗВУКОМ === */
.fishing-sound-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    padding: 0 !important;
    line-height: normal !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    flex: 0 0 auto !important;
}

.fishing-sound-btn:hover {
    background: rgba(59, 130, 246, 0.8) !important;
    transform: scale(1.05) !important;
    color: white !important;
}

.fishing-sound-btn.muted {
    background: rgba(239, 68, 68, 0.3) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

.fishing-sound-btn.muted:hover {
    background: rgba(239, 68, 68, 0.5) !important;
}

/* === КНОПКА ПОЛНОЭКРАННОГО РЕЖИМА === */
.fishing-fullscreen-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    width: auto !important;
    height: 36px !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    font-size: 16px !important;
    padding: 0 12px !important;
    line-height: normal !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
}

.fishing-fullscreen-text {
    font-size: 12px !important;
    font-weight: 600 !important;
}

.fishing-fullscreen-btn:hover {
    background: rgba(59, 130, 246, 0.8) !important;
    transform: scale(1.05) !important;
    color: white !important;
}

/* === СЕЛЕКТОР СЛОЖНОСТИ === */
.fishing-difficulty-selector {
    display: flex !important;
    gap: 4px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    padding: 4px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex: 0 1 auto !important;
    flex-shrink: 0 !important;
}

.fishing-diff-btn {
    border: none !important;
    color: rgba(255, 255, 255, 0.6) !important;
    padding: 6px 14px !important;
    border-radius: 8px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    background: transparent !important;
    position: relative !important;
    overflow: hidden !important;
    line-height: normal !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    display: inline-block !important;
    vertical-align: middle !important;
    text-decoration: none !important;
}

.fishing-diff-btn::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(255, 255, 255, 0.05) !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.fishing-diff-btn:hover::before {
    opacity: 1 !important;
}

.fishing-diff-btn:hover {
    color: rgba(255, 255, 255, 0.8) !important;
    transform: translateY(-2px) !important;
}

.fishing-diff-btn.active {
    color: #fff !important;
    transform: scale(1) !important;
    font-weight: 800 !important;
}

.fishing-diff-btn[data-diff="1"].active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.fishing-diff-btn[data-diff="2"].active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.fishing-diff-btn[data-diff="3"].active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

/* === СЕЛЕКТОР РЕЖИМА === */
.fishing-mode-selector {
    display: flex !important;
    gap: 4px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    padding: 4px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex: 0 1 auto !important;
    flex-shrink: 0 !important;
}

.fishing-mode-btn {
    border: none !important;
    color: rgba(255, 255, 255, 0.6) !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    background: transparent !important;
    white-space: nowrap !important;
    position: relative !important;
    overflow: hidden !important;
    line-height: normal !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    display: inline-block !important;
    vertical-align: middle !important;
    text-decoration: none !important;
}

.fishing-mode-btn::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(255, 255, 255, 0.05) !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.fishing-mode-btn:hover::before {
    opacity: 1 !important;
}

.fishing-mode-btn:hover {
    color: rgba(255, 255, 255, 0.8) !important;
    transform: translateY(-2px) !important;
}

.fishing-mode-btn.active {
    color: #fff !important;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    transform: scale(1) !important;
    font-weight: 800 !important;
}

/* === СТАТИСТИКА ПОЙМАННОЙ РЫБЫ (правый верхний угол) === */
.fishing-catch-stats {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    z-index: 100 !important;
    pointer-events: none !important;
}

.fishing-catch-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    background: rgba(15, 23, 42, 0.9) !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.fishing-catch-fish {
    font-size: 32px !important;
    line-height: 1 !important;
}

.fishing-catch-value,
.fishing-catch-value-shark {
    font-size: 28px !important;
    font-weight: 900 !important;
    color: #fbbf24 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
    min-width: 30px !important;
    text-align: left !important;
}

/* === ЭКРАН ЗАПУСКА ИГРЫ === */
.fishing-start-screen {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

.fishing-start-screen.hidden {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.fishing-start-content {
    text-align: center;
    padding: 40px;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.fishing-start-image {
    width: 200px;
    height: auto;
    margin-bottom: 30px;
    animation: floatImage 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

@keyframes floatImage {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

.fishing-start-title {
    font-size: 48px;
    font-weight: 900;
    color: #fff;
    margin: 0 0 12px 0;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.fishing-start-subtitle {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 32px 0;
    font-weight: 600;
}

.fishing-start-btn {
    background: #ffd700 !important;
    border: none !important;
    color: #0f172a !important;
    padding: 20px 64px !important;
    border-radius: 60px !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.4) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    display: inline-block !important;
    line-height: normal !important;
    outline: none !important;
    text-decoration: none !important;
    vertical-align: middle !important;
}

.fishing-start-btn:hover {
    background: #ffed4e !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 32px rgba(255, 215, 0, 0.5) !important;
    color: #0f172a !important;
}

.fishing-start-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.3) !important;
}

.fishing-start-btn:focus {
    outline: none !important;
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.4) !important;
}

/* === ИНСТРУКЦИИ === */
.fishing-instructions {
    position: absolute;
    bottom: 20px;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 5;
}

/* === АЛЕРТЫ === */
.fishing-alert {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff5252;
    font-size: 48px;
    font-weight: 900;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 20;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.fishing-shark-alert {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(239, 68, 68, 0.8);
    padding: 5px 20px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 14px;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 15;
}

/* === GAME OVER ЭКРАН === */
.fishing-game-over {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.98);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 1000;
    backdrop-filter: blur(20px);
}

.fishing-go-title {
    font-size: 56px;
    font-weight: 900;
    margin-bottom: 20px;
    color: #3b82f6;
    text-transform: uppercase;
    font-style: italic;
    letter-spacing: -2px;
}

.fishing-go-time {
    font-size: 28px;
    margin-bottom: 10px;
    color: #60a5fa;
    font-weight: 700;
}

.fishing-go-score {
    font-size: 32px;
    margin-bottom: 10px;
    color: #FFD700;
    font-weight: 800;
}

.fishing-go-fish {
    font-size: 24px;
    margin-bottom: 40px;
    color: #94a3b8;
    font-weight: 600;
}

.fishing-go-btn {
    background: #3b82f6 !important;
    border: none !important;
    color: white !important;
    padding: 18px 48px !important;
    border-radius: 50px !important;
    font-size: 20px !important;
    font-weight: 900 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    line-height: normal !important;
    display: inline-block !important;
    text-decoration: none !important;
    vertical-align: middle !important;
    outline: none !important;
}

.fishing-go-btn:hover {
    transform: scale(1.05) !important;
    background: #2563eb !important;
    color: white !important;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 768px) {
    .fishing-start-image {
        width: 150px;
    }

    .fishing-start-title {
        font-size: 36px;
    }

    .fishing-start-subtitle {
        font-size: 16px;
    }

    .fishing-start-btn {
        padding: 18px 52px !important;
        font-size: 20px !important;
    }

    .fishing-game-header {
        padding: 10px 20px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .fishing-header-left {
        flex: 1 1 auto;
        order: 1;
    }

    .fishing-header-center {
        display: none;
    }

    .fishing-header-right {
        flex: 1 1 100%;
        order: 3;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .fishing-header-score {
        font-size: 18px;
    }

    .fishing-header-info {
        font-size: 11px;
        gap: 12px;
    }

    .fishing-score {
        font-size: 20px;
    }

    .fishing-depth,
    .fishing-timer {
        font-size: 14px;
    }

    .fishing-go-title {
        font-size: 36px;
    }

    .fishing-go-time {
        font-size: 22px;
    }

    .fishing-go-score {
        font-size: 24px;
    }

    .fishing-go-fish {
        font-size: 18px;
    }

    .fishing-sound-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 16px !important;
    }

    .fishing-fullscreen-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
        padding: 0 !important;
    }

    .fishing-fullscreen-text {
        display: none !important;
    }

    .fishing-catch-stats {
        top: 15px !important;
        right: 15px !important;
        gap: 10px !important;
    }

    .fishing-catch-item {
        padding: 8px 12px !important;
    }

    .fishing-catch-fish {
        font-size: 28px !important;
    }

    .fishing-catch-value,
    .fishing-catch-value-shark {
        font-size: 24px !important;
    }

    .fishing-difficulty-selector {
        padding: 3px;
        gap: 3px;
    }

    .fishing-diff-btn {
        padding: 5px 10px;
        font-size: 9px;
    }

    .fishing-instructions {
        font-size: 12px;
        bottom: 15px;
    }

    .fishing-alert {
        font-size: 36px;
    }

    .fishing-shark-alert {
        font-size: 12px;
        padding: 4px 16px;
    }

    .fishing-mode-selector {
        padding: 3px;
        gap: 3px;
    }

    .fishing-mode-btn {
        padding: 5px 10px;
        font-size: 9px;
    }

    .fishing-instructions {
        bottom: 15px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .fishing-start-image {
        width: 120px;
    }

    .fishing-start-title {
        font-size: 28px;
    }

    .fishing-start-subtitle {
        font-size: 14px;
    }

    .fishing-start-btn {
        padding: 16px 44px !important;
        font-size: 18px !important;
    }

    .fishing-game-header {
        padding: 8px 15px;
    }

    .fishing-header-score {
        font-size: 16px;
    }

    .fishing-header-info {
        font-size: 10px;
        gap: 8px;
    }

    .fishing-header-title {
        font-size: 14px;
    }

    .fishing-ui {
        top: 10px;
        left: 10px;
    }

    .fishing-score {
        font-size: 18px;
    }

    .fishing-depth,
    .fishing-timer {
        font-size: 12px;
    }

    .fishing-go-title {
        font-size: 28px;
    }

    .fishing-go-time {
        font-size: 18px;
    }

    .fishing-go-score {
        font-size: 20px;
    }

    .fishing-go-fish {
        font-size: 16px;
    }

    .fishing-go-btn {
        padding: 12px 32px !important;
        font-size: 16px !important;
    }

    .fishing-sound-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 14px !important;
    }

    .fishing-fullscreen-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
        padding: 0 !important;
    }

    .fishing-fullscreen-text {
        display: none !important;
    }

    .fishing-catch-stats {
        top: 10px !important;
        right: 10px !important;
        gap: 8px !important;
    }

    .fishing-catch-item {
        padding: 6px 10px !important;
        gap: 8px !important;
    }

    .fishing-catch-fish {
        font-size: 24px !important;
    }

    .fishing-catch-value,
    .fishing-catch-value-shark {
        font-size: 20px !important;
    }

    .fishing-difficulty-selector {
        padding: 3px;
        gap: 2px;
    }

    .fishing-diff-btn {
        padding: 4px 8px;
        font-size: 8px;
    }

    .fishing-mode-selector {
        padding: 3px;
        gap: 2px;
    }

    .fishing-mode-btn {
        padding: 4px 8px;
        font-size: 8px;
    }

    .fishing-instructions {
        bottom: 10px;
        font-size: 10px;
    }
}

/* === ИЗОЛЯЦИЯ ОТ WORDPRESS ТЕМА === */
/* Сброс стилей, которые могут быть переопределены темой */
.fishing-game-wrapper button,
.fishing-game-wrapper h2,
.fishing-game-wrapper p {
    all: revert;
}

.fishing-game-wrapper button {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Предотвращение переопределения WordPress темами */
.fishing-game-wrapper {
    line-height: normal;
    letter-spacing: normal;
}

.fishing-game-wrapper *:not(.fishing-game-inner):not(.fishing-game-header) {
    margin: 0;
    padding: 0;
}

/* Сброс стилей <pre> если WordPress оборачивает шорткод */
pre .fishing-game-wrapper {
    white-space: normal;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: visible;
}
