/**
 * The Lobotomy Ward - Phase Styles
 * Auction, claiming, card selection, surgery, dice, outcomes, special effects
 */

/* ================================
   AUCTION & CLAIMING STYLES
   ================================ */

/* Phase Popup Overlay */
.phase-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    animation: screenFadeIn 0.2s ease-out;
}

.phase-popup-container {
    max-width: 750px;
    width: 95%;
    max-height: 90vh;
    background: var(--color-bg-card);
    border: 2px solid var(--color-gold);
    border-radius: 8px;
    padding: var(--spacing-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.phase-popup-content {
    text-align: center;
}

.phase-popup-content h2 {
    color: var(--color-gold);
    font-family: var(--font-display);
    margin-bottom: var(--spacing-sm);
}

.phase-popup-content p {
    color: var(--color-text-dim);
    font-size: 0.9rem;
}

.phase-popup-hand {
    display: flex;
    gap: var(--spacing-sm);
    overflow-x: auto;
    padding: var(--spacing-sm);
    background: var(--color-bg-mid);
    border-radius: 6px;
    min-height: 120px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.phase-popup-hand:empty {
    display: none;
}

.phase-popup-controls {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
}

.phase-popup-controls button {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-gold);
    color: var(--color-text-dark);
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.phase-popup-controls button:hover:not(:disabled) {
    background: var(--color-yellow-bright);
    transform: translateY(-1px);
}

.phase-popup-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.phase-popup-controls button.danger {
    background: var(--color-danger);
    color: var(--color-text);
}

.phase-popup-controls button.danger:hover {
    background: var(--color-red-bright);
}

.auction-current-lunatic {
    display: flex;
    justify-content: center;
    margin: var(--spacing-md) 0;
}

/* Claiming UI */
.lunatic-card.claimed,
.ward-card-wrapper.claimed .lunatic-card {
    border: 3px solid var(--color-gold);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
}

/* Claim Markers (game piece SVGs on ward cards) */
.claim-markers {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    min-height: 22px;
    padding: 2px 0;
    align-items: center;
}

/* Player piece SVG (meeple, castle, shield, flag, crown) */
.player-piece {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.claim-button {
    width: 100%;
    padding: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    background: var(--color-gold-dim);
    color: var(--color-text);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    transition: background 0.2s, transform 0.1s;
}

.claim-button:hover:not(:disabled) {
    background: var(--color-gold);
    transform: translateY(-1px);
}

.claim-button:active:not(:disabled) {
    transform: translateY(0);
}

.claim-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: var(--color-bg-mid);
    color: var(--color-text-dim);
    transform: none;
}

.claim-button:disabled:hover {
    transform: none;
    background: var(--color-bg-mid);
}

/* Pulse animation on human's turn */
.claim-button.pulse {
    animation: claimPulse 1.5s ease-in-out infinite;
}

@keyframes claimPulse {
    0%, 100% { transform: scale(1); box-shadow: none; }
    50% { transform: scale(1.03); box-shadow: 0 0 8px rgba(212, 175, 55, 0.4); }
}

/* Flying claim piece (animated from sidebar to ward card) */
.claim-piece-flying {
    position: fixed;
    z-index: 1000;
    transition: left 0.6s cubic-bezier(0.2, 0.8, 0.3, 1),
                top 0.6s cubic-bezier(0.2, 0.8, 0.3, 1);
    pointer-events: none;
}

/* Ward card glow when receiving a claim piece */
.lunatic-card.claim-landing {
    animation: claimLand 0.3s ease-out;
}

@keyframes claimLand {
    0% { box-shadow: 0 0 0 rgba(212, 175, 55, 0); }
    50% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.6); }
    100% { box-shadow: none; }
}

/* Pass button (replaces Done Claiming) */
.pass-claim-button {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-bg-mid);
    color: var(--color-text-dim);
    border: 1px solid var(--color-text-dim);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.2s;
}

.pass-claim-button:hover:not(:disabled) {
    background: var(--color-bg-card);
    color: var(--color-text);
    border-color: var(--color-gold);
}

.pass-claim-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.help-button {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-gold);
    color: var(--color-text-dark);
    border: 1px solid var(--color-gold);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s;
}

.help-button:hover {
    background: #e6c347;
    color: var(--color-text-dark);
    border-color: #e6c347;
}

/* Card Selection */
.treatment-card {
    position: relative;
}

.treatment-card.selected {
    border: 3px solid var(--color-success);
    transform: translateY(-8px);
    box-shadow: 0 6px 12px rgba(74, 124, 79, 0.4);
}

