@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&family=Rajdhani:wght@500;700&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1f4068 100%);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-highlight: rgba(255, 255, 255, 0.2);
    --accent-color: #00d2ff; /* 爽やかな水色 */
    --text-main: #ffffff;
    --text-sub: #b0c4de;
}

body {
    margin: 0; padding: 0;
    font-family: 'Poppins', sans-serif;
    color: var(--text-main);
    background: #0f0f1a;
    overflow: hidden; /* アプリっぽくスクロール禁止 */
    height: 100vh;
}

/* 背景 */
.background-gradient {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-gradient);
    z-index: -2;
}
/* 粒子っぽい装飾（オプション） */
.background-particles {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.3; z-index: -1;
}

/* ヘッダー (Glassmorphism) */
.glass-header {
    position: fixed; top: 0; left: 0; width: 100%; height: 60px;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; box-sizing: border-box;
    background: rgba(20, 30, 50, 0.6);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 100;
}

.icon-btn {
    background: none; border: none; color: var(--text-main);
    font-size: 1.2rem; padding: 10px; cursor: pointer;
    transition: 0.2s; border-radius: 8px;
}
.icon-btn:hover { background: var(--glass-highlight); color: var(--accent-color); }

.logo {
    font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 1.4rem;
    letter-spacing: 2px; color: var(--text-main);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

/* サイドバー */
.sidebar {
    position: fixed; top: 0; left: -280px; width: 260px; height: 100%;
    background: rgba(15, 20, 35, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    z-index: 200; transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex; flex-direction: column;
}
.sidebar.active { left: 0; box-shadow: 10px 0 30px rgba(0,0,0,0.3); }

.sidebar-header {
    height: 60px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; border-bottom: 1px solid var(--glass-border);
}
.close-btn { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }

.nav-links { list-style: none; padding: 20px 0; margin: 0; }
.nav-links li {
    padding: 15px 25px; cursor: pointer; color: var(--text-sub);
    font-size: 1rem; display: flex; align-items: center; gap: 15px;
    transition: 0.2s; border-left: 3px solid transparent;
}
.nav-links li:hover {
    background: var(--glass-bg); color: #fff; border-left-color: var(--accent-color);
}
.nav-links li.disabled { opacity: 0.4; cursor: not-allowed; }

.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 150;
    opacity: 0; pointer-events: none; transition: 0.3s;
}
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

/* メインエリアとビュー切り替え */
#main-container {
    padding-top: 60px; height: 100vh; box-sizing: border-box;
    position: relative;
}

.view {
    position: absolute; top: 60px; left: 0; width: 100%; height: calc(100vh - 60px);
    overflow-y: auto; padding: 20px; box-sizing: border-box;
    opacity: 0; pointer-events: none; transition: 0.3s; transform: translateY(10px);
}
.view.active {
    opacity: 1; pointer-events: auto; transform: translateY(0);
}
.view.hidden { display: none; } /* 完全非表示用 */

/* ホームビュー */
#view-home {
    display: flex; align-items: center; justify-content: center;
}
.hero-content { text-align: center; }
.hero-content h1 {
    font-size: 3.5rem; margin: 0; font-family: 'Rajdhani', sans-serif;
    background: linear-gradient(to right, #fff, #b0e0ff);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-content p { color: var(--text-sub); margin: 20px 0 40px; }

.primary-btn {
    padding: 15px 40px; font-size: 1.2rem; border-radius: 50px;
    border: none; background: var(--accent-color); color: #000;
    font-weight: 600; cursor: pointer; transition: 0.3s;
    box-shadow: 0 5px 20px rgba(0, 210, 255, 0.3);
}
.primary-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(0, 210, 255, 0.5); }

/* ゲーム一覧ビュー */
.section-header { text-align: center; margin-bottom: 30px; }
.section-header h2 { font-family: 'Rajdhani', sans-serif; font-size: 2rem; margin: 0; }
.section-header p { color: var(--text-sub); margin: 5px 0 0; }

.game-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px; max-width: 1200px; margin: 0 auto; padding-bottom: 50px;
}

.game-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 20px;
    aspect-ratio: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.3s;
    backdrop-filter: blur(5px);
}
.game-card:hover {
    background: var(--glass-highlight);
    border-color: var(--accent-color);
    transform: translateY(-5px);
}
.game-card i { font-size: 2.5rem; margin-bottom: 15px; color: var(--text-main); }
.game-card h3 { font-size: 0.9rem; font-weight: 500; margin: 0; color: var(--text-sub); }

/* ゲームプレイビュー */
#view-gameplay { display: flex; justify-content: center; align-items: center; padding: 20px; }

.game-frame {
    width: 100%; max-width: 800px; height: 80vh;
    background: rgba(15, 20, 30, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.game-bar {
    padding: 15px 20px; border-bottom: 1px solid var(--glass-border);
    display: flex; justify-content: space-between; align-items: center;
}
.back-link {
    background: none; border: none; color: var(--text-sub); cursor: pointer;
    font-size: 0.9rem; display: flex; align-items: center; gap: 5px;
}
.back-link:hover { color: #fff; }
#game-title-display { font-family: 'Rajdhani', sans-serif; font-size: 1.2rem; font-weight: bold; }

.game-area {
    flex: 1; position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    overflow: hidden;
}

.game-footer { padding: 15px; text-align: center; color: var(--text-sub); font-size: 0.9rem; border-top: 1px solid var(--glass-border); }

/* --- 汎用ゲームUI (ネオン感を少し抑えめに) --- */
.btn-neon {
    padding: 12px 30px; font-size: 1.2rem; margin: 10px;
    background: transparent; border: 2px solid var(--accent-color);
    color: var(--accent-color); cursor: pointer; border-radius: 30px;
    font-family: 'Rajdhani', sans-serif; transition: 0.2s;
}
.btn-neon:hover { background: var(--accent-color); color: #000; }

.big-text { font-size: 3.5rem; font-family: 'Rajdhani', sans-serif; margin-bottom: 20px; }
.result-text { font-size: 2rem; color: #0aff0a; margin-bottom: 20px; }
.fail-text { font-size: 2rem; color: #ff3366; margin-bottom: 20px; }
.grid-3x3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { 
    width: 70px; height: 70px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); 
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem; 
    cursor: pointer; user-select: none; border-radius: 10px; transition: 0.2s;
}
.tile:active, .tile.active { background: var(--accent-color); color: #000; }