
:root { 
    --primary: #1a4d2e; --primary-light: #2d6a4f; 
    --gold: #d4ac0d; --gold-light: #f4d03f;
    --bg: #f8f9fa; --white: #ffffff; --surface: #ffffff;
    --text: #2d3436; --text-light: #3b3b3b;
    --border: #eef2f3; --shadow: rgba(0,0,0,0.05);
    --danger: #e74c3c;
}

/* DARK MODE (Lobby Only) */
[data-theme="dark"] {
    --primary: #1a4d2e; 
    --bg: #121212; --white: #1e1e1e; --surface: #252525;
    --text: #e0e0e0; --text-light: #a0a0a0;
    --border: #333; --shadow: rgba(0,0,0,0.3);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    background: var(--bg); margin: 0; color: var(--text); overflow-x: hidden; 
    transition: background 0.3s, color 0.3s; padding-bottom: 80px; 
    display: flex; flex-direction: column; min-height: 100vh; 
}

/* HEADER */
header { 
    background: var(--primary); color: white; height: 36px; 
    display: flex; align-items: center; justify-content: space-between; 
    padding: 0 15px; position: sticky; top: 0; z-index: 1000; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.2); 
}
.header-btn { 
    background: none; border: none; color: white; font-size: 1.4rem; 
    padding: 10px; cursor: pointer; 
}
.header-title { 
    font-weight: 600; font-size: 1.1rem; white-space: nowrap; 
    overflow: hidden; text-overflow: ellipsis; max-width: 70%; 
}

/* FLOATING BACK BUTTON */
.fab-back {
    position: fixed; bottom: 25px; right: 25px; width: 60px; height: 60px;
    background: var(--primary); color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 2000;
    font-size: 1.8rem; border: none; cursor: pointer;
    transition: transform 0.2s, background 0.2s; display: none;
}
.fab-back:active { transform: scale(0.9); background: var(--primary-light); }

/* BREADCRUMB */
.breadcrumb { 
    background: var(--surface); padding: 10px 15px; font-size: 0.85rem; 
    color: var(--text-light); border-bottom: 1px solid var(--border); 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; 
}

/* SEARCH */
.search-container { 
    background: var(--surface); padding: 10px 15px; 
    border-bottom: 1px solid var(--border); 
}
#searchBox { 
    width: 100%; padding: 12px 40px 12px 15px; font-size: 16px; 
    border: 1px solid var(--border); border-radius: 8px; 
    background: var(--bg); color: var(--text); outline: none; transition: all 0.2s; 
}
#searchBox:focus { 
    border-color: var(--gold); 
    box-shadow: 0 0 0 2px rgba(212, 172, 13, 0.1); 
}

/* LIST */
#file-list { list-style: none; padding: 0; margin: 0; flex: 1; }
.list-item { 
    background: var(--surface); border-bottom: 1px solid var(--border); 
    padding: 16px 15px; display: flex; align-items: flex-start; 
    justify-content: space-between; cursor: pointer; position: relative; 
    height: auto; min-height: 60px; overflow: visible;
}
.list-item:active { background: var(--border); }

