* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #fff;
    overflow: hidden;
    position: relative;
    /* レスポンシブスケーリング */
    transform-origin: top left;
}

/* レスポンシブスケーリング */
@media (max-height: 800px) {
    body {
        transform: scale(0.85);
        transform-origin: top left;
    }
}

@media (max-height: 700px) {
    body {
        transform: scale(0.75);
        transform-origin: top left;
    }
}

@media (max-height: 600px) {
    body {
        transform: scale(0.65);
        transform-origin: top left;
    }
}

/* 背景スライドショー */
.background-slideshow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 3s ease-in-out;
    transform: scale(1.2);
}

.slide.active {
    opacity: 0.12;
    animation: slideMove 15s ease-in-out infinite;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    image-rendering: pixelated;
    filter: blur(2px) brightness(0.6) saturate(1.3) contrast(1.1);
}

/* 各スライドに異なるアニメーションを適用 */
.slide[data-monster="erena"].active {
    animation: slideMove1 15s ease-in-out infinite;
}

.slide[data-monster="ritti"].active {
    animation: slideMove2 15s ease-in-out infinite;
}

.slide[data-monster="tensi"].active {
    animation: slideMove3 15s ease-in-out infinite;
}

.slide[data-monster="chinenunko"].active {
    animation: slideMove4 15s ease-in-out infinite;
}

.slide[data-monster="itachi"].active {
    animation: slideMove5 15s ease-in-out infinite;
}

.slide[data-monster="bomb_fairy"].active {
    animation: slideMove6 15s ease-in-out infinite;
}

@keyframes slideMove1 {
    0%, 100% { transform: scale(1.2) translateX(-3%) translateY(-2%); }
    50% { transform: scale(1.35) translateX(4%) translateY(3%); }
}

@keyframes slideMove2 {
    0%, 100% { transform: scale(1.25) translateX(2%) translateY(3%); }
    50% { transform: scale(1.4) translateX(-5%) translateY(-2%); }
}

@keyframes slideMove3 {
    0%, 100% { transform: scale(1.3) translateX(4%) translateY(-3%); }
    50% { transform: scale(1.45) translateX(-2%) translateY(4%); }
}

@keyframes slideMove4 {
    0%, 100% { transform: scale(1.2) translateX(-4%) translateY(2%); }
    50% { transform: scale(1.5) translateX(3%) translateY(-3%); }
}

@keyframes slideMove5 {
    0%, 100% { transform: scale(1.25) translateX(3%) translateY(-1%); }
    50% { transform: scale(1.4) translateX(-4%) translateY(2%); }
}

@keyframes slideMove6 {
    0%, 100% { transform: scale(1.3) translateX(-2%) translateY(4%); }
    50% { transform: scale(1.35) translateX(5%) translateY(-4%); }
}

/* パーティクル効果 */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.8) 0%, rgba(255, 215, 0, 0) 70%);
    border-radius: 50%;
    animation: float 20s infinite ease-in-out;
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 18s;
}

.particle:nth-child(2) {
    left: 20%;
    animation-delay: 2s;
    animation-duration: 22s;
}

.particle:nth-child(3) {
    left: 30%;
    animation-delay: 4s;
    animation-duration: 19s;
}

.particle:nth-child(4) {
    left: 40%;
    animation-delay: 6s;
    animation-duration: 21s;
}

.particle:nth-child(5) {
    left: 60%;
    animation-delay: 8s;
    animation-duration: 20s;
}

.particle:nth-child(6) {
    left: 70%;
    animation-delay: 10s;
    animation-duration: 17s;
}

.particle:nth-child(7) {
    left: 80%;
    animation-delay: 12s;
    animation-duration: 23s;
}

.particle:nth-child(8) {
    left: 90%;
    animation-delay: 14s;
    animation-duration: 18s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

.home-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* コンテンツ背景の強化 */
.home-container::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.1) 0%, 
        rgba(118, 75, 162, 0.15) 50%,
        rgba(102, 126, 234, 0.1) 100%);
    backdrop-filter: blur(5px);
    border-radius: 20px;
    z-index: -1;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 20px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.coins {
    background: rgba(255,255,255,0.2);
    padding: 10px 15px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    font-size: 1.1rem;
    font-weight: bold;
}

.volume-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255,255,255,0.2);
    padding: 12px 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    min-width: 200px;
}

.data-control {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.2);
    padding: 8px 12px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.reset-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.reset-btn:hover {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

.reset-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.reset-icon {
    font-size: 14px;
}

.reset-text {
    font-size: 11px;
    letter-spacing: 0.5px;
}

.volume-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-label {
    font-size: 12px;
    color: #fff;
    min-width: 35px;
    font-weight: bold;
}

.volume-control button {
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.volume-control button:hover {
    transform: scale(1.1);
}

#volumeSlider, #bgmVolumeSlider, #sfxVolumeSlider {
    width: 80px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

#volumeSlider::-webkit-slider-thumb, 
#bgmVolumeSlider::-webkit-slider-thumb, 
#sfxVolumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

#volumeSlider::-webkit-slider-thumb:hover, 
#bgmVolumeSlider::-webkit-slider-thumb:hover, 
#sfxVolumeSlider::-webkit-slider-thumb:hover {
    background: #ffd700;
    transform: scale(1.1);
}

.main-menu {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.menu-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
}

.menu-btn {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 25px 40px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 350px;
}

.menu-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: #ffd700;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.btn-icon {
    font-size: 3rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.btn-text h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.btn-text p {
    font-size: 1rem;
    color: #ccc;
    margin: 0;
}

/* モーダルスタイル */
.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: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    border: 2px solid #ffd700;
    max-width: 95%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 1000px; /* エリア選択画面用の幅拡張 */
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #ffd700;
    font-size: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* エリア選択グリッド */
.area-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    padding: 25px;
}