.check-mark {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--color-success);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.card-selection-header {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.card-selection-header h2 {
    color: var(--color-gold);
    margin-bottom: var(--spacing-xs);
}

.card-selection-header p {
    color: var(--color-text-dim);
    font-size: 0.95rem;
}

.selection-info {
    text-align: center;
    font-size: 1rem;
    color: var(--color-gold);
    margin: var(--spacing-md) 0;
    font-weight: bold;
}

.selection-warning {
    text-align: center;
    font-size: 0.85rem;
    color: #ff6b6b;
    margin-bottom: var(--spacing-sm);
}

.confirm-commit-button {
    width: 100%;
    padding: var(--spacing-lg);
    background: var(--color-success);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.2s;
}

.confirm-commit-button:hover:not(:disabled) {
    background: var(--color-green-bright);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.confirm-commit-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--color-bg-mid);
}

.abandon-claim-button {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: transparent;
    color: var(--color-text-dim);
    border: 1px solid var(--color-text-dim);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.abandon-claim-button:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
    background: rgba(139, 38, 53, 0.15);
}

/* Auction Status */
.auction-status {
    margin: var(--spacing-lg) 0;
}

.auction-status h3 {
    color: var(--color-gold);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-sm);
}

.bidder {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    margin: var(--spacing-xs) 0;
    background: var(--color-bg-mid);
    border-radius: 4px;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.bidder.active {
    border: 2px solid var(--color-gold);
    background: var(--color-bg-card);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.bidder-name {
    font-weight: bold;
}

.bid-amount {
    color: var(--color-gold);
    font-weight: bold;
}

/* Winner Announcement */
.winner-announcement {
    text-align: center;
    padding: var(--spacing-lg) 0;
    animation: winnerScaleUp 0.5s ease-out forwards;
}

.winner-name {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: var(--color-gold);
    margin-bottom: var(--spacing-xs);
    text-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}

.winner-label {
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
}

.winner-detail {
    font-size: 0.9rem;
    color: var(--color-text-dim);
}

@keyframes winnerScaleUp {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    60% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Bid Actions */
.bid-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    flex-wrap: wrap;
}

.bid-action-button {
    flex: 1;
    min-width: 120px;
    padding: var(--spacing-md);
    background: var(--color-gold-dim);
    color: var(--color-text);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.bid-action-button:hover {
    background: var(--color-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.bid-action-button:active {
    transform: translateY(0);
}

.bid-action-button.danger {
    background: var(--color-danger);
}

.bid-action-button.danger:hover {
    background: #c94f5f;
}

/* Waiting Message */
.waiting-message {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--color-text-dim);
    font-style: italic;
    font-size: 1.1rem;
}

/* ============================================
   SURGERY PHASE STYLES
   ============================================ */

/* Surgery Container */
.surgery-container {
    background: var(--color-bg-card);
    border: 2px solid var(--color-gold);
    border-radius: 8px;
    padding: var(--spacing-lg);
}

.surgery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-gold-dim);
}

.surgery-header h2 {
    margin: 0;
    color: var(--color-gold);
}

.surgery-progress {
    color: var(--color-text-dim);
    font-size: 0.9rem;
}

/* Surgery Patient Display */
.surgery-patient {
    display: flex;
    justify-content: center;
    margin: var(--spacing-lg) 0;
}

.surgery-patient-small {
    text-align: center;
    margin: var(--spacing-md) 0;
}

.surgery-patient-small .patient-name {
    font-size: 1.2rem;
    color: var(--color-gold);
    font-weight: bold;
}

/* Surgery Requirements */
.surgery-requirements {
    text-align: center;
    margin: var(--spacing-md) 0;
}

.surgery-requirements h3 {
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
}

.requirement-dots {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.requirement-dot.matched {
    background: var(--color-success) !important;
    box-shadow: 0 0 8px var(--color-success);
    border-color: var(--color-green-bright);
}

/* Committed Cards Display */
.surgery-committed-cards {
    margin: var(--spacing-lg) 0;
}

.surgery-committed-cards h3 {
    text-align: center;
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: var(--spacing-md);
}

.cards-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-sm);
}

.committed-card {
    animation: cardReveal 0.3s ease-out;
    animation-fill-mode: backwards;
}

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

/* Dice Container */
.dice-container {
    text-align: center;
    padding: var(--spacing-xl);
    background: var(--color-bg-mid);
    border-radius: 8px;
    margin: var(--spacing-lg) 0;
}

.dice-header {
    font-size: 1.2rem;
    color: var(--color-gold);
    margin-bottom: var(--spacing-sm);
    font-weight: bold;
}

.dice-bonus-note {
    font-size: 0.85rem;
    color: #a78bfa;
    margin-bottom: var(--spacing-md);
    font-style: italic;
}

.dice-dropped {
    margin-top: var(--spacing-sm);
    font-size: 0.8rem;
    color: var(--color-text-dim);
}

.die-inline {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
    opacity: 0.5;
}

.die-inline.success {
    background: var(--color-success);
    color: white;
}

.die-inline.failure {
    background: var(--color-danger);
    color: white;
}

.dice-results {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    margin-top: var(--spacing-md);
}

.die {
    width: 60px;
    height: 60px;
    background: var(--color-bg-card);
    border: 3px solid var(--color-gold);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    animation: diceRoll 0.5s ease-out;
    animation-fill-mode: backwards;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.die.success {
    background: var(--color-success);
    color: white;
    border-color: var(--color-green-bright);
    box-shadow: 0 0 12px var(--color-success);
}

.die.failure {
    background: var(--color-danger);
    color: white;
    border-color: #c94f5f;
    box-shadow: 0 0 12px var(--color-danger);
}

@keyframes diceRoll {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        transform: scale(1.2) rotate(180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(360deg);
    }
}

.all-matched {
    margin-top: var(--spacing-lg);
    color: var(--color-success);
    font-size: 1.1rem;
    font-weight: bold;
}

/* Surgery Outcome */
.surgery-outcome {
    text-align: center;
    padding: var(--spacing-xl);
    border-radius: 8px;
    margin: var(--spacing-lg) 0;
}

.surgery-outcome.cured {
    background: linear-gradient(135deg, var(--color-bg-card), rgba(76, 175, 80, 0.2));
    border: 2px solid var(--color-success);
}

.surgery-outcome.dead {
    background: linear-gradient(135deg, var(--color-bg-card), rgba(244, 67, 54, 0.2));
    border: 2px solid var(--color-danger);
}

.outcome-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    animation: outcomeReveal 0.5s ease-out;
}

.surgery-outcome.cured .outcome-icon {
    color: var(--color-green-bright);
}

.surgery-outcome.dead .outcome-icon {
    color: #c94f5f;
}

@keyframes outcomeReveal {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.outcome-text {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-gold);
    margin-bottom: var(--spacing-md);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.outcome-summary {
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: var(--spacing-lg);
}

.outcome-details {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-gold-dim);
    font-size: 0.9rem;
    color: var(--color-text-dim);
}

.outcome-details div {
    margin: var(--spacing-xs) 0;
}

.instant-death {
    color: var(--color-danger);
    font-weight: bold;
    font-style: italic;
    margin-top: var(--spacing-sm);
    font-size: 0.9rem;
}

/* Continue Button */
.continue-button {
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--color-gold);
    color: var(--color-text-dark);
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: var(--spacing-lg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.continue-button:hover {
    background: var(--color-yellow-bright);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.continue-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Special Card Effects */
.special-card-effect {
    background: linear-gradient(135deg, var(--color-wild), var(--color-bg-card));
    border: 2px solid var(--color-gold);
    border-radius: 8px;
    padding: var(--spacing-lg);
    text-align: center;
    margin: var(--spacing-lg) 0;
    animation: specialPulse 0.5s ease-out;
}

@keyframes specialPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px var(--color-gold);
    }
}

.special-icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.special-text {
    font-size: 1.2rem;
    color: var(--color-gold);
    font-weight: bold;
}

/* Lobotomy Card Styling */
.treatment-card.lobotomy-card {
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.6);
}

.treatment-card.lobotomy-card .treatment-card-special {
    color: #e8e4f0;
}

/* Surgery outcome — lobotomized state */
.surgery-outcome.lobotomized {
    background: linear-gradient(135deg, var(--color-bg-card), rgba(184, 134, 11, 0.2));
    border: 2px solid #b8860b;
}

.surgery-outcome.lobotomized .outcome-icon {
    color: #b8860b;
    font-size: 2.5rem;
}

.surgery-outcome.lobotomized .outcome-text {
    color: #b8860b;
}

.lobotomy-detail {
    font-size: 0.85rem;
    color: var(--color-text-dim);
    font-style: italic;
    margin-top: var(--spacing-xs);
}
