:root {
  --bg: #fff7ef;
  --bg-cool: #eef8ff;
  --surface: #ffffff;
  --surface-soft: #fffaf4;
  --ink: #1c2740;
  --ink-soft: #5f6c82;
  --line: #e3d6c8;
  --accent: #e25f3d;
  --accent-deep: #c84b2e;
  --accent-cyan: #0f88a6;
  --accent-olive: #8ea83f;
  --danger: #b64353;
  --shadow-soft: 0 22px 34px -30px rgba(24, 39, 64, 0.45);
  --shadow-strong: 0 26px 48px -34px rgba(24, 39, 64, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at -6% -12%, rgba(226, 95, 61, 0.17), transparent 62%),
    radial-gradient(1100px 700px at 106% -18%, rgba(15, 136, 166, 0.16), transparent 57%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-cool) 100%);
}

.scene-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 999px;
  opacity: 0.42;
}

.blob-a {
  width: 340px;
  height: 340px;
  top: -130px;
  right: -100px;
  background: radial-gradient(circle, rgba(226, 95, 61, 0.34), rgba(226, 95, 61, 0));
  animation: floatA 14s ease-in-out infinite;
}

.blob-b {
  width: 280px;
  height: 280px;
  left: -90px;
  bottom: -80px;
  background: radial-gradient(circle, rgba(15, 136, 166, 0.3), rgba(15, 136, 166, 0));
  animation: floatB 16s ease-in-out infinite;
}

.blob-c {
  width: 230px;
  height: 230px;
  left: 44%;
  top: 54%;
  background: radial-gradient(circle, rgba(142, 168, 63, 0.24), rgba(142, 168, 63, 0));
  animation: floatC 17s ease-in-out infinite;
}

#app {
  position: relative;
  z-index: 1;
  width: min(1040px, 94vw);
  margin: 30px auto 34px;
}

.app-shell {
  display: grid;
  gap: 16px;
}

.top-grid {
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--surface), var(--surface-soft));
  box-shadow: var(--shadow-soft);
}

.animate-in {
  animation: riseBounce 620ms cubic-bezier(0.21, 1.18, 0.34, 1) both;
}

.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 26px;
  box-shadow: var(--shadow-strong);
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(115deg, rgba(226, 95, 61, 0.55), rgba(15, 136, 166, 0.52), rgba(142, 168, 63, 0.46));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: -120% -40% auto;
  height: 160%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
  transform: rotate(-10deg);
  animation: sweep 6.2s linear infinite;
}

.hero-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  font-weight: 800;
  color: #6a6b72;
}

.header-title {
  margin: 10px 0 0;
  font-family: "Sora", sans-serif;
  font-size: clamp(1.8rem, 3.4vw, 2.7rem);
  letter-spacing: -0.04em;
}

.header-subtitle {
  margin: 10px auto 0;
  max-width: 62ch;
  color: var(--ink-soft);
}

.hero-pulse {
  margin: 14px auto 0;
  display: inline-flex;
  align-items: flex-end;
  gap: 5px;
  height: 24px;
}

.hero-pulse span {
  width: 8px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent), var(--accent-cyan));
  animation: barBounce 1.3s ease-in-out infinite;
}

.hero-pulse span:nth-child(1) {
  height: 10px;
  animation-delay: 0s;
}

.hero-pulse span:nth-child(2) {
  height: 18px;
  animation-delay: 0.16s;
}

.hero-pulse span:nth-child(3) {
  height: 12px;
  animation-delay: 0.32s;
}

.hero-actions {
  margin-top: 16px;
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 2;
}

.badge {
  border: 1px solid #e7d5cc;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.79rem;
  font-weight: 700;
  background: #fff4ea;
  color: #8a533f;
}

.badge.success {
  border-color: #cce6e2;
  background: #edfbf8;
  color: #1f6f67;
  animation: pulse 2.4s ease-in-out infinite;
}

.badge.warn {
  border-color: #f0d8bf;
  background: #fff8ef;
  color: #8f5f24;
  animation: pulse 2.4s ease-in-out infinite;
}

.badge.error {
  border-color: #efc2c8;
  background: #fff3f5;
  color: #9b4050;
}

.badge.quiet {
  border-color: #d7e2ea;
  background: #f5faff;
  color: #546f90;
}

.toast {
  border: 1px solid #dcd0c8;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #6a4d45;
  background: #fff4ea;
  animation: riseBounce 320ms cubic-bezier(0.21, 1.12, 0.3, 1);
}

.toast.success {
  border-color: #c6e2de;
  color: #226e64;
  background: #ecfbf7;
}

.toast.error {
  border-color: #efc3c9;
  color: #a04152;
  background: #fff2f4;
}

