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

body {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    background-color: #f0f0f0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    max-width: 600px;
    width: 95%;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.score-container {
    text-align: center;
    margin-bottom: 20px;
}

.main-clicker-area {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    user-select: none;
    overflow: visible;
}

.clicker {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    cursor: pointer;
    user-select: none;
    overflow: hidden;  
}

.target {
    width: 100%;
    height: 100%;
    transition: transform 0.1s;
}

.target:active {
    transform: scale(0.9);
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

.accumulated-text {
    width: 100%;
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
    background-color: #f9f9f9;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
    text-align: left;
    line-height: 1.5;
    font-size: 18px;
    font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif;
    border: 1px solid #e0e0e0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.floating-character {
    position: absolute;
    font-size: 32px;
    font-weight: bold;
    font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif;
    animation: float-up 2s forwards;
    pointer-events: none;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    user-select: none;
}

.sentence-points-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
    background-color: #f0f8ff;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 0 0 5px rgba(0,0,0,0.05);
}

.sentence-storage {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 30px;
    width: 100%;
    background-color: rgba(255,255,255,0.5);
    border-radius: 3px;
    padding: 5px;
    margin-top: 5px;
}

.sentence-dot {
    width: 8px;
    height: 8px;
    background-color: #4CAF50;
    border-radius: 50%;
    margin: 3px;
    display: inline-block;
    animation: dot-appear 0.3s ease-in-out;
}

.flying-sentence {
    position: absolute;
    background-color: rgba(255,255,255,0.9);
    padding: 5px 10px;
    border-radius: 5px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
    transition: all 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
    z-index: 100;
    font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif;
    font-size: 16px;
    pointer-events: none;
}

.instructions {
    display: none;
}

.help-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: transform 0.2s, background-color 0.2s;
}

.help-icon:hover {
    background-color: #45a049;
    transform: scale(1.1);
}

.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.help-popup {
    background-color: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 80%;
    max-height: 80vh;
    overflow-y: auto;
}

.help-popup h3 {
    text-align: center;
    margin-bottom: 15px;
    color: #333;
}

.help-popup ul {
    list-style-type: none;
    margin-bottom: 20px;
}

.help-popup li {
    padding: 8px 0;
    margin-left: 15px;
    position: relative;
    line-height: 1.4;
}

.help-popup li:before {
    content: "•";
    color: #4CAF50;
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

.help-popup button {
    display: block;
    margin: 0 auto;
    padding: 10px 20px;
    font-size: 16px;
}

.shop {
    margin-top: 20px;
    border-top: 2px solid #eee;
    padding-top: 20px;
}

.shop h2 {
    text-align: center;
    margin-bottom: 15px;
}

.upgrade {
    background: #f5f5f5;
    padding: 15px;
    margin: 10px 0;
    border-radius: 5px;
    transition: background-color 0.3s;
}

#walkUpgrade, #thesaurusUpgrade {
    background: linear-gradient(45deg, #f5f5f5, #e0e0e0);
    border: 1px solid #ddd;
}

button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background: #45a049;
}

button:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.theme-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    z-index: 100;
}

.theme-label {
    margin-left: 8px;
    font-size: 14px;
}

/* Switch styling */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.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: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Dark theme styles */
body.dark-theme {
    background-color: #121212;
}

.game-container.dark-theme {
    background-color: #1e1e1e;
    color: #e0e0e0;
    box-shadow: 0 0 10px rgba(255,255,255,0.1);
}

.dark-theme .accumulated-text {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border-color: #444;
}

.dark-theme .sentence-points-container {
    background-color: #263238;
    color: #e0e0e0;
}

.dark-theme .sentence-storage {
    background-color: rgba(0,0,0,0.2);
}

.dark-theme .shop {
    border-top-color: #444;
}

.dark-theme .upgrade {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

.dark-theme #walkUpgrade, 
.dark-theme #thesaurusUpgrade {
    background: linear-gradient(45deg, #2d2d2d, #222);
    border-color: #444;
}

.dark-theme .flying-sentence {
    background-color: rgba(50,50,50,0.9);
    color: #e0e0e0;
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1.5);
    }
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes dot-appear {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes dot-disappear {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0);
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .main-clicker-area {
        width: 150px;
        height: 150px;
    }
    
    .clicker {
        width: 150px;
        height: 150px;
    }
    
    .game-container {
        padding: 15px;
    }
    
    .upgrade {
        padding: 10px;
    }
    
    .help-icon {
        width: 35px;
        height: 35px;
        font-size: 20px;
        bottom: 15px;
        right: 15px;
    }
    
    .help-popup {
        width: 90%;
        padding: 15px;
    }
    
    .instructions li {
        font-size: 14px;
    }
    
    .theme-toggle {
        top: 10px;
        right: 10px;
    }
}