.extra-stage {
    background: linear-gradient(135deg, #ff6b35, #f7931e) !important;
    border: 2px solid #ffd700 !important;
    animation: extraGlow 3s ease-in-out infinite;
}

.extra-stage .area-number {
    font-size: 2.5rem !important;
    color: #fff !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8) !important;
}

.extra-stage .area-name {
    color: #fff !important;
    font-weight: bold !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important;
}

.extra-stage .area-level {
    color: #ffeb3b !important;
    font-weight: bold !important;
}

@keyframes extraGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.6), 0 0 40px rgba(255, 107, 53, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 107, 53, 0.8), 0 0 60px rgba(255, 107, 53, 0.5);
    }
}

.area-card {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.area-card:hover {
    background: rgba(255,255,255,0.2);
    border-color: #ffd700;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.area-number {
    font-size: 2rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    margin-bottom: 10px;
}

.area-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.area-level {
    font-size: 0.9rem;
    color: #ccc;
}

/* パーティ選択 */
.party-selection {
    padding: 30px;
    min-width: 900px;
}

.current-party {
    margin-bottom: 30px;
}

.current-party h3 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.selected-members {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.selected-slot {
    width: 120px;
    height: 140px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.selected-slot:hover {
    background: rgba(255,255,255,0.2);
    border-color: #ffd700;
}

.selected-slot.empty {
    border-style: dashed;
    color: #ccc;
    font-size: 2rem;
}

.selected-slot img {
    width: 70px;
    height: 70px;
    image-rendering: pixelated;
    border-radius: 5px;
    margin-bottom: 8px;
}

.selected-slot span {
    font-size: 0.9rem;
    text-align: center;
    color: #fff;
    font-weight: bold;
}

.members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.members-header h3 {
    color: #ffd700;
    font-size: 1.2rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    margin: 0;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-controls select {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    color: #fff;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    backdrop-filter: blur(10px);
}

.sort-controls select option {
    background: #2a2a2a;
    color: #fff;
}

.sort-order-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    color: #fff;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    min-width: 25px;
}

.sort-order-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: #ffd700;
}

.member-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}

.available-member {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 15px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.available-member:hover {
    background: rgba(255,255,255,0.2);
    border-color: #ffd700;
    transform: translateY(-2px);
}

.available-member img {
    width: 60px;
    height: 60px;
    image-rendering: pixelated;
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    padding: 3px;
}

.member-details .name {
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.member-details .stats {
    font-size: 0.9rem;
    color: #ccc;
}

/* 編成中バッジとパーティメンバー視覚表示 */
.in-party-badge {
    display: inline-block;
    background: linear-gradient(45deg, #ff6b35, #ff8e53);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    animation: pulse 2s infinite;
}

.available-member.in-party {
    border-color: #ff6b35;
    background: rgba(255, 107, 53, 0.15);
    position: relative;
}

.available-member.in-party::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff6b35, #ff8e53, #ff6b35);
    border-radius: 12px;
    z-index: -1;
    opacity: 0.6;
}

.available-member.in-party:hover {
    border-color: #ff8e53;
    background: rgba(255, 107, 53, 0.25);
    transform: translateY(-2px);
}

@keyframes pulse {
    0% {
        box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 0 0 0 rgba(255, 107, 53, 0.7);
    }
    70% {
        box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 0 0 8px rgba(255, 107, 53, 0);
    }
    100% {
        box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 0 0 0 rgba(255, 107, 53, 0);
    }
}

.party-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.confirm-btn {
    padding: 12px 25px;
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.confirm-btn:hover {
    background: linear-gradient(45deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* 初回スライム選択スタイル */
.first-time-content {
    text-align: center;
    padding: 20px;
}

.first-time-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.slime-selection {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.slime-option {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
    backdrop-filter: blur(10px);
}

.slime-option:hover {
    background: rgba(255,255,255,0.2);
    border-color: #ffd700;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.slime-option.selected {
    background: rgba(255,215,0,0.2);
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255,215,0,0.5);
}

.slime-img {
    width: 80px;
    height: 80px;
    image-rendering: pixelated;
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    padding: 4px;
    margin-bottom: 15px;
}

.slime-info h3 {
    color: #ffd700;
    margin-bottom: 10px;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.slime-info p {
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

#confirmSlimeSelection {
    padding: 15px 30px;
    font-size: 1.2rem;
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

#confirmSlimeSelection:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

#confirmSlimeSelection:not(:disabled):hover {
    background: linear-gradient(45deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .home-container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .menu-btn {
        min-width: 280px;
        padding: 20px 25px;
    }
    
    .btn-icon {
        font-size: 2.5rem;
    }
    
    .btn-text h3 {
        font-size: 1.3rem;
    }
    
    .area-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .selected-members {
        flex-wrap: wrap;
    }
}