:root {
  --bg: #0f1216;
  --bg-soft: #161b22;
  --panel: #1b2129;
  --panel-2: #212936;
  --border: #2b3543;
  --border-soft: #232c38;
  --text: #e8edf3;
  --text-dim: #9aa7b6;
  --text-faint: #6b7787;
  --accent: #ffb454;
  --accent-2: #6ea8fe;
  --green: #4ade80;
  --red: #f87171;
  --purple: #c084fc;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(110, 168, 254, 0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 10%, rgba(255, 180, 84, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(15, 18, 22, 0.82);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--text-faint); letter-spacing: 1px; text-transform: uppercase; }
.ghost-link { color: var(--text-dim); text-decoration: none; font-size: 14px; padding: 6px 12px; border-radius: 8px; }
.ghost-link:hover { color: var(--text); background: var(--panel); }

/* Hero */
.hero { padding: 42px 0 24px; }
.hero h1 { font-size: clamp(26px, 4.6vw, 40px); line-height: 1.22; margin: 0 0 14px; letter-spacing: -0.5px; }
.lede { font-size: clamp(15px, 2.1vw, 18px); color: var(--text-dim); max-width: 760px; margin: 0; }
.lede b { color: var(--text); font-weight: 600; }

/* App layout */
.app { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; margin-bottom: 40px; }
@media (max-width: 880px) { .app { grid-template-columns: 1fr; } }

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.input-panel { position: sticky; top: 76px; }
@media (max-width: 880px) { .input-panel { position: static; } }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 10px; }
.panel-head label { font-weight: 600; font-size: 14px; }
.panel-actions { display: flex; gap: 8px; }

textarea#notes {
  width: 100%; min-height: 240px; resize: vertical;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; font-size: 14px; line-height: 1.7;
  font-family: inherit;
}
textarea#notes:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(110, 168, 254, 0.18); }
textarea#notes::placeholder { color: var(--text-faint); }

.lens { margin: 14px 0 12px; }
.lens-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.lens-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text-dim);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { color: var(--text); border-color: var(--text-faint); }
.chip.active { background: rgba(255, 180, 84, 0.14); border-color: var(--accent); color: var(--accent); font-weight: 600; }

button { font-family: inherit; }
.primary {
  width: 100%; margin-top: 4px; padding: 13px 16px; font-size: 15px; font-weight: 700;
  color: #1a1205; background: linear-gradient(180deg, #ffc06a, var(--accent));
  border: none; border-radius: 10px; cursor: pointer; letter-spacing: 0.3px;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: translateY(1px); }

.mini {
  padding: 6px 11px; font-size: 12.5px; border-radius: 8px; cursor: pointer;
  background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border);
  transition: all 0.15s ease;
}
.mini:hover { color: var(--text); border-color: var(--text-faint); }
.mini.ghost { background: transparent; }

.privacy { font-size: 12px; color: var(--text-faint); margin: 12px 0 2px; }

/* Output */
.output-panel { min-height: 300px; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-dim); }
.empty-emoji { font-size: 40px; margin-bottom: 10px; }
.empty-state p { margin: 0 auto 16px; max-width: 340px; }
.how-mini { text-align: left; max-width: 320px; margin: 0 auto; color: var(--text-faint); font-size: 13px; padding-left: 18px; }
.how-mini li { margin: 5px 0; }

.result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 20px; color: var(--accent); line-height: 1.1; }
.stat span { font-size: 11.5px; color: var(--text-faint); }
.result-actions { display: flex; gap: 8px; }

.focus-card {
  border: 1px solid var(--accent); background: rgba(255, 180, 84, 0.09);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 16px;
}
.focus-card .focus-tag { display: inline-block; font-size: 11px; font-weight: 700; color: #1a1205; background: var(--accent); padding: 2px 9px; border-radius: 999px; letter-spacing: 0.5px; margin-bottom: 8px; }
.focus-card h3 { margin: 0 0 6px; font-size: 15px; }
.focus-card p { margin: 4px 0; font-size: 13.5px; color: var(--text-dim); }
.focus-card p b { color: var(--text); }

.cards { display: flex; flex-direction: column; gap: 14px; }
.card {
  border: 1px solid var(--border); border-left-width: 4px;
  background: var(--panel); border-radius: 12px; padding: 15px 16px;
  animation: rise 0.35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card.type-method { border-left-color: var(--accent-2); }
.card.type-principle { border-left-color: var(--purple); }
.card.type-avoid { border-left-color: var(--red); }
.card.type-fact { border-left-color: var(--green); }
.card.type-insight { border-left-color: var(--accent); }

.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; letter-spacing: 0.4px; }
.badge.method { color: var(--accent-2); background: rgba(110, 168, 254, 0.14); }
.badge.principle { color: var(--purple); background: rgba(192, 132, 252, 0.14); }
.badge.avoid { color: var(--red); background: rgba(248, 113, 113, 0.14); }
.badge.fact { color: var(--green); background: rgba(74, 222, 128, 0.14); }
.badge.insight { color: var(--accent); background: rgba(255, 180, 84, 0.14); }
.card-source { font-size: 12.5px; color: var(--text-faint); flex: 1; min-width: 0; }

.card-action { font-size: 15px; font-weight: 600; margin: 2px 0 12px; line-height: 1.5; }

.field { display: grid; grid-template-columns: 84px 1fr; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--border-soft); font-size: 13.5px; }
.field:first-of-type { border-top: none; }
.field .k { color: var(--text-faint); font-size: 12.5px; padding-top: 1px; }
.field .v { color: var(--text-dim); }
.field .v b { color: var(--text); font-weight: 600; }

/* How section */
.how-section { padding: 20px 0 50px; }
.how-section h2 { font-size: 22px; margin: 0 0 18px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 720px) { .how-grid { grid-template-columns: 1fr; } }
.how-item { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.how-item h3 { margin: 0 0 8px; font-size: 15px; color: var(--accent); }
.how-item p { margin: 0; font-size: 13.5px; color: var(--text-dim); }
.method-note { font-size: 13px; color: var(--text-faint); background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 10px; padding: 14px; margin: 0; }

/* Footer */
.footer { border-top: 1px solid var(--border-soft); padding: 22px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-dim); }
.footer .muted { color: var(--text-faint); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--green); color: #08240f; font-weight: 700; font-size: 13.5px;
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
