:root {
    /* Color Palette */
    --clr-bg: #fffbf0;
    --clr-bg-dark: #fcf4db;
    --clr-honey-light: #ffd966;
    --clr-honey: #ffb703;
    --clr-honey-dark: #fb8500;
    --clr-text: #4a3b2c;
    --clr-text-light: #8a735c;
    --clr-card-bg: rgba(255, 255, 255, 0.85);

    /* Fonts */
    --font-heading: 'Fredoka', sans-serif;
    --font-body: 'Nunito', sans-serif;

    /* Shadows & Effects */
    --shadow-sm: 0 4px 6px rgba(184, 134, 11, 0.1);
    --shadow-md: 0 8px 15px rgba(184, 134, 11, 0.15);
    --shadow-lg: 0 15px 30px rgba(184, 134, 11, 0.2);
    --shadow-honey: 0 0 20px rgba(255, 183, 3, 0.3), inset 0 0 15px rgba(255, 255, 255, 0.5);
    
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none; /* ゲームでテキスト選択を防ぐ */
}

body {
    font-family: var(--font-body);
    color: var(--clr-text);
    height: 100vh;
    overflow: hidden;
    /* 六角形（ハニカム）模様の背景 */
    background-color: var(--clr-bg);
    background-image: 
        radial-gradient(circle at top right, rgba(255, 230, 150, 0.4), transparent 60%),
        radial-gradient(circle at bottom left, rgba(255, 200, 100, 0.3), transparent 60%),
        url("data:image/svg+xml,%3Csvg width='60' height='103.923' viewBox='0 0 60 103.923' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0l30 17.32v34.641L30 69.282 0 51.961V17.32zM30 34.641L15 25.98v17.32l15 8.66 15-8.66v-17.32z' fill='%23ffb703' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-size: 100% 100%, 100% 100%, 60px 103.923px;
    animation: bgScroll 60s linear infinite;
}

@keyframes bgScroll {
    0% { background-position: center, center, 0 0; }
    100% { background-position: center, center, 0 103.923px; }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 1);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 400px;
    width: 90%;
    opacity: 0;
    transform: scale(0.9);
}

.modal-overlay.show .modal-content {
    animation: jelly 0.5s ease-out forwards;
    opacity: 1;
}
.app-container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- クレジットUI --- */
.credits-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: linear-gradient(135deg, var(--clr-honey), #ff9900);
    border: 3px solid rgba(255, 255, 255, 1);
    padding: 15px 30px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-heading);
    color: white;
    font-size: 1.3rem;
    font-weight: bold;
    box-shadow: 0 10px 20px rgba(255, 183, 3, 0.4), inset 0 2px 5px rgba(255,255,255,0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 150; /* パーティクル(100)よりも手前に表示する */
    /* 目立つようにふわふわ浮く＋光るアニメーション */
    animation: fadeIn 2s ease-out, floatBtn 3s ease-in-out infinite;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

@keyframes floatBtn {
    0%, 100% { transform: translateY(0); box-shadow: 0 10px 20px rgba(255, 183, 3, 0.4); }
    50% { transform: translateY(-10px); box-shadow: 0 15px 25px rgba(255, 183, 3, 0.8); }
}

.credits-btn:hover {
    background: linear-gradient(135deg, #ff9900, var(--clr-honey-dark));
    transform: translateY(-10px) scale(1.05);
    color: white;
    box-shadow: 0 15px 30px rgba(255, 183, 3, 0.6);
    animation: none;
}

.credits-btn:active {
    transform: translateY(2px) scale(0.95);
    box-shadow: 0 2px 10px rgba(255, 183, 3, 0.4);
}

/* --- 左側：クリッカーエリア --- */
.clicker-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 2rem;
}

.resource-display {
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 4rem;
    animation: slideDown 0.6s ease-out;
}

.honey-amount-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#honey-icon {
    font-size: 3rem;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.1));
}

#honey-amount {
    font-family: var(--font-heading);
    font-size: 5rem;
    font-weight: 700;
    color: var(--clr-honey-dark);
    text-shadow: 2px 2px 0px #fff, 4px 4px 0px rgba(251, 133, 0, 0.2);
    line-height: 1;
    letter-spacing: -2px;
}

.honey-rate-container {
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-pill);
    display: inline-block;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(4px);
}

#honey-per-second {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--clr-text-light);
}

.royal-jelly-container {
    margin-top: 0.5rem;
    background: linear-gradient(135deg, rgba(230,200,255,0.7), rgba(200,150,255,0.7));
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-pill);
    display: inline-block;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(4px);
    font-weight: 700;
    color: #4a2c6d;
    animation: fadeIn 0.5s ease-out;
}

.click-area {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
}

.honey-button {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--clr-honey-light), var(--clr-honey));
    border: none;
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-honey), 0 20px 40px rgba(251, 133, 0, 0.3);
    transition: box-shadow 0.2s;
    outline: none;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.honey-button::before {
    content: '';
    position: absolute;
    top: 5%;
    left: 10%;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
}

.honey-button-inner {
    width: 80%;
    height: 80%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" x="50" font-size="60" text-anchor="middle" dominant-baseline="central">🍯</text></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
}

.honey-button:hover {
    box-shadow: var(--shadow-honey), 0 25px 50px rgba(251, 133, 0, 0.4);
    /* hover時はbreatheアニメーションを上書きして少し大きくする */
    animation: hoverScale 0.3s forwards;
}

@keyframes hoverScale {
    to { transform: scale(1.05); }
}

