/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Game Container */
.game-container {
    display: grid;
    grid-template-columns: 350px 1fr 480px;
    column-gap: 30px;
    row-gap: 30px;
    align-items: start;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-left: -55px;
}

.panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.panel h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #667eea;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.card-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-panel .cards-container {
    flex: 1;
    overflow-y: auto;
    max-height: 800px;
}

.active-spells-panel {
    width: 100%;
    margin-top: 10px;
}

.active-spells-panel h2 {
    font-size: 1.1rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-artifact {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    color: white;
    margin-bottom: 10px;
}

.btn-artifact:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Status Info */
.status-info {
    margin-bottom: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.status-item:last-child {
    border-bottom: none;
}

.status-item .label {
    font-weight: 600;
    color: #666;
}

.status-item .value {
    color: #333;
    font-weight: 500;
}

/* Mana Display */
.mana-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 10px 12px !important;
    border: none !important;
    color: white;
    align-items: center;
    gap: 8px;
}

.mana-display .label,
.mana-display .value {
    color: white !important;
    font-weight: 600;
}

.mana-icon {
    width: 24px;
    height: 24px;
    margin-right: 4px;
    vertical-align: middle;
}

.mana-icon-fallback {
    font-size: 20px;
    margin-right: 4px;
    vertical-align: middle;
}

.artifact-indicator {
    margin-left: 6px;
    font-size: 16px;
    cursor: default;
    vertical-align: middle;
}

/* Message Box */
.message-box {
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
    font-weight: 500;
    display: none;
}

.message-box.success {
    background: #d1fae5;
    color: #065f46;
    display: block;
}

.message-box.error {
    background: #fee2e2;
    color: #991b1b;
    display: block;
}

.message-box.info {
    background: #dbeafe;
    color: #1e40af;
    display: block;
}

/* Move History */
.move-history {
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
}

.move-pair {
    display: grid;
    grid-template-columns: 40px 1fr 1fr;
    gap: 10px;
    padding: 6px;
    border-bottom: 1px solid #f0f0f0;
}

.move-number {
    font-weight: bold;
    color: #667eea;
}

.move {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.move:hover {
    background: #f0f0f0;
}

/* Board Container */
.board-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
    min-width: 660px;
    max-width: 660px;
}

/* Chessboard */
.chessboard {
    flex-shrink: 0;
}

/* Board wrapper with coordinates */
.board-wrapper {
    display: flex;
    flex-direction: column;
}

/* Rank labels (1-8) on the left side */
.rank-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 600px;
    padding-right: 8px;
}

.coord-label {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rank-label {
    height: 75px;
}

/* Board grid (the actual 8x8 squares) */
.board-grid {
    display: grid;
    grid-template-columns: repeat(8, 75px);
    grid-template-rows: repeat(8, 75px);
    width: 600px;
    height: 600px;
    border: 3px solid #333;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* File labels container (a-h at bottom) */
.file-labels-container {
    display: flex;
    flex-direction: row;
}

.corner-space {
    width: 22px; /* Match rank labels width + padding */
}

.file-labels {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    width: 600px;
    padding-top: 8px;
}

.file-label {
    width: 75px;
}

/* Update board wrapper to be horizontal */
.board-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

.square {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    position: relative;
}

.square.light {
    background-color: #f0d9b5;
}

.square.dark {
    background-color: #b58863;
}

.square.selected {
    background-color: #baca44 !important;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.square.legal-move {
    position: relative;
}

.square.legal-move::after {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
}

.square.legal-move.has-piece::after {
    width: 90%;
    height: 90%;
    background-color: transparent;
    border: 4px solid rgba(255, 0, 0, 0.5);
    border-radius: 50%;
}

.square.cannon-target {
    position: relative;
}

.square.cannon-target::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 50%;
    background-color: rgba(255, 100, 0, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 69, 0, 0.6);
}

.square.cannon-target.has-piece::after {
    width: 90%;
    height: 90%;
    background-color: transparent;
    border: 4px solid rgba(255, 69, 0, 0.7);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
}

.square.last-move {
    background-color: rgba(39, 186, 245, 0.4) !important;
}

.square.pre-move {
    background-color: rgba(255, 76, 76, 0.25) !important;
}

.square.in-check {
    background-color: rgba(255, 0, 0, 0.6) !important;
    box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.5);
}

