/* Custom Font */
@font-face {
    font-family: 'Old Claude LP';
    src: url('Assets/Fonts/Old Claude LP Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

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

body {
    font-family: 'Old Claude LP', 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 5px 20px 5px 20px;
    position: relative;
    gap: 5px;
    overflow: hidden;
    background-image: url('Boats and Water/water.png');
    background-repeat: repeat;
}

/* Player Areas */
.player-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 15px;
    transition: all 0.3s;
    position: relative;
}

.player-area.active-turn {
    background: rgba(255, 215, 0, 0.1);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.player-area.active-turn .player-label {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* When player is eliminated, fade out the content but maintain layout space */
.player-top.eliminated,
.player-left.eliminated,
.player-right.eliminated,
.player-bottom.eliminated {
    opacity: 0.3;
    pointer-events: none;
}

.player-label {
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
}

/* Quest Mode Player Info Boxes */
.player-area-top,
.player-area-left,
.player-area-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.player-area-top {
    flex-direction: row;
    justify-content: center;
}

.player-area-left {
    flex-direction: row;
    justify-content: flex-start;
}

.player-area-right {
    flex-direction: row;
    justify-content: flex-end;
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #ffd700;
    min-width: 180px;
}

.player-info.active-turn {
    background: rgba(100, 140, 180, 0.5);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.player-name-display {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-align: center;
}

.player-hp {
    font-size: 20px;
    color: #00ff00;
    text-align: center;
}

.game-container .boat-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    /* Size to fit the boat image */
    width: 132px;
}

.game-container .boat-container .boat-image {
    width: 132px;
    height: auto;
}

/* Position particle container to overlay the boat image exactly */
.game-container .boat-container .boat-particles-container {
    width: 132px;
    height: 226px;
    top: 0;
    left: 0;
}

/* Health Bar */
.health-bar-container {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.player-top .health-bar-container {
    margin-bottom: 0;
    margin-top: 3px;
}

.player-bottom .health-bar-container {
    margin-bottom: 3px;
}

.health-bar {
    width: 200px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #ffd700;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

/* Vertical health bars for left/right players */
.health-bar-vertical {
    flex-direction: column;
    margin-bottom: 0;
}

.health-bar-vertical .health-bar {
    width: 24px;
    height: 200px;
    writing-mode: vertical-lr;
}

.health-bar-vertical .health-bar-fill {
    width: 100%;
    height: 100%;
}

.health-bar-vertical .health-text {
    writing-mode: vertical-lr;
    transform: rotate(180deg);
}

.health-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
    transition: width 0.5s ease-out, height 0.5s ease-out, background 0.3s;
    width: 100%;
    position: relative;
}

.health-bar-vertical .health-bar-fill {
    background: linear-gradient(180deg, #27ae60 0%, #2ecc71 100%);
}

.health-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
}

/* Health bar color states - horizontal */
.health-bar-fill[data-health="100"],
.health-bar-fill[data-health^="9"],
.health-bar-fill[data-health^="8"],
.health-bar-fill[data-health^="7"],
.health-bar-fill[data-health^="6"] {
    background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
}

.health-bar-fill[data-health^="5"],
.health-bar-fill[data-health^="4"] {
    background: linear-gradient(90deg, #f39c12 0%, #f1c40f 100%);
}

.health-bar-fill[data-health^="3"],
.health-bar-fill[data-health^="2"],
.health-bar-fill[data-health^="1"],
.health-bar-fill[data-health="0"] {
    background: linear-gradient(90deg, #c0392b 0%, #e74c3c 100%);
}

/* Health bar color states - vertical */
.health-bar-vertical .health-bar-fill[data-health="100"],
.health-bar-vertical .health-bar-fill[data-health^="9"],
.health-bar-vertical .health-bar-fill[data-health^="8"],
.health-bar-vertical .health-bar-fill[data-health^="7"],
.health-bar-vertical .health-bar-fill[data-health^="6"] {
    background: linear-gradient(180deg, #27ae60 0%, #2ecc71 100%);
}

.health-bar-vertical .health-bar-fill[data-health^="5"],
.health-bar-vertical .health-bar-fill[data-health^="4"] {
    background: linear-gradient(180deg, #f39c12 0%, #f1c40f 100%);
}

.health-bar-vertical .health-bar-fill[data-health^="3"],
.health-bar-vertical .health-bar-fill[data-health^="2"],
.health-bar-vertical .health-bar-fill[data-health^="1"],
.health-bar-vertical .health-bar-fill[data-health="0"] {
    background: linear-gradient(180deg, #c0392b 0%, #e74c3c 100%);
}

.health-text {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    min-width: 60px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hand {
    display: flex;
    gap: 8px;
    min-height: 140px;
    padding: 3px;
}

/* Card Slots */
.card-slot {
    width: 100px;
    height: 140px;
    border: 2px dashed rgba(255, 215, 0, 0.2);
    border-radius: 10px;
    position: relative;
    transition: border-color 0.3s;
}

/* Landscape orientation for AI Left and AI Right players */
.player-left .card-slot,
.player-right .card-slot {
    width: 140px;
    height: 100px;
}

.card-slot:hover {
    border-color: rgba(255, 215, 0, 0.4);
}

/* Top Player */
.player-top {
    flex: 0 0 auto;
    visibility: hidden; /* Hidden by default, shown in single round mode */
}

.player-top-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
}

.player-top-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.player-top-left .health-bar-container {
    align-self: flex-end;
}

.player-top-left .color-tracker {
    align-self: flex-end;
}

.player-top-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Middle Row */
.middle-row {
    flex: 0 1 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    max-height: 45vh;
}

.player-left,
.player-right {
    flex: 0 0 auto;
    visibility: hidden; /* Hidden by default, shown in single round mode */
}

.player-left {
    margin-top: -150px;
}

.player-left .hand,
.player-right .hand {
    flex-direction: column;
    min-height: 100px; /* Adjusted for landscape cards */
}

/* Player content wrapper for left/right players */
.player-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* AI Left player - vertical layout with castle on top */
.player-left .player-content {
    flex-direction: column;
    align-items: flex-start;
}

/* AI Right cards and castle wrapper - vertical layout with castle on bottom */
.player-right-cards-castle {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* AI Left bottom section - horizontal layout for hand/health/color/skills */
.player-left-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Bottom Player */
.player-bottom {
    flex: 0 0 auto;
    margin-top: 200px;
}

.player-bottom-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
}

.player-bottom-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.player-bottom-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.player-bottom-right .health-bar-container {
    align-self: flex-start;
}

.player-bottom-right .color-tracker {
    align-self: flex-start;
}

/* Center Area */
.center-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 100px;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    padding-top: 110px;
    transform: translateX(100px) translateY(-50px);
}

.deck-container {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: center;
}

.deck-controls-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.deck-row {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: center;
}

.deck {
    width: 100px;
    height: 140px;
    background: #2c3e50;
    border: 3px solid #ffd700;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s;
}

.deck:hover {
    transform: translateY(-5px);
}

.deck::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 6px;
}

.deck-count {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
}

.discard-pile {
    width: 100px;
    height: 140px;
    border: 3px dashed rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.discard-pile .card {
    position: relative;
}

.discard-label {
    font-size: 12px;
    color: rgba(255, 215, 0, 0.5);
    text-transform: uppercase;
}

/* Kraken Entity */
.kraken-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

#kraken-image {
    max-width: 438px;
    max-height: 438px;
    width: auto;
    height: auto;
    display: block;
    image-rendering: auto;
    object-fit: contain;
}

/* Tension Meter */
.tension-meter-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tension-label {
    font-size: 14px;
    font-weight: bold;
    color: #DC143C;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(220, 20, 60, 0.5);
}

.tension-meter {
    width: 300px;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    border: 3px solid #DC143C;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 20px rgba(220, 20, 60, 0.3);
}

.tension-meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8B0000 0%, #DC143C 50%, #FF0000 100%);
    transition: width 0.5s ease-out;
    position: relative;
    box-shadow: 0 0 15px rgba(220, 20, 60, 0.6);
}

.tension-meter-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, transparent 100%);
}

.tension-value {
    font-size: 16px;
    font-weight: bold;
    color: #DC143C;
    text-shadow: 0 0 10px rgba(220, 20, 60, 0.5);
}

/* Color Tracker */
.color-tracker {
    display: flex;
    flex-direction: row;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 10px;
    border-radius: 8px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.color-total {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: bold;
}

.color-label {
    min-width: auto;
}

.color-value {
    font-size: 14px;
    min-width: 24px;
    text-align: center;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
}

.color-red .color-label,
.color-red .color-value {
    color: #e74c3c;
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.color-green .color-label,
.color-green .color-value {
    color: #2ecc71;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

.color-blue .color-label,
.color-blue .color-value {
    color: #3498db;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.color-yellow .color-label,
.color-yellow .color-value {
    color: #f1c40f;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
}

/* Player-specific color tracker positioning */
.player-left .color-tracker {
    transform: rotate(90deg);
    transform-origin: center center;
}

.player-right .color-tracker {
    transform: rotate(270deg);
    transform-origin: center center;
}

/* Skills Panel */
.skills-panel {
    display: flex;
    gap: 5px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    margin-top: 4px;
}

.skills-panel-vertical {
    flex-direction: column;
    margin-top: 0;
    margin-left: 4px;
}

/* Move AI Left skills panel to the left */
#skills-panel-left {
    margin-left: -210px;
}

/* Move AI Left color tracker to the right */
#color-tracker-left {
    transform: rotate(90deg) translateY(-40px);
}

/* Align AI Right skills panel with card slots (compensate for castle in container) */
#skills-panel-right {
    align-self: center;
    transform: translateX(0px) translateY(-100px);
}

/* Align AI Right color tracker with skills panel */
#color-tracker-right {
    align-self: center;
    transform: translateX(72px) translateY(-100px) rotate(270deg);
}

.skill-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 5px 7px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(100, 100, 100, 0.5);
    border-radius: 6px;
    min-width: 71px;
    min-height: 78px;
    cursor: not-allowed;
    opacity: 0.4;
    transition: all 0.3s;
}

.skill-button.affordable {
    border-color: #ffd700;
    opacity: 1;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.skill-button.affordable:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    background: rgba(255, 215, 0, 0.1);
}

.skill-button.locked {
    opacity: 0.3;
    border-color: rgba(80, 80, 80, 0.5);
}

.skill-button.shield-active {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.2);
    opacity: 1;
    animation: shield-glow 1.5s ease-in-out infinite;
}

@keyframes shield-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(46, 204, 113, 0.6);
    }
    50% {
        box-shadow: 0 0 25px rgba(46, 204, 113, 1);
    }
}

