:root {
  --bg: #0B0F14;
  --surface: #121820;
  --surface-2: #1A2230;
  --border: #222c3a;
  --text: #E7EDF3;
  --muted: #8A97A8;
  --accent: #7DD3FC;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100dvh;
  padding-bottom: 40px;
}

header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid #1a2230;
}
.brand { display: flex; align-items: center; gap: 10px; }
h1 { font-family: 'Space Grotesk', sans-serif; font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.actions { display: flex; gap: 8px; }
.actions button {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid #202a3a;
  background: var(--surface); color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.actions button:active { transform: scale(.94); }
.actions button.spin svg { animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 18px 6px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 100px;
  border: 1px solid #202a3a; background: var(--surface);
  color: var(--muted); font-size: 13.5px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.chip.active { background: var(--text); color: #0B0F14; border-color: var(--text); }

.feed { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; max-width: 620px; margin: 0 auto; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 14.5px; }

.card {
  background: var(--surface);
  border: 1px solid #1c2534;
  border-radius: 18px;
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.card:active { border-color: #2c3a52; }
.card .meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); margin-bottom: 9px;
}
.card .meta .dot { width: 7px; height: 7px; border-radius: 50%; }
.card .meta .topic { font-weight: 600; letter-spacing: .2px; }
.card .meta .sep { opacity: .5; }
.card .phrase { font-size: 16px; line-height: 1.5; font-weight: 500; }
.card .details { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid #1c2534; }
.card.open .details { display: block; }
.card .details .title { font-size: 13px; color: var(--muted); line-height: 1.45; margin-bottom: 12px; font-style: italic; }
.card .details a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent); text-decoration: none; font-size: 14px; font-weight: 600;
}
.card .badge {
  float: right; font-size: 11px; font-weight: 600; color: var(--accent);
  background: rgba(125, 211, 252, .1); border-radius: 6px; padding: 2px 7px; margin-left: 8px;
}

.more {
  display: block; margin: 14px auto 30px; padding: 11px 26px;
  border-radius: 100px; border: 1px solid #202a3a; background: var(--surface);
  color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer;
}

.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  background: var(--surface-2); border-radius: 24px 24px 0 0;
  padding: 10px 22px calc(env(safe-area-inset-bottom) + 28px);
  max-width: 620px; margin: 0 auto;
}
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: #2c3a52; margin: 8px auto 18px; }
.sheet h2 { font-family: 'Space Grotesk', sans-serif; font-size: 19px; margin-bottom: 18px; }
.setting-block { margin-bottom: 22px; }
.setting-block h3 { font-size: 14px; margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--muted); margin-bottom: 12px; line-height: 1.4; }
.primary {
  width: 100%; padding: 13px; border-radius: 14px; border: none;
  background: var(--accent); color: #06222e; font-size: 15px; font-weight: 600; cursor: pointer;
}
.primary[disabled] { opacity: .55; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid #222c3d; font-size: 14.5px;
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .left { display: flex; align-items: center; gap: 10px; }
.toggle-row .dot { width: 8px; height: 8px; border-radius: 50%; }
.switch { position: relative; width: 44px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 100px; background: #26324a;
  transition: background .15s; cursor: pointer;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