.command,
.feedbank,
.explorer {
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.panel-title {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1.08rem;
}

.panel-subtitle {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.command-form {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  font-size: 0.79rem;
  font-weight: 700;
  color: #5f6d83;
}

.accent-field,
.add-btn {
  width: 100%;
}

.stats-line {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  border: 1px solid #e4d8cb;
  border-radius: 12px;
  padding: 9px 10px;
  background: #fff8f1;
  font-size: 0.82rem;
  color: #6e635f;
  font-weight: 700;
}

.metric strong {
  margin-left: 6px;
  color: var(--ink);
  font-family: "Sora", sans-serif;
}

.settings-wrap {
  margin-top: 12px;
  border: 1px dashed #dfd0c1;
  border-radius: 14px;
  background: #fffbf6;
  padding: 9px 10px;
}

.settings-wrap > summary {
  cursor: pointer;
  font-weight: 700;
  color: #625a61;
}

.settings-wrap[open] {
  animation: fadeIn 220ms ease;
}

.form-grid {
  margin-top: 10px;
  display: grid;
  gap: 9px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkline {
  grid-column: 1 / -1;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid #dfd2c4;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #ea7a5e;
  box-shadow: 0 0 0 3px rgba(226, 95, 61, 0.16);
}

input[type="color"] {
  height: 42px;
  padding: 4px;
}

.btn {
  border: 1px solid #dfd2c6;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffefc, #fff7ef);
  color: var(--ink);
  font-weight: 700;
  padding: 9px 12px;
  cursor: pointer;
  transition:
    transform 180ms cubic-bezier(0.2, 1.25, 0.36, 1),
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 24px -22px rgba(24, 39, 64, 0.5);
}

.btn:active {
  transform: translateY(0) scale(0.99);
}

.btn.primary {
  border-color: #de6e50;
  color: #fff;
  background: linear-gradient(180deg, #e97758, var(--accent));
}

.btn.secondary {
  border-color: #268fa9;
  color: #fff;
  background: linear-gradient(180deg, #27a0bd, var(--accent-cyan));
}

.btn.ghost {
  background: #fff;
}

.btn.danger {
  border-color: #ebb8bf;
  color: var(--danger);
  background: #fff2f4;
}

.btn-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.feed-list {
  margin-top: 11px;
  display: grid;
  gap: 9px;
  max-height: 560px;
  overflow: auto;
  padding-right: 2px;
}

.feed-card {
  border: 1px solid #e0d3c4;
  border-left: 5px solid var(--feed-accent, var(--accent));
  border-radius: 14px;
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 7px;
  animation: riseBounce 560ms cubic-bezier(0.21, 1.14, 0.34, 1) both;
  animation-delay: calc(var(--stagger, 0) * 24ms);
  transition: transform 170ms cubic-bezier(0.2, 1.25, 0.36, 1), box-shadow 170ms ease;
}

.feed-card:hover {
  transform: translateY(-2px) rotate(-0.2deg);
  box-shadow: 0 16px 24px -24px rgba(24, 39, 64, 0.52);
}

.feed-card.active {
  border-color: #e7ad9c;
  box-shadow: 0 16px 24px -24px rgba(226, 95, 61, 0.55);
}

.feed-title {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 0.98rem;
}

.feed-url {
  margin: 3px 0 0;
  color: #7d7082;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.feed-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.feed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.feed-actions .btn {
  padding: 6px 9px;
  font-size: 0.8rem;
}

.explorer {
  display: grid;
  gap: 12px;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr auto;
  gap: 9px;
}

.article-stream {
  display: grid;
  gap: 10px;
}

.article-card {
  border: 1px solid #ded1c2;
  border-left: 6px solid var(--feed-accent, var(--accent));
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 9px;
  animation: riseBounce 640ms cubic-bezier(0.21, 1.14, 0.34, 1) both;
  animation-delay: calc(var(--stagger, 0) * 16ms);
  transition:
    transform 170ms cubic-bezier(0.2, 1.25, 0.36, 1),
    box-shadow 170ms ease,
    border-color 170ms ease;
}

.article-card:hover {
  transform: translateY(-2px) scale(1.005);
  border-color: #e2b19f;
  box-shadow: 0 18px 26px -24px rgba(24, 39, 64, 0.46);
}

.article-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.article-title {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1rem;
  line-height: 1.38;
}

.article-title a {
  color: var(--ink);
  text-decoration: none;
}

.article-title a:hover {
  color: var(--accent);
}

.source-pill {
  border: 1px solid #ddd0c2;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #5f5f78;
  white-space: nowrap;
}

.article-summary {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
  font-size: 0.9rem;
}

.article-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.article-meta {
  margin: 0;
  color: #716682;
  font-size: 0.78rem;
}

.empty {
  border: 1px dashed #dccfbe;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  font-weight: 700;
  color: #6f647f;
  background: #fff8f0;
}

@keyframes riseBounce {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sweep {
  0% {
    transform: translateX(-150%) rotate(-10deg);
  }
  100% {
    transform: translateX(160%) rotate(-10deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(15, 136, 166, 0.18);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(15, 136, 166, 0.03);
  }
}

@keyframes barBounce {
  0%,
  100% {
    transform: scaleY(0.75);
  }
  50% {
    transform: scaleY(1.25);
  }
}

@keyframes floatA {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-14px, 10px);
  }
}

@keyframes floatB {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(12px, -8px);
  }
}

@keyframes floatC {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-10px, 8px);
  }
}

@media (max-width: 980px) {
  .top-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .feed-list {
    max-height: none;
  }
}

@media (max-width: 700px) {
  #app {
    width: 96vw;
    margin-top: 14px;
  }

  .hero,
  .command,
  .feedbank,
  .explorer {
    padding: 14px;
    border-radius: 18px;
  }

  .hero::before {
    border-radius: 18px;
  }

  .stats-line {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