.skill-icon {
    font-size: 24px;
    line-height: 1;
}

.skill-name {
    font-size: 11px;
    font-weight: bold;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
}

.skill-cost {
    display: flex;
    gap: 5px;
    font-size: 15px;
    font-weight: bold;
}

.cost-red {
    color: #e74c3c;
    text-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
}

.cost-green {
    color: #2ecc71;
    text-shadow: 0 0 5px rgba(46, 204, 113, 0.5);
}

.cost-blue {
    color: #3498db;
    text-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.cost-yellow {
    color: #f1c40f;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
}

/* Cost display when player has enough */
.skill-cost span.has-enough {
    filter: brightness(1.3);
}

.skill-cost span:not(.has-enough) {
    opacity: 0.5;
}

/* Clickable skill button (player's turn, can afford, not used yet) */
.skill-button.clickable {
    cursor: pointer;
    animation: skill-ready-pulse 2s ease-in-out infinite;
}

.skill-button.clickable:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
}

@keyframes skill-ready-pulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
    }
}

/* Heal particle effect */
.heal-particle {
    position: fixed;
    font-size: 24px;
    pointer-events: none;
    z-index: 99999;
    filter: drop-shadow(0 0 5px rgba(255, 100, 100, 0.8));
}

/* Card Styles */
.card {
    width: 100px;
    height: 140px;
    border-radius: 10px;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Landscape cards for AI Left and AI Right players */
/* Dimensions now applied via inline styles in JavaScript */

.card.clickable {
    cursor: pointer;
}

.card.clickable:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 16px rgba(255, 215, 0, 0.4);
}

/* Playable card highlighting */
.card.playable {
    border: 3px solid #ffd700;
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.6);
}

/* Card Face */
.card-face {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    border: 3px solid rgba(0, 0, 0, 0.2);
    position: relative;
}

/* Card backs/faces for AI Left and AI Right - portrait dimensions before rotation */
.player-left .card-face,
.player-left .card-back,
.card[data-player="left"] .card-face,
.card[data-player="left"] .card-back,
.player-right .card-face,
.player-right .card-back,
.card[data-player="right"] .card-face,
.card[data-player="right"] .card-back {
    width: 100px;
    height: 140px;
}

/* Rotate card content for AI Left and AI Right for readability */
.player-left .card-face,
.player-left .card-back,
.card[data-player="left"] .card-face,
.card[data-player="left"] .card-back {
    transform: translate(20px, -20px) rotate(90deg);
}

.player-right .card-face,
.player-right .card-back,
.card[data-player="right"] .card-face,
.card[data-player="right"] .card-back {
    transform: translate(20px, -20px) rotate(-90deg);
}

/* Card Colors */
.card-green { background: linear-gradient(135deg, #27ae60 0%, #229954 100%); }
.card-blue { background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); }
.card-red { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); }
.card-yellow { background: linear-gradient(135deg, #f39c12 0%, #d68910 100%); }

/* Damage Cards */
.damage-card {
    display: flex;
    align-items: center;
    justify-content: center;
}

.damage-text {
    text-align: center;
}

.damage-label {
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.damage-amount {
    font-size: 48px;
    font-weight: bold;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
}

.damage-card::before,
.damage-card::after {
    display: none;
}

/* Reverse Cards */
.reverse-card {
    display: flex;
    align-items: center;
    justify-content: center;
}

.reverse-text {
    text-align: center;
    position: relative;
    transform: translateY(8px); /* Lower to align REVERSE with ATTACK label */
}

.reverse-label {
    font-size: 14px; /* Match ATTACK font size for alignment */
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.reverse-icon {
    font-size: 56px;
    font-weight: bold;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
}

.reverse-card::before,
.reverse-card::after {
    display: none;
}

/* Tension Damage Cards */
.tension-damage-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%) !important;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.tension-damage-text {
    text-align: center;
}

.tension-damage-label {
    font-size: 16px;
    font-weight: 500; /* Lighter weight */
    letter-spacing: 2px;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 3px 3px 6px rgba(0, 0, 0, 0.9);
}

.tension-damage-card::before,
.tension-damage-card::after {
    display: none;
}

/* Card Back - Nightjar Pattern */
.card-back {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(135deg, #1e90ff 0%, #87ceeb 50%, #1e90ff 100%);
    border: 3px solid #000;
    position: relative;
    overflow: hidden;
}

.card-back::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    background:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 255, 255, 0.1) 10px, rgba(255, 255, 255, 0.1) 20px),
        repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(30, 144, 255, 0.2) 10px, rgba(30, 144, 255, 0.2) 20px);
}

.card-back::after {
    content: '🐦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Shield Card Back */
.card-back-shield {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 50%, #27ae60 100%);
    border: 3px solid #000;
    position: relative;
    overflow: hidden;
}

.card-back-shield::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 6px;
    background:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0, 0, 0, 0.2) 10px, rgba(0, 0, 0, 0.2) 20px),
        repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(46, 204, 113, 0.3) 10px, rgba(46, 204, 113, 0.3) 20px);
}

.card-back-shield::after {
    content: '🛡️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Card Animation */
.card-flying {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
}

@keyframes deal-card {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotate(var(--rotate));
    }
}

/* Controls */
.controls {
    position: fixed;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: 2px solid #ffd700;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.btn:active {
    transform: translateY(0);
}

/* Pass Turn Message */
.pass-turn-message {
    position: fixed;
    top: 75%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 30px 60px;
    border-radius: 15px;
    border: 3px solid #ffd700;
    font-size: 32px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease-out;
}

.pass-turn-message.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Quest mode discard message - needs higher z-index to appear above quest screen */
#quest-discard-message {
    z-index: 100000;
    top: calc(75% - 120px);
    font-size: 24px;
    padding: 20px 45px;
}

/* Win Message */
.win-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: white;
    padding: 50px 80px;
    border-radius: 20px;
    border: 4px solid #ffd700;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s ease-out;
}

.win-message.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.win-title {
    font-size: 56px;
    font-weight: bold;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    }
    50% {
        text-shadow: 0 0 40px rgba(255, 215, 0, 0.9);
    }
}

.win-player {
    font-size: 32px;
    font-weight: bold;
    color: white;
    margin-bottom: 30px;
    letter-spacing: 2px;
}

.win-message .btn {
    margin-top: 20px;
    font-size: 18px;
    padding: 15px 40px;
}

/* Island Attack Message */
.entity-attack-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #8B0000 0%, #DC143C 100%);
    color: white;
    padding: 40px 80px;
    border-radius: 20px;
    border: 4px solid #FF0000;
    font-size: 48px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 4px;
    box-shadow: 0 20px 60px rgba(220, 20, 60, 0.8), 0 0 40px rgba(220, 20, 60, 0.5);
    z-index: 2500;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s ease-out;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.entity-attack-message.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Skill Cast Message */
.skill-cast-message {
    position: fixed;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    padding: 30px 60px;
    border-radius: 15px;
    border: 3px solid #ffd700;
    font-size: 28px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 10px 30px rgba(46, 204, 113, 0.5);
    z-index: 20000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease-out;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.skill-cast-message.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ESC Menu */
.esc-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
}

.esc-menu-overlay.visible {
    display: flex;
}

.esc-menu {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    border: 4px solid #ffd700;
    border-radius: 20px;
    padding: 40px 60px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.esc-menu-title {
    color: #ffd700;
    font-size: 36px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 30px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.esc-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.esc-menu-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: 3px solid #ffd700;
    border-radius: 10px;
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.esc-menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(255, 215, 0, 0.4);
}

.esc-menu-btn.resume {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

/* Particle Animation */
.color-particle {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3000;
    box-shadow: 0 0 8px currentColor;
    opacity: 0.9;
}

.color-particle.red {
    background: #e74c3c;
}

.color-particle.green {
    background: #2ecc71;
}

.color-particle.blue {
    background: #3498db;
}

.color-particle.yellow {
    background: #f1c40f;
}

/* Gem particle style (replaces colored circles with gem images) */
.color-particle-gem {
    position: fixed;
    width: 48px;
    height: 48px;
    pointer-events: none;
    z-index: 3000;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

/* Tension/Kraken Particle */
.tension-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    background: radial-gradient(circle at 30% 30%, #8b0000, #DC143C);
    box-shadow: 0 0 8px #DC143C, 0 0 16px rgba(220, 20, 60, 0.5);
}

/* Wild Card */
.wild-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        to right,
        #e74c3c 0% 25%,
        #2ecc71 25% 50%,
        #3498db 50% 75%,
        #f1c40f 75% 100%
    ) !important;
    border: 3px solid rgba(255, 255, 255, 0.4);
}

.wild-card-text {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #ffffff;
    text-shadow:
        0 0 10px rgba(0, 0, 0, 0.9),
        2px 2px 4px rgba(0, 0, 0, 0.9),
        -2px -2px 4px rgba(0, 0, 0, 0.9);
}

/* Damage Particle Animation */
.damage-particle {
    position: fixed;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 26px solid #e74c3c;
    pointer-events: none;
    z-index: 3000;
    filter:
        drop-shadow(0 0 2px #ffffff)
        drop-shadow(0 0 2px #ffffff)
        drop-shadow(0 0 10px #e74c3c);
    opacity: 0.95;
}

/* Crew Member Particle Animation */
.crew-particle {
    position: fixed;
    width: 32px;
    height: 32px;
    pointer-events: none;
    z-index: 99997;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.8));
    /* No CSS animation - JS handles the transform */
}

.crew-particle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Wood Particle Animation */
.wood-particle {
    position: fixed;
    width: 12px;
    height: 12px;
    pointer-events: none;
    z-index: 99996;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
    /* Random rotation set via JS */
    --start-rotation: 0deg;
    --end-rotation: 720deg;
}

.wood-particle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes wood-blast {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) rotate(720deg);
    }
}

/* Floating debris that persists in water */
.floating-debris {
    animation: float-bob 2s ease-in-out infinite !important;
    opacity: 0.8 !important;
    /* Scale and rotation set via CSS custom properties from JS */
    --debris-rotation: 0deg;
}

@keyframes float-bob {
    0%, 100% {
        transform: translateY(0px) rotate(var(--debris-rotation));
    }
    50% {
        transform: translateY(-4px) rotate(var(--debris-rotation));
    }
}

/* Damage Number Animation (Fixed Position) */
.damage-number-fixed {
    position: fixed;
    font-family: 'Old Claude LP', sans-serif;
    font-size: 42px;
    font-weight: bold;
    color: #ff4444;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.95), -2px -2px 3px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 68, 68, 0.7);
    pointer-events: none;
    z-index: 10010;
    white-space: nowrap;
    animation: damageNumberPopFixed 1.8s ease-out forwards;
}

