/* CYBER REFLEX - Styles */
/* --- 全体設定 --- */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

body {
    margin: 0;
    background-color: #050505;
    color: #00ffcc;
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-image: url('assets/wireframe-blue-cyber.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.scan-line {
    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: 10;
}

h1 {
    font-size: 4rem;
    text-shadow: 0 0 10px #00ffcc, 0 0 20px #00ffcc;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.btn {
    background: rgba(0, 255, 204, 0.1);
    border: 2px solid #00ffcc;
    color: #00ffcc;
    padding: 15px 40px;
    font-size: 1.5rem;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.3);
    margin-top: 20px;
}

.btn:hover {
    background: #00ffcc;
    color: #000;
    box-shadow: 0 0 20px #00ffcc;
}

.btn-online {
    background: rgba(255, 0, 255, 0.1);
    border: 2px solid #ff00ff;
    color: #ff00ff;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}

.btn-online:hover {
    background: #ff00ff;
    color: #000;
    box-shadow: 0 0 20px #ff00ff;
}

.btn-back {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #888;
    color: #888;
    padding: 10px 30px;
    font-size: 1rem;
}

.btn-back:hover {
    background: #888;
    color: #000;
}

.btn-small {
    background: rgba(255, 0, 85, 0.1);
    border: 1px solid #ff0055;
    color: #ff0055;
    padding: 8px 20px;
    font-size: 0.8rem;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    margin-top: 15px;
}
.btn-small:hover {
    background: #ff0055;
    color: #fff;
    box-shadow: 0 0 10px #ff0055;
}

.hidden { display: none !important; }

/* --- 画面コンテナ --- */
.screen {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: absolute; top: 0; left: 0;
}

/* --- ランキング --- */
#ranking-board {
    margin-top: 30px; text-align: left;
    border: 1px solid #ff00ff; padding: 20px;
    background: rgba(20, 0, 20, 0.8);
    box-shadow: 0 0 15px #ff00ff;
    width: 60%; max-width: 600px;
}
#ranking-board h2 { color: #ff00ff; text-align: center; margin-top: 0; }
.rank-item {
    display: flex; justify-content: space-between;
    align-items: center;
    font-size: 1.2rem; border-bottom: 1px solid rgba(255, 0, 255, 0.3);
    padding: 5px 0;
    gap: 10px;
}
.rank-item span:first-child {
    min-width: 50px;
}
.rank-name {
    flex: 1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rank-item span:last-child {
    min-width: 120px;
    text-align: right;
}

/* --- ゲーム画面 UI --- */
#hud {
    position: absolute; top: 20px; width: 90%;
    display: flex; justify-content: space-between;
    align-items: center;
    font-size: 1.5rem; z-index: 5;
}
.score-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}
.score-box {
    border: 1px solid #00aaff; padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    min-width: 150px; text-align: center;
    color: #00aaff;
}
.diamond-display {
    font-size: 1.8rem;
    letter-spacing: 5px;
    text-shadow: 0 0 10px currentColor;
}
#p1-diamonds { color: #00aaff; }
#p2-diamonds { color: #ff00ff; }
#p2-score { border-color: #ff00ff; color: #ff00ff; }
#round-info { border-color: #00ffcc; color: #00ffcc; }

/* --- ログ表示エリア --- */
.log-container {
    position: absolute;
    top: 150px;
    width: 200px;
    height: 400px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid;
    padding: 10px;
    overflow-y: auto;
    z-index: 4;
}
.log-container h3 {
    margin-top: 0;
    text-align: center;
    border-bottom: 1px solid;
    padding-bottom: 5px;
    font-size: 1.2rem;
}
.log-list {
    font-size: 1rem;
    margin-top: 10px;
}
.log-entry {
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

#p1-log-box {
    left: 5%;
    border-color: #00aaff;
    box-shadow: 0 0 10px rgba(0, 170, 255, 0.2);
}
#p1-log-box h3 { border-color: #00aaff; color: #00aaff; }

#p2-log-box {
    right: 5%;
    border-color: #ff00ff;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.2);
}
#p2-log-box h3 { border-color: #ff00ff; color: #ff00ff; }

/* --- 照準と敵 --- */
#center-reticle {
    position: absolute; width: 40px; height: 40px;
    border: 2px solid rgba(0, 255, 204, 0.5);
    border-radius: 50%; z-index: 4;
    display: flex; justify-content: center; align-items: center;
}
#center-reticle::after {
    content: ''; width: 4px; height: 4px;
    background: #00ffcc; border-radius: 50%;
}

#enemy-target {
    position: absolute; width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(255,0,85,0.2) 20%, transparent 20%),
                radial-gradient(circle, transparent 60%, rgba(255,0,85,0.5) 65%, transparent 70%);
    border: 2px solid #ff0055;
    box-shadow: 0 0 30px #ff0055, inset 0 0 20px #ff0055;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    z-index: 3;
    animation: pulse 0.2s infinite alternate;
}
#enemy-target::before {
    content: 'TARGET ACQUIRED'; color: #ff0055;
    font-weight: bold; font-size: 1rem; position: absolute;
    top: -30px; text-shadow: 0 0 5px #000, 0 0 10px #ff0055;
    white-space: nowrap;
}

