/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: gradientShift 10s ease infinite;
    min-height: 100vh;
    padding: 20px;
    color: #333;
    position: relative;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 40px rgba(102, 126, 234, 0.5);
    overflow: hidden;
    animation: containerFloat 3s ease-in-out infinite;
    border: 3px solid transparent;
    background-clip: padding-box;
    position: relative;
    z-index: 1; /* 通常は低く */
}

.container::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 3px;
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #667eea);
    background-size: 300% 300%;
    animation: borderGlow 3s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
}

@keyframes borderGlow {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes containerFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.01);
    }
}

/* ヘッダー */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: headerGradient 5s ease infinite;
    color: white;
    padding: 30px 20px;
    position: relative;
    overflow: visible; /* ボタンが切れないように */
    z-index: 1001; /* オーバーレイより上 */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-text {
    flex: 1;
    text-align: center;
    min-width: 200px;
}

header::before {
    content: '✨';
    position: absolute;
    font-size: 2em;
    animation: sparkle1 3s ease-in-out infinite;
    left: 10%;
    top: 20%;
}

header::after {
    content: '⭐';
    position: absolute;
    font-size: 1.5em;
    animation: sparkle2 4s ease-in-out infinite;
    right: 15%;
    top: 30%;
}

@keyframes headerGradient {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes sparkle1 {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
    }
}

@keyframes sparkle2 {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.3) rotate(-180deg);
        opacity: 1;
    }
}

header h1 {
    font-size: 2em;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5), 0 0 40px rgba(255, 255, 255, 0.3);
    animation: titleGlow 2s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.5), 0 0 40px rgba(255, 255, 255, 0.3);
    }
    50% {
        text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 60px rgba(255, 255, 255, 0.5);
    }
}

header .subtitle {
    font-size: 0.9em;
    opacity: 0.9;
}

/* 通知停止ボタン */
.btn-mute {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    border-radius: 30px;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1001; /* オーバーレイ(999)とポップアップ(1000)より上 */
    animation: buttonPulse 2s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
    }
}

.btn-mute:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.4);
}

.btn-mute:active {
    transform: scale(0.95);
}

.btn-mute.muted {
    background: rgba(255, 100, 100, 0.3);
    border-color: #ff6b6b;
    animation: none;
}

.btn-mute.muted:hover {
    background: rgba(255, 100, 100, 0.4);
}

/* 固定の通知停止ボタン */
.btn-mute-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 3px solid white;
    border-radius: 50px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 20px rgba(102, 126, 234, 0.6);
    z-index: 10000; /* 最前面 */
    animation: fixedButtonPulse 1.5s ease-in-out infinite;
}

@keyframes fixedButtonPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 20px rgba(102, 126, 234, 0.6);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4), 0 0 30px rgba(102, 126, 234, 0.9);
    }
}

.btn-mute-fixed:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 40px rgba(102, 126, 234, 1);
}

.btn-mute-fixed:active {
    transform: scale(0.98);
}

.btn-mute-fixed.muted {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    animation: none;
}

.btn-mute-fixed.muted:hover {
    box-shadow: 0 12px 40px rgba(235, 51, 73, 0.6);
}

@media (max-width: 480px) {
    .btn-mute-fixed {
        top: 10px;
        right: 10px;
        padding: 12px 20px;
        font-size: 0.9em;
    }
}

/* メインコンテンツ */
main {
    padding: 20px;
}

/* キャラクターエリア */
.character-area {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    position: relative;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
    overflow: hidden;
}

.character-area::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    animation: shine 3s infinite;
    pointer-events: none;
}

@keyframes shine {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.character {
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.character-face {
    font-size: 4em;
    animation: bounce 2s infinite, rainbow 5s linear infinite;
    filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.5));
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-15px) scale(1.1);
    }
}

@keyframes rainbow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.8)) hue-rotate(0deg);
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(102, 126, 234, 1)) hue-rotate(180deg);
    }
}

/* リズム機能 */
.rhythm-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    position: relative;
    z-index: 2;
}

.rhythm-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: 3px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.rhythm-btn:hover {
    transform: scale(1.1);
}

.rhythm-btn.active {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    animation: pulse 0.5s infinite;
}

.visualizer-mode-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b894, #00cec9);
    border: 3px solid rgba(255, 255, 255, 0.6);
    color: white;
    font-size: 1.8em;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.5);
    z-index: 100;
}

