/* style-base.css - VMO Board Game: Base Styles & Common Components */

/* --- 基本設定 --- */
body {
    margin: 0;
    padding: 0;
    font-family: 'Zen Kaku Gothic New', sans-serif;
    background-color: #000000;
    color: #ffffff;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none;
}

#mobile-frame {
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 100%;
    background-color: #020617;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(30, 58, 138, 0.3);
    border: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
}

/* 走査線エフェクト */
.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0) 50%,
        rgba(0, 0, 0, 0.1) 50%,
        rgba(0, 0, 0, 0.1)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 999;
    opacity: 0.3;
}

#game-root {
    width: 100%;
    height: 100%;
    position: relative;
    transform-origin: center center;
    perspective: 1200px;
}

/* --- 各画面共通レイアウト --- */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
    z-index: 10;
    position: absolute;
    top: 0;
    left: 0;
    background-color: #020617;
    overflow: hidden;
}

.screen.active {
    display: flex;
}

/* --- 共通コンポーネント: 入力・ボタン --- */
.input-container {
    width: 100%;
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-family: 'Teko', sans-serif;
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 5px;
}

.input-common,
#player-name {
    width: 100%;
    padding: 10px;
    background-color: rgba(30, 41, 59, 0.4);
    border: 1px solid #334155;
    border-radius: 4px;
    color: #f1f5f9;
    font-family: 'Teko', sans-serif;
    font-size: 1.4rem;
    text-align: center;
    letter-spacing: 0.1em;
    outline: none;
    box-sizing: border-box;
}

.input-common:focus,
#player-name:focus {
    border-color: #60a5fa;
    background-color: rgba(30, 41, 59, 0.8);
}

.btn-menu {
    width: 100%;
    padding: 12px;
    font-family: 'Teko', sans-serif;
    font-size: 1.3rem;
    letter-spacing: 0.1em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: white;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.btn-menu:active {
    transform: scale(0.98);
}

.btn-menu:disabled {
    background: #1e293b;
    color: #475569;
    cursor: not-allowed;
    border: 1px solid #334155;
    filter: grayscale(100%);
}

.btn-blue { background: linear-gradient(to right, #1d4ed8, #3b82f6); }
.btn-purple { background: linear-gradient(to right, #7e22ce, #a855f7); }
.btn-red { background: linear-gradient(to right, #b91c1c, #ef4444); }
.btn-gray { background: #1e293b; color: #94a3b8; border: 1px solid #334155; }

.btn-text {
    background: none;
    border: none;
    color: #64748b;
    font-family: 'Teko', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    padding: 10px;
}

.version-info {
    margin-top: auto;
    font-family: 'Teko', sans-serif;
    font-size: 0.8rem;
    color: #334155;
}

/* --- 共通コンポーネント: モーダル --- */
#modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    justify-content: center;
    
    align-items: flex-start; /* 上揃え */
    padding-top: 50px;       /* 【変更】15vh -> 50px (ノッチを避けつつ限界まで上げる) */
    
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}

#modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    width: 85%;
    max-width: 360px;
    background: #0f172a;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s;
}

#modal-overlay.active .modal-box { transform: scale(1); }

#modal-title {
    font-family: 'Teko', sans-serif;
    font-size: 2.2rem;
    margin: 0 0 10px 0;
    color: #fff;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

#modal-body {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    color: #cbd5e1;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-wrap;
}

/* --- ローディング画面 --- */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #020617; /* 背景色 */
    z-index: 9999; /* 最前面に表示 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

#loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fbbf24; /* 黄色 */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    font-family: 'Teko', sans-serif;
    color: #fbbf24;
    font-size: 1.5rem;
    letter-spacing: 0.1em;
    animation: pulseText 1.5s infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}