/*#####################################################################*/
/* トレカジミニゲーム共通CSS
/*#####################################################################*/

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f0f0f0;
    /* Light background for the page */
}

#error-overlay.hidden,
#loading-overlay.hidden {
    display: none !important;
}

#error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Semi-transparent black */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    /* Subtle blur */
}

#error-overlay .error-modal {
    background-color: #ffffff;
    color: #333333;
    padding: 5%;
    /* Responsive padding */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 85%;
    /* Fits well on iPhone SE (375 * 0.85 = ~318px) */
    max-width: 500px;
    /* Cap size on desktop so it doesn't get huge */
    aspect-ratio: 1.5;
    /* Fixed Aspect Ratio (3:2) as requested */
    border: none;

    /* Flex layout to center content within the fixed ratio box */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Removed .error-title and .error-message */

#error-overlay .error-main {
    font-size: clamp(1rem, 5vw, 1.5rem);
    /* Scales with width */
    font-weight: bold;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: #333;
}

#error-overlay .error-sub {
    font-size: clamp(0.75rem, 3.5vw, 1rem);
    /* Scales with width */
    color: #666;
    margin-bottom: 8%;
    /* Relative margin */
    line-height: 1.4;
    max-width: 90%;
}

#error-overlay .text-red {
    color: #e74c3c !important;
}

#error-overlay .modal-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 3% 8%;
    /* Responsive padding */
    font-size: clamp(0.875rem, 4vw, 1.125rem);
    font-weight: 500;
    border-radius: 100px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

#error-overlay .modal-button:hover {
    background-color: #0056b3;
}

#error-overlay .modal-button:active {
    transform: scale(0.98);
}

#error-overlay .button-icon {
    display: block;
    width: 1.2em;
    /* Scale with font size */
    height: 1.2em;
}



#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: overlay-fade-in 0.3s ease-out;
}

#loading-overlay.fade-out {
    animation: overlay-fade-out 0.25s ease-in forwards;
}

#loading-overlay .loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* ===== Circular Spinner (8 dots) ===== */

#loading-overlay .spinner {
    position: relative;
    width: 48px;
    height: 48px;
    animation: spinner-rotate 1.2s linear infinite;
}

#loading-overlay .dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}

/* Position each dot around the circle (radius = 20px from center) */
#loading-overlay .dot:nth-child(1) {
    top: 0;
    left: 20px;
    animation: dot-fade 1.2s 0.00s ease-in-out infinite;
}

#loading-overlay .dot:nth-child(2) {
    top: 3px;
    left: 34px;
    animation: dot-fade 1.2s -0.15s ease-in-out infinite;
}

#loading-overlay .dot:nth-child(3) {
    top: 20px;
    left: 40px;
    animation: dot-fade 1.2s -0.30s ease-in-out infinite;
}

#loading-overlay .dot:nth-child(4) {
    top: 34px;
    left: 34px;
    animation: dot-fade 1.2s -0.45s ease-in-out infinite;
}

#loading-overlay .dot:nth-child(5) {
    top: 40px;
    left: 20px;
    animation: dot-fade 1.2s -0.60s ease-in-out infinite;
}

#loading-overlay .dot:nth-child(6) {
    top: 34px;
    left: 3px;
    animation: dot-fade 1.2s -0.75s ease-in-out infinite;
}

#loading-overlay .dot:nth-child(7) {
    top: 20px;
    left: 0;
    animation: dot-fade 1.2s -0.90s ease-in-out infinite;
}

#loading-overlay .dot:nth-child(8) {
    top: 3px;
    left: 3px;
    animation: dot-fade 1.2s -1.05s ease-in-out infinite;
}

/* ===== Loading Text ===== */

#loading-overlay .loading-text {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(0.78rem, 3.2vw, 0.9rem);
    font-weight: 500;
    letter-spacing: 0.04em;
}

/* ===== Keyframes ===== */

@keyframes spinner-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes dot-fade {

    0%,
    40%,
    100% {
        opacity: 0.15;
        transform: scale(0.7);
    }

    20% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes overlay-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes overlay-fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}