* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #101713;
  --bg-soft: #151d18;
  --panel: #18211c;
  --panel-strong: #1d2923;
  --line: #34443c;
  --line-bright: #587066;
  --text: #eef1ec;
  --muted: #aeb9b1;
  --soft: #7e8b84;
  --mint: #7ff7dc;
  --mint-soft: rgba(127, 247, 220, 0.13);
  --coral: #ff7a5c;
  --gold: #f0c15f;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 82% 4%, rgba(255, 122, 92, 0.14), transparent 32%),
    radial-gradient(circle at 9% 0%, rgba(127, 247, 220, 0.12), transparent 28%),
    linear-gradient(180deg, #101713 0%, #131c17 50%, #0e1411 100%);
  color: var(--text);
}

.site-header {
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(13, 25, 21, 0.94), rgba(27, 22, 20, 0.92)),
    var(--bg);
}

.header-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0 38px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--mint);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 760px;
  color: var(--text);
  font-size: clamp(48px, 9vw, 92px);
  line-height: 0.92;
}

.intro {
  max-width: 680px;
  margin: 20px 0 30px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.65;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(760px, 100%);
  min-height: 66px;
  padding: 8px 12px 8px 18px;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: rgba(12, 17, 15, 0.72);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.search-box:focus-within {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(127, 247, 220, 0.13), 0 24px 70px rgba(0, 0, 0, 0.24);
}

.search-box span {
  color: var(--mint);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-width: 0;
  padding: 14px 12px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-weight: 700;
}

input::placeholder {
  color: var(--soft);
  font-weight: 600;
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 64px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  color: var(--muted);
}

.toolbar p,
.toolbar span {
  margin: 0;
}

.toolbar p {
  color: var(--text);
  font-size: 21px;
  font-weight: 900;
}

.toolbar span {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 33, 28, 0.8);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

#news-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  min-height: 268px;
  flex-direction: column;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 42%),
    var(--panel);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card::before {
  content: "";
  height: 4px;
  margin: -22px -22px 18px;
  background: linear-gradient(90deg, var(--mint), var(--coral), var(--gold));
}

.card:hover {
  border-color: var(--line-bright);
  box-shadow: 0 26px 58px rgba(0, 0, 0, 0.28);
  transform: translateY(-4px);
}

.source {
  width: fit-content;
  margin-bottom: 16px;
  padding: 6px 9px;
  border: 1px solid rgba(127, 247, 220, 0.25);
  border-radius: 6px;
  background: var(--mint-soft);
  color: var(--mint);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.card h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1.28;
}

.card p {
  margin: 14px 0 22px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.card a {
  width: fit-content;
  margin-top: auto;
  color: var(--coral);
  font-weight: 900;
  text-decoration: none;
}

.card a:hover {
  color: #ff9b84;
  text-decoration: underline;
}

.state-message {
  grid-column: 1 / -1;
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed var(--line-bright);
  border-radius: 8px;
  background: rgba(15, 21, 18, 0.62);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.loader {
  width: 34px;
  height: 34px;
  border: 4px solid var(--line);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 38px 0 28px;
  }

  h1 {
    font-size: 48px;
  }

  .intro {
    font-size: 16px;
  }

  .search-box {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
  }

  input {
    padding: 8px 0;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