.damage-number-fixed.heal {
    color: #44ff44;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.95), -2px -2px 3px rgba(0, 0, 0, 0.8), 0 0 15px rgba(68, 255, 68, 0.7);
}

@keyframes damageNumberPopFixed {
    0% {
        opacity: 1;
        transform: translateY(-50%) scale(0.5);
    }
    15% {
        opacity: 1;
        transform: translateY(-50%) scale(1.5);
    }
    30% {
        opacity: 1;
        transform: translateY(-50%) scale(1.1);
    }
    70% {
        opacity: 1;
        transform: translateY(-70%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100%) scale(0.9);
    }
}

/* Crew that will persist in water - rotate but don't fade */
.crew-particle.will-persist {
    animation: crew-blast-persist 1.5s ease-out forwards;
}

@keyframes crew-blast-persist {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(360deg);
    }
}

/* Floating crew in water - bobbing animation */
.crew-particle.floating {
    --final-scale: 0.6;
    animation: crew-bob 1.2s ease-in-out infinite;
}

@keyframes crew-bob {
    0%, 100% {
        transform: scale(var(--final-scale, 0.6)) translateY(0) rotate(0deg);
    }
    50% {
        transform: scale(var(--final-scale, 0.6)) translateY(-6px) rotate(3deg);
    }
}

/* Wood particles that will persist should rotate but not fade out */
.wood-particle.will-persist {
    animation: wood-blast-persist 1.8s ease-out forwards;
}

@keyframes wood-blast-persist {
    0% {
        opacity: 1;
        transform: rotate(var(--start-rotation));
    }
    100% {
        opacity: 1;
        transform: rotate(var(--end-rotation));
    }
}

/* Update wood-blast to use CSS variables for rotation */
@keyframes wood-blast {
    0% {
        opacity: 1;
        transform: rotate(var(--start-rotation, 0deg));
    }
    100% {
        opacity: 0;
        transform: rotate(var(--end-rotation, 720deg));
    }
}

.damage-particle.black {
    border-bottom: 26px solid #1a1a1a;
    filter:
        drop-shadow(0 0 2px #ffffff)
        drop-shadow(0 0 2px #ffffff)
        drop-shadow(0 0 10px #1a1a1a);
}

.damage-particle.purple {
    border-bottom: 26px solid #DC143C;
    filter:
        drop-shadow(0 0 2px #ffffff)
        drop-shadow(0 0 2px #ffffff)
        drop-shadow(0 0 15px #DC143C);
}

/* Cannonball Animation */
.cannonball {
    position: fixed;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #555555, #000000);
    pointer-events: none;
    z-index: 99999;
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.8),
        inset -5px -5px 10px rgba(0, 0, 0, 0.5),
        inset 5px 5px 10px rgba(255, 255, 255, 0.2);
}

.cannonball-small {
    position: fixed;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #555555, #000000);
    border: 2px solid #888888;
    pointer-events: none;
    z-index: 99999;
    box-shadow:
        0 0 10px rgba(0, 0, 0, 0.8),
        inset -2px -2px 5px rgba(0, 0, 0, 0.5),
        inset 2px 2px 5px rgba(255, 255, 255, 0.2);
}

/* Castle Explosion Effects */
.explosion-particle {
    position: fixed;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 99998;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 26px solid #ff6600;
    filter: drop-shadow(0 0 8px #ffaa00) drop-shadow(0 0 16px #ff6600);
    animation: explosion-fade 1.5s ease-out forwards;
}

.explosion-particle.fire {
    border-bottom-color: #ff3300;
    filter: drop-shadow(0 0 10px #ff6600) drop-shadow(0 0 20px #ff3300);
}

.explosion-particle.ember {
    border-bottom-color: #ffdd00;
    filter: drop-shadow(0 0 8px #ffff00) drop-shadow(0 0 16px #ffaa00);
}

.smoke-particle {
    position: fixed;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, #888888, #444444);
    pointer-events: none;
    z-index: 99997;
    opacity: 0.8;
    animation: smoke-rise 1.5s ease-out forwards;
}

@keyframes explosion-fade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

@keyframes smoke-rise {
    0% {
        opacity: 0.7;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(2);
    }
}

/* Health Bar Under Attack Effect */
.health-bar-under-attack {
    animation: health-bar-damage-flash 0.15s ease-in-out;
    background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%) !important;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.3);
}

@keyframes health-bar-damage-flash {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.5);
    }
}

/* Castle 3D Visualization */
.castle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.castle-container canvas {
    width: 200px;
    height: 200px;
    display: block;
}

.boat-image {
    width: 100px;
    height: 200px;
    display: block;
    object-fit: contain;
    transition: opacity 0.3s ease-in-out;
    transform-origin: center center;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Boat container rotations and rocking - particles move with the boat */
#boat-container-top {
    transform: rotate(0deg);
    animation: boat-rock-top 3.5s linear infinite;
    transform-origin: center center;
}

#boat-container-bottom {
    transform: rotate(180deg);
    animation: boat-rock-bottom 4s linear infinite;
    transform-origin: center center;
}

#boat-container-left {
    transform: rotate(270deg);
    animation: boat-rock-left 4.2s linear infinite;
    transform-origin: center center;
}

#boat-container-right {
    transform: rotate(90deg);
    animation: boat-rock-right 3.8s linear infinite;
    transform-origin: center center;
}

/* Boat rocking animations - subtle side-to-side motion */
@keyframes boat-rock-bottom {
    0%, 100% {
        transform: rotate(180deg);
    }
    25% {
        transform: rotate(178deg);
    }
    50% {
        transform: rotate(180deg);
    }
    75% {
        transform: rotate(182deg);
    }
}

@keyframes boat-rock-top {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-2deg);
    }
    50% {
        transform: rotate(0deg);
    }
    75% {
        transform: rotate(2deg);
    }
}

@keyframes boat-rock-left {
    0%, 100% {
        transform: rotate(270deg);
    }
    25% {
        transform: rotate(268deg);
    }
    50% {
        transform: rotate(270deg);
    }
    75% {
        transform: rotate(272deg);
    }
}

@keyframes boat-rock-right {
    0%, 100% {
        transform: rotate(90deg);
    }
    25% {
        transform: rotate(88deg);
    }
    50% {
        transform: rotate(90deg);
    }
    75% {
        transform: rotate(92deg);
    }
}

.castle-integrity {
    font-size: 20px;
    font-weight: bold;
    color: #D4C4A8;
    text-align: center;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
}

/* Castle Bottom - left of hand */
.castle-bottom {
    margin-right: 20px;
    margin-top: -40px;
}

/* Castle Top - right of hand (their left from their perspective) */
.castle-top {
    margin-left: 20px;
}

/* Castle Left - above hand */
.castle-left {
    margin-bottom: 10px;
    margin-left: 50px;
}

/* Castle Right - above hand */
.castle-right {
    margin-bottom: 10px;
    margin-right: 50px;
}

/* Title Screen */
.title-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 50%, #1a0b2e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 1s ease-out;
}

.title-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.title-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.logo-nightjar-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    margin-top: -40px;
}

.title-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.title-logo img {
    max-width: 500px;
    max-height: 200px;
    width: auto;
    height: auto;
    display: block;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
}

.nightjar-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.nightjar-image {
    height: 180px;
    width: auto;
    display: block;
}

.nightjar-dialog {
    position: absolute;
    right: -180px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    color: #333;
    padding: 15px 25px;
    border-radius: 20px;
    border: 3px solid #333;
    font-size: 24px;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.nightjar-dialog::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 20px solid #333;
}

.nightjar-dialog::after {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-right: 17px solid white;
}

.nightjar-dialog.show {
    opacity: 1;
}

.project-title {
    font-size: 48px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    letter-spacing: 4px;
    text-align: center;
    margin-top: 40px;
    margin-bottom: 40px;
}

/* Dev Mode Toggle */
.dev-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.dev-toggle {
    position: relative;
    width: 50px;
    height: 26px;
}

.dev-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.dev-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #444;
    border: 2px solid #666;
    border-radius: 26px;
    transition: all 0.3s ease;
}

.dev-toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #888;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.dev-toggle input:checked + .dev-toggle-slider {
    background-color: #2ecc71;
    border-color: #27ae60;
}

.dev-toggle input:checked + .dev-toggle-slider::before {
    transform: translateX(24px);
    background-color: white;
}

.dev-toggle-label {
    font-size: 14px;
    font-weight: bold;
    color: #888;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.dev-toggle input:checked ~ .dev-toggle-label,
.dev-toggle-container:has(input:checked) .dev-toggle-label {
    color: #2ecc71;
}

/* Button grid flip wrapper for dev mode toggle */
.button-grid-flipper-wrapper {
    perspective: 1000px;
    display: flex;
    justify-content: center;
}

.button-grid-flipper {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
}

.button-grid-flipper.flipped {
    transform: rotateY(180deg);
}

.button-grid-front,
.button-grid-back {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.button-grid-front {
    position: relative;
}

.button-grid-back {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) rotateY(180deg);
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, 350px);
    gap: 25px;
    justify-content: center;
}

.start-button {
    font-family: inherit;
    font-size: 32px;
    font-weight: bold;
    padding: 20px 60px;
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
    border: 3px solid #7ab8e8;
    border-radius: 15px;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    box-shadow: 0 4px 15px rgba(74, 144, 217, 0.4);
    transition: all 0.3s ease;
}

.start-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(74, 144, 217, 0.6);
}

.start-button:active {
    transform: scale(0.98);
}

.experimental-box {
    padding: 15px 30px;
    border: 3px solid #ffd700;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 400px;
}

.experimental-label {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-align: center;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.experimental-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    min-height: 36px;
}

.experimental-button {
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    padding: 8px 0;
    width: 110px;
    background: linear-gradient(135deg, #444 0%, #333 100%);
    color: #ffd700;
    border: 2px solid #ffd700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.experimental-button:hover {
    background: linear-gradient(135deg, #555 0%, #444 100%);
    transform: scale(1.05);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.server-label {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    letter-spacing: 1px;
}

.server-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e74c3c;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.8);
}

.server-light.online {
    background: #2ecc71;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.8);
}

.experimental-page {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Both pages match the width of page 1 (5 buttons + server + gaps) */
    min-width: 790px;
}

.experimental-page-arrow {
    font-size: 16px;
    color: #88aaff;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    display: inline-block;
}

.experimental-page-arrow:hover {
    color: #aaccff;
    transform: scale(1.2);
}

.exp-arrow-back {
    transform: rotate(180deg);
}

.exp-arrow-back:hover {
    transform: rotate(180deg) scale(1.2);
}

.copyright-text {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 14.4px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
}

.version-number {
    position: absolute;
    bottom: 20px;
    right: 30px;
    font-size: 14px;
    color: rgba(255, 215, 0, 0.8);
    font-family: monospace;
    letter-spacing: 1px;
    z-index: 10001;
}

/* Quest Map Screen */
.quest-map-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 100%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    flex-direction: column;
    gap: 30px;
}

