/* ============================================
   UI Overlays — オーバーレイ・モーダル
   ============================================ */

/* Verifying Overlay */
.verifying-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.verifying-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    text-align: center;
}

.verifying-text {
    font-family: 'Orbitron', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.2em;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(0, 172, 193, 0.4);
    animation: blink 2s infinite;
}


/* --- Hint Modal --- */
.hint-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}

.hint-modal-overlay.active {
    display: flex;
}

.hint-modal {
    background: rgba(10, 25, 40, 0.95);
    border: 1px solid var(--green-neon);
    border-radius: 16px;
    padding: 28px 32px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 0 40px rgba(0, 172, 193, 0.3);
}

.hint-modal-title {
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--green-neon);
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 0.1em;
    text-shadow: 0 0 10px var(--green-glow-strong);
}

.hint-modal-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.hint-modal-buttons button {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.hint-btn-confirm {
    background: linear-gradient(135deg, #00acc1, #00838f);
    color: #fff;
    border-color: var(--green-neon) !important;
    box-shadow: 0 0 15px var(--green-glow);
}

.hint-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--green-glow-strong);
}

.hint-btn-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.hint-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.hint-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.hint-ticket-display {
    text-align: center;
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: #b0bec5;
}

.hint-ticket-count {
    color: var(--green-neon);
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 0 8px var(--green-glow);
}

.hint-notes {
    font-size: 0.78rem;
    color: #78909c;
    line-height: 1.6;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 14px;
}

.hint-notes p {
    margin-bottom: 6px;
}

/* Clear Screen (Result Screen) */
#clear-screen {
    background: rgba(5, 15, 25, 0.95);
    backdrop-filter: blur(10px);
}

.clear-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    width: 90%;
    max-width: 480px;
    background: rgba(10, 20, 40, 0.8);
    border: 1px solid var(--green-neon);
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 10px 40px rgba(0, 255, 65, 0.15);
}



.clear-info {
    text-align: center;
}

.clear-title {
    font-family: var(--font-title);
    font-size: 2.5rem;
    font-weight: 900;
    color: transparent;
    -webkit-text-stroke: 1.5px var(--green-neon);
    text-shadow: 0 0 15px var(--green-glow);
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.clear-time {
    font-size: 1.15rem;
    color: #e0faff;
    font-weight: bold;
}

.clear-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.permanent-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
}

.permanent-group .control-btn {
    padding: 12px 20px;
    font-size: 1.05rem;
}

.common-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.common-grid .control-btn, 
.common-grid .hint-btn {
    padding: 12px 10px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* SNS Share Button (Neon Purple) */
.control-btn.-sns {
    border-color: #d500f9 !important;
    color: #d500f9 !important;
}

.control-btn.-sns:hover {
    background: rgba(213, 0, 249, 0.1) !important;
    box-shadow: 0 0 15px rgba(213, 0, 249, 0.4) !important;
    color: #ea80fc !important;
}

/* Solution Hint Button Overrides */
.hint-btn.-solution {
    border-color: #00bcd4 !important;
    color: #00bcd4 !important;
}

.hint-btn.-solution:hover {
    background: rgba(0, 188, 212, 0.15) !important;
    box-shadow: 0 0 15px rgba(0, 188, 212, 0.4) !important;
    color: #84ffff !important;
}

/* --- Ad Overlay (Simulated) --- */
.ad-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    z-index: 5000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-title);
}

.ad-overlay.active {
    display: flex;
}

.ad-content {
    text-align: center;
    max-width: 300px;
}

.ad-title {
    font-size: 1.40rem;
    color: var(--green-neon);
    margin-bottom: 30px;
    letter-spacing: 0.1em;
    text-shadow: 0 0 15px var(--green-glow-strong);
}

.ad-progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 20px;
}

.ad-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00acc1, var(--green-neon));
    box-shadow: 0 0 10px var(--green-neon);
}

.ad-overlay.active .ad-progress-bar {
    animation: ad-progress 3s linear forwards;
}

@keyframes ad-progress {
    from { width: 0%; }
    to { width: 100%; }
}

.ad-status {
    font-size: 0.85rem;
    color: #78909c;
    animation: blink 1.5s infinite;
}

/* ============================================
   Loading & Sudoku Loader
   ============================================ */

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

/* 3x3 Sudoku Loader Animation */
.sudoku-loader {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Mini version */
.sudoku-loader.-mini {
    grid-template-columns: repeat(3, 20px);
    grid-template-rows: repeat(3, 20px);
    gap: 2px;
    padding: 4px;
    box-shadow: none;
    background: transparent;
}

.sudoku-loader .cell {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.sudoku-loader.-mini .cell {
    width: 20px;
    height: 20px;
}

/* Micro version (for buttons or small slots) */
.sudoku-loader.-micro {
    grid-template-columns: repeat(3, 12px);
    grid-template-rows: repeat(3, 12px);
    gap: 1px;
    padding: 2px;
    box-shadow: none;
    background: transparent;
}

.sudoku-loader.-micro .cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.sudoku-loader .p1, 
.sudoku-loader .p2, 
.sudoku-loader .p3 {
    position: absolute;
    inset: 0;
    opacity: 0;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.4);
    border-radius: 2px;
}

.sudoku-loader.-mini .p1, 
.sudoku-loader.-mini .p2, 
.sudoku-loader.-mini .p3 {
    box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.4);
}


