/* ---------------------------------
    1. Set Up
   --------------------------------- */
* {
    box-sizing: border-box; 
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    text-align: center;     
    background: #121212; /* 背景画像がない場合のフォールバック */
    background-image: url('/common/img_ranaclype.webp');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
    color: #ffffff;            
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    overflow-x: hidden;
    user-select: none;
}

/* アプリ全体を包むコンテナ */
.app-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.ui-container {
    width: min(1280px, 95vw);
    position: relative;
}

/* ---------------------------------
    2. Title Area
   --------------------------------- */
.title-area h1 {
    font-size: 1.25rem;     
    font-weight: bold;      
    letter-spacing: 4px;    
    padding: 10px 0;        
    background-color: rgba(0, 20, 10, 0.85); 
    color: #00ffcc; 
    border-radius: 9999px;    
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.6); 
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 
                inset 0 0 15px rgba(0, 255, 204, 0.2); 
    border: 1px solid #00bfa5; 
}

/* ---------------------------------
    3. Status Area
   --------------------------------- */
.status-area {
    display: grid;
    grid-template-columns: 1fr auto; 
    align-items: center; 
    gap: 12px;
    margin: 14px 0;
}

.status-info {
    font-size: clamp(0.85rem, 3.5vw, 1rem);
    font-weight: bold;
    color: #e0e0e0;
    text-align: left; 
    padding-left: 8px;
    white-space: pre-line;  
    line-height: 1.5;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 1px;
}

.btn-group {
    display: flex;
    gap: 8px; 
    align-items: center; 
}

/* ---------------------------------
    4. Button
   --------------------------------- */
.reset-btn, .manual-btn, .size-btn, .bgm-btn {
    width: 105px;           
    padding: 8px 0;        
    font-size: 0.85rem;        
    font-weight: bold;      
    border: none; 
    border-radius: 9999px;    
    cursor: pointer;        
    display: inline-block;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s, text-shadow 0.2s;
}

.reset-btn:active, .manual-btn:active, .size-btn:active, .bgm-btn:active {
    transform: scale(0.95);
}

.reset-btn { 
    background-color: rgba(211, 47, 47, 0.2); 
    border: 1px solid #ff8a80; 
    color: #ff8a80; 
    text-shadow: 0 0 5px rgba(255, 138, 128, 0.6);
    box-shadow: 0 0 10px rgba(255, 138, 128, 0.3), inset 0 0 5px rgba(255, 138, 128, 0.2);
}
.reset-btn:hover { 
    background-color: #b71c1c; 
    color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 138, 128, 0.8); 
}

.manual-btn {
    background-color: rgba(26, 115, 232, 0.2); 
    border: 1px solid #4fc3f7; 
    color: #4fc3f7; 
    text-shadow: 0 0 5px rgba(79, 195, 247, 0.6);
    box-shadow: 0 0 10px rgba(79, 195, 247, 0.3), inset 0 0 5px rgba(79, 195, 247, 0.2);
}
.manual-btn:hover {
    background-color: #1557b0; 
    color: #ffffff;
    box-shadow: 0 0 20px rgba(79, 195, 247, 0.8); 
}

.size-btn {
    background-color: rgba(0, 191, 165, 0.15); 
    border: 1px solid #00ffcc; 
    color: #00ffcc; 
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.6);
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.3), inset 0 0 5px rgba(0, 255, 204, 0.2);
}
.size-btn:hover {
    background-color: #00796b; 
    color: #ffffff;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.8); 
}

.bgm-btn {
    background-color: rgba(255, 145, 0, 0.2); 
    border: 1px solid #ff9100; 
    color: #ff9100; 
    text-shadow: 0 0 5px rgba(255, 145, 0, 0.6);
    box-shadow: 0 0 10px rgba(255, 145, 0, 0.3), inset 0 0 5px rgba(255, 145, 0, 0.2);
}
.bgm-btn:hover {
    background-color: #ff9100; 
    color: #ffffff; 
    box-shadow: 0 0 20px rgba(255, 145, 0, 0.8); 
}

/* ---------------------------------
    5. Field Area
   --------------------------------- */
.field-area {
    position: relative;
    width: min(1280px, 95vw);
    height: auto;            
    aspect-ratio: 16 / 9; 
    margin: 0 auto;
    border-radius: 12px;    
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.9); 
    border: 5px solid #37474f; 
    overflow: hidden; 
}

.bg-layer, .fx-layer, .core-layer, .card-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Layer 1: bg */
.bg-layer {
    z-index: 1;
    background-color: #0d1117; /* 深いダークグレー */
}

/* Layer 2: fx */
canvas.fx-layer {
    z-index: 2;
    pointer-events: none;
    display: block;
}

/* Layer 3: core */
canvas.core-layer {
    z-index: 3;
    pointer-events: auto; 
    display: block;
    background-color: rgba(0, 20, 40, 0.2); /* ほんのり青みがかった透明 */
}

/* ---------------------------------
    6. Layer 4: card
   --------------------------------- */
.card-layer {
    position: absolute;
    z-index: 4;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    background: rgba(0, 15, 10, 0.9); 
    border: 2px solid #00ffcc; 
    padding: 30px; 
    border-radius: 8px;
    box-shadow: inset 0 0 30px rgba(0, 255, 204, 0.3), 
                0 0 40px rgba(0, 0, 0, 0.8);
    opacity: 0;
    pointer-events: none; 
    transform: translate(-50%, -50%) scale(0.8);    
    transition: opacity 0.3s ease, 
                transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* JSからこのクラスが付与されるとバウンドして出現 */
.card-layer.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.content-card {
    width: 100%;
}

.title-card {
    font-size: 1.3rem;
    font-weight: bold;
    color: #00ffcc;
    border-bottom: 2px dashed rgba(0, 255, 204, 0.4); 
    padding-bottom: 12px;
    margin-bottom: 20px;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    text-align: left;
    text-shadow: 0 0 8px rgba(0, 255, 204, 0.5);
}

.line-card {
    font-size: 0.9rem; 
    color: #a7ffeb;
    margin: 14px 0; 
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.6;
    text-align: left;
}

.powered-card {
    font-size: 0.7rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    color: rgba(0, 255, 204, 0.4); 
    text-align: right;
    margin-top: 24px;
    text-transform: uppercase; 
}

/* スキャンラインエフェクト */
.scanline-card {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%);
    background-size: 100% 4px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0.4;
}