.quest-map-screen.active {
    display: flex;
}

/* Flip card wrapper - maintains 3D perspective */
.quest-map-flipper-wrapper {
    width: 1350px;
    height: 900px;
    perspective: 2000px;
}

/* The flipper container that rotates */
.quest-map-flipper {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s ease-in-out;
}

/* Flipped state */
.quest-map-flipper.flipped {
    transform: rotateY(180deg);
}

/* Common styles for front and back */
.quest-map-front,
.quest-map-back {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Front side - the map */
.quest-map-front {
    z-index: 2;
}

/* Back side - the store and dialog (flipped) */
.quest-map-back {
    transform: rotateY(180deg);
    z-index: 1;
    display: none; /* Hidden by default, shown when active */
}

/* Show the active back face */
.quest-map-back.active {
    display: block;
}

.quest-map-container {
    width: 1350px;
    height: 900px;
    border: 3px solid #ffd700;
    border-radius: 15px;
    overflow: visible;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    position: relative;
}

/* Store container (back of flip card) */
.store-container {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0b1a2a 0%, #1b3d5e 50%, #0a2a4a 100%);
    border: 3px solid #ffd700;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    box-sizing: border-box;
    position: relative;
}

/* Store close button (X in upper right) */
.store-close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 42px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.store-close-btn:hover {
    color: #ff6b6b;
    transform: scale(1.1);
}

.store-title {
    color: #ffd700;
    font-size: 72px;
    font-family: 'Old Claude LP', Arial, sans-serif;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    flex-shrink: 0;
}

/* Quest Dialog Container (back of flip card for quest selection) */
.quest-dialog-container {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 50%, #1a0b2e 100%);
    border: 3px solid #ffd700;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    box-sizing: border-box;
    position: relative;
}

/* Red X close button for quest dialog */
.quest-dialog-close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 42px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.quest-dialog-close-btn:hover {
    color: #ff6b6b;
    transform: scale(1.1);
}

.quest-dialog-flip-title {
    color: #ffd700;
    font-size: 64px;
    font-family: 'Old Claude LP', Arial, sans-serif;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 40px;
    text-align: center;
}

.quest-dialog-flip-content {
    color: #e0e0e0;
    font-size: 28px;
    line-height: 1.8;
    text-align: center;
    max-width: 900px;
    margin-bottom: 60px;
    white-space: pre-wrap;
}

/* Quest Dialog Rewards Section */
.quest-dialog-rewards {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40px;
}

.quest-dialog-rewards-title {
    color: #ffd700;
    font-size: 32px;
    font-family: 'Old Claude LP', Arial, sans-serif;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.quest-dialog-rewards-row {
    display: flex;
    gap: 40px;
}

.quest-reward-item {
    font-size: 28px;
    font-family: 'Old Claude LP', Arial, sans-serif;
    padding: 10px 25px;
    border-radius: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.quest-reward-xp {
    color: #7ab8e8;
    background: rgba(74, 144, 217, 0.2);
    border: 2px solid #4a90d9;
}

.quest-reward-gold {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid #ffd700;
}

.quest-dialog-flip-buttons {
    display: flex;
    justify-content: center;
}

.btn-begin-quest {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
    border: 3px solid #7ab8e8;
    border-radius: 15px;
    padding: 20px 60px;
    font-size: 28px;
    font-family: 'Old Claude LP', Arial, sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-begin-quest:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(74, 144, 217, 0.6);
}

.store-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.store-subtitle {
    color: #a0a0a0;
    font-size: 32px;
    font-style: italic;
}

/* Store Inventory Wrapper with Navigation */
.store-inventory-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    flex: 1;
    gap: 15px;
    overflow: hidden;
}

/* Store Navigation Arrows */
.store-nav-arrow {
    background: linear-gradient(135deg, #1a3a5a 0%, #0d1a2d 100%);
    border: 3px solid #4a90d9;
    border-radius: 10px;
    color: #ffd700;
    font-size: 36px;
    font-weight: bold;
    width: 50px;
    height: 80px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.store-nav-arrow:hover:not(:disabled) {
    background: linear-gradient(135deg, #2a4a6a 0%, #1d2a3d 100%);
    border-color: #7ab8e8;
    transform: scale(1.05);
}

.store-nav-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Store Page Indicator */
.store-page-indicator {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 0;
    flex-shrink: 0;
}

.store-page-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.store-page-dot.active {
    background: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Store Inventory */
.store-inventory {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 10px 15px;
    flex: 1;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    align-content: start;
    align-self: flex-start;
}

.store-item {
    background: linear-gradient(135deg, #0d1a2d 0%, #1a3a5a 100%);
    border: 3px solid #4a90d9;
    border-radius: 15px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.store-item-purchasable:hover {
    transform: translateY(-5px);
    border-color: #7ab8e8;
    box-shadow: 0 8px 25px rgba(74, 144, 217, 0.4);
}

.store-item-owned:hover {
    transform: none;
    cursor: default;
}

.store-item-locked {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.store-item-owned {
    border-color: #7ab8e8;
    background: linear-gradient(135deg, #0d1a2d 0%, #1a3a5a 100%);
}

.store-item-owned::after {
    content: 'OWNED';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4a90d9;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 5px;
}

.store-item {
    position: relative;
}

.store-item-icon {
    font-size: 64px;
    margin-bottom: 4px;
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.store-item-name {
    color: #ffd700;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
}

.store-item-color-cost {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.store-item-color-pip {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.store-item-color-pip.red { background: #e74c3c; }
.store-item-color-pip.blue { background: #3498db; }
.store-item-color-pip.green { background: #2ecc71; }
.store-item-color-pip.yellow { background: #f1c40f; color: #333; text-shadow: none; }

.store-item-description {
    color: #ccc;
    font-size: 18px;
    margin-bottom: 15px;
    min-height: 50px;
    line-height: 1.4;
}

.store-item-requirements {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.store-item-cost-gold {
    color: #ffd700;
    font-size: 18px;
    font-weight: bold;
}

.store-item-level {
    color: #7ab8e8;
    font-size: 18px;
    font-weight: bold;
}

.store-item-cost-gold.requirement-not-met {
    color: #e74c3c;
}

.store-item-level.requirement-not-met {
    color: #e74c3c;
}

.store-item-free {
    color: #2ecc71;
    font-size: 20px;
    font-weight: bold;
}

.btn-back-to-map {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
    border: 2px solid #7ab8e8;
    border-radius: 10px;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    flex-shrink: 0;
}

.btn-back-to-map:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(74, 144, 217, 0.6);
}

#quest-map-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 12px; /* Match container border-radius minus border width */
}

.quest-tooltip {
    position: absolute;
    background: linear-gradient(135deg, #2d1b4e 0%, #1a0b2e 100%);
    border: 3px solid #ffd700;
    border-radius: 10px;
    padding: 20px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    z-index: 1000;
}

.quest-tooltip.show {
    opacity: 1;
}

.quest-tooltip-title {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 10px;
}

.quest-tooltip-description {
    font-size: 16px;
    color: #ffffff;
    line-height: 1.4;
}

.btn-back {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
    border: 3px solid #7ab8e8;
    padding: 15px 50px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(74, 144, 217, 0.6);
}

.btn-back:active {
    transform: scale(0.98);
}

.quest-map-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: flex-start;
}

.quest-map-row {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: flex-start;
}

.quest-info-box {
    width: 449px;
    height: 900px;
    border: 3px solid #ffd700;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    background: linear-gradient(135deg, #2d1b4e 0%, #1a0b2e 100%);
    padding: 15px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.quest-player-name-input {
    width: calc(100% - 10px);
    padding: 0 0 8px 0;
    font-size: 33px;
    font-family: inherit;
    color: white;
    background: transparent;
    border: none;
    border-bottom: 2px solid #ffd700;
    border-radius: 0;
    outline: none;
}

.quest-player-name-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.quest-player-name-input:focus {
    border-bottom-color: #fff;
}

.quest-info-stats-row {
    display: flex;
    justify-content: space-between;
    width: calc(100% - 10px);
    margin-top: 15px;
    font-size: 24px;
    color: white;
}

.quest-info-level {
    float: left;
    position: relative;
    display: inline-block;
}

/* Level-up pulse animation */
.quest-info-level.level-up {
    animation: levelUpPulse 0.9s ease-out forwards;
}

@keyframes levelUpPulse {
    0% {
        transform: scale(1);
        color: white;
    }
    30% {
        transform: scale(1.5);
        color: #ffd700;
        text-shadow: 0 0 20px #ffd700, 0 0 40px #ffaa00;
    }
    100% {
        transform: scale(1);
        color: white;
        text-shadow: none;
    }
}

/* Level-up particles */
.level-up-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffd700;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 6px #ffd700, 0 0 12px #ffaa00;
    animation: levelUpParticle 0.8s ease-out forwards;
}

@keyframes levelUpParticle {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--particle-x), var(--particle-y)) scale(0.3);
    }
}

.quest-info-exp {
    float: right;
}

.quest-exp-bar-container {
    width: calc(100% - 10px);
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #ffd700;
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.quest-exp-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4a90d9, #7bb8f5);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.quest-info-gold-row {
    margin-top: 20px;
    font-size: 24px;
    color: white;
}

.quest-info-gold {
    float: left;
}

.quest-info-loadout-label {
    clear: both;
    margin-top: 80px;
    font-size: 24px;
    color: white;
    text-align: center;
}

.quest-info-loadout-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.quest-loadout-slot {
    width: 70px;
    height: 70px;
    border: 2px solid #ffd700;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-sizing: border-box;
    cursor: grab;
    transition: all 0.2s ease;
}

.quest-loadout-slot.filled:hover {
    border-color: #ffec8b;
    transform: scale(1.05);
}

.quest-loadout-slot.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.quest-loadout-slot.drag-over {
    border-color: #7ab8e8;
    background: rgba(74, 144, 217, 0.3);
    box-shadow: 0 0 10px rgba(74, 144, 217, 0.5);
}

.quest-loadout-slot-icon {
    font-size: 28px;
    text-align: center;
    margin-bottom: 3px;
}

.quest-loadout-slot-costs {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
}

.quest-loadout-slot-pip {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 9px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.quest-loadout-slot-pip.red { background: #e74c3c; }
.quest-loadout-slot-pip.blue { background: #3498db; }
.quest-loadout-slot-pip.green { background: #2ecc71; }
.quest-loadout-slot-pip.yellow { background: #f1c40f; color: #333; text-shadow: none; }

.quest-info-skills-label {
    margin-top: 80px;
    font-size: 24px;
    color: white;
    text-align: center;
}

.quest-info-skills-inventory {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.quest-skills-row {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.quest-skill-slot {
    width: 70px;
    height: 70px;
    border: 2px solid #4a90d9;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-sizing: border-box;
    cursor: grab;
    transition: all 0.2s ease;
}

.quest-skill-slot.filled:hover {
    border-color: #7ab8e8;
    transform: scale(1.05);
}

.quest-skill-slot.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.quest-skill-slot.drag-over {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.2);
}

.quest-skill-slot-icon {
    font-size: 28px;
    text-align: center;
    margin-bottom: 3px;
}

.quest-skill-slot-costs {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
}

.quest-skill-slot-pip {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 9px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.quest-skill-slot-pip.red { background: #e74c3c; }
.quest-skill-slot-pip.blue { background: #3498db; }
.quest-skill-slot-pip.green { background: #2ecc71; }
.quest-skill-slot-pip.yellow { background: #f1c40f; color: #333; text-shadow: none; }

.quest-bottom-buttons {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
}

.quest-info-box-buttons {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-left: auto;
}

#quest-save-btn {
    margin-left: auto;
}

.btn-reset {
    background: linear-gradient(135deg, #dc143c 0%, #8b0000 100%);
    color: white;
    border: 3px solid #ffd700;
    padding: 15px 50px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(220, 20, 60, 0.6);
}

.btn-reset:active {
    transform: scale(0.98);
}

.btn-editor {
    background: linear-gradient(135deg, #4169e1 0%, #1e3a8a 100%);
    color: white;
    border: 3px solid #ffd700;
    padding: 15px 50px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-editor:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(65, 105, 225, 0.6);
}

.btn-editor:active {
    transform: scale(0.98);
}

.btn-save {
    background: linear-gradient(135deg, #32cd32 0%, #228b22 100%);
    color: white;
    border: 3px solid #ffd700;
    padding: 15px 50px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-save:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(50, 205, 50, 0.6);
}

.btn-save:active {
    transform: scale(0.98);
}

.btn-save-loadout {
    background: linear-gradient(135deg, #32cd32 0%, #228b22 100%);
    color: white;
    border: 2px solid #ffd700;
    padding: 8px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: auto;
    width: 100%;
}

.btn-save-loadout:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(50, 205, 50, 0.5);
}

.btn-save-loadout:active {
    transform: scale(0.98);
}

.btn-reset {
    background: linear-gradient(135deg, #dc3545 0%, #a71d2a 100%);
    color: white;
    border: 3px solid #ffd700;
    padding: 15px 30px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.6);
}

.btn-reset:active {
    transform: scale(0.98);
}

#quest-map-canvas {
    cursor: default;
}

#quest-map-canvas.dragging {
    cursor: move;
}

/* ========================================
   BOAT FIRE AND SMOKE PARTICLES
   ======================================== */

.boat-particles-container {
    position: absolute;
    /* Match the boat image dimensions exactly (132x226) */
    width: 132px;
    height: 226px;
    pointer-events: none;
    z-index: 10;
    /* Position at top-left of boat-container, same as boat image */
    top: 0;
    left: 0;
}

.boat-fire-particle {
    position: absolute;
    border-radius: 50% 50% 20% 20%;
    pointer-events: none;
}

.boat-smoke-particle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, rgba(80, 80, 80, 0.6) 0%, rgba(40, 40, 40, 0.3) 100%);
    border-radius: 50%;
    opacity: 0.4;
    filter: blur(2px);
    animation: boat-smoke-rise 2s ease-out forwards;
}

/* Fire animations from editor presets */

/* Ember animation - drifting glowing particles (Tier 1: light damage) */
@keyframes boat-fire-ember {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-25px) translateX(var(--drift, 10px)) scale(0.8);
        opacity: 0.7;
    }
    100% {
        transform: translateY(-50px) translateX(calc(var(--drift, 10px) * 2)) scale(0.2);
        opacity: 0;
    }
}

/* Intense animation - raging fire (Tier 2: medium damage, Tier 3: heavy damage) */
@keyframes boat-fire-intense {
    0% {
        transform: translateY(0) scale(1) rotate(0deg);
        opacity: 1;
    }
    20% {
        transform: translateY(-14px) scale(1.3) rotate(-8deg);
        opacity: 1;
    }
    40% {
        transform: translateY(-28px) scale(1.1) rotate(8deg);
        opacity: 0.8;
    }
    60% {
        transform: translateY(-42px) scale(1.2) rotate(-5deg);
        opacity: 0.6;
    }
    80% {
        transform: translateY(-56px) scale(0.8) rotate(5deg);
        opacity: 0.3;
    }
    100% {
        transform: translateY(-70px) scale(0.4) rotate(0deg);
        opacity: 0;
    }
}

/* Explosive animation - burst of fire (Tier 4: critical damage) */
@keyframes boat-fire-explosive {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 1;
    }
    10% {
        transform: translateY(-8px) scale(1.5);
        opacity: 1;
    }
    30% {
        transform: translateY(-24px) scale(1.2);
        opacity: 0.9;
    }
    100% {
        transform: translateY(-80px) scale(0.3);
        opacity: 0;
    }
}

@keyframes boat-smoke-rise {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0.4;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-40px) scale(1.5);
        opacity: 0;
    }
}

/* ========================================
   SKILL EFFECT ANIMATIONS - from skills editor
   These are the canonical animations used by skillEffects.js
   ======================================== */

/* Freeze effect */
@keyframes freezePulse {
    0% { opacity: 0; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0; transform: scale(1); }
}

@keyframes iceFloat {
    0% { opacity: 0; transform: scale(0) rotate(0deg); }
    20% { opacity: 1; transform: scale(1.2) rotate(90deg); }
    100% { opacity: 0; transform: scale(0.5) translateY(-50px) rotate(180deg); }
}

/* Persistent freeze overlay pulse */
@keyframes freeze-overlay-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.9; }
    100% { opacity: 0.6; }
}

/* Snowflake float animation for persistent freeze (matches poison timing) */
@keyframes snowflake-float {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(0deg); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2) rotate(45deg); }
    100% { opacity: 0; transform: translate(-50%, calc(-50% - 40px)) scale(0.8) rotate(180deg); }
}

/* Generic fade out */
@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Lightning impact spark */
@keyframes lightningImpact {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* Explosion particles */
@keyframes explosion-fade {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.3); opacity: 0; }
}

/* Wood fragments */
@keyframes wood-blast {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 0; transform: translateY(40px) rotate(720deg); }
}

/* Damage flash */
@keyframes damage-flash-anim {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Heal flash */
@keyframes heal-flash-anim {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Heal particles floating up */
@keyframes heal-float {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(0.5); }
}

/* Damage number pop */
@keyframes damage-pop {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    20% { transform: translate(-50%, -50%) scale(1.3); }
    40% { transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -100%) scale(0.8); }
}

/* Poison cloud burst (initial application) - matches skills editor */
@keyframes poison-cloud-anim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 0.8; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

@keyframes poison-particle-float {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    20% { opacity: 0.9; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--tx) * 1.5), calc(-50% + var(--ty) - 30px)) scale(0.6); }
}

/* Persistent poison emitter - particles float up from boat */
@keyframes poison-emit-float {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    20% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + (random - 0.5) * 40px), calc(-50% - 60px)) scale(0.5);
    }
}

/* Fallback for browsers that don't support random - use fixed upward float */
@keyframes poison-emit-float {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    20% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, calc(-50% - 50px)) scale(0.6);
    }
}

@keyframes poison-tick-burst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        opacity: 0;
        transform: translate(
            calc(-50% + cos(var(--angle)) * 40px),
            calc(-50% + sin(var(--angle)) * 40px)
        ) scale(1);
    }
}

/* Syphon glow */
@keyframes syphon-glow-pulse {
    0% { box-shadow: 0 0 20px rgba(255, 0, 0, 0); }
    50% { box-shadow: 0 0 40px rgba(255, 0, 0, 0.6); }
    100% { box-shadow: 0 0 20px rgba(255, 0, 0, 0); }
}

/* Shield pulse */
@keyframes shield-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Different intensity levels - using editor presets */

/* Tier 1: Light damage (60-79% HP) - Ember preset: glowing drifting coals */
.boat-fire-particle.light {
    width: 6px;
    height: 8px;
    background: radial-gradient(ellipse at center bottom, #ffcc00 0%, #ff6600 40%, #cc3300 70%, transparent 100%);
    animation: boat-fire-ember 1.2s ease-out forwards;
}

.boat-smoke-particle.light {
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, rgba(100, 100, 100, 0.5) 0%, rgba(60, 60, 60, 0.2) 100%);
    opacity: 0.35;
}

/* Tier 2: Medium damage (35-59% HP) - Large preset: bonfire */
.boat-fire-particle.medium {
    width: 18px;
    height: 23px;
    background: radial-gradient(ellipse at center bottom, #ffffff 0%, #ffaa00 40%, #ff2200 70%, transparent 100%);
    animation: boat-fire-intense 0.8s ease-out forwards;
    filter: blur(0.5px);
}

.boat-smoke-particle.medium {
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, rgba(60, 60, 60, 0.7) 0%, rgba(30, 30, 30, 0.4) 100%);
    opacity: 0.55;
    animation-duration: 1.8s;
}

/* Tier 3: Heavy damage (20-34% HP) - Intense preset: raging fire */
.boat-fire-particle.heavy {
    width: 20px;
    height: 26px;
    background: radial-gradient(ellipse at center bottom, #ffffff 0%, #ff8800 40%, #cc0000 70%, transparent 100%);
    animation: boat-fire-intense 0.7s ease-out forwards;
    filter: blur(1px);
}

.boat-smoke-particle.heavy {
    width: 22px;
    height: 22px;
    background: radial-gradient(circle, rgba(40, 40, 40, 0.8) 0%, rgba(20, 20, 20, 0.5) 100%);
    opacity: 0.7;
    animation-duration: 1.5s;
    filter: blur(3px);
}

/* Tier 4: Critical damage (1-19% HP) - Explosion preset: burst of fire */
.boat-fire-particle.critical {
    width: 25px;
    height: 32px;
    background: radial-gradient(ellipse at center bottom, #ffffff 0%, #ffcc00 40%, #ff4400 70%, transparent 100%);
    animation: boat-fire-explosive 0.5s ease-out forwards;
    filter: blur(1px);
}

.boat-smoke-particle.critical {
    width: 28px;
    height: 28px;
    background: radial-gradient(circle, rgba(20, 20, 20, 0.9) 0%, rgba(0, 0, 0, 0.6) 100%);
    opacity: 0.85;
    animation-duration: 1.2s;
    filter: blur(4px);
}

/* ========================================
   SCREEN FLASH EFFECTS (QUEST MODE)
   ======================================== */

/* Screen flash on heal */
.quest-heal-flash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(46, 204, 113, 0.4);
    pointer-events: none;
    z-index: 9000;
    animation: quest-heal-flash 0.5s ease-out forwards;
}

@keyframes quest-heal-flash {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Screen flash on damage (optional - can be enabled if desired) */
.quest-damage-flash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(231, 76, 60, 0.3);
    pointer-events: none;
    z-index: 9000;
    animation: quest-damage-flash 0.3s ease-out forwards;
}

@keyframes quest-damage-flash {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* ========================================
   QUEST DIALOG MODAL
   ======================================== */

.quest-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.quest-dialog-overlay.active {
    display: flex;
}

.quest-dialog-box {
    background: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 100%);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 40px 50px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.3);
    animation: dialogSlideIn 0.3s ease-out;
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.quest-dialog-title {
    color: #ffd700;
    font-size: 32px;
    margin-bottom: 25px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.quest-dialog-content {
    color: #e0e0e0;
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 35px;
    white-space: pre-wrap;
}

.quest-dialog-button {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
    border: 2px solid #7ab8e8;
    border-radius: 10px;
    padding: 15px 50px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quest-dialog-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(74, 144, 217, 0.6);
}

/* ========================================
   EMPTY LOADOUT WARNING MODAL
   ======================================== */

.empty-loadout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 25000;
}

.empty-loadout-overlay.active {
    display: flex;
}

.empty-loadout-box {
    background: linear-gradient(135deg, #2a1a1a 0%, #4a2020 100%);
    border: 3px solid #ff6b6b;
    border-radius: 20px;
    padding: 40px 50px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 107, 107, 0.3);
    animation: dialogSlideIn 0.3s ease-out;
}

.empty-loadout-title {
    color: #ff6b6b;
    font-size: 32px;
    font-family: 'Old Claude LP', Arial, sans-serif;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.empty-loadout-content {
    color: #e0e0e0;
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 30px;
    text-align: left;
}

.empty-loadout-button {
    background: linear-gradient(135deg, #ff6b6b 0%, #cc5555 100%);
    color: white;
    border: 2px solid #ff8888;
    border-radius: 10px;
    padding: 12px 40px;
    font-size: 20px;
    font-family: 'Old Claude LP', Arial, sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.empty-loadout-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

/* ========================================
   PURCHASE CONFIRMATION MODAL
   ======================================== */

.purchase-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 26000;
}

.purchase-confirm-overlay.active {
    display: flex;
}

.purchase-confirm-box {
    background: linear-gradient(135deg, #1a2a1a 0%, #2a4a2a 100%);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 40px 50px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.3);
    animation: dialogSlideIn 0.3s ease-out;
}

.purchase-confirm-title {
    color: #ffd700;
    font-size: 32px;
    font-family: 'Old Claude LP', Arial, sans-serif;
    margin-bottom: 25px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.purchase-confirm-skill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.purchase-confirm-icon {
    font-size: 48px;
}

.purchase-confirm-name {
    color: #fff;
    font-size: 28px;
    font-family: 'Old Claude LP', Arial, sans-serif;
}

.purchase-confirm-cost {
    color: #ffd700;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
}

.purchase-confirm-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.purchase-confirm-btn {
    padding: 12px 40px;
    font-size: 20px;
    font-family: 'Old Claude LP', Arial, sans-serif;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.purchase-confirm-yes {
    background: linear-gradient(135deg, #32cd32 0%, #228b22 100%);
    color: white;
    border: 2px solid #50fa50;
}

.purchase-confirm-yes:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(50, 205, 50, 0.6);
}

.purchase-confirm-no {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    color: #ccc;
    border: 2px solid #888;
}

.purchase-confirm-no:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(100, 100, 100, 0.6);
}

/* ========================================
   STORE POPUP
   ======================================== */

.store-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.store-popup-overlay.active {
    display: flex;
}

.store-popup-box {
    background: linear-gradient(135deg, #1a2a0b 0%, #2d4e1b 100%);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 40px 50px;
    max-width: 700px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.3);
    animation: dialogSlideIn 0.3s ease-out;
}

.store-popup-title {
    color: #ffd700;
    font-size: 42px;
    margin-bottom: 25px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    font-family: 'Old Claude LP', Arial, sans-serif;
}

.store-popup-content {
    color: #e0e0e0;
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 35px;
}

.store-popup-close {
    background: linear-gradient(135deg, #d94a4a 0%, #bd3535 100%);
    color: white;
    border: 2px solid #e87a7a;
    border-radius: 10px;
    padding: 12px 40px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.store-popup-close:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(217, 74, 74, 0.6);
}

/* ========================================
   NEW QUEST GAME SCREEN (Multiplayer-based UI)
   ======================================== */

.quest-game-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    background-image: url('Boats and Water/water.png');
    background-repeat: repeat;
}

.quest-game-screen.active {
    display: flex;
}

/* Three.js Water Background Canvas */
#water-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.quest-game-board {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    position: relative;
}

/* Flow arrows canvas */
#quest-flow-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Quest Player Areas */
.quest-player-area {
    display: flex;
    align-items: center;
    gap: 20px;
    overflow: visible;
}

.quest-player-area-top,
.quest-player-area-bottom {
    justify-content: center;
    gap: 10px;
    position: relative;
    z-index: 2;
}

.quest-player-area-left {
    justify-content: flex-start;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
    z-index: 2;
    min-width: 460px;
    width: 460px;
    flex-shrink: 0;
}

.quest-player-area-left .player-info {
    margin-top: -10px;
}

.quest-player-area-right {
    justify-content: flex-end;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
    z-index: 2;
    min-width: 460px;
    width: 460px;
    flex-shrink: 0;
}

.quest-player-area-right .boat-container {
    margin-top: -10px;
}

/* Quest player info boxes */
.quest-game-board .player-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgb(20, 20, 35);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #ffd700;
    min-width: 180px;
    width: 443px;
    transition: background 0.3s ease;
    overflow: visible;
}

.quest-game-board .player-info.active-turn {
    position: relative;
}

.quest-game-board .player-info.active-turn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgb(50, 80, 110);
    border-radius: 8px;
    z-index: 0;
}

.quest-game-board .player-info.active-turn > * {
    position: relative;
    z-index: 1;
}

/* Name and HP on same line */
.quest-game-board .player-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 10px;
}

.quest-game-board .player-name-display {
    font-size: 28px;
    font-weight: bold;
    color: #ffd700;
    text-align: left;
}

.quest-game-board .player-hp {
    font-size: 28px;
    color: #00ff00;
    text-align: right;
    position: relative;
    overflow: visible;
}

/* Player effect indicator (shown between name and HP) */
.quest-game-board .player-effect-indicator {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #ff4444;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-height: 24px;
}

.quest-game-board .player-effect-indicator:empty {
    display: none;
}

/* Quest color tracker */
.quest-game-board .color-tracker {
    display: flex;
    flex-direction: row;
    gap: 12px;
    background: transparent;
    border: none;
    padding: 0;
    justify-content: center;
    align-self: center;
}

.quest-game-board .color-total {
    display: flex;
    align-items: center;
    font-size: 17px;
    gap: 0px;
}

.quest-game-board .color-gem {
    width: 48px;
    height: 48px;
    object-fit: contain;
    vertical-align: middle;
}

.quest-game-board .color-value {
    font-size: 28px;
    min-width: 34px;
    padding-left: 3px;
    text-align: center;
    background: transparent;
}

.quest-game-board .skills-panel {
    display: flex;
    gap: 5px;
    background: transparent;
    border: none;
    padding: 5px 0;
    margin-top: 4px;
    justify-content: flex-start;
    align-self: center;
    /* Fixed width for 5 skills: (71px * 5) + (5px gap * 4) = 375px */
    width: 375px;
}

/* Quest skill slots (empty placeholders) */
.quest-game-board .skill-slot {
    min-width: 71px;
    min-height: 78px;
    background: rgb(15, 15, 25);
    border: 2px solid rgba(100, 100, 100, 0.5);
    border-radius: 6px;
}

/* Quest skill buttons need opaque backgrounds and full opacity */
.quest-game-board .skill-button {
    background: rgb(15, 15, 25);
    opacity: 1;
}

.quest-game-board .skill-button.locked {
    opacity: 0.5;
    background: rgb(15, 15, 25);
}

/* Quest boat styles */
.quest-game-board .boat-container {
    position: relative;
}

.quest-game-board .boat-image {
    width: 132px;
    height: 226px;
    display: block;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    transform-origin: center center;
}

/* Quest boat images - rotation and rocking animation */
#quest-boat-img-top {
    transform: rotate(0deg);
    animation: quest-boat-rock-top 3.5s linear infinite;
    margin-left: 40px;
}

#quest-boat-img-bottom {
    transform: rotate(180deg);
    animation: quest-boat-rock-bottom 4s linear infinite;
    margin-right: 40px;
}

