:root {
    --primary-orange: #ff9f43;      
    --primary-coral: #ff6b6b;       
    --sun-yellow: #feca57;          
    --warm-cream: #fbfbfb;          
    --soft-tangerine: #fff5e6;      
    --jeju-forest: #10ac84;         
    --ocean-blue: #0984e3;          
    --ocean-bright: #00d2d3;        
    --ocean-light: #74b9ff;         
    --stone-grey: #636e72;          
    --text-dark: #2d3436;           
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Pretendard', -apple-system, sans-serif; }
body { 
    background-color: var(--warm-cream); color: var(--text-dark); padding: 20px 16px; line-height: 1.6; max-width: 500px; margin: 0 auto;
    background-image: radial-gradient(#ffeaa7 1.5px, transparent 1.5px); background-size: 24px 24px;
}

header { 
    background: linear-gradient(135deg, var(--primary-orange), var(--primary-coral)); 
    color: white; padding: 28px 20px; border-radius: 28px; text-align: center; margin-bottom: 22px; 
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.25); border: 2px solid rgba(255,255,255,0.4);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
header h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.5px; word-break: keep-all; }
header p { font-size: 13px; opacity: 0.95; margin-top: 6px; font-weight: 600; }

.mode-toggle { 
    background: white; border: none; color: var(--primary-coral); padding: 8px 18px; border-radius: 50px; font-size: 12px; font-weight: 800; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.08); margin-top: 16px; transition: all 0.2s;
}
.mode-toggle.editing { background: #d63031; color: white; }

details { background: white; border-radius: 22px; border: 1.5px solid rgba(255, 159, 67, 0.25); margin-bottom: 14px; overflow: hidden; box-shadow: 0 6px 16px rgba(255, 159, 67, 0.08); }
summary { font-size: 14px; font-weight: 800; padding: 16px 20px; color: var(--primary-coral); cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::after { content: '✨ 펼치기'; font-size: 11px; color: white; background: var(--primary-orange); padding: 4px 10px; border-radius: 50px; font-weight: bold; }
details[open] summary::after { content: '🌿 접기'; background: #dfe6e9; color: var(--stone-grey); }
.details-content { padding: 0 20px 20px 20px; }

.info-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.info-item { font-size: 12.5px; background: var(--soft-tangerine); padding: 12px 16px; border-radius: 16px; border-left: 4px solid var(--primary-orange); }
.info-item strong { display: block; color: var(--primary-coral); font-size: 11px; margin-bottom: 3px; }

.tab-container { 
    display: flex; 
    gap: 8px; 
    margin: 20px 0 12px 0; 
    overflow-x: auto; 
    white-space: nowrap; 
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; 
    cursor: grab;
    user-select: none;
}
.tab-container.active-drag { cursor: grabbing; }
.tab-container::-webkit-scrollbar { display: none; }

.tab-btn { 
    flex: 0 0 auto;
    min-width: 82px;
    background: white; 
    border: 1px solid rgba(0,0,0,0.05); 
    padding: 10px 8px; 
    border-radius: 16px; 
    font-size: 11.5px; 
    font-weight: 700; 
    cursor: pointer; 
    color: var(--stone-grey); 
    text-align: center; 
    box-shadow: 0 3px 8px rgba(0,0,0,0.03); 
    transition: all 0.2s;
}
.tab-btn.active { 
    background: var(--primary-coral); 
    color: white; 
    box-shadow: 0 6px 14px rgba(255, 107, 107, 0.35); 
    transform: translateY(-2px);
}

.map-route-btn { background: var(--ocean-blue); color: white; font-size: 13.5px; font-weight: 800; border: none; padding: 14px; border-radius: 20px; cursor: pointer; display: flex; justify-content: center; align-items: center; box-shadow: 0 6px 16px rgba(9, 132, 227, 0.3); }
.ai-daily-btn { background: linear-gradient(135deg, var(--ocean-bright), var(--jeju-forest)); color: white; font-size: 13.5px; font-weight: 800; border: none; padding: 14px; border-radius: 20px; cursor: pointer; display: flex; justify-content: center; align-items: center; box-shadow: 0 6px 16px rgba(0, 210, 211, 0.3); }

.timeline { display: none; }
.timeline.active { display: block; }
.timeline-item { display: flex; margin-bottom: 24px; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: 58px; top: 22px; bottom: -28px; width: 2px; background: #feca57; z-index: 0; }
.timeline-item:last-child::before { display: none; }
.time { width: 52px; font-size: 13px; font-weight: 800; color: var(--primary-orange); text-align: right; margin-right: 18px; flex-shrink: 0; padding-top: 12px; }

.content { background: white; padding: 16px; border-radius: 22px; flex-grow: 1; box-shadow: 0 6px 15px rgba(255, 159, 67, 0.08); border: 1px solid rgba(0,0,0,0.02); cursor: pointer; position: relative; z-index: 2; }
.map-actions { display: flex; gap: 6px; margin-top: 10px; border-top: 1px solid #f5f5f5; padding-top: 8px; }
.btn-action { background: var(--soft-tangerine); border: none; padding: 6px 12px; border-radius: 8px; font-size: 11px; font-weight: 700; color: var(--primary-coral); cursor: pointer; }

.inline-editor { display: none; }
.inline-editor label { display: block; font-size: 11px; font-weight: bold; color: var(--ocean-blue); margin-top: 10px; }
.inline-editor input, .inline-editor textarea { width: 100%; padding: 10px; margin-top: 5px; font-size: 13px; border: 1.5px solid var(--ocean-light); border-radius: 12px; outline: none; background: #fafafa; }
.editor-btns { margin-top: 12px; display: flex; gap: 6px; }
.timeline-item.on-edit .view-text, .timeline-item.on-edit .map-actions { display: none; }
.timeline-item.on-edit .inline-editor { display: block; }

.btn { padding: 8px 14px; font-size: 12px; border: none; border-radius: 12px; cursor: pointer; font-weight: 700; }
.btn-save { background: var(--ocean-blue); color: white; }
.btn-del { background: #d63031; color: white; }
.btn-close { background: #dfe6e9; color: var(--text-dark); }
.btn-add { background: var(--primary-orange); color: white; font-size: 14px; padding: 12px; border-radius: 18px; width: 100%; box-shadow: 0 4px 12px rgba(255, 159, 67, 0.3); border: none; font-weight: 800; cursor: pointer; margin-top: 10px; }

.add-form-wrapper, .ai-prompt-wrapper { display: none; margin-top: 30px; background: white; padding: 20px; border-radius: 26px; border: 2px dashed var(--sun-yellow); box-shadow: 0 4px 15px rgba(254, 202, 87, 0.2); }
body.edit-mode .add-form-wrapper, body.edit-mode .ai-prompt-wrapper { display: block; }
.add-form-wrapper h4, .ai-prompt-wrapper h4 { font-size: 15px; font-weight: 800; margin-bottom: 14px; color: var(--primary-coral); text-align: center; }
.add-form-wrapper input, .add-form-wrapper textarea, .ai-prompt-wrapper textarea { width: 100%; padding: 10px; margin-bottom: 10px; border-radius: 12px; border: 1.5px solid var(--sun-yellow); outline: none; font-size: 13px; }

.map-modal { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(45, 52, 54, 0.7); backdrop-filter: blur(4px); z-index:9999; justify-content:center; align-items:center; padding:12px; }
.map-modal-content { background:white; width:96%; max-width:600px; height: 85vh; display: flex; flex-direction: column; border-radius:26px; overflow:hidden; position:relative; box-shadow:0 15px 35px rgba(0,0,0,0.3); }
#mapContainer { width:100%; flex-grow: 1; height: 100%; background:#f5f5f5; }
.map-modal-header { padding:16px 20px; font-size:15px; font-weight:800; background:var(--primary-orange); color:white; display:flex; justify-content:space-between; align-items:center; flex-shrink: 0; }

#searchModalList { max-height: 240px; overflow-y: auto; margin-top: 12px; padding: 0; border-top: 1px solid #eee; }
#searchModalList li { padding: 12px; border-bottom: 1px solid #f9f9f9; list-style: none; cursor: pointer; transition: background 0.2s; }
#searchModalList li:hover { background: var(--soft-tangerine); }

.ai-box { background: #f8f9fa; border-left: 4px solid var(--jeju-forest); padding: 12px; margin-bottom: 15px; border-radius: 8px; }
.ai-box h5 { color: var(--jeju-forest); margin-bottom: 8px; font-size: 15px;}