.visualizer-mode-btn:hover {
    transform: scale(1.1);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.bpm-display {
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.rhythm-tap-area {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: rgba(102, 126, 234, 0.5);
    z-index: 100;
    pointer-events: none;
}

.rhythm-tap-area.active {
    pointer-events: auto;
}

/* リズムモード時のキャラクター */
.character-face {
    transition: transform 0.05s ease-out;
}

.speech-bubble {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3), 0 0 0 2px rgba(102, 126, 234, 0.1);
    position: relative;
    display: inline-block;
    max-width: 80%;
    animation: bubblePulse 2s ease-in-out infinite;
    z-index: 2;
}

@keyframes bubblePulse {
    0%, 100% {
        box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3), 0 0 0 2px rgba(102, 126, 234, 0.1);
    }
    50% {
        box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5), 0 0 0 3px rgba(102, 126, 234, 0.2);
    }
}

.speech-bubble::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid white;
}

.speech-bubble p {
    margin: 0;
    font-weight: 500;
    color: #333;
    animation: textShimmer 3s ease-in-out infinite;
}

@keyframes textShimmer {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.9;
    }
}

/* セクション共通スタイル */
section {
    margin-bottom: 25px;
}

section h2 {
    font-size: 1.2em;
    margin-bottom: 15px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientText 3s linear infinite;
    border-bottom: 3px solid;
    border-image: linear-gradient(90deg, #667eea, #764ba2, #f093fb) 1;
    padding-bottom: 8px;
    font-weight: 700;
}

@keyframes gradientText {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* 入力フォーム */
.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.search-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-container input {
    width: 100%;
}

.btn-search {
    padding: 12px 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(240, 147, 251, 0.4);
    white-space: nowrap;
    margin-bottom: 0;
    width: 100%;
}

.btn-search:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 30px rgba(240, 147, 251, 0.6);
}

.btn-search:active {
    transform: translateY(0) scale(1);
}

.search-status {
    margin-top: 8px;
    font-size: 0.85em;
    min-height: 20px;
    animation: fadeIn 0.3s ease-in;
}

.search-status.success {
    color: #38ef7d;
    font-weight: 600;
}

.search-status.error {
    color: #f45c43;
    font-weight: 600;
}

.search-status.loading {
    color: #667eea;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3), 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

/* セレクトボックス */
.voice-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    cursor: pointer;
}

.voice-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3), 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.voice-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.voice-help {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 0.85em;
}

/* 省電力設定 */
.power-settings {
    background: white;
    padding: 20px;
    margin: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.power-settings h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.power-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.power-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    transition: all 0.3s;
}

.power-option:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.power-option-text {
    flex: 1;
}

.power-option-text strong {
    display: block;
    color: #333;
    margin-bottom: 3px;
}

.power-option-text small {
    color: #666;
    font-size: 0.85em;
    line-height: 1.3;
}

/* トグルスイッチ */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* 画面を暗くするオーバーレイ */
.screen-dimmer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    pointer-events: none;
    transition: opacity 0.3s;
}

/* バイブレーションパターン選択 */
.vibration-pattern {
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
}

.vibration-pattern label {
    display: block;
    margin-bottom: 8px;
    color: #333;
}

.vibration-pattern select {
    width: 100%;
}

/* モバイル対応 */
@media (max-width: 600px) {
    .power-option {
        flex-direction: row;
        align-items: flex-start;
    }

    .power-option-text {
        flex: 1;
    }

    .switch {
        margin-top: 3px;
    }
}

/* ステータス表示 */
.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.status-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 2px solid transparent;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.status-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    animation: statusShimmer 3s infinite;
}

@keyframes statusShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.status-item:hover {
    border-color: #667eea;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-3px) scale(1.02);
}

.status-label {
    font-size: 0.85em;
    color: #666;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.status-item span:last-child {
    font-size: 1.1em;
    font-weight: 700;
    background: linear-gradient(90deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
}

/* ボタン */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: buttonGradient 3s ease infinite;
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

@keyframes buttonGradient {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.6);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    background-size: 200% 200%;
    animation: successGlow 2s ease infinite;
    color: white;
    box-shadow: 0 5px 15px rgba(56, 239, 125, 0.4);
}

@keyframes successGlow {
    0%, 100% {
        box-shadow: 0 5px 15px rgba(56, 239, 125, 0.4);
    }
    50% {
        box-shadow: 0 8px 25px rgba(56, 239, 125, 0.7);
    }
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(56, 239, 125, 0.7);
}