.square.best-move-from {
    background-color: rgba(168, 85, 247, 0.5) !important;
    box-shadow: inset 0 0 15px rgba(168, 85, 247, 0.7);
}

.square.best-move-to {
    background-color: rgba(168, 85, 247, 0.7) !important;
    box-shadow: inset 0 0 20px rgba(168, 85, 247, 0.9);
    animation: pulse-best-move 1s ease-in-out infinite;
}

@keyframes pulse-best-move {
    0%, 100% { box-shadow: inset 0 0 20px rgba(168, 85, 247, 0.9); }
    50% { box-shadow: inset 0 0 30px rgba(168, 85, 247, 1); }
}

.square.explosion {
    background-color: rgba(255, 69, 0, 0.8) !important;
    box-shadow: inset 0 0 30px rgba(255, 100, 0, 0.9), 0 0 20px rgba(255, 69, 0, 0.6);
    animation: explode 0.6s ease-out;
}

@keyframes explode {
    0% {
        background-color: rgba(255, 255, 0, 1);
        box-shadow: inset 0 0 50px rgba(255, 200, 0, 1), 0 0 40px rgba(255, 150, 0, 1);
    }
    50% {
        background-color: rgba(255, 100, 0, 0.95);
        box-shadow: inset 0 0 40px rgba(255, 100, 0, 1), 0 0 30px rgba(255, 69, 0, 0.8);
    }
    100% {
        background-color: rgba(255, 69, 0, 0.8);
        box-shadow: inset 0 0 30px rgba(255, 100, 0, 0.9), 0 0 20px rgba(255, 69, 0, 0.6);
    }
}

.square:hover {
    opacity: 0.9;
}

/* Captured Pieces Bar */
.captured-pieces-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    margin-bottom: 8px;
    min-height: 36px;
    height: 36px;
    gap: 4px;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.captured-pieces-bar:last-of-type {
    margin-bottom: 0;
    margin-top: 8px;
}

.captured-piece {
    font-size: 20px;
    line-height: 1;
    opacity: 0.7;
}

.material-advantage {
    margin-left: auto;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(76, 175, 80, 0.15);
    color: #2e7d32;
    font-size: 0.9rem;
}

/* Chess Pieces (Images) */
.piece {
    width: 100%;
    height: 100%;
    cursor: grab;
    transition: transform 0.1s;
    pointer-events: none;
    user-select: none;
}

.piece[data-piece="P"] {
    width: 90%;
    height: 90%;
}

.square:active .piece {
    cursor: grabbing;
    transform: scale(1.05);
}

/* Animated piece movement */
.piece-animation {
    position: absolute;
    z-index: 100;
    pointer-events: none;
    transition: transform 200ms ease-out;
}

/* Mirage pieces (illusory copies) */
.piece.mirage {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
    z-index: 10;
}

/* Freeze Ray overlay */
.frozen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    background-color: rgba(70, 130, 220, 0.4);
}

/* Poisoned pawn overlay */
.poison-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    background-color: rgba(50, 180, 50, 0.3);
}

/* Sinkhole overlay */
.sinkhole-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.sinkhole-overlay img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1;
}

/* Promotion Dialog */
.promotion-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.promotion-dialog.hidden {
    display: none;
}

.promotion-dialog h3 {
    margin-bottom: 20px;
    text-align: center;
    color: #667eea;
}

.promotion-pieces {
    display: flex;
    gap: 15px;
}

.promotion-btn {
    width: 80px;
    height: 80px;
    border: 2px solid #667eea;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.promotion-btn:hover {
    background: #f0f0f0;
    border-color: #5568d3;
    transform: scale(1.05);
}

.promotion-btn img {
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 1500px) {
    .game-container {
        grid-template-columns: 300px 1fr 440px;
    }

    .board-container {
        min-width: 580px;
        max-width: 580px;
    }

    .board-grid {
        grid-template-columns: repeat(8, 65px);
        grid-template-rows: repeat(8, 65px);
        width: 520px;
        height: 520px;
    }

    .rank-labels {
        height: 520px;
    }

    .rank-label {
        height: 65px;
    }

    .file-labels {
        width: 520px;
    }

    .file-label {
        width: 65px;
    }
}