#quest-boat-img-left {
    transform: rotate(270deg);
    animation: quest-boat-rock-left 4.2s linear infinite;
}

#quest-boat-img-right {
    transform: rotate(90deg);
    animation: quest-boat-rock-right 3.8s linear infinite;
}

/* Quest boat particle containers - no rotation needed, container handles it */
#quest-boat-particles-top {
    margin-left: 40px;
}

#quest-boat-particles-bottom {
    margin-right: 40px;
}

/* Quest shield overlays - match boat margins */
#quest-shield-overlay-top {
    margin-left: 40px;
}

#quest-shield-overlay-bottom {
    margin-right: 40px;
}

/* Rocking animations - each includes base rotation + subtle rocking */
@keyframes quest-boat-rock-top {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-1.5deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(1.5deg); }
}

@keyframes quest-boat-rock-bottom {
    0%, 100% { transform: rotate(180deg); }
    25% { transform: rotate(178.5deg); }
    50% { transform: rotate(180deg); }
    75% { transform: rotate(181.5deg); }
}

@keyframes quest-boat-rock-left {
    0%, 100% { transform: rotate(270deg); }
    25% { transform: rotate(268.5deg); }
    50% { transform: rotate(270deg); }
    75% { transform: rotate(271.5deg); }
}

@keyframes quest-boat-rock-right {
    0%, 100% { transform: rotate(90deg); }
    25% { transform: rotate(88.5deg); }
    50% { transform: rotate(90deg); }
    75% { transform: rotate(91.5deg); }
}