.btn-danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    background-size: 200% 200%;
    animation: dangerPulse 1.5s ease infinite;
    color: white;
    box-shadow: 0 5px 15px rgba(235, 51, 73, 0.4);
}

@keyframes dangerPulse {
    0%, 100% {
        box-shadow: 0 5px 15px rgba(235, 51, 73, 0.4);
    }
    50% {
        box-shadow: 0 8px 25px rgba(235, 51, 73, 0.7);
    }
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(235, 51, 73, 0.7);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(108, 117, 125, 0.6);
}

/* 追跡中ボタンの明滅アニメーション */
.btn.tracking-active {
    animation: trackingBlink 1s ease-in-out infinite;
}

@keyframes trackingBlink {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 5px 15px rgba(56, 239, 125, 0.4);
    }
    50% {
        opacity: 0.6;
        box-shadow: 0 8px 25px rgba(56, 239, 125, 0.8);
    }
}

/* コントロールセクション */
.controls {
    margin-top: 30px;
}

/* フッター */
footer {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #667eea);
    background-size: 200% auto;
    animation: footerLine 3s linear infinite;
}

@keyframes footerLine {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* 訪問者カウンター */
.visitor-counter {
    margin-top: 8px;
    font-size: 0.85em;
    color: #888;
}

.visitor-counter #visitor-count {
    font-weight: bold;
    color: #667eea;
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    .status-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.5em;
    }

    .character-face {
        font-size: 3em;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
    }

    .header-text {
        text-align: center;
    }

    .btn-mute {
        width: 100%;
        max-width: 250px;
    }
}

/* 通知アニメーション */
.notification-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 5px rgba(102, 126, 234, 0.3);
    z-index: 1000;
    text-align: center;
    animation: popupAppear 0.5s ease-out, popupBounce 0.5s ease-out 0.5s;
    border: 3px solid;
    border-image: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #667eea) 1;
}

@keyframes popupAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
}

@keyframes popupBounce {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
    }
}

.notification-popup h2 {
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    font-size: 2em;
    animation: titlePulse 1s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.notification-popup .close-btn {
    margin-top: 20px;
    padding: 12px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
}

.notification-popup .close-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.6);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    backdrop-filter: blur(5px);
    animation: overlayFade 0.3s ease-out;
}

@keyframes overlayFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 装飾的な浮遊エレメント */
body::before {
    content: '🚄';
    position: fixed;
    font-size: 3em;
    top: 10%;
    left: 5%;
    animation: float1 8s ease-in-out infinite;
    opacity: 0.3;
    z-index: 0;
}

body::after {
    content: '🚆';
    position: fixed;
    font-size: 2.5em;
    bottom: 15%;
    right: 8%;
    animation: float2 10s ease-in-out infinite;
    opacity: 0.3;
    z-index: 0;
}

@keyframes float1 {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    50% {
        transform: translateY(-30px) translateX(20px) rotate(10deg);
    }
}

@keyframes float2 {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    50% {
        transform: translateY(20px) translateX(-30px) rotate(-10deg);
    }
}

/* 装飾的な星 */
.star {
    position: fixed;
    font-size: 2em;
    animation: starTwinkle 3s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes starTwinkle {
    0%, 100% {
        opacity: 0.2;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.5) rotate(180deg);
    }
}

/* ===== 駅掲示板スタイル ===== */
.station-board-section {
    background: linear-gradient(135deg, #fff9f9 0%, #f9f9ff 100%);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-top: 25px;
}

.board-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.board-info p {
    margin: 5px 0;
    color: #555;
}

#board-station-name {
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
}

.board-distance {
    font-size: 0.9em;
    color: #999;
}

/* 投稿フォーム */
.board-post-form {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.board-post-form h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.1em;
}

.board-post-form textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

.board-post-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

.char-count {
    display: block;
    text-align: right;
    margin-top: 5px;
    color: #999;
    font-size: 0.85em;
}

.post-restriction {
    margin-top: 10px;
    padding: 10px;
    background: #fff3cd;
    border-radius: 5px;
    border-left: 4px solid #ffc107;
    font-size: 0.9em;
    color: #856404;
}