.cyber-soldier {
    position: absolute; width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 1; opacity: 0.9;
    filter: drop-shadow(0 0 10px #00ffcc);
}
.cyber-soldier .head {
    width: 50px; height: 50px; background: #0a2a2a;
    border: 2px solid #00ffcc; border-radius: 10px;
    position: relative; margin-bottom: -5px;
}
.cyber-soldier .head::after {
    content: ''; position: absolute; top: 15px; left: 5px;
    width: 38px; height: 12px; background: #ff0055;
    box-shadow: 0 0 15px #ff0055;
}
.cyber-soldier .body {
    width: 80px; height: 100px;
    background: linear-gradient(135deg, #0a2a2a, #000);
    border: 2px solid #00ffcc;
    clip-path: polygon(10% 0%, 90% 0%, 100% 20%, 85% 100%, 15% 100%, 0% 20%);
    position: relative;
}
.cyber-soldier .arm-gun {
    position: absolute; top: 50%; left: 60%;
    width: 100px; height: 25px; background: #0a2a2a;
    border: 2px solid #00ffcc;
    transform: rotate(-15deg); transform-origin: left center;
}
.cyber-soldier .arm-gun::before {
    content: ''; position: absolute; right: -10px; top: -8px;
    width: 15px; height: 35px; background: #ff0055;
    box-shadow: 0 0 20px #ff0055;
}

@keyframes pulse {
    from { transform: scale(1); opacity: 0.8; }
    to { transform: scale(1.05); opacity: 1; }
}

/* --- メッセージエリア --- */
#status-message {
    position: absolute;
    top: 40%; width: 100%;
    text-align: center;
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 0 0 10px black;
    z-index: 6;
    pointer-events: none;
    white-space: pre-wrap;
    line-height: 1.5;
}

.warning { color: #ffff00; text-shadow: 0 0 10px #ffaa00, 0 0 20px #ffaa00; }
.danger { color: #ff0055; text-shadow: 0 0 20px #ff0000, 0 0 30px #ff0000; }
.success { color: #00ffcc; text-shadow: 0 0 20px #00ffcc; }

.result-text-small { font-size: 2.5rem; color: #ccc; }
.result-winner { font-size: 4rem; color: #00ffcc; animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

#new-record-msg {
    color: #ffff00;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-shadow: 0 0 20px #ffff00;
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#flash {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: white; opacity: 0; pointer-events: none;
    z-index: 20; transition: opacity 0.1s;
}

/* --- 紙吹雪エフェクト --- */
#confetti-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 15;
    overflow: hidden;
}
.confetti {
    position: absolute; top: -10px;
    width: 6px; height: 6px;
    background-color: #00aaff; 
    opacity: 0.8; border-radius: 50%;
    animation: fall linear forwards;
}
.p1-win-theme .confetti { background-color: #00aaff; }
.p2-win-theme .confetti { background-color: #ff00ff; }

@keyframes fall {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 1; }
    100% {
        transform: translateY(110vh) translateX(calc(-50px + 100px * var(--random-x))) rotate(calc(360deg * var(--random-r)));
        opacity: 0;
    }
}

/* --- 名前入力画面 --- */
#name-input-screen h1 {
    color: #ffff00;
    text-shadow: 0 0 20px #ffff00;
    font-size: 2rem;
    margin-bottom: 10px;
}
#record-info {
    text-align: center;
    margin: 20px 0 30px 0;
}
.record-rank {
    font-size: 2rem;
    color: #ffff00;
    text-shadow: 0 0 15px #ffff00;
    margin-bottom: 10px;
}
.record-rank span {
    font-size: 2.5rem;
}
.record-time {
    font-size: 2rem;
    color: #00ffcc;
    text-shadow: 0 0 10px #00ffcc;
}
.record-time span {
    font-size: 4rem;
    font-weight: bold;
}
#name-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
#name-input-container label {
    font-size: 1.5rem;
    color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff;
}
#player-name-input, .room-input {
    width: 350px;
    padding: 15px 20px;
    font-size: 1.5rem;
    font-family: 'Orbitron', sans-serif;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #ff00ff;
    color: #fff;
    text-align: center;
    outline: none;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}
#player-name-input:focus, .room-input:focus {
    border-color: #00ffcc;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.5);
}
#player-name-input::placeholder, .room-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* --- オンライン関連 --- */
.mode-buttons {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.room-id-display {
    font-size: 5rem;
    color: #00ffcc;
    text-shadow: 0 0 20px #00ffcc;
    letter-spacing: 20px;
    margin: 30px 0;
    font-weight: bold;
}

.waiting-text {
    font-size: 1.5rem;
    color: #ff00ff;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    z-index: 100;
}
.status-connected {
    background: rgba(0, 255, 100, 0.2);
    border: 1px solid #00ff66;
    color: #00ff66;
}
.status-disconnected {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid #ff0000;
    color: #ff0000;
}

.player-role {
    font-size: 1.2rem;
    margin-bottom: 10px;
}
.role-host { color: #00aaff; }
.role-guest { color: #ff00ff; }

/* --- オンライン待機メッセージ --- */
.online-wait-msg {
    font-size: 2rem;
    color: #ffff00;
    text-shadow: 0 0 15px #ffaa00;
    animation: blink 1s infinite;
}

/* --- チュートリアル画面 --- */
#tutorial-screen {
    background: rgba(0, 0, 0, 0.95);
    z-index: 50;
}

.tutorial-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.tutorial-image {
    max-width: 95%;
    max-height: 85vh;
    object-fit: contain;
    border: 2px solid #00ffcc;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.4);
    border-radius: 5px;
}

.btn-tutorial-ok {
    margin-top: 15px;
    padding: 8px 40px;
    font-size: 0.9rem;
    background: rgba(0, 255, 204, 0.1);
    border: 1px solid #00ffcc;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.3);
}

.btn-tutorial-ok:hover {
    background: #00ffcc;
    color: #000;
    box-shadow: 0 0 15px #00ffcc;
}
