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

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #6FA0D9 0%, #85B3E0 30%, #9FC4E8 60%, #C5D9F0 80%, #D8E8F7 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-top: 80px;
    padding-bottom: 140px;
}

/* アフィリエイト広告スタイル */
.ad-container {
    text-align: center;
    margin: 10px 0;
    position: relative;
    z-index: 10;
}

.ad-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ヘッダー広告 */
.header-ad {
    margin: 10px auto 2px auto;
    padding: 5px;
    background: none;
}

/* サイドバー広告（Web版） */
.sidebar-ad {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    background: none;
    padding: 8px;
}

.sidebar-ad.left {
    left: 10px;
}

.sidebar-ad.right {
    right: 10px;
}

/* フッター広告 */
.footer-ad {
    margin: 20px auto 10px auto;
    background: none;
    padding: 10px;
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 998;
    width: auto;
}

/* インライン広告（スマホ） */
.inline-ad {
    margin: 20px auto;
    text-align: center;
    background: none;
    padding: 10px;
    z-index: 10;
}

/* 下部固定インライン広告 */
.inline-ad-bottom {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    background: none;
    padding: 10px;
    width: 90%;
    max-width: 468px;
}

.inline-ad-bottom img {
    width: 100%;
    height: auto;
    max-width: 468px;
}

/* 風船爆発広告 */
.balloon-explosion-ad {
    position: fixed;
    z-index: 1000;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border: 3px solid #ff9ff3;
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.balloon-explosion-ad .close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: #ff9ff3;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.5) translate(-50%, -50%); }
    100% { opacity: 1; transform: scale(1) translate(-50%, -50%); }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .sidebar-ad {
        display: none;
    }
    
    .header-ad, .footer-ad {
        margin: 10px 10px 2px 10px;
        background: none !important;
        padding: 5px;
    }
    
    .inline-ad {
        width: 90%;
        max-width: 320px;
    }
    
    .balloon-explosion-ad {
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 300px;
        max-width: 90vw;
    }
}

@media (min-width: 769px) {
    .inline-ad {
        display: none;
    }
    
    .balloon-explosion-ad {
        width: 440px;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }
}

@media (min-width: 1200px) {
    .sidebar-ad {
        display: block;
    }
}

/* 控えめな雲 */
body::before,
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

body::before {
    background: 
        radial-gradient(ellipse 600px 150px at 20% 80%, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.08) 50%, transparent 75%),
        radial-gradient(ellipse 400px 100px at 75% 85%, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.06) 60%, transparent 80%);
    animation: cloudFloat1 70s ease-in-out infinite;
}

body::after {
    background: 
        radial-gradient(ellipse 350px 90px at 60% 75%, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.04) 60%, transparent 80%);
    animation: cloudFloat2 90s ease-in-out infinite reverse;
}

@keyframes cloudFloat1 {
    0%, 100% { transform: translateX(0px) translateY(0px); }
    25% { transform: translateX(15px) translateY(-8px); }
    50% { transform: translateX(-10px) translateY(5px); }
    75% { transform: translateX(8px) translateY(-3px); }
}

@keyframes cloudFloat2 {
    0%, 100% { transform: translateX(0px) translateY(0px); }
    25% { transform: translateX(-12px) translateY(6px); }
    50% { transform: translateX(18px) translateY(-10px); }
    75% { transform: translateX(-8px) translateY(4px); }
}

#app {
    position: relative;
    z-index: 1;
}

.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    text-align: center;
    padding: 1rem;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.fixed-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
    color: #333;
    font-weight: 700;
}

.catchcopy {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    margin: 0;
}

.main-content {
    flex: 1;
    padding: 2rem 1rem 0;
    position: relative;
}

.bottom-input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(0,0,0,0.1);
    padding: 1rem;
    z-index: 999;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
}

.input-container {
    max-width: 600px;
    margin: 0 auto;
}