.post-restriction.allowed {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

/* 投稿一覧 */
.board-posts {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.board-posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.board-posts-header h3 {
    margin: 0;
    color: #667eea;
    font-size: 1.1em;
}

.btn-refresh {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-refresh:hover {
    background: #667eea;
    color: white;
}

.posts-container {
    max-height: 500px;
    overflow-y: auto;
}

.no-posts {
    text-align: center;
    color: #999;
    padding: 30px;
    font-style: italic;
}

.post-item {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85em;
}

.post-author {
    font-weight: bold;
    color: #667eea;
}

.post-time {
    color: #999;
}

.post-message {
    margin: 0;
    color: #333;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

.posts-loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .board-posts-header {
        flex-direction: column;
        gap: 10px;
    }

    .btn-refresh {
        width: 100%;
    }

    .posts-container {
        max-height: 400px;
    }
}

/* ===== 画像投稿掲示板 ===== */
.image-board-section {
    background: linear-gradient(135deg, #f9fff9 0%, #f9f9ff 100%);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-top: 25px;
}

#image-board-station-name {
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
}

/* 画像投稿フォーム */
.image-post-form {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.image-post-form h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.1em;
}

.image-post-form input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #667eea;
    border-radius: 8px;
    cursor: pointer;
    background: #f8f9ff;
    transition: all 0.3s;
}

.image-post-form input[type="file"]:hover {
    background: #eef0ff;
    border-color: #764ba2;
}

.file-help {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 0.85em;
}

.image-preview-container {
    position: relative;
    margin: 15px 0;
    text-align: center;
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(235, 51, 73, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.btn-remove-image:hover {
    background: rgba(235, 51, 73, 1);
    transform: scale(1.1);
}

/* 画像投稿一覧 */
.image-posts {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.images-container {
    max-height: 600px;
    overflow-y: auto;
}

.image-post-item {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #38ef7d;
    animation: slideIn 0.3s ease-out;
}

.image-post-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.85em;
}

.image-post-content {
    margin: 10px 0;
}

.image-post-image {
    max-width: 100%;
    border-radius: 8px;
    cursor: default;
    pointer-events: none;
}

.image-post-comment {
    margin-top: 10px;
    color: #333;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
    padding: 10px;
    background: white;
    border-radius: 5px;
}

@media (max-width: 600px) {
    .images-container {
        max-height: 400px;
    }
}

/* ===== 設定モーダル ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.modal-header h2 {
    margin: 0;
    color: white;
    font-size: 1.3em;
    border: none;
    padding: 0;
    background: none;
    -webkit-text-fill-color: white;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
    max-height: calc(85vh - 80px);
    overflow-y: auto;
}

.modal-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-section:last-child {
    border-bottom: none;
}

.modal-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.1em;
}

/* ヘッダーボタンのスタイル */
.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-help {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
}

.btn-help:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn-settings {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
}

.btn-settings:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

/* モーダル内のスクロールバーをカスタマイズ */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-body {
        padding: 15px;
        max-height: calc(90vh - 70px);
    }

    .modal-header {
        padding: 15px;
    }

    .header-buttons {
        flex-direction: column;
        gap: 5px;
    }

    .btn-settings, .btn-help {
        padding: 8px 15px;
        font-size: 0.85em;
    }
}

/* ===== お絵描き掲示板スタイル ===== */
.drawing-board-section {
    background: linear-gradient(135deg, #fff9f9 0%, #f9f9ff 100%);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-top: 25px;
    margin-bottom: 25px;
}

.drawing-board-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.drawing-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 10px 15px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s;
    flex: 1;
    min-width: 80px;
}

.tool-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
    color: #666;
    border-color: #ccc;
}

.tool-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.tool-btn.save-btn {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
    color: white;
}

.tool-btn.save-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 15px rgba(56, 239, 125, 0.4);
}

.tool-btn.save-btn:disabled {
    background: #ccc;
    opacity: 0.5;
}

.canvas-wrapper {
    background: white;
    border: 3px solid #667eea;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#drawing-canvas {
    display: block;
    cursor: crosshair;
    background: white;
    max-width: 100%;
    height: auto;
}

#drawing-canvas.eraser-mode {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><rect x="2" y="2" width="20" height="20" fill="white" stroke="black" stroke-width="2"/></svg>') 12 12, auto;
}

#drawing-canvas.disabled {
    pointer-events: none;
    opacity: 0.5;
    cursor: not-allowed;
}

.drawing-restriction {
    margin-top: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: #fff3cd;
    border-radius: 5px;
    border-left: 4px solid #ffc107;
    font-size: 0.9em;
    color: #856404;
}

