/* Hanamaru Overlay */
#hanamaru-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Allow pointer events for buttons, but maybe click-through on transparent parts? */
    /* Simpler: just active pointer events for children, or cover whole screen to block interaction */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    background: rgba(255, 255, 255, 0.5);
    /* Slight dim */
    animation: fadeIn 0.3s ease-out;
}

.hanamaru-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#hanamaru-overlay img {
    width: 300px;
    height: 300px;
    opacity: 0.9;
    /* Drop shadow for pop */
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
}

.hanamaru-buttons {
    display: flex;
    gap: 15px;
}

@keyframes popIn {
    0% {
        transform: scale(0) rotate(-30deg);
        opacity: 0;
    }

    80% {
        transform: scale(1.1) rotate(5deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        background: rgba(255, 255, 255, 0);
    }

    to {
        background: rgba(255, 255, 255, 0.5);
    }
}

/* Global Header Layout */
.global-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mode-switcher {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 0;
}

/* Global Settings Control (Right side) */
.global-settings-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f7f7f7;
    padding: 5px 15px;
    border-radius: 30px;
    border: 1px solid #eee;
}

.settings-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: bold;
}

/* View Header Content Adjustments */
.view-header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
    text-align: center;
}

.view-header-content h1 {
    margin: 0;
}

/* Keep Mode Btn Styles */
.mode-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
}

.mode-btn.active {
    background: #FF6B6B;
    color: white;
    border-color: #FF6B6B;
}

/* Existing Styles (Ensuring preservation) */
body {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #fcfcfc;
    color: #333;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Settings Modal Sections */
.setting-section {
    margin-bottom: 20px;
}

.setting-section h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: #555;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

/* Views */
.hidden {
    display: none !important;
}

#view-practice {
    text-align: center;
    position: relative;
}

#practice-container.gallery-mode {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    justify-items: center;
    gap: 16px;
    padding: 20px;
}

#practice-container .practice-canvas {
    margin: 0 auto;
}

.char-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 12px;
    transition: background 0.2s;
}

.char-wrapper:hover {
    background: #f9f9f9;
}

/* Editor Dots */
.dot.empty {
    background-color: transparent;
    border: 1px dashed #eee;
    opacity: 0.5;
    cursor: pointer;
}

.dot.filled {
    border: none;
    cursor: pointer;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.secondary-btn,
.danger-btn,
.primary-btn {
    border: none;
    cursor: pointer;
    border-radius: 50px;
    font-weight: bold;
}

.secondary-btn {
    background-color: #f0f0f0;
    color: #333;
    padding: 0.8rem 1.5rem;
}

.danger-btn {
    background-color: #ffcccc;
    color: #d00;
    padding: 0.8rem 1.5rem;
}

.primary-btn {
    background: #FF6B6B;
    color: white;
    padding: 10px 20px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.input-wrapper {
    position: relative;
    width: 100px;
}

#char-input {
    width: 100%;
    font-size: 2rem;
    border: none;
    border-bottom: 2px solid #ddd;
    text-align: center;
}

#char-select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.nav-btn {
    background: none;
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.color-palette {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
}

.color-option.selected {
    border-color: #333;
    transform: scale(1.1);
}