.single-line-input {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

#guchiInput {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 1rem;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    min-height: 45px;
    max-height: 100px;
    background: #f8f9fa;
}

#guchiInput:focus {
    border-color: #007bff;
    background: white;
    box-shadow: 0 2px 8px rgba(0,123,255,0.2);
}

.char-counter {
    text-align: center;
    color: #666;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.color-selector-horizontal {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    margin-bottom: 0.8rem;
    padding: 0.5rem 0;
}

.color-option {
    width: 35px;
    height: 35px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.color-option.selected {
    border-color: #333;
    transform: scale(1.15);
}

.send-btn {
    padding: 0;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    background: #0056b3;
}

.send-btn:active {
    background: #004494;
}

.send-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.color-picker {
    position: relative;
    display: flex;
    align-items: center;
}

.selected-color {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.selected-color:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.color-options {
    position: absolute;
    bottom: 55px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 25px;
    padding: 0.5rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    display: flex;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
}

.color-options.hidden {
    display: none;
}

.color-option {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.color-option:hover {
    transform: scale(1.2);
    border-color: #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.balloon-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 500;
}

.balloon {
    position: absolute;
    width: 90px;
    height: 120px;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.2));
}

.balloon:hover {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 15px 35px rgba(0,0,0,0.25));
}

.balloon-body {
    width: var(--balloon-width, 90px);
    height: var(--balloon-height, 117px);
    position: relative;
    background-image: var(--balloon-image);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center top;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 8px 15px rgba(0,0,0,0.2));
}

.balloon-text {
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.9);
    text-align: center;
    padding: 0.3rem;
    word-break: break-word;
    line-height: 1.3;
    max-height: calc(var(--balloon-height, 117px) * 0.55);
    overflow: hidden;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(255,255,255,0.8);
    z-index: 2;
    position: absolute;
    width: calc(var(--balloon-width, 90px) * 0.75);
    height: calc(var(--balloon-height, 117px) * 0.5);
    top: calc(var(--balloon-height, 117px) * 0.22);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    hyphens: auto;
    word-wrap: break-word;
}

/* String is now part of SVG - removed */

/* Knot is now part of SVG - removed */

.balloon.red {
    --balloon-image: url('balloon_red.svg');
}
.balloon.blue {
    --balloon-image: url('balloon_blue.svg');
}
.balloon.green {
    --balloon-image: url('balloon_green.svg');
}
.balloon.yellow {
    --balloon-image: url('balloon_yellow.svg');
}
.balloon.pink {
    --balloon-image: url('balloon_pink.svg');
}

/* Removed - highlights are now in SVG */

/* Removed - highlights are now in SVG */

@keyframes launch {
    0% {
        transform: translate(-50%, 20px) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--drift, 0px)), -2000px) scale(0.3);
        opacity: 0;
    }
}

@keyframes sway {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(8px); }
    50% { transform: translateX(-5px); }
    75% { transform: translateX(3px); }
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
    100% { transform: rotate(0deg); }
}

.balloon.launch {
    animation: 
        launch var(--duration, 18s) cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
    animation-delay: var(--delay, 0s);
    will-change: transform;
}

.continuous-balloon {
    opacity: 0.7;
    pointer-events: all;
}

.continuous-balloon:hover {
    opacity: 1;
    transform: scale(1.05);
}

/* ユーザーの「動き減らす」設定を尊重 */
@media (prefers-reduced-motion: reduce) {
    .balloon.launch {
        animation: none;
        bottom: 40vh !important;
        opacity: 0.8;
    }
}

/* モバイル最適化 */
@media (max-width: 768px) {
    @keyframes launch {
        0% {
            transform: translate(-50%, 20px) scale(1);
            opacity: 1;
        }
        100% {
            transform: translate(calc(-50% + var(--drift, 0px)), -1500px) scale(0.3);
            opacity: 0;
        }
    }
}