.drawing-restriction.allowed {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.drawing-info {
    text-align: center;
    color: #666;
    font-size: 0.85em;
    margin: 10px 0 0 0;
    padding: 10px;
    background: #fff3cd;
    border-radius: 5px;
    border-left: 4px solid #ffc107;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .drawing-toolbar {
        flex-direction: column;
    }

    .tool-btn {
        width: 100%;
        min-width: auto;
    }

    #drawing-canvas {
        width: 100%;
        height: auto;
    }

    .canvas-wrapper {
        width: 100%;
    }
}

/* ===== 弾幕シューティングゲーム ===== */

/* ゲーム開始ボタン */
.btn-attack {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ff4757 100%);
    background-size: 200% 200%;
    animation: attackButtonGradient 3s ease infinite;
    color: white;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    box-shadow: 0 5px 20px rgba(255, 107, 53, 0.5);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

@keyframes attackButtonGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.btn-attack:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.7);
}

.btn-attack:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    animation: none;
}

.attack-icon {
    font-size: 1.3em;
}

.station-hp-info {
    margin-top: 10px;
    padding: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    font-size: 0.9em;
    color: #555;
    text-align: center;
}

.station-hp-info .hp-critical {
    color: #e74c3c;
    font-weight: bold;
}

.station-hp-info .hp-warning {
    color: #f39c12;
    font-weight: bold;
}

.station-hp-info .feature-disabled {
    color: #e74c3c;
    font-weight: bold;
    display: block;
    margin-top: 5px;
}

/* ゲームオーバーレイ */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 20000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20001;
}

.hp-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.hp-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hp-label {
    color: white;
    font-weight: bold;
    font-size: 0.9em;
    min-width: 30px;
}

.hp-bar {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    max-width: 200px;
}

.hp-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.hp-fill.tank {
    background: linear-gradient(90deg, #00b894, #55efc4);
}

.hp-fill.station {
    background: linear-gradient(90deg, #e74c3c, #fd79a8);
}

.hp-text {
    color: white;
    font-size: 0.85em;
    min-width: 60px;
    text-align: right;
}

.btn-exit-game {
    background: rgba(231, 76, 60, 0.8);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-exit-game:hover {
    background: rgba(231, 76, 60, 1);
    transform: scale(1.05);
}

/* ゲームキャンバス */
#game-canvas {
    flex: 1;
    width: 100%;
    display: block;
}

/* ゲームコントロール */
.game-controls {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 20002;
    pointer-events: none;
}

/* バーチャルD-Pad（8方向） */
.virtual-dpad {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 44px);
    gap: 3px;
    pointer-events: auto;
}

.dpad-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.dpad-btn:active, .dpad-btn.active {
    background: rgba(102, 126, 234, 0.8);
    transform: scale(0.95);
}

/* 8方向配置（グリッドで自動配置） */
.dpad-up-left { grid-area: 1 / 1; }
.dpad-up { grid-area: 1 / 2; }
.dpad-up-right { grid-area: 1 / 3; }
.dpad-left { grid-area: 2 / 1; }
.dpad-right { grid-area: 2 / 3; }
.dpad-down-left { grid-area: 3 / 1; }
.dpad-down { grid-area: 3 / 2; }
.dpad-down-right { grid-area: 3 / 3; }

/* 攻撃ボタン */
.attack-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 4px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 2em;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.5);
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.attack-btn:active {
    transform: scale(0.9);
    background: linear-gradient(135deg, #c0392b, #a93226);
}

.attack-text {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 攻撃エリア（攻撃ボタン + ボムボタン） */
.attack-area {
    position: relative;
    pointer-events: auto;
}

/* ボムボタン */
.bomb-btn {
    position: absolute;
    top: -30px;
    right: -10px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b894, #00cec9);
    border: 3px solid rgba(255, 255, 255, 0.6);
    color: white;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 184, 148, 0.5);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    pointer-events: auto;
    z-index: 20003;
}

.bomb-btn:active {
    transform: scale(0.9);
    background: linear-gradient(135deg, #00a884, #00beb9);
}

.bomb-count {
    position: absolute;
    top: -5px;
    left: -5px;
    background: #e74c3c;
    color: white;
    font-size: 0.6em;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

@keyframes bombShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

/* ゲーム結果モーダル */
.game-result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30000;
    animation: fadeIn 0.3s ease;
}

.game-result-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.result-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.result-icon.victory {
    animation: victoryPulse 1s infinite;
}

@keyframes victoryPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.result-icon.defeat {
    animation: defeatShake 0.5s ease;
}

@keyframes defeatShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.game-result-content h2 {
    margin-bottom: 15px;
    font-size: 1.8em;
}

.game-result-content p {
    margin-bottom: 25px;
    color: #666;
    line-height: 1.6;
}

/* 機能無効化バッジ */
.feature-disabled-badge {
    display: inline-block;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.75em;
    font-weight: bold;
    margin-left: 5px;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .hp-bar {
        max-width: 120px;
    }

    .virtual-dpad {
        grid-template-columns: repeat(3, 38px);
        grid-template-rows: repeat(3, 38px);
        gap: 2px;
    }

    .dpad-btn {
        width: 38px;
        height: 38px;
        font-size: 1em;
    }

    .attack-btn {
        width: 80px;
        height: 80px;
        font-size: 1.5em;
    }

    .game-controls {
        padding: 0 10px;
        bottom: 10px;
    }
}

/* ===== アイテムリスト ===== */
.items-list {
    max-height: 300px;
    overflow-y: auto;
}

.item-entry {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid #667eea;
    transition: all 0.3s;
}

.item-entry:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.item-icon {
    font-size: 2em;
    min-width: 40px;
    text-align: center;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 3px;
}

.item-details {
    font-size: 0.85em;
    color: #666;
}

.item-count-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 15px;
    font-weight: bold;
}

.btn-use-item {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(56, 239, 125, 0.3);
}

.btn-use-item:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 15px rgba(56, 239, 125, 0.5);
}