/* Quest shield overlay */
.quest-game-board .shield-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    font-size: 96px;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.quest-game-board .shield-overlay::before {
    content: '🛡️';
    filter: drop-shadow(0 0 20px rgba(46, 204, 113, 0.8))
            drop-shadow(0 0 35px rgba(46, 204, 113, 0.6));
}

.quest-game-board .shield-overlay.active {
    opacity: 1;
    animation: shield-pulse 3s linear infinite;
}

/* Quest Middle Row */
.quest-middle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    gap: 20px;
    position: relative;
}

/* Position side players absolutely so center stays centered */
.quest-middle-row .quest-player-area-left {
    position: absolute;
    left: 0;
}

.quest-middle-row .quest-player-area-right {
    position: absolute;
    right: 0;
}

/* Quest Center Area */
.quest-center-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex: 1;
}

/* Quest Kraken and Deck Row */
.quest-game-board .kraken-deck-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 60px;
}

.quest-game-board .kraken-meter-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.quest-game-board .kraken-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

#quest-kraken-image {
    max-width: 440px;
    max-height: 440px;
    width: auto;
    height: auto;
    display: block;
    image-rendering: auto;
    object-fit: contain;
    animation: kraken-rock 4s linear infinite;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Kraken attack animation */
.quest-game-board .kraken-container.attacking #quest-kraken-image {
    animation: kraken-attack 0.5s ease-in-out;
}