@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .sidebar-right {
        order: -1;
    }

    .board-container {
        min-width: auto;
        max-width: 680px;
    }

    .board-grid {
        grid-template-columns: repeat(8, 75px);
        grid-template-rows: repeat(8, 75px);
        width: 600px;
        height: 600px;
    }

    .rank-labels {
        height: 600px;
    }

    .rank-label {
        height: 75px;
    }

    .file-labels {
        width: 600px;
    }

    .file-label {
        width: 75px;
    }

    .square {
        font-size: 3rem;
    }

    .cards-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .board-grid {
        grid-template-columns: repeat(8, 50px);
        grid-template-rows: repeat(8, 50px);
        width: 400px;
        height: 400px;
    }

    .rank-labels {
        height: 400px;
    }

    .rank-label {
        height: 50px;
    }

    .file-labels {
        width: 400px;
    }

    .file-label {
        width: 50px;
    }

    .coord-label {
        font-size: 12px;
    }

    .square {
        font-size: 2.5rem;
    }

    header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .board-grid {
        grid-template-columns: repeat(8, 40px);
        grid-template-rows: repeat(8, 40px);
        width: 320px;
        height: 320px;
    }

    .rank-labels {
        height: 320px;
    }

    .rank-label {
        height: 40px;
    }

    .file-labels {
        width: 320px;
    }

    .file-label {
        width: 40px;
    }

    .coord-label {
        font-size: 10px;
    }

    .square {
        font-size: 2rem;
    }

    body {
        padding: 10px;
    }
}

/* Cards Container */
.cards-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.card {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 0;
    width: 200px;
    height: 280px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    color: white;
    border: 3px solid #d4af37;
    position: relative;
    overflow: hidden;
}

/* Rarity-based borders and glows */
.card[data-rarity="common"] {
    border-color: #9e9e9e;
}

.card[data-rarity="rare"] {
    border-color: #2196f3;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 15px rgba(33, 150, 243, 0.4);
}

.card[data-rarity="rare"]:hover {
    box-shadow: 0 12px 24px rgba(33, 150, 243, 0.5), 0 0 25px rgba(33, 150, 243, 0.6);
}

.card[data-rarity="epic"] {
    border-color: #9c27b0;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 15px rgba(156, 39, 176, 0.4);
}

.card[data-rarity="epic"]:hover {
    box-shadow: 0 12px 24px rgba(156, 39, 176, 0.5), 0 0 25px rgba(156, 39, 176, 0.6);
}

.card[data-rarity="legendary"] {
    border-color: #ffd700;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.5);
    animation: legendary-pulse 2s ease-in-out infinite;
}

.card[data-rarity="legendary"]:hover {
    box-shadow: 0 12px 24px rgba(255, 215, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.7);
}

/* Sealed card (Evil Eye of Kismet) - full image, no text */
.card.card-sealed {
    padding: 0;
    border: 3px solid #1e90ff;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(30, 144, 255, 0.5);
    animation: sealed-pulse 2s ease-in-out infinite;
}

.card.card-sealed:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(30, 144, 255, 0.6), 0 0 30px rgba(30, 144, 255, 0.7);
}

.card-sealed-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 9px;
}

.card-sealed-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    background: linear-gradient(135deg, #1a237e, #0d47a1);
}

@keyframes sealed-pulse {
    0%, 100% { box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(30, 144, 255, 0.5); }
    50% { box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 30px rgba(30, 144, 255, 0.7); }
}

@keyframes legendary-pulse {
    0%, 100% {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 30px rgba(255, 215, 0, 0.7);
    }
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(212, 175, 55, 0) 50%);
    pointer-events: none;
    z-index: 1;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(212, 175, 55, 0.4), 0 0 20px rgba(212, 175, 55, 0.3);
    border-color: #ffd700;
}

.card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.5);
}

.card.card-disabled {
    opacity: 0.6;
    cursor: default;
    pointer-events: none;
    filter: grayscale(0.3);
}

.card.card-selectable {
    border: 2px solid #4caf50;
    cursor: pointer;
    animation: selectable-glow 1.5s ease-in-out infinite;
}

.card.card-selectable:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 12px 24px rgba(76, 175, 80, 0.6), 0 0 25px rgba(76, 175, 80, 0.5);
    border-color: #66bb6a;
}

@keyframes selectable-glow {
    0%, 100% {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 10px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(76, 175, 80, 0.6);
    }
}