.btn-use-item:active:not(:disabled) {
    transform: translateY(0) scale(1);
}

.btn-use-item:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #ccc;
}

/* ===== 着せ替えシステム ===== */

/* 着せ替えボタン */
.dress-up-btn {
    background: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    box-shadow: 0 3px 10px rgba(196, 69, 105, 0.3);
}

.dress-up-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 15px rgba(196, 69, 105, 0.5);
}

/* キャラクターキャンバス */
#character-canvas {
    display: block;
    margin: 0 auto;
    border-radius: 10px;
}

/* 着せ替えモーダル */
.dress-up-modal-content {
    max-width: 500px;
    width: 95%;
}

.dress-up-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dress-up-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    gap: 8px;
}

.ai-convert-buttons {
    display: flex;
    gap: 6px;
}

.btn-ai-convert {
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 14px;
    font-size: 0.7em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-ai-anime {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
}

.btn-ai-real {
    background: linear-gradient(135deg, #00b894, #00cec9);
}

.btn-ai-convert:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

#equipment-preview-canvas {
    border-radius: 10px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.dress-up-selection {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 装備タブ */
.equipment-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

.equip-tab {
    padding: 8px 12px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.equip-tab:hover {
    background: #f0f3ff;
}

.equip-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* 装備リスト */
.equipment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.equipment-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.equipment-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.2);
}

.equipment-item.equipped {
    border-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.equipment-item .item-preview {
    width: 50px;
    height: 50px;
    margin: 0 auto 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
}

.equipment-item .item-name {
    font-size: 0.8em;
    font-weight: bold;
    color: #333;
}

.equipment-item .item-rarity {
    font-size: 0.7em;
    margin-top: 3px;
}

.equipment-item .item-rarity.common {
    color: #6c757d;
}

.equipment-item .item-rarity.uncommon {
    color: #28a745;
}

.equipment-item .item-rarity.rare {
    color: #9b59b6;
}

.no-equipment {
    color: #999;
    text-align: center;
    padding: 20px;
    grid-column: 1 / -1;
}

/* 装備解除ボタン */
.unequip-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    cursor: pointer;
    margin-top: 5px;
    transition: all 0.3s;
}

.unequip-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

/* 装備交換エリア */
.equipment-exchange {
    margin-top: 10px;
    text-align: center;
    padding: 8px;
    background: #f0f0f5;
    border-radius: 10px;
}

.btn-exchange {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-exchange:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-exchange:disabled {
    background: #bbb;
    cursor: not-allowed;
    opacity: 0.7;
}

.exchange-count {
    font-size: 0.75em;
    color: #888;
    margin: 5px 0 0;
}

/* 装備交換選択UI */
.exchange-select-header {
    text-align: center;
    font-weight: bold;
    font-size: 0.9em;
    padding: 8px;
    color: #764ba2;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 4px;
}

.exchange-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.exchange-select-item:hover {
    background: #f0f0ff;
}

.exchange-select-item.checked {
    background: #e8e0ff;
}

.exchange-select-check {
    font-size: 1.2em;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.exchange-select-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.85em;
}

.exchange-select-slot {
    font-size: 0.75em;
    color: #999;
}

.exchange-select-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 8px;
    border-top: 1px solid #e0e0e0;
    margin-top: 4px;
    position: sticky;
    bottom: 0;
    background: #fff;
}

.exchange-counter {
    font-weight: bold;
    font-size: 0.9em;
    color: #764ba2;
}

.btn-execute-exchange {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-execute-exchange:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.btn-execute-exchange:disabled {
    background: #bbb;
    cursor: not-allowed;
    opacity: 0.7;
}

/* レスポンシブ */
@media (max-width: 480px) {
    .equipment-tabs {
        gap: 3px;
    }

    .equip-tab {
        padding: 6px 10px;
        font-size: 0.75em;
    }

    .equipment-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* 追跡バナー */
.tracking-banner {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(15, 52, 96, 0.4);
    animation: trackingPulse 3s ease-in-out infinite;
}

.tracking-banner-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#tracking-banner-text {
    color: #fff;
    font-size: 1.1em;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.tracking-dot {
    width: 10px;
    height: 10px;
    background: #00e676;
    border-radius: 50%;
    display: inline-block;
    animation: trackingDotBlink 1.5s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.6);
}

@keyframes trackingDotBlink {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(0, 230, 118, 0.6); }
    50% { opacity: 0.3; box-shadow: 0 0 4px rgba(0, 230, 118, 0.2); }
}

@keyframes trackingPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(15, 52, 96, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(15, 52, 96, 0.6); }
}

/* 使い方モーダル */
.help-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.help-section h3 {
    font-size: 1.1em;
    margin-bottom: 8px;
    color: #333;
}

.help-section ol, .help-section ul {
    padding-left: 20px;
    line-height: 1.8;
}

.help-section p {
    line-height: 1.6;
    color: #555;
}

/* ===== モグラたたきゲーム ===== */
.mole-game-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    border: 3px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.mole-game-btn:hover {
    transform: scale(1.1);
}

.mole-game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mole-score-display {
    background: rgba(243, 156, 18, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(243, 156, 18, 0.3);
    animation: scoreGlow 1s ease-in-out infinite;
}

@keyframes scoreGlow {
    0%, 100% { box-shadow: 0 2px 10px rgba(243, 156, 18, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(243, 156, 18, 0.6); }
}

/* モグラたたき結果モーダル */
.mole-result-content {
    max-width: 450px;
}

.mole-result-body {
    text-align: center;
}

.mole-result-stats {
    margin-bottom: 20px;
}

.mole-result-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.mole-result-label {
    font-size: 1em;
    color: #666;
    margin-bottom: 5px;
}

.mole-result-value {
    font-size: 3em;
    font-weight: bold;
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mole-result-details {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.mole-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 10px;
}

.mole-stat-item span:first-child {
    font-size: 0.85em;
    color: #666;
}

.mole-stat-item span:last-child {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

.mole-name-input {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.mole-name-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.mole-name-input input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    margin-bottom: 10px;
    text-align: center;
}

.mole-name-input input:focus {
    outline: none;
    border-color: #f39c12;
}

.mole-ranking-section {
    margin-top: 20px;
}

.mole-ranking-section h3 {
    color: #f39c12;
    margin-bottom: 10px;
}

.mole-ranking-list {
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
}

.mole-ranking-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    gap: 10px;
}

.mole-ranking-item:last-child {
    border-bottom: none;
}

.mole-rank-number {
    font-weight: bold;
    min-width: 30px;
    text-align: center;
    color: #999;
}

.mole-ranking-item:nth-child(1) .mole-rank-number { color: #ffd700; font-size: 1.2em; }
.mole-ranking-item:nth-child(2) .mole-rank-number { color: #c0c0c0; font-size: 1.1em; }
.mole-ranking-item:nth-child(3) .mole-rank-number { color: #cd7f32; font-size: 1.05em; }

.mole-rank-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mole-rank-score {
    font-weight: bold;
    color: #e74c3c;
}

.mole-rank-info {
    font-size: 0.8em;
    color: #999;
    min-width: 80px;
    text-align: right;
}

/* ===== 投げ銭ボタン ===== */
.btn-donate {
    display: inline-block;
    margin-top: 12px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 50%, #ee5a24 100%);
    background-size: 200% 200%;
    animation: donateGradient 3s ease infinite;
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-size: 1em;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    transition: all 0.3s;
}

@keyframes donateGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.btn-donate:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
}

.btn-donate:active {
    transform: translateY(0) scale(1);
}

/* ===== ガチャショップ ===== */
.gacha-shop-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gacha-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s;
}

.gacha-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.gacha-card-icon {
    font-size: 2.2em;
    min-width: 50px;
    text-align: center;
}

.gacha-card-info {
    flex: 1;
}

.gacha-card-name {
    font-weight: 700;
    color: #333;
    margin-bottom: 2px;
}

.gacha-card-desc {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 6px;
}

.gacha-card-price {
    font-size: 0.9em;
    font-weight: 700;
    color: #667eea;
}

.btn-gacha-buy {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.btn-gacha-buy:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.5);
}

/* ガチャ結果モーダル */
.gacha-result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30000;
    animation: fadeIn 0.3s ease;
}

.gacha-result-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease;
}

.gacha-result-content h2 {
    margin-bottom: 20px;
    font-size: 1.5em;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gacha-result-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.gacha-result-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

.gacha-result-item .rarity-badge {
    font-size: 0.75em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    color: white;
}

.rarity-badge.common { background: #6c757d; }
.rarity-badge.uncommon { background: #28a745; }
.rarity-badge.rare { background: #9b59b6; }
.rarity-badge.legendary { background: linear-gradient(135deg, #f1c40f, #e67e22); }

@media (max-width: 480px) {
    .gacha-card {
        flex-direction: column;
        text-align: center;
    }

    .btn-gacha-buy {
        width: 100%;
    }
}

/* ===== 塔登りゲーム ===== */
.tower-game-btn {
    background: linear-gradient(135deg, #2d1b4e, #4a2d7a);
    color: #ddd;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tower-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.tower-overlay canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.tower-controls {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    z-index: 10001;
}

.tower-controls-left,
.tower-controls-right {
    display: flex;
    gap: 10px;
    pointer-events: auto;
    align-items: flex-end;
}

.tower-controls-right {
    gap: 14px;
}

.tower-ctrl-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.tower-ctrl-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

.tower-jump-btn {
    width: 70px;
    height: 70px;
    font-size: 25px;
}

.tower-attack-btn {
    width: 64px;
    height: 64px;
    font-size: 24px;
    background: rgba(255, 100, 100, 0.2);
    border-color: rgba(255, 100, 100, 0.4);
    margin-top: 12px;
}

.tower-attack-btn:active {
    background: rgba(255, 100, 100, 0.5);
}

.tower-ranking-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.tower-ranking-inner {
    background: linear-gradient(160deg, #1a1030 0%, #2a1a4a 100%);
    border: 1px solid rgba(180, 140, 255, 0.4);
    border-radius: 16px;
    padding: 20px 18px 18px;
    width: 100%;
    max-width: 340px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 0 30px rgba(150, 80, 255, 0.3);
}

.tower-ranking-title {
    text-align: center;
    color: #ffd700;
    font-size: 18px;
    margin: 0;
}

.tower-floor-badge {
    text-align: center;
    color: #e0c0ff;
    font-size: 15px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    padding: 6px 10px;
}

.tower-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
    color: #fff;
    min-height: 40px;
}

.tower-ranking-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
}

.tower-ranking-row.highlight {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.rk-rank {
    width: 28px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.rk-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e0d0ff;
}

.rk-floor {
    color: #ffcc66;
    font-weight: bold;
    flex-shrink: 0;
}

.tower-ranking-register {
    display: flex;
    gap: 8px;
}

.tower-name-input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(180, 140, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    outline: none;
}

.tower-name-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.tower-ranking-btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(180, 140, 255, 0.5);
    background: rgba(120, 80, 200, 0.5);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
}

.tower-ranking-btn:active {
    background: rgba(150, 100, 240, 0.7);
}

.tower-ranking-retry-btn {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 140, 60, 0.5);
    background: rgba(180, 80, 20, 0.5);
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
    width: 100%;
}

.tower-ranking-retry-btn:active {
    background: rgba(220, 100, 30, 0.7);
}

.tower-exit-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 10002;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 14px;
    cursor: pointer;
}