@keyframes kraken-rock {
    0%, 100% {
        transform: rotate(0deg) translateZ(0);
    }
    25% {
        transform: rotate(-1.5deg) translateZ(0);
    }
    50% {
        transform: rotate(0deg) translateZ(0);
    }
    75% {
        transform: rotate(1.5deg) translateZ(0);
    }
}

@keyframes kraken-attack {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); filter: drop-shadow(0 0 20px #DC143C); }
    100% { transform: scale(1); }
}

/* Quest Deck Area */
.quest-game-board .deck-area {
    display: flex;
    gap: 20px;
    align-items: center;
}

.quest-game-board .deck-display {
    display: none;
}

.quest-game-board .deck-display::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
}

.quest-game-board .deck-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 22px;
    font-weight: bold;
    color: #ffd700;
}

.quest-game-board .discard-display {
    width: 180px;
    height: 258px;
    background: rgba(255, 255, 255, 0.1);
    border: 4px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Quest Discard Card Styling */
.quest-game-board .discard-card {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 96px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
}

.quest-game-board .discard-card.card-image-container {
    background: transparent;
    padding: 0;
    overflow: hidden;
}

.quest-game-board .discard-card .card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.quest-game-board .discard-card.wild-card {
    background: linear-gradient(
        to right,
        #e74c3c 0% 25%,
        #2ecc71 25% 50%,
        #3498db 50% 75%,
        #f1c40f 75% 100%
    );
}

.quest-game-board .discard-card .wild-card-text {
    font-size: 32px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #ffffff;
    text-shadow:
        0 0 10px rgba(0, 0, 0, 0.9),
        2px 2px 4px rgba(0, 0, 0, 0.9),
        -2px -2px 4px rgba(0, 0, 0, 0.9);
}

.quest-game-board .discard-card .discard-label {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: bold;
    color: white;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 12px;
    border-radius: 4px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Quest Tension Meter */
.quest-game-board .tension-meter-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.quest-game-board .tension-label {
    display: none;
}

.quest-game-board .tension-meter {
    width: 280px;
    height: 16px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #DC143C;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 20px rgba(220, 20, 60, 0.3);
}

.quest-game-board .tension-meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8B0000 0%, #DC143C 50%, #FF0000 100%);
    transition: width 0.5s ease-out;
    position: relative;
    box-shadow: 0 0 15px rgba(220, 20, 60, 0.6);
}

.quest-game-board .tension-value {
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    text-align: right;
    min-width: 90px;
}

.quest-game-board .tension-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    width: 100%;
    align-self: stretch;
}

.quest-game-board .tension-multiplier {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    text-align: left;
    min-width: 50px;
}

/* Quest Player Bottom (Human) - with hand */
.quest-player-area-bottom {
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
}

.quest-player-area-bottom .boat-container {
    align-self: flex-end;
    margin-right: 10px;
}

.quest-hand {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

/* Curve Export Modal */
.curve-export-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10002;
}

.curve-export-overlay.active {
    display: flex;
}

.curve-export-box {
    background: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 100%);
    border: 3px solid #9C27B0;
    border-radius: 20px;
    padding: 30px 40px;
    max-width: 700px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 30px rgba(156, 39, 176, 0.5);
}

.curve-export-title {
    color: #CE93D8;
    font-size: 24px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(206, 147, 216, 0.5);
}

.curve-export-content {
    width: 100%;
    height: 400px;
    background: #0d0d1a;
    border: 2px solid #7B1FA2;
    border-radius: 10px;
    color: #4FC3F7;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 15px;
    resize: none;
    margin-bottom: 20px;
}

.curve-export-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.curve-export-btn {
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
    color: white;
    border: 2px solid #CE93D8;
    border-radius: 10px;
    padding: 12px 30px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.curve-export-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.5);
}

.curve-export-btn-close {
    background: linear-gradient(135deg, #424242 0%, #212121 100%);
    border-color: #757575;
}

.curve-export-btn-close:hover {
    box-shadow: 0 4px 15px rgba(66, 66, 66, 0.5);
}

.curve-editor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10001;
    pointer-events: auto;
    background: #000;
}

.curve-editor-controls {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 210;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
}

.curve-editor-controls select {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 4px;
    border: 2px solid #666;
    background: #333;
    color: white;
    cursor: pointer;
}

.curve-editor-controls button {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid;
}

#curve-export-btn {
    background: #4CAF50;
    border-color: #388E3C;
    color: white;
}

#curve-export-btn:hover {
    background: #66BB6A;
}

.curve-back-btn {
    background: #666;
    border-color: #888;
    color: white;
    padding: 8px 16px;
}

.curve-back-btn:hover {
    background: #888;
}

#curve-editor-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.curve-dot {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: grab;
    pointer-events: auto;
    z-index: 220;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    border: 3px solid white;
}

.curve-dot:active {
    cursor: grabbing;
}

.curve-dot-start {
    background: #4CAF50;
}

.curve-dot-control {
    background: #FF9800;
}

.curve-dot-control2 {
    background: #FFB74D;
}

.curve-dot-control2a,
.curve-dot-control2b {
    background: #FFEB3B;
    border-color: #FF9800;
}

.curve-dot-control3 {
    background: #FF9800;
}

.curve-dot-end {
    background: #f44336;
}

/* Quest card styles (same as controller but larger) */
.quest-hand .card {
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    min-height: 180px;
    width: 126px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.quest-hand .card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.quest-hand .card.playable {
    border: 3px solid #ffd700;
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.6);
}

/* Player info wrapper for bottom player with card peek */
.quest-game-board .player-info-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Card peek area - sits above player info, partially hidden */
.card-peek-area {
    display: flex;
    position: relative;
    z-index: 1;
    margin-bottom: -40px;
    justify-content: center;
}

.card-peek-slot {
    width: 126px;
    min-width: 126px;
    height: 180px;
    background: rgba(255, 255, 255, 0.15);
    border: 3px dashed rgba(255, 215, 0, 0.4);
    border-radius: 8px;
    margin-left: -48px; /* Overlap for fan effect */
    transition: transform 0.2s ease, z-index 0s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    cursor: pointer;
    transform-origin: bottom center;
}

/* Fan rotation - cards spread from center */
.card-peek-slot:nth-child(1) { z-index: 1; transform: rotate(-12deg); }
.card-peek-slot:nth-child(2) { z-index: 2; transform: rotate(-6deg); }
.card-peek-slot:nth-child(3) { z-index: 3; transform: rotate(0deg); }
.card-peek-slot:nth-child(4) { z-index: 4; transform: rotate(6deg); }
.card-peek-slot:nth-child(5) { z-index: 5; transform: rotate(12deg); }

/* Hover effect - card rises up and straightens */
.card-peek-slot:nth-child(1):hover { transform: translateY(-70px) rotate(-12deg); z-index: 10 !important; }
.card-peek-slot:nth-child(2):hover { transform: translateY(-70px) rotate(-6deg); z-index: 10 !important; }
.card-peek-slot:nth-child(3):hover { transform: translateY(-70px) rotate(0deg); z-index: 10 !important; }
.card-peek-slot:nth-child(4):hover { transform: translateY(-70px) rotate(6deg); z-index: 10 !important; }
.card-peek-slot:nth-child(5):hover { transform: translateY(-70px) rotate(12deg); z-index: 10 !important; }

.card-peek-slot:has(.peek-card) {
    background: transparent;
    border: none;
    box-shadow: none;
}

.card-peek-slot:first-child {
    margin-left: 0;
}

