:root {
    --bg-color: #0b0c10; /* ダークブルーブラック */
    --primary-color: #00e5ff; /* ネオンシアン */
    --danger-color: #ff3366; /* ネオンレッド */
    --accent-color: #f3e500; /* ネオンイエロー */
    --text-main: #c5c6c7;
    --border-color: #1f2833;
    
    --font-pop: 'M PLUS Rounded 1c', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body {
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    font-family: var(--font-pop);
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 600px;
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(rgba(0, 229, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
    touch-action: none; /* スマホでのスクロール無効化 */
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* --- HUD --- */
#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hud-left, .hud-right {
    background: rgba(11, 12, 16, 0.8);
    border: 2px solid var(--border-color);
    padding: 5px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.hud-label {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: bold;
}

#score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 5px var(--primary-color);
}

#life-container {
    display: flex;
    gap: 5px;
    font-size: 1.2rem;
}

.heart {
    filter: grayscale(100%) opacity(0.3);
    transition: filter 0.3s;
}
.heart.active {
    filter: none;
}

/* --- 操作ヒント --- */
.hint-text {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 229, 255, 0.2);
    color: var(--primary-color);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1rem;
    pointer-events: none;
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
    animation: pulse 2s infinite;
}

.tutorial-overlay {
    position: absolute;
    inset: 0;
    z-index: 11;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.tutorial-loop {
    position: relative;
    width: 140px;
    height: 94px;
    border: 3px dashed rgba(0, 229, 255, 0.7);
    border-radius: 50%;
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.55));
    animation: tutorialPulse 1.8s ease-in-out infinite;
}

.tutorial-dot {
    position: absolute;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 14px var(--accent-color);
    animation: tutorialTrace 1.8s linear infinite;
}

@keyframes tutorialPulse {
    0%, 100% { opacity: 0.35; transform: scale(0.96); }
    50% { opacity: 0.9; transform: scale(1.03); }
}

@keyframes tutorialTrace {
    0% { left: 64px; top: -8px; }
    25% { left: 132px; top: 40px; }
    50% { left: 64px; top: 88px; }
    75% { left: -6px; top: 40px; }
    100% { left: 64px; top: -8px; }
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* --- スクリーン共通 --- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 12, 16, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 20;
    padding: 10px;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

/* --- サイバーパネル --- */
.cyber-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.title-container {
    text-align: center;
    margin-bottom: 10px;
    padding: 20px;
    background: rgba(31, 40, 51, 0.8);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

.main-title {
    font-size: 2.2rem;
    color: #fff;
    line-height: 1.2;
    text-shadow: 2px 2px 0px #000;
}

.highlight {
    color: var(--primary-color);
    font-size: 2.8rem;
    text-shadow: 0 0 10px var(--primary-color);
}

.instruction {
    background: rgba(31, 40, 51, 0.8);
    padding: 15px;
    border-radius: 10px;
    border-left: 5px solid var(--primary-color);
    width: 95%;
    max-width: 320px;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.5;
    text-align: center;
}

.text-cyan { color: var(--primary-color); font-weight: bold; }
.text-yellow { color: var(--accent-color); font-weight: bold; }
.warning {
    margin-top: 10px;
    color: var(--danger-color);
    font-weight: bold;
    font-size: 0.85rem;
}

/* --- ボタン --- */
.cyber-btn {
    appearance: none;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 12px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    font-family: var(--font-pop);
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
    transition: all 0.2s;
    text-transform: uppercase;
}

.cyber-btn:active {
    transform: scale(0.95);
    background: var(--primary-color);
    color: #000;
}

.menu-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(260px, 90%);
}

.menu-buttons-vertical .cyber-btn {
    width: 100%;
}

.cyber-btn.primary {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 15px var(--primary-color);
}

.cyber-btn.x-share {
    background: #000;
    color: #fff;
    border-color: #fff;
    padding: 10px 20px;
    font-size: 1rem;
}

.cyber-btn.secondary {
    border-color: var(--border-color);
    color: #888;
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* --- リザルト --- */
.result-box {
    background: rgba(31, 40, 51, 0.95);
    border: 2px solid var(--danger-color);
    border-radius: 10px;
    padding: 20px;
    width: 95%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 0 30px rgba(255, 51, 102, 0.3);
}

.result-title {
    text-align: center;
    color: var(--danger-color);
    font-size: 2rem;
    line-height: 1.2;
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
}

.sub-title {
    font-size: 1rem;
    color: #fff;
}

.score-container, .rank-container {
    background: rgba(11, 12, 16, 0.8);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.score-label, .rank-label {
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.final-score {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px var(--primary-color);
}

.best-score-label {
    font-size: 0.9rem;
    color: #888;
}

.rank-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
}

.next-achievement-text {
    margin-top: 6px;
    color: #9ca3af;
    font-size: 0.8rem;
    line-height: 1.4;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}

.hidden {
    display: none !important;
}

.modal {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
    padding: 18px;
    pointer-events: auto;
}

.modal-content {
    width: min(520px, 96%);
    max-height: 88%;
    overflow-y: auto;
    background: rgba(31, 40, 51, 0.98);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.35);
}

.modal-title {
    color: #fff;
    text-align: center;
    font-size: 1.35rem;
}

.achievements-list {
    display: grid;
    gap: 10px;
}

.achievement-card {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(11, 12, 16, 0.85);
}

.achievement-card.unlocked {
    border-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.18);
}

.achievement-card.locked {
    opacity: 0.55;
    filter: grayscale(1);
}

.achievement-score {
    color: var(--accent-color);
    font-size: 0.85rem;
    text-align: center;
}

.achievement-name {
    color: #fff;
    font-size: 1rem;
}

.achievement-desc {
    color: #9ca3af;
    font-size: 0.78rem;
    line-height: 1.4;
}

.toast-container {
    position: absolute;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 50;
    display: grid;
    gap: 8px;
    width: min(360px, 90%);
    pointer-events: none;
}

.toast {
    opacity: 0;
    transform: translateY(10px);
    background: rgba(0, 229, 255, 0.92);
    color: #001318;
    border-radius: 8px;
    padding: 10px 14px;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.35);
    transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.blink {
    animation: blinker 1s linear infinite;
    color: var(--danger-color);
    font-weight: bold;
    font-size: 0.9rem;
}
@keyframes blinker {
    50% { opacity: 0; }
}

/* --- 残業モード（ダークモード）トグル --- */
