:root {
    --bg: #0a0f1e;
    --text: #f1f5f9;
    --subtext: #94a3b8;
    --glass: rgba(30, 41, 59, 0.45);
    --glass-border: rgba(255, 255, 255, 0.09);
    --accent: #3b82f6;
    --c1: linear-gradient(135deg, #ff2a5f, #ff7e5f);
    --c2: linear-gradient(135deg, #00d2ff, #3a7bd5);
    --c3: linear-gradient(135deg, #11998e, #38ef7d);
    --c4: linear-gradient(135deg, #8e2de2, #4a00e0);
    --c5: linear-gradient(135deg, #f7971e, #ffd200);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', -apple-system, sans-serif; }

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    padding: 2.5rem 1.5rem 6rem;
}

/* ── Blobs ─────────────────────────────────────────── */
.blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.45; animation: float 22s ease-in-out infinite alternate; }
.blob-1 { width: 55vw; height: 55vw; top: -15%; left: -10%; background: radial-gradient(circle, rgba(59,130,246,0.55) 0%, transparent 70%); }
.blob-2 { width: 65vw; height: 65vw; bottom: -15%; right: -10%; background: radial-gradient(circle, rgba(139,92,246,0.45) 0%, transparent 70%); animation-delay: -11s; }
@keyframes float { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(4%,8%) scale(1.08); } }

/* ── Header ────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; }
.header { text-align: center; margin-bottom: 2.5rem; animation: fadeDown 0.7s ease-out both; }
.header-title-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 0.4rem; }
.header-logo { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.header h1 { font-size: 2.6rem; font-weight: 800; background: linear-gradient(135deg, #fff 30%, #94a3b8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -0.5px; }
.header p { color: var(--subtext); font-size: 0.95rem; margin-bottom: 0.8rem; }
.refresh-bar { display: flex; align-items: center; justify-content: center; gap: 12px; }
#last-updated { font-size: 0.72rem; color: #475569; letter-spacing: 0.02em; }
#refresh-btn { background: var(--glass); border: 1px solid var(--glass-border); color: #64748b; padding: 4px 14px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; cursor: pointer; transition: background 0.2s, color 0.2s; }
#refresh-btn:hover:not(:disabled) { background: rgba(255,255,255,0.12); color: #fff; }
#refresh-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Control Bar ───────────────────────────────────── */
.control-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem; margin-bottom: 2.5rem; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--glass-border); padding: 0.9rem 1.2rem; border-radius: 20px; box-shadow: 0 8px 32px rgba(0,0,0,0.25); animation: fadeDown 0.7s 0.08s ease-out both; }
#search { background: rgba(10,15,30,0.6); border: 1px solid rgba(255,255,255,0.15); color: #fff; padding: 0.55rem 1.1rem; border-radius: 12px; outline: none; font-size: 0.88rem; width: 240px; transition: border-color 0.2s, box-shadow 0.2s; }
#search::placeholder { color: #475569; }
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
.sort-pills { display: flex; gap: 0.35rem; background: rgba(10,15,30,0.4); padding: 0.25rem; border-radius: 14px; }
.pill { background: transparent; color: var(--subtext); border: none; padding: 0.45rem 0.9rem; border-radius: 10px; cursor: pointer; font-size: 0.8rem; font-weight: 600; transition: all 0.25s cubic-bezier(0.4,0,0.2,1); white-space: nowrap; }
.pill:hover { color: #fff; background: rgba(255,255,255,0.08); }
.pill.active { background: var(--accent); color: #fff; box-shadow: 0 3px 12px rgba(59,130,246,0.4); }

/* ── Grid ──────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 2rem 1.2rem; padding-bottom: 2rem; }

/* ── App Item ──────────────────────────────────────── */
.app-item { display: flex; flex-direction: column; align-items: center; cursor: pointer; animation: popIn 0.45s cubic-bezier(0.175,0.885,0.32,1.275) both; user-select: none; }
.icon-wrap { position: relative; width: 80px; height: 80px; margin-bottom: 10px; }
.app-icon { width: 100%; height: 100%; border-radius: 22.5%; display: flex; align-items: center; justify-content: center; font-size: 1.85rem; font-weight: 700; color: #fff; box-shadow: 0 4px 18px rgba(0,0,0,0.45); transition: transform 0.1s ease-out, box-shadow 0.1s ease-out; transform-style: preserve-3d; position: relative; overflow: hidden; }
.app-icon::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%); border-radius: inherit; }
.app-icon.color-1 { background: var(--c1); }
.app-icon.color-2 { background: var(--c2); }
.app-icon.color-3 { background: var(--c3); }
.app-icon.color-4 { background: var(--c4); }
.app-icon.color-5 { background: var(--c5); }
.app-item:active .app-icon { transform: scale(0.93) !important; }

/* Idea card variant */
.app-item.is-idea .icon-wrap::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 25%;
    border: 2px dashed rgba(251, 191, 36, 0.5);
    pointer-events: none;
}
.app-item.is-idea .app-icon { filter: saturate(0.7) brightness(0.85); }
.app-item.is-idea .app-name { color: #fbbf24; }

/* Badge */
.badge { position: absolute; top: -6px; right: -8px; background: #ef4444; color: #fff; font-size: 0.72rem; font-weight: 800; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg); box-shadow: 0 2px 8px rgba(239,68,68,0.5); z-index: 2; animation: badgePop 0.3s cubic-bezier(0.175,0.885,0.32,1.275) both; }
.badge.idea-badge { background: #f59e0b; box-shadow: 0 2px 8px rgba(245,158,11,0.5); font-size: 0.65rem; }

.app-name { font-size: 0.78rem; font-weight: 500; text-align: center; width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #cbd5e1; margin-bottom: 3px; }
.app-sub { font-size: 0.65rem; color: #475569; text-align: center; width: 100px; }

/* ── Floating Idea Button ──────────────────────────── */
#new-idea-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(245,158,11,0.5), 0 0 0 0 rgba(245,158,11,0.4);
    animation: pulse-glow 2.5s ease-in-out infinite;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
#new-idea-btn:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(245,158,11,0.7); }
#new-idea-btn:active { transform: scale(0.95); }
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 4px 20px rgba(245,158,11,0.5), 0 0 0 0 rgba(245,158,11,0.3); }
    50%       { box-shadow: 0 4px 20px rgba(245,158,11,0.5), 0 0 0 12px rgba(245,158,11,0); }
}

/* ── Tooltip ───────────────────────────────────────── */
.tooltip { position: fixed; background: rgba(10,15,30,0.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--glass-border); color: #fff; padding: 0.6rem 0.85rem; border-radius: 10px; font-size: 0.78rem; line-height: 1.5; pointer-events: none; opacity: 0; transform: translateY(6px); transition: opacity 0.15s, transform 0.15s; z-index: 200; max-width: 220px; white-space: pre-line; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.tooltip.show { opacity: 1; transform: translateY(0); }

/* ── Modal shared ──────────────────────────────────── */
#modal, #idea-modal { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; }
#modal.visible, #idea-modal.visible { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal-card { position: relative; z-index: 10; background: rgba(10,18,40,0.98); border: 1px solid var(--glass-border); border-radius: 24px; padding: 28px 24px 24px; width: 400px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 40px 90px rgba(0,0,0,0.7); transform: scale(0.88) translateY(16px); opacity: 0; transition: transform 0.25s cubic-bezier(0.175,0.885,0.32,1.275), opacity 0.2s ease; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }
.modal-card.shown { transform: scale(1) translateY(0); opacity: 1; }
.modal-close { position: absolute; top: 14px; right: 16px; background: rgba(255,255,255,0.07); border: none; color: #64748b; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s; flex-shrink: 0; }
.modal-close:hover { background: rgba(255,255,255,0.14); color: #fff; }
.modal-icon-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.modal-icon-img { width: 58px; height: 58px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 700; color: #fff; flex-shrink: 0; box-shadow: 0 4px 16px rgba(0,0,0,0.5); position: relative; overflow: hidden; }
.modal-icon-img::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%); }
.modal-icon-img.color-1 { background: var(--c1); }
.modal-icon-img.color-2 { background: var(--c2); }
.modal-icon-img.color-3 { background: var(--c3); }
.modal-icon-img.color-4 { background: var(--c4); }
.modal-icon-img.color-5 { background: var(--c5); }
.modal-title { font-size: 1.1rem; font-weight: 700; color: #fff; margin-bottom: 3px; }
.modal-tag { font-size: 0.68rem; font-weight: 600; color: #60a5fa; text-transform: uppercase; letter-spacing: 0.08em; }
.modal-desc { font-size: 0.85rem; color: #94a3b8; line-height: 1.55; margin-bottom: 12px; }
.modal-meta { font-size: 0.73rem; color: #475569; margin-bottom: 14px; padding: 9px 13px; background: rgba(255,255,255,0.03); border-radius: 10px; border: 1px solid var(--glass-border); }
.modal-meta strong { color: #94a3b8; }

/* ── Notes ─────────────────────────────────────────── */
.modal-section { margin-bottom: 12px; }
.section-label { font-size: 0.72rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; display: block; cursor: pointer; user-select: none; }
.notes-area { width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border); border-radius: 10px; color: #cbd5e1; font-size: 0.82rem; padding: 10px 12px; resize: vertical; outline: none; font-family: inherit; line-height: 1.5; transition: border-color 0.2s, box-shadow 0.2s; min-height: 70px; }
.notes-area:focus { border-color: rgba(59,130,246,0.5); box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
.notes-area::placeholder { color: #334155; }

/* ── Collapsible sections ──────────────────────────── */
.modal-details { margin-bottom: 12px; }
.modal-details summary { list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.modal-details summary::-webkit-details-marker { display: none; }
.modal-details summary::after { content: '▸'; font-size: 0.65rem; color: #475569; margin-left: auto; transition: transform 0.2s; }
.modal-details[open] summary::after { transform: rotate(90deg); }

/* Commits list */
.commits-list { margin-top: 8px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.commits-list li { font-size: 0.78rem; color: #64748b; padding: 5px 10px; background: rgba(255,255,255,0.02); border-radius: 7px; border-left: 2px solid #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.commits-list li strong { color: #94a3b8; font-size: 0.65rem; margin-left: 6px; }

/* README panel */
.readme-panel { margin-top: 8px; padding: 12px; background: rgba(255,255,255,0.02); border: 1px solid var(--glass-border); border-radius: 10px; font-size: 0.78rem; color: #94a3b8; line-height: 1.65; max-height: 260px; overflow-y: auto; white-space: pre-wrap; font-family: 'SF Mono', 'Fira Code', monospace; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }
.readme-panel h1, .readme-panel h2, .readme-panel h3 { color: #e2e8f0; margin: 8px 0 4px; font-family: inherit; }
.readme-panel h1 { font-size: 1rem; }
.readme-panel h2 { font-size: 0.9rem; }
.readme-panel h3 { font-size: 0.82rem; }
.readme-panel code { background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; font-size: 0.75rem; }
.readme-panel pre { background: rgba(0,0,0,0.3); padding: 8px; border-radius: 7px; overflow-x: auto; margin: 6px 0; }
.readme-panel a { color: #60a5fa; }
.readme-panel ul, .readme-panel ol { padding-left: 16px; margin: 4px 0; }
.readme-panel em { color: #cbd5e1; font-style: italic; }
.readme-panel strong { color: #e2e8f0; }
.readme-empty { color: #334155; font-style: italic; font-family: inherit; }

/* ── Modal buttons ─────────────────────────────────── */
.modal-buttons { display: flex; gap: 8px; margin-top: 16px; }
.modal-btn { flex: 1; display: flex; align-items: center; justify-content: center; padding: 11px 8px; border-radius: 12px; font-size: 0.78rem; font-weight: 600; text-decoration: none; transition: transform 0.15s, box-shadow 0.15s; text-align: center; cursor: pointer; border: none; }
.modal-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.35); }
.modal-btn:active { transform: translateY(0); }
.btn-antigravity { background: linear-gradient(135deg, #6e40c9, #3a7bd5); color: #fff; }
.btn-vscode { background: linear-gradient(135deg, #007acc, #005fa3); color: #fff; }
.btn-online { background: var(--glass); border: 1px solid var(--glass-border); color: #94a3b8; }
.btn-online:hover { color: #fff; background: rgba(255,255,255,0.1); }
.btn-delete { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.btn-delete:hover { background: rgba(239,68,68,0.25); color: #fff; }

/* ── Idea modal specific ───────────────────────────── */
.idea-card { width: 420px; }
.idea-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.idea-emoji { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, #f59e0b, #f97316); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; box-shadow: 0 4px 16px rgba(245,158,11,0.4); flex-shrink: 0; }
.idea-form { display: flex; flex-direction: column; gap: 10px; }
.form-label { font-size: 0.72rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: 0.06em; }
.form-input { background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border); border-radius: 10px; color: #f1f5f9; padding: 9px 12px; font-size: 0.85rem; font-family: inherit; outline: none; width: 100%; transition: border-color 0.2s, box-shadow 0.2s; }
.form-input:focus { border-color: rgba(59,130,246,0.5); box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
select.form-input option { background: #0f172a; }
.color-picker { display: flex; gap: 10px; padding: 4px 0; }
.color-swatch { width: 32px; height: 32px; border-radius: 8px; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; outline: 2px solid transparent; outline-offset: 2px; }
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.active { outline-color: #fff; transform: scale(1.12); box-shadow: 0 4px 12px rgba(0,0,0,0.4); }

/* ── Animations ────────────────────────────────────── */
@keyframes fadeDown { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes badgePop { from { transform: scale(0); } to { transform: scale(1); } }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 600px) {
    body { padding: 1.5rem 1rem 5rem; }
    .header h1 { font-size: 2rem; }
    .grid { grid-template-columns: repeat(4, 1fr); gap: 1.2rem 0.6rem; }
    .app-icon { font-size: 1.4rem; }
    .icon-wrap { width: 62px; height: 62px; }
    .app-icon { width: 62px; height: 62px; }
    .app-name { width: 72px; font-size: 0.7rem; }
    .app-sub { width: 72px; font-size: 0.58rem; }
    #search { width: 100%; }
    .sort-pills { flex-wrap: wrap; justify-content: center; }
    .modal-buttons { flex-wrap: wrap; }
    #new-idea-btn { bottom: 16px; right: 16px; width: 50px; height: 50px; font-size: 1.3rem; }
}