.honey-button:active {
    animation: jelly 0.4s ease;
    box-shadow: 0 0 10px rgba(255, 183, 3, 0.3), inset 0 0 30px rgba(0, 0, 0, 0.15);
}

@keyframes jelly {
    0% { transform: scale(1.05); }
    30% { transform: scale(0.9, 1.1); }
    40% { transform: scale(1.05, 0.95); }
    50% { transform: scale(0.95, 1.02); }
    65% { transform: scale(1.02, 0.98); }
    75% { transform: scale(0.99, 1.01); }
    100% { transform: scale(1); }
}

.prestige-container {
    margin-top: auto; /* Push to bottom of the clicker section */
    width: 100%;
    display: flex;
    justify-content: center;
    padding-top: 2rem;
    animation: fadeIn 1s;
}

.prestige-button {
    background: linear-gradient(135deg, #a770ef, #cf8bf3, #fdb99b);
    background-size: 200% 200%;
    border: none;
    border-radius: var(--radius-pill);
    padding: 1rem 2.5rem;
    color: white;
    font-family: var(--font-heading);
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(167, 112, 239, 0.3);
    transition: all 0.3s ease;
    animation: gradientMove 5s ease infinite;
}

.prestige-button .prestige-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.prestige-button strong {
    font-size: 1.4rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.prestige-button span {
    font-size: 0.95rem;
    opacity: 0.9;
    font-family: var(--font-body);
}

.prestige-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(167, 112, 239, 0.4);
}

.prestige-button:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 5px 10px rgba(167, 112, 239, 0.3);
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- 右側：アップグレードエリア --- */
.upgrade-section {
    width: 450px;
    background: rgba(255, 255, 255, 0.25); /* より透明にして後ろのハニカムを見せる */
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border-left: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: -10px 0 40px rgba(184, 134, 11, 0.1), inset 1px 0 0 rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.upgrade-header {
    padding: 2rem 2rem 1rem;
    border-bottom: 2px dashed rgba(255, 183, 3, 0.3);
}

.upgrade-header h2 {
    font-family: var(--font-heading);
    color: var(--clr-text);
    font-size: 1.8rem;
    font-weight: 600;
}

.enhancement-list {
    padding: 1rem 1.5rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    /* max-heightとoverflowがないと少し縦に伸びますが、これをなくすことでツールチップが切れるのを防ぎます */
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.enhancement-item {
    width: 45px;
    height: 45px;
    background: var(--clr-card-bg);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

.enhancement-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--clr-honey-light);
}

.enhancement-item.disabled {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: transparent;
}

.enhancement-item .tooltip {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--clr-text);
    color: var(--clr-bg);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: pre-wrap; /* 長いテキストは折り返すように変更 */
    min-width: 150px; /* ある程度の幅を確保 */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
    text-align: center;
    line-height: 1.4;
    box-shadow: var(--shadow-md);
}

.enhancement-item:hover .tooltip {
    opacity: 1;
}

.upgrade-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* スクロールバーのカスタマイズ */
.upgrade-list::-webkit-scrollbar {
    width: 8px;
}
.upgrade-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
}
.upgrade-list::-webkit-scrollbar-thumb {
    background: var(--clr-honey-light);
    border-radius: var(--radius-pill);
}

.upgrade-item {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05), inset 0 2px 0 rgba(255,255,255,0.8);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    /* overflow: hidden; を削除してテキストが途切れるのを防ぎます */
}

.upgrade-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 20px rgba(184, 134, 11, 0.15), inset 0 2px 0 rgba(255,255,255,1);
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--clr-honey-light);
}

.upgrade-item:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 5px rgba(184, 134, 11, 0.1);
}

.upgrade-item.disabled {
    opacity: 0.6;
    filter: grayscale(0.8);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.4);
}

.upgrade-icon {
    font-size: 2.5rem;
    background: var(--clr-bg);
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.upgrade-info {
    flex: 1;
    padding-right: 4rem; /* 長いテキストでも数字に被らないように余白を少し増やす */
}

.upgrade-name {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.upgrade-desc {
    font-size: 0.85rem;
    color: var(--clr-text-light);
    margin-bottom: 0.6rem;
    line-height: 1.4; /* 行間を広げて読みやすくする */
}

.upgrade-cost {
    font-weight: 700;
    color: var(--clr-honey-dark);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
}

.upgrade-cost-icon {
    font-size: 1rem;
}

/* プログレスバーのスタイリング */
.upgrade-progress-container {
    width: 100%;
    height: 6px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-pill);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.upgrade-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffc837, #ff8008);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: var(--radius-pill);
}

.upgrade-progress-bar.ready {
    background: linear-gradient(90deg, #00b09b, #96c93d); /* 購入可能になったら緑色っぽく光る */
    box-shadow: 0 0 5px rgba(150, 201, 61, 0.5);
    animation: readyPulse 2s infinite;
}

@keyframes readyPulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

.upgrade-count {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: rgba(0,0,0,0.1);
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.upgrade-item:not(.disabled) .upgrade-count {
    color: var(--clr-honey-light);
}

/* パーティクルアニメーション */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.particle {
    position: absolute;
    pointer-events: none;
    font-weight: bold;
    color: var(--clr-honey-dark);
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    animation: fadeUp 1s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
    z-index: 100;
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* レスポンシブ対応 */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }
    
    .clicker-section {
        flex: none;
        height: 50vh;
        padding: 1rem;
    }
    
    .honey-amount {
        font-size: 3.5rem;
    }
    
    .honey-button {
        width: 180px;
        height: 180px;
    }
    
    .upgrade-section {
        width: 100%;
        height: 50vh;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.8);
    }
}