/* CONTENT LAYOUT */
.item-content { 
    flex: 1; display: flex; align-items: flex-start; min-width: 0; 
}
.folder-icon { 
    font-size: 1.4rem; margin-right: 12px; min-width: 25px; 
    text-align: center; margin-top: 2px; 
}
.item-title { 
    font-weight: 500; font-size: 1.1rem; white-space: normal; 
    word-wrap: break-word; line-height: 1.4; color: var(--text); 
    padding-right: 5px; display: block; 
}
.folder-title { font-weight: 600; color: var(--text); }
[data-theme="dark"] .folder-title { color: var(--gold-light); }
.action-group { 
    display: flex; gap: 15px; padding-left: 10px; 
    align-self: flex-start; margin-top: 2px; flex-shrink: 0; 
}
.icon-btn { 
    background: none; border: none; font-size: 1.3rem; 
    cursor: pointer; opacity: 0.5; transition: transform 0.2s; 
    padding: 0; color: var(--text-light); 
}
.icon-btn:hover { opacity: 1; transform: scale(1.1); }
.icon-btn.liked { color: #e74c3c; opacity: 1; animation: pop 0.3s; }
@keyframes pop { 50% { transform: scale(1.4); } }

/* TAGS */
.tag { 
    padding: 2px 6px; border-radius: 4px; background: var(--border); 
    font-weight: 500; font-size: 0.7rem; white-space: nowrap; 
}
.tag.html { background: #e3f2fd; color: #1565c0; }
.tag.folder { background: #fff8e1; color: #f57f17; }

.slide-in { 
    animation: slideIn 0.2s cubic-bezier(0.25, 1, 0.5, 1) forwards; 
}
@keyframes slideIn { 
    from { opacity: 0; transform: translateX(15px); } 
    to { opacity: 1; transform: translateX(0); } 
}
mark { 
    background: rgba(212, 172, 13, 0.4); color: inherit; 
    padding: 0 2px; border-radius: 2px; 
}

/* LOBBY */
.logo-container { text-align: center; padding: 3rem 1rem 1rem; }
.main-logo { 
    width: 120px; height: 120px; border-radius: 20px; 
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); 
}
.app-title { 
    font-size: 1.8rem; color: var(--primary); 
    margin: 15px 0; font-weight: 700; 
}
.footer-tagline { 
    text-align: center; padding: 30px 20px; font-size: 1.2rem; 
    color: var(--text-light); border-top: 1px solid var(--border); 
    margin-top: auto; line-height: 1.5; 
}

#installBtn { 
    background: linear-gradient(135deg, var(--gold), #f1c40f); 
    color: #000; border: none; width: 90%; max-width: 400px; 
    margin: 10px auto 30px; padding: 16px; border-radius: 12px; 
    font-weight: 800; font-size: 1.1rem; letter-spacing: 1px; 
    display: none; cursor: pointer; text-transform: uppercase; 
    box-shadow: 0 4px 15px rgba(212, 172, 13, 0.4); 
}
.card-grid { 
    max-width: 600px; margin: 0 auto; padding: 1rem; 
    display: flex; flex-direction: column; gap: 15px; 
}
.lib-card { 
    background: var(--surface); text-decoration: none; 
    color: var(--text); display: flex; align-items: center; 
    padding: 20px; border-radius: 16px; 
    box-shadow: 0 4px 12px var(--shadow); 
    border-left: 6px solid var(--primary); 
}
.card-icon { font-size: 2.2rem; margin-right: 15px; }
.card-info h2 { margin: 0; font-size: 1.1rem; color: var(--primary); }
.card-info p { 
    margin: 4px 0 0; font-size: 0.85rem; color: var(--text-light); 
}

/* WIDGETS */
.section-header { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 20px 15px 10px; max-width: 600px; margin: 0 auto; 
}
.section-title { 
    font-weight: 700; color: var(--text-light); 
    text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px; 
}
.clear-btn { 
    background: none; border: none; color: var(--danger); 
    font-size: 0.8rem; cursor: pointer; font-weight: 600; 
    display: flex; align-items: center; gap: 5px; opacity: 0.8;
}
.clear-btn:hover { opacity: 1; }
.horizontal-scroll { 
    display: flex; overflow-x: auto; gap: 15px; padding: 10px 15px; 
    scrollbar-width: none; max-width: 600px; margin: 0 auto; 
}
.horizontal-scroll::-webkit-scrollbar { display: none; }
.recent-card { 
    min-width: 140px; width: 140px; background: var(--surface); 
    border-radius: 10px; padding: 12px; 
    box-shadow: 0 2px 8px var(--shadow); border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 8px; position: relative;
}
.recent-card .icon { font-size: 1.8rem; }
.recent-card .title { 
    font-size: 0.85rem; font-weight: 600; overflow: hidden; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; 
    line-height: 1.3; height: 2.4em; 
}
.card-delete { 
    position: absolute; top: -5px; right: -5px; 
    background: var(--surface); border: 1px solid var(--border); 
    border-radius: 50%; width: 26px; height: 26px; 
    display: flex; align-items: center; justify-content: center; 
    color: var(--danger); cursor: pointer; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
