:root {
    --bg: #07070c;
    --panel: rgba(22, 22, 30, 0.72);
    --panel-solid: #16161e;
    --text: #ffffff;
    --muted: #9ca3af;

    --accent: #7c5cff;
    --accent2: #fbbf24;

    --border: rgba(255,255,255,0.08);

    --nav-h: 64px;

    --blur: 18px;
    --radius: 18px;
}

/* GLOBAL RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

body {
    background: radial-gradient(circle at 20% 10%, rgba(124,92,255,0.18), transparent 40%),
                radial-gradient(circle at 80% 80%, rgba(251,191,36,0.10), transparent 45%),
                var(--bg);
    color: var(--text);
    overflow: hidden;
}

/* subtle animated noise overlay */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("https://grainy-gradients.vercel.app/noise.svg");
    opacity: 0.06;
    pointer-events: none;
}

/* APP FRAME */
.app-container {
    height: 100vh;
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* HEADER */
.app-header {
    padding: 18px 20px;
    backdrop-filter: blur(var(--blur));
    background: rgba(10,10,14,0.6);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 1.3rem;
    letter-spacing: 0.22em;
    font-weight: 700;
}

.header-subtitle {
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.14em;
}

/* VIEW SYSTEM */
.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    padding-bottom: calc(var(--nav-h) + 90px);
}

.app-view {
    display: none;
    opacity: 0;
    transform: translateY(10px);
}

.app-view.active {
    display: block;
    animation: fadeUp 0.35s ease forwards;
    pointer-events: auto;
}

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

/* TYPOGRAPHY */
h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

p {
    color: var(--muted);
    font-size: 0.92rem;
}

/* GLASS CARDS */
.source-card, .ai-card {
    background: var(--panel);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 14px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.source-card:hover {
    transform: translateY(-2px);
    border-color: rgba(124,92,255,0.35);
}

/* LEFT ACCENT BAR */
.source-card {
    border-left: 3px solid var(--accent2);
}

.source-title {
    font-weight: 650;
    margin-bottom: 4px;
}

.source-agency {
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.12em;
}

.source-meta {
    font-size: 0.75rem;
    color: var(--muted);
}

/* BADGE */
.badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 0.6rem;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(124,92,255,0.15);
    color: var(--accent);
    border: 1px solid rgba(124,92,255,0.3);
}

/* AI CARD */
.ai-card {
    border: 1px solid rgba(124,92,255,0.4);
}

.ai-card.speculative {
    border-color: rgba(251,191,36,0.5);
}

.ai-header {
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    color: var(--accent);
    margin-bottom: 10px;
}

.ai-card.speculative .ai-header {
    color: var(--accent2);
}

.ai-content {
    font-size: 0.95rem;
    line-height: 1.55;
}

/* SETTINGS / ABOUT MENU */
.settings-menu {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--panel);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.settings-item:hover {
    color: var(--text);
    border-color: rgba(124,92,255,0.4);
    background: rgba(124,92,255,0.08);
    transform: translateY(-1px);
}

.settings-item.support-link {
    border-left: 3px solid var(--accent2);
    color: var(--text);
    font-weight: 600;
}

/* CHIPS */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.chip {
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text);
    transition: all 0.2s ease;
    cursor: pointer;
}

.chip:hover {
    transform: translateY(-1px);
    border-color: rgba(124,92,255,0.4);
    background: rgba(124,92,255,0.08);
}

/* SEARCH */
.search-wrapper {
    position: fixed;
    bottom: var(--nav-h);
    left: 0;
    right: 0;
    max-width: 640px;
    margin: 0 auto;
    padding: 14px 16px;
    z-index: 80;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(22,22,30,0.7);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px;
    transition: all 0.2s ease;
}

.search-box:focus-within {
    border-color: rgba(124,92,255,0.5);
    box-shadow: 0 0 0 3px rgba(124,92,255,0.12);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 10px 14px;
    font-size: 0.95rem;
}

.search-box input:focus {
    outline: none;
}

.search-box button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(124,92,255,0.15);
    color: var(--accent);
    cursor: pointer;
}

/* NAV */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 640px;
    margin: 0 auto;
    height: var(--nav-h);
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(10,10,14,0.85);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.65rem;
    color: var(--muted);
    gap: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-item.active {
    color: var(--accent);
    transform: translateY(-2px);
}

.nav-item.active svg {
    stroke: var(--accent);
    filter: drop-shadow(0 0 6px rgba(124,92,255,0.4));
}

/* LOADING */
.loading {
    text-align: center;
    color: var(--accent2);
    margin: 12px 0;
    animation: pulse 1.4s infinite;
    display: none;
}

.error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-bottom: 20px;
    text-align: center;
}

@keyframes pulse {
    0%,100% { opacity: 0.5; }
    50% { opacity: 1; }
}