@keyframes pop {
    0% { 
        transform: scale(1); 
        opacity: 1; 
    }
    30% { 
        transform: scale(1.8); 
        opacity: 0.9; 
    }
    100% { 
        transform: scale(3.5); 
        opacity: 0; 
    }
}

@keyframes explode {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    30% {
        transform: scale(1.8);
        opacity: 0.9;
    }
    100% {
        transform: scale(3.5);
        opacity: 0;
    }
}

.balloon.popping {
    /* CSS爆発アニメーションを無効化 - クリック位置エフェクトのみ使用 */
    opacity: 0 !important;
    transform: scale(0) !important;
    transition: none !important;
    animation: none !important; /* launchアニメーションを強制停止 */
    will-change: auto !important;
}

.explosion-ring {
    position: absolute;
    border: 4px solid;
    border-radius: 50%;
    animation: explode 0.8s ease-out forwards;
    pointer-events: none;
}

.instructions {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    z-index: 200;
}

.instructions p {
    margin: 0;
    color: #333;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .fixed-header h1 {
        font-size: 1.5rem;
    }
    
    .catchcopy {
        font-size: 0.8rem;
    }
    
    .bottom-input-area {
        padding: 0.8rem;
    }
    
    .input-container {
        max-width: 100%;
        padding: 0 0.5rem;
    }
    
    .single-line-input {
        gap: 0.5rem;
        flex-wrap: nowrap;
    }
    
    #guchiInput {
        font-size: 1rem;
        padding: 0.6rem 0.8rem;
        min-height: 44px;
    }
    
    .selected-color {
        width: 40px;
        height: 40px;
    }
    
    .color-options {
        gap: 0.4rem;
        bottom: 50px;
        padding: 0.4rem;
    }
    
    .color-option {
        width: 28px;
        height: 28px;
    }
    
    .send-btn {
        min-width: 75px;
        height: 44px;
        font-size: 0.9rem;
        padding: 0 0.8rem;
    }
    
    .balloon {
        width: 60px;
        height: 80px;
    }
    
    .balloon-body {
        --balloon-width: 60px;
        --balloon-height: 80px;
    }
    
    .balloon-text {
        font-size: 0.7rem;
        line-height: 1.3;
        padding: 0.2rem;
        font-weight: 600;
    }
    
    .instructions {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        transform: none;
        padding: 0.8rem 1rem;
        font-size: 0.8rem;
    }
}

/* 小さなスマホ用 */
@media (max-width: 480px) {
    .fixed-header {
        padding: 0.8rem;
    }
    
    .fixed-header h1 {
        font-size: 1.3rem;
        margin-bottom: 0.1rem;
    }
    
    .catchcopy {
        font-size: 0.75rem;
    }
    
    .bottom-input-area {
        padding: 0.6rem;
    }
    
    .single-line-input {
        gap: 0.4rem;
    }
    
    #guchiInput {
        font-size: 1rem;
        padding: 0.6rem 0.8rem;
        min-height: 44px;
    }
    
    .selected-color {
        width: 38px;
        height: 38px;
    }
    
    .color-option {
        width: 26px;
        height: 26px;
    }
    
    .send-btn {
        min-width: 75px;
        height: 44px;
        font-size: 0.9rem;
        padding: 0 0.8rem;
    }
    
    .balloon {
        width: 50px;
        height: 70px;
    }
    
    .balloon-body {
        --balloon-width: 50px;
        --balloon-height: 70px;
    }
    
    .balloon-text {
        font-size: 0.65rem;
        line-height: 1.2;
        padding: 0.15rem;
        font-weight: 600;
    }
    
    /* メッセージ表示の調整 */
    .instructions {
        bottom: 0.8rem;
        left: 0.8rem;
        right: 0.8rem;
        padding: 0.6rem 0.8rem;
        font-size: 0.75rem;
    }
    
    /* フラッシュメッセージの調整 */
    .fixed-header + div[style*="position: fixed"] {
        padding: 0.8rem 1.5rem;
        font-size: 0.8rem;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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