:root {
    --bg: #0b1221;
    --card: rgba(255, 255, 255, 0.08);
    --glass: rgba(255, 255, 255, 0.06);
    --text: #e8edf5;
    --muted: #9ba6bf;
    --accent: #6dd3ff;
    --accent-2: #a855f7;
    --border: rgba(255, 255, 255, 0.12);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: radial-gradient(120% 80% at 20% 20%, rgba(109, 211, 255, 0.12), transparent),
                radial-gradient(100% 70% at 80% 0%, rgba(168, 85, 247, 0.12), transparent),
                var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Space Grotesk', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

.bg-blur {
    position: fixed;
    inset: 0;
    pointer-events: none;
    filter: blur(120px);
    opacity: 0.5;
    z-index: 0;
}
.blur-1 { background: radial-gradient(300px at 20% 30%, rgba(109, 211, 255, 0.25), transparent); }
.blur-2 { background: radial-gradient(320px at 80% 20%, rgba(168, 85, 247, 0.2), transparent); }
.blur-3 { background: radial-gradient(260px at 50% 80%, rgba(255, 255, 255, 0.08), transparent); }

.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 7vw;
    backdrop-filter: blur(14px);
    background: linear-gradient(90deg, rgba(12, 18, 33, 0.9), rgba(12, 18, 33, 0.6));
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.brand-logo {
    height: 48px;
    width: auto;
}
.badge {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #0b1221;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
}
.brand-text {
    font-weight: 700;
    letter-spacing: 0.4px;
}

.nav-links {
    display: flex;
    gap: 18px;
}
.nav-links a {
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    padding: 8px 10px;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }

.ghost-btn {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: border 0.2s, transform 0.2s;
}
.ghost-btn:hover { border-color: var(--accent); transform: translateY(-1px); }

main { position: relative; z-index: 1; }

.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 32px;
    padding: 80px 7vw 40px;
    align-items: center;
}
.hero-copy h1 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(38px, 5vw, 56px);
    margin: 6px 0 12px;
    letter-spacing: -0.5px;
}
.lede {
    color: var(--muted);
    margin: 0 0 24px;
}
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 12px;
    color: var(--accent);
    margin: 0;
}

.cta-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.input-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.input-actions.dual { gap: 8px; }
.primary-btn.small, .ghost-btn.small { padding: 8px 12px; font-size: 13px; }