/* Mana Cost Display on Cards */
.card-mana-cost {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    max-width: 60px;
}

.mana-cost-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.mana-cost-fallback {
    font-size: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    display: inline-block;
}

.card-art {
    width: 100%;
    height: 70%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    overflow: hidden;
}

.card-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    position: relative;
    z-index: 0;
}

/* Unique card art backgrounds based on card type */
.card[data-card-id="backswing"] .card-art {
    background: linear-gradient(135deg, #16a085 0%, #1abc9c 100%);
}

.card[data-card-id="blitz_strike"] .card-art {
    background: linear-gradient(135deg, #ff6f00 0%, #ffab00 100%);
}

.card[data-card-id="royal_reach"] .card-art {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
}

.card[data-card-id="queen_on_horse"] .card-art {
    background: linear-gradient(135deg, #8e44ad 0%, #c39bd3 100%);
}

.card[data-card-id="bait"] .card-art {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.card[data-card-id="terrible_advice"] .card-art {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.card[data-card-id="concussion"] .card-art {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.card[data-card-id="bastille_day"] .card-art {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}

.card[data-card-id="c4"] .card-art {
    background: linear-gradient(135deg, #ff4500 0%, #8b0000 100%);
}

.card[data-card-id="poisoned_pawn"] .card-art {
    background: linear-gradient(135deg, #27ae60 0%, #16a085 100%);
}

.card[data-card-id="apocalypse"] .card-art {
    background: linear-gradient(135deg, #8b0000 0%, #2c0000 100%);
}

.card[data-card-id="meteor_strike"] .card-art {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
}

.card[data-card-id="steamroll"] .card-art {
    background: linear-gradient(135deg, #607d8b 0%, #455a64 100%);
}

.card[data-card-id="cavalry_rampage"] .card-art {
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
}

.card[data-card-id="false_truce"] .card-art {
    background: linear-gradient(135deg, #546e7a 0%, #37474f 100%);
}

.card[data-card-id="portcullis_malfunction"] .card-art {
    background: linear-gradient(135deg, #5d4037 0%, #3e2723 100%);
}

.card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.card-name {
    font-size: 1.0rem;
    font-weight: bold;
    margin-bottom: 4px;
    color: #d4af37;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.2px;
    text-align: center;
    line-height: 1.2;
}

/* Rarity-based name colors */
.card[data-rarity="common"] .card-name {
    color: #b0b0b0 !important;  /* Light gray */
}

.card[data-rarity="rare"] .card-name {
    color: #ffffff !important;  /* White */
}

.card[data-rarity="epic"] .card-name {
    color: #f0a0b0 !important;  /* Light pink */
}

.card[data-rarity="legendary"] .card-name {
    color: #ffd700 !important;  /* Gold */
}

/* Mana cards always have blue names */
.card[data-card-type="mana_temp"] .card-name,
.card[data-card-type="mana_permanent"] .card-name {
    color: #4da6ff !important;  /* Blue */
}

.card-description {
    font-size: 0.6rem;
    line-height: 1.3;
    color: #ffffff;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.active-spells {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
}

.active-spell {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.85rem;
    margin: 3px;
}

.active-spell.temporary {
    background: #fef3c7;
    color: #92400e;
}

.active-spell.persistent {
    background: #d1fae5;
    color: #065f46;
}

.active-spell.triggered {
    background: #fecaca;
    color: #991b1b;
}

/* Loading State */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-box {
    animation: slideIn 0.3s ease-out;
}

/* Scry Modal */
.scry-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.scry-modal.hidden {
    display: none;
}

.scry-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 90%;
}

.scry-modal-content h3 {
    color: #fff;
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    text-align: center;
}

.scry-instructions {
    color: #a0a0ff;
    text-align: center;
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.scry-cards-container {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    justify-content: center;
    align-items: flex-start;
}

.scry-card-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.scry-card-label {
    color: #a0a0ff;
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    min-height: 30px;
}

.scry-card-item {
    width: 160px;
    height: 224px;
    cursor: move;
    transition: all 0.2s ease;
}

.scry-card-item:hover {
    transform: translateY(-5px);
}

.scry-card-item.dragging {
    opacity: 0.5;
}

.scry-card-item.drag-over {
    transform: scale(1.05);
}

.scry-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.scry-modal-buttons .btn {
    padding: 10px 20px;
    font-size: 1rem;
}
