/* Ash Excavation Minigame Styles */
.ash-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: ash-fade-in 0.3s ease;
}

@keyframes ash-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ash-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

.ash-container {
    width: 90vw;
    max-width: 420px;
    background: linear-gradient(180deg, #1a1612 0%, #0f0d0a 100%);
    border: 1px solid rgba(212, 160, 23, 0.25);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 40px rgba(212, 160, 23, 0.05);
}

.ash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ash-title {
    font-size: 15px;
    color: #d4c5a0;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.ash-progress {
    font-size: 11px;
    color: rgba(212, 197, 160, 0.6);
    background: rgba(212, 160, 23, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(212, 160, 23, 0.2);
}

.ash-close-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: rgba(212, 197, 160, 0.5);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.ash-close-btn:hover {
    color: #d4c5a0;
}

.ash-canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: #2a2520;
    background-image:
        radial-gradient(circle at 30% 40%, #3a342c 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, #332e26 0%, transparent 50%),
        linear-gradient(180deg, #2a2520 0%, #1e1a16 100%);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
    touch-action: none;
}

.ash-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.ash-fragment {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.ash-fragment.revealed {
    opacity: 1;
}

.ash-fragment-paper {
    background: #8b7355;
    background-image:
        linear-gradient(135deg, #9a8266 0%, #7a6347 50%, #8b7355 100%);
    border: 1px solid #5a4830;
    border-radius: 2px;
    padding: 6px 8px;
    font-size: 10px;
    line-height: 1.4;
    color: #3a2a10;
    font-family: 'Georgia', serif;
    transform: rotate(var(--rot, 0deg));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    text-shadow: 0 0 0.5px rgba(58, 42, 16, 0.5);
    max-width: 140px;
    word-break: break-all;
}

.ash-fragment-paper::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, transparent 40%, rgba(60, 40, 20, 0.15) 70%),
        radial-gradient(circle at 80% 70%, transparent 30%, rgba(40, 30, 15, 0.2) 60%);
    pointer-events: none;
    border-radius: 2px;
}

.ash-hint {
    text-align: center;
    font-size: 11px;
    color: rgba(212, 197, 160, 0.45);
    margin-top: 10px;
    min-height: 16px;
    transition: color 0.3s;
}

.ash-hint.active {
    color: rgba(212, 197, 160, 0.7);
}

.ash-discovery {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 16, 10, 0.95);
    border: 1px solid rgba(212, 160, 23, 0.4);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 12px;
    color: #d4c5a0;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    max-width: 80%;
}

.ash-discovery.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
}

.ash-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}

.ash-btn {
    padding: 8px 20px;
    border: 1px solid rgba(212, 160, 23, 0.3);
    background: rgba(212, 160, 23, 0.08);
    color: #d4c5a0;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.ash-btn:hover {
    background: rgba(212, 160, 23, 0.15);
    border-color: rgba(212, 160, 23, 0.5);
}

.ash-btn:active {
    transform: scale(0.96);
}

.ash-btn-primary {
    background: rgba(212, 160, 23, 0.2);
    border-color: rgba(212, 160, 23, 0.5);
}

.ash-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ash-result {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: rgba(212, 160, 23, 0.05);
    border: 1px solid rgba(212, 160, 23, 0.15);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.6;
    color: #d4c5a0;
    text-align: justify;
}

.ash-result.show {
    display: block;
    animation: ash-fade-in 0.5s ease;
}

.ash-result-title {
    font-weight: 600;
    color: #e4d5b0;
    margin-bottom: 6px;
    font-size: 13px;
}

/* Small screens */
@media (max-width: 380px) {
    .ash-container {
        padding: 12px;
    }
    .ash-title {
        font-size: 13px;
    }
    .ash-fragment-paper {
        font-size: 9px;
        padding: 4px 6px;
        max-width: 110px;
    }
}