/* Colors */
.sudoku-loader .p1 { background: #03a9f4; animation: fill-p1 3s infinite; }
.sudoku-loader .p2 { background: #4caf50; animation: fill-p2 3s infinite; }
.sudoku-loader .p3 { background: #ff9800; animation: fill-p3 3s infinite; }

@keyframes fill-p1 {
    0%, 10% { opacity: 0; }
    15%, 85% { opacity: 1; box-shadow: 0 0 12px #03a9f4; }
    90%, 100% { opacity: 0; }
}

@keyframes fill-p2 {
    0%, 35% { opacity: 0; }
    40%, 85% { opacity: 1; box-shadow: 0 0 12px #4caf50; }
    90%, 100% { opacity: 0; }
}

@keyframes fill-p3 {
    0%, 60% { opacity: 0; }
    65%, 85% { opacity: 1; box-shadow: 0 0 12px #ff9800; }
    90%, 100% { opacity: 0; }
}

/* Grid Cell Positions */
.sudoku-loader .c1 { grid-area: 1 / 1; }
.sudoku-loader .c2 { grid-area: 1 / 2; }
.sudoku-loader .c3 { grid-area: 1 / 3; }
.sudoku-loader .c4 { grid-area: 2 / 1; }
.sudoku-loader .c5 { grid-area: 2 / 2; }
.sudoku-loader .c6 { grid-area: 2 / 3; }
.sudoku-loader .c7 { grid-area: 3 / 1; }
.sudoku-loader .c8 { grid-area: 3 / 2; }
.sudoku-loader .c9 { grid-area: 3 / 3; }

#loading-screen {
    background: var(--bg-primary);
    z-index: 9999;
}

/* ============================================
   Collapse Warning Modal (崩壊アナウンス)
   ============================================ */
.collapse-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 5, 5, 0.9);
    backdrop-filter: blur(8px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.collapse-modal {
    background: linear-gradient(145deg, #1a0505, #000000);
    border: 2px solid #ff1744;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 30px rgba(255, 23, 68, 0.4), inset 0 0 20px rgba(255, 23, 68, 0.1);
    text-align: center;
    animation: shakeAlert 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.collapse-title {
    font-family: 'Orbitron', 'Noto Sans JP', sans-serif;
    color: #ff5252;
    font-size: 1.5rem;
    font-weight: 900;
    margin-top: 0;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 82, 82, 0.6);
    letter-spacing: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.collapse-icon {
    font-size: 3rem;
    animation: blinkWarning 1s infinite;
}

.collapse-message {
    color: #ffcdd2;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
    font-weight: bold;
}

.collapse-btn-close {
    background: #d50000;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(213, 0, 0, 0.4);
    transition: all 0.2s;
    width: 100%;
}

.collapse-btn-close:hover {
    background: #ff1744;
    box-shadow: 0 6px 20px rgba(255, 23, 68, 0.6);
    transform: translateY(-2px);
}

@keyframes shakeAlert {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

@keyframes blinkWarning {
    0%, 100% { opacity: 1; text-shadow: 0 0 20px red; }
    50% { opacity: 0.5; text-shadow: none; }
}

/* ============================================
   System Modal (汎用システムダイアログ)
   ============================================ */
.system-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(5, 10, 15, 0.85);
    backdrop-filter: blur(5px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.system-modal-overlay.fade-out {
    animation: fadeOut 0.2s ease-in forwards;
}

.system-modal {
    background: linear-gradient(135deg, rgba(10, 20, 35, 0.95), rgba(5, 10, 15, 0.95));
    border: 1px solid var(--blue-neon);
    border-radius: 4px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.2), inset 0 0 10px rgba(0, 229, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.system-modal-header {
    background: rgba(0, 229, 255, 0.25);
    border-bottom: 1px solid rgba(0, 229, 255, 0.5);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.system-modal-icon {
    color: #ffffff;
    font-weight: bold;
    font-family: 'Orbitron', monospace;
    animation: blink 1.5s infinite;
}

.system-modal-title {
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

.system-modal-body {
    padding: 25px 20px;
    color: #e0e0e0;
    font-size: 1rem;
    line-height: 1.6;
}

.system-modal-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.system-modal-footer.two-buttons {
    justify-content: space-between;
}

.system-btn {
    font-family: 'Orbitron', 'Noto Sans JP', sans-serif;
    font-weight: bold;
    padding: 10px 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.system-btn-primary {
    background: rgba(0, 229, 255, 0.35);
    border: 1px solid rgba(0, 229, 255, 0.8);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
    text-shadow: 0 0 5px rgba(0, 229, 255, 0.5);
}

.system-btn-primary:hover {
    background: rgba(0, 229, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
}

.system-btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #aaa;
}

.system-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #fff;
    color: #fff;
}

/* ============================================
   Admin Share Section (管理者専用公式コピーツール)
   ============================================ */
.admin-share-section {
    width: 100%;
    margin-top: 15px;
    padding: 16px 20px;
    background: rgba(255, 61, 0, 0.08); /* 赤・オレンジ色の管理カラー */
    border: 1px dashed #ff3d00;
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(255, 61, 0, 0.1);
    box-sizing: border-box;
}

.admin-share-title {
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: bold;
    color: #ff6d00;
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.admin-share-buttons {
    display: flex;
    gap: 10px;
}

.admin-copy-btn {
    flex: 1;
    padding: 10px 8px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    background: rgba(255, 61, 0, 0.15);
    border: 1px solid #ff3d00;
    color: #ff9e80;
    border-radius: 6px;
    transition: all 0.2s;
    text-align: center;
}

.admin-copy-btn:hover {
    background: #ff3d00;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 61, 0, 0.4);
}