/* Peek card styling - matches multiplayer cards but larger */
.peek-card {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 3px solid #333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Playable card gold outline */
.peek-card.playable {
    border: 3px solid #ffd700 !important;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.3) !important;
}

.peek-card.playable.card-image-container {
    border: 3px solid #ffd700 !important;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.3) !important;
}

/* Card color backgrounds */
.peek-card.card-green {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    border-color: #1e8449;
}

.peek-card.card-blue {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-color: #1f618d;
}

.peek-card.card-red {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-color: #a93226;
}

.peek-card.card-yellow {
    background: linear-gradient(135deg, #f39c12 0%, #d68910 100%);
    border-color: #c27803;
}

.peek-card.card-black {
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    border-color: rgba(255, 255, 255, 0.3);
}

.peek-card .card-number {
    font-size: 56px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

.peek-card .card-damage {
    font-size: 56px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Card image container (for 5 cards with art) */
.peek-card.card-image-container {
    background: transparent !important;
    padding: 0 !important;
    overflow: hidden;
}

.peek-card .card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* Reverse card */
.peek-card.reverse-card {
    display: flex;
    align-items: center;
    justify-content: center;
}

.peek-card .reverse-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.peek-card .reverse-label {
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.peek-card .reverse-icon {
    font-size: 64px;
    color: white;
    line-height: 1;
}

/* Tension damage / Kraken card */
.peek-card.tension-damage-card {
    display: flex;
    align-items: center;
    justify-content: center;
}

.peek-card .tension-damage-text {
    text-align: center;
}

.peek-card .tension-damage-label {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 1px;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 3px 3px 6px rgba(0, 0, 0, 0.9);
    line-height: 1.2;
}

/* Player info needs higher z-index to cover bottom of cards */
.quest-game-board .player-info-wrapper .player-info {
    position: relative;
    z-index: 2;
    background: rgb(20, 20, 35); /* Opaque dark background */
}

/* Active turn highlight for bottom player uses same pseudo-element approach */
/* The ::before from .player-info.active-turn handles the highlight */

/* Quest ESC Menu Overlay */
.quest-esc-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.quest-esc-menu.active {
    display: flex;
}

.quest-esc-menu-box {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #ffd700;
    border-radius: 15px;
    padding: 40px 60px;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
}

.quest-esc-title {
    font-size: 48px;
    font-family: 'Pirata One', 'Old Claude LP', cursive;
    color: #ffd700;
    margin-bottom: 30px;
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.quest-esc-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.quest-esc-btn {
    padding: 15px 50px;
    font-size: 24px;
    font-weight: bold;
    font-family: 'Pirata One', 'Old Claude LP', cursive;
    border: 3px solid #ffd700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.quest-esc-btn:hover {
    transform: scale(1.05);
}

.quest-esc-btn:active {
    transform: scale(0.98);
}

.quest-esc-btn-resume {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
}

.quest-esc-btn-resume:hover {
    box-shadow: 0 0 25px rgba(46, 204, 113, 0.6);
}

.quest-esc-btn-menu {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    color: white;
}

.quest-esc-btn-menu:hover {
    box-shadow: 0 0 25px rgba(231, 76, 60, 0.6);
}

/* ========================================
   GAME END OVERLAYS (Victory/Defeat)
   ======================================== */

.game-end-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.game-end-overlay.visible {
    opacity: 1;
}

.game-end-message {
    text-align: center;
    animation: game-end-pop-in 0.6s ease-out forwards;
}

.game-end-icon {
    font-size: 100px;
    margin-bottom: 20px;
    animation: icon-bounce 1s infinite;
}

.game-end-title {
    font-size: 72px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 8px;
    margin-bottom: 15px;
    text-shadow: 0 0 30px currentColor;
}

.victory-title {
    color: #4ade80;
    text-shadow: 0 0 30px rgba(74, 222, 128, 0.8),
                 0 0 60px rgba(74, 222, 128, 0.5);
}

.defeat-title {
    color: #f87171;
    text-shadow: 0 0 30px rgba(248, 113, 113, 0.8),
                 0 0 60px rgba(248, 113, 113, 0.5);
}

.game-end-subtitle {
    font-size: 24px;
    color: #a0a0a0;
    margin-bottom: 40px;
    letter-spacing: 2px;
}

.btn-game-end {
    padding: 15px 50px;
    font-size: 24px;
    font-family: 'Old Claude LP', 'Arial', sans-serif;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #1a1a2e;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.btn-game-end:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.6);
}

.btn-game-end:active {
    transform: scale(0.98);
}

@keyframes game-end-pop-in {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Rewards display in game end overlays */
.game-end-rewards {
    margin: 20px 0 30px 0;
    padding: 25px 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    min-width: 500px;
}

.reward-row {
    display: flex;
    align-items: center;
    margin: 12px 0;
}

.reward-header {
    margin-bottom: 16px;
}

.reward-header .reward-col-xp,
.reward-header .reward-col-gold {
    font-size: 28px;
    font-weight: bold;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.reward-col-label {
    flex: 1;
    font-size: 32px;
    color: #d4d4d4;
    text-align: left;
    letter-spacing: 0.5px;
}

.reward-col-amount {
    width: 100px;
    text-align: right;
    font-size: 32px;
    color: #ffffff;
    font-weight: bold;
}

.reward-col-xp {
    width: 120px;
    text-align: right;
    font-size: 32px;
    color: #60a5fa;
    font-weight: bold;
}

.reward-col-gold {
    width: 120px;
    text-align: right;
    font-size: 32px;
    color: #ffd700;
    font-weight: bold;
}

.reward-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.5), transparent);
    margin: 16px 0;
}

.reward-total-row .reward-col-label {
    font-size: 36px;
    font-weight: bold;
    color: #ffffff;
}

.reward-total-row .reward-col-amount {
    font-size: 36px;
    color: #ffffff;
}

.reward-total-row .reward-col-xp {
    font-size: 36px;
    color: #60a5fa;
}

.reward-total-row .reward-col-gold {
    font-size: 36px;
    color: #ffd700;
}

/* ========================================
   TURN NOTIFICATION
   ======================================== */

.turn-notification {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    border: 2px solid #ffd700;
    font-size: 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.5);
    z-index: 20000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease-out;
}

.turn-notification.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ========================================
   QUEST MODE SETTINGS
   ======================================== */

.quest-settings-icon {
    position: fixed;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    color: rgba(255, 215, 0, 0.8);
    transition: all 0.2s ease;
}

.quest-settings-icon:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: #ffd700;
    color: #ffd700;
    transform: scale(1.05);
}

.quest-settings-icon:active {
    transform: scale(0.95);
}

.quest-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.quest-settings-overlay.active {
    display: flex;
}

.quest-settings-popup {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #ffd700;
    border-radius: 20px;
    width: 480px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.2);
    overflow: hidden;
}

.quest-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 30px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.quest-settings-header h3 {
    color: #ffd700;
    font-size: 30px;
    margin: 0;
    letter-spacing: 1px;
}

.quest-settings-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 42px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.quest-settings-close:hover {
    color: #ff6b6b;
}

.quest-settings-content {
    padding: 35px 30px;
}

.quest-settings-item {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.quest-settings-item label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 24px;
    font-weight: bold;
}

.quest-volume-control {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.quest-volume-control label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 24px;
    font-weight: bold;
}

.quest-volume-row {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.quest-volume-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quest-volume-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 21px;
    min-width: 30px;
    text-align: center;
}

.quest-volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    outline: none;
}

.quest-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s ease;
}

.quest-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.quest-volume-slider::-moz-range-thumb {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.quest-volume-value {
    text-align: center;
    color: #ffd700;
    font-size: 36px;
    font-weight: bold;
    margin-top: 10px;
}

/* ========================================
   BOAT FIRE AND SMOKE PARTICLES (Quest Mode)
   ======================================== */

.quest-game-board .boat-particles-container {
    position: absolute;
    /* Match the boat image dimensions in quest mode (132x226) */
    width: 132px;
    height: 226px;
    pointer-events: none;
    z-index: 10;
    /* Align with top-left of boat-container (same as boat image) */
    top: 0;
    left: 0;
}

.boat-fire-particle {
    position: absolute;
    width: 8px;
    height: 12px;
    background: radial-gradient(circle, #ff6600 0%, #ff3300 50%, #ff0000 100%);
    border-radius: 50% 50% 20% 20%;
    opacity: 0.8;
    filter: blur(1px);
    animation: boat-fire-flicker 0.3s infinite alternate;
}

.boat-smoke-particle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, rgba(80, 80, 80, 0.6) 0%, rgba(40, 40, 40, 0.3) 100%);
    border-radius: 50%;
    opacity: 0.4;
    animation: boat-smoke-rise 2s ease-out forwards;
}

@keyframes boat-fire-flicker {
    0% {
        transform: scaleY(0.8) translateY(0);
        opacity: 0.7;
    }
    100% {
        transform: scaleY(1.2) translateY(-3px);
        opacity: 0.9;
    }
}

@keyframes boat-smoke-rise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
    100% {
        transform: translateY(-40px) scale(2);
        opacity: 0;
    }
}

/* Different intensity levels */

/* Light damage (60-79% HP) - small wisps */
.boat-fire-particle.light {
    width: 8px;
    height: 12px;
}

.boat-smoke-particle.light {
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, rgba(100, 100, 100, 0.5) 0%, rgba(60, 60, 60, 0.2) 100%);
    opacity: 0.35;
}

/* Medium damage (35-59% HP) - moderate flames and darker smoke */
.boat-fire-particle.medium {
    width: 12px;
    height: 16px;
    animation-duration: 0.25s;
}

.boat-smoke-particle.medium {
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, rgba(60, 60, 60, 0.7) 0%, rgba(30, 30, 30, 0.4) 100%);
    opacity: 0.55;
    animation-duration: 1.8s;
}

/* Heavy damage (20-34% HP) - larger flames and thick dark smoke */
.boat-fire-particle.heavy {
    width: 16px;
    height: 20px;
    animation-duration: 0.2s;
    filter: blur(1.5px);
}

.boat-smoke-particle.heavy {
    width: 22px;
    height: 22px;
    background: radial-gradient(circle, rgba(40, 40, 40, 0.8) 0%, rgba(20, 20, 20, 0.5) 100%);
    opacity: 0.7;
    animation-duration: 1.5s;
    filter: blur(3px);
}

/* Critical damage (1-19% HP) - raging inferno and billowing black smoke */
.boat-fire-particle.critical {
    width: 20px;
    height: 26px;
    background: radial-gradient(circle, #ffcc00 0%, #ff6600 40%, #ff0000 100%);
    animation-duration: 0.15s;
    filter: blur(2px);
}

.boat-smoke-particle.critical {
    width: 28px;
    height: 28px;
    background: radial-gradient(circle, rgba(20, 20, 20, 0.9) 0%, rgba(0, 0, 0, 0.6) 100%);
    opacity: 0.85;
    animation-duration: 1.2s;
    filter: blur(4px);
}

/* Dev Mode Password Modal */
.dev-password-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.dev-password-overlay.active {
    display: flex;
}

.dev-password-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 12px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.dev-password-title {
    font-family: 'Old Claude LP', Arial, sans-serif;
    font-size: 24px;
    color: #ffd700;
    margin-bottom: 20px;
}

.dev-password-input {
    width: 200px;
    padding: 12px 15px;
    font-size: 24px;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    color: white;
    font-family: 'Old Claude LP', Arial, sans-serif;
    letter-spacing: 8px;
    outline: none;
}

.dev-password-input:focus {
    border-color: rgba(255, 215, 0, 0.7);
}

.dev-password-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.dev-password-btn {
    padding: 10px 25px;
    font-size: 16px;
    font-family: 'Old Claude LP', Arial, sans-serif;
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.dev-password-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.8);
}

.dev-password-submit {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}