.primary-btn, .secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.primary-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #0b1221;
    box-shadow: 0 10px 30px rgba(109, 211, 255, 0.25);
}
.secondary-btn {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--border);
}
.primary-btn:hover, .secondary-btn:hover { transform: translateY(-1px); }
.primary-btn.full { width: 100%; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 12px;
}
.stat-number {
    font-size: 24px;
    font-weight: 700;
}
.stat-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.hero-panel .card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.glass {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.mono { font-family: 'Space Grotesk', monospace; }
.label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.card textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    color: var(--text);
    resize: vertical;
    min-height: 120px;
}
.card textarea:focus { outline: 1px solid var(--accent); }
.response-box {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    min-height: 80px;
}
.response-text { color: var(--muted); }
.related-papers {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
.paper-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.paper-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-btn {
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
}
.pill-btn.active { border-color: var(--accent); }
.papers-list {
    margin-top: 8px;
    display: grid;
    gap: 6px;
}
.paper-area-tag { margin-left: 8px; }
.paper-item {
    padding: 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}
.paper-item a { color: var(--accent); text-decoration: none; }
.paper-authors { color: var(--muted); font-size: 12px; }
.paper-summary { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.papers-inline { margin-top: 6px; font-size: 12px; color: var(--muted); }
.paper-item.title-only {
    background: transparent;
    border: none;
    padding: 4px 2px;
}
.paper-item.title-only a {
    color: var(--text);
    font-weight: 600;
}

.history-card { margin-top: 14px; }
.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.history-list {
    margin-top: 8px;
    display: grid;
    gap: 8px;
}
.history-entry {
    padding: 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}
.ghost-btn.small { padding: 6px 10px; font-size: 12px; }

.section {
    padding: 80px 7vw;
}
.section-alt {
    background: radial-gradient(160% 120% at 20% 0%, rgba(109, 211, 255, 0.08), rgba(12, 18, 33, 0.9));
}
.section-head {
    margin-bottom: 32px;
}
.section-title {
    margin: 8px 0 0;
    font-size: clamp(28px, 4vw, 38px);
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.step-card {
    position: relative;
    overflow: hidden;
}
.step-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(109, 211, 255, 0.08), rgba(168, 85, 247, 0.08));
    opacity: 0;
    transition: opacity 0.3s;
}
.step-card:hover::after { opacity: 1; }
.step-card h3 { margin: 8px 0; }
.step-card p { color: var(--muted); }
.step-number {
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.1em;
}

.qa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.qa-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 260px;
}
.qa-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.qa-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.pill {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
}
.status-pill {
    background: rgba(109, 211, 255, 0.12);
    color: var(--text);
    border-color: rgba(109, 211, 255, 0.4);
}
.status-pill.soft {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}
.like-pill {
    background: linear-gradient(135deg, rgba(109, 211, 255, 0.2), rgba(168, 85, 247, 0.2));
    color: #0b1221;
    font-weight: 700;
    border-color: transparent;
}
.subtle-pill {
    opacity: 0.7;
}
.votes { display: flex; gap: 6px; }
.vote-chip {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 10px;
    cursor: pointer;
    transition: border 0.2s, transform 0.1s;
}
.vote-chip.subtle { opacity: 0.8; }
.vote-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.qa-question {
    font-weight: 700;
}
.qa-answer {
    color: var(--text);
    font-weight: 600;
    white-space: pre-wrap;
    line-height: 1.5;
}
.comments {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    color: var(--muted);
    min-height: 24px;
}
.comment-form {
    display: flex;
    gap: 8px;
    flex-direction: column;
}
.comment-form input {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}
.comment-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.reward-input {
    flex: 1;
    min-width: 180px;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.faq-item h4 { margin: 6px 0; }
.faq-item p { color: var(--muted); margin: 0; }

.footer {
    border-top: 1px solid var(--border);
    padding: 24px 7vw;
    background: rgba(12, 18, 33, 0.9);
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.footer-links {
    display: flex;
    gap: 14px;
}
.footer-links a {
    color: var(--muted);
    text-decoration: none;
}
.muted { color: var(--muted); }

.langEn { display: none; }
.langJp { display: block; }

.recentQA {
    display: grid;
    gap: 12px;
}
.question {
    background: linear-gradient(135deg, rgba(109, 211, 255, 0.08), rgba(168, 85, 247, 0.08));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow);
}
.question strong { color: var(--accent); }
.question p { margin: 4px 0; color: var(--text); line-height: 1.4; }
.question input { width: 100%; margin-top: 6px; border-radius: 8px; border: 1px solid var(--border); padding: 8px; background: rgba(255,255,255,0.04); color: var(--text); }
.vote {
    margin-right: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    padding: 6px 8px;
    transition: border 0.2s, transform 0.1s;
}
.vote:hover { border-color: var(--accent); transform: translateY(-1px); }
.vote.down { color: #ff9f9f; }

.chat-hero {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    align-items: start;
    gap: 24px;
}
.chat-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-thread {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 260px;
    max-height: 520px;
    overflow-y: auto;
    display: grid;
    gap: 10px;
}
.chat-bubble {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow);
}
.chat-bubble.user {
    justify-self: end;
    background: linear-gradient(135deg, rgba(109, 211, 255, 0.2), rgba(168, 85, 247, 0.2));
}
.chat-bubble.ai {
    justify-self: start;
}
.bubble-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 4px;
}
.bubble-body {
    white-space: pre-wrap;
    color: var(--text);
    font-weight: 600;
}
.chat-input-block textarea {
    width: 100%;
}
.chat-input-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.streaming .bubble-body {
    color: var(--accent);
}

@media (max-width: 960px) {
    .hero {
        grid-template-columns: 1fr;
        padding-top: 60px;
    }
    .chat-hero { grid-template-columns: 1fr; }
    .nav { position: sticky; top: 0; }
}
@media (max-width: 680px) {
    .nav { padding: 14px 5vw; }
    .nav-links { display: none; }
    .hero { padding: 60px 5vw 32px; }
    .section { padding: 60px 5vw; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
}
