:root {
  color-scheme: light;
  --bg: #eef3f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --border: #d9e0e7;
  --soft-border: #e6ebf1;
  --blue: #0057b8;
  --black: #111827;
  --green: #047857;
  --amber: #a16207;
  --red: #b42318;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f8fbff 0, var(--bg) 280px),
    var(--bg);
  color: var(--text);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 18px 34px;
  background:
    radial-gradient(circle at 88% 8%, rgba(89, 153, 255, 0.42), transparent 34%),
    linear-gradient(135deg, #0b1324 0%, #0c356d 58%, #0057b8 100%);
  color: white;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.8;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

main {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 16px 12px 28px;
}

.back-button,
.chip,
.refresh-button {
  border: 1px solid var(--soft-border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.club-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background:
    linear-gradient(#07111f, #07111f) padding-box,
    conic-gradient(from 28deg, #0072ce 0 25%, #08111f 25% 50%, #0072ce 50% 75%, #08111f 75% 100%) border-box;
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.1),
    0 12px 28px rgba(0, 0, 0, 0.24);
}

.club-mark::after {
  position: absolute;
  inset: 7px;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: inherit;
}

.club-mark span {
  position: relative;
  z-index: 1;
  color: white;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: -34px 0 14px;
}

.chip {
  display: grid;
  place-items: center;
  min-height: 58px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
}

.chip span {
  font-size: 15px;
}

.chip small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.chip.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.chip.active small {
  color: rgba(255, 255, 255, 0.82);
}

.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 2px 10px;
}

.status {
  min-width: 0;
  min-height: 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.admin-panel {
  display: grid;
  gap: 7px;
  margin: 0 2px 12px;
  padding: 10px;
  border: 1px solid #d6e2f0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.admin-panel label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.admin-token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.admin-token-row input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--soft-border);
  border-radius: 8px;
  color: var(--text);
  background: white;
  font: inherit;
  font-size: 13px;
}

.admin-token-row button {
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--black);
  border-radius: 8px;
  background: var(--black);
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.admin-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.refresh-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #0b4ea2;
  background: rgba(255, 255, 255, 0.78);
  border-color: #d6e2f0;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.07);
  -webkit-tap-highlight-color: transparent;
}

.refresh-button:active {
  transform: translateY(1px);
}

.refresh-button svg,
.back-button svg,
.copy-link-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.refresh-button:disabled {
  cursor: progress;
  opacity: 0.75;
}

.refresh-button.is-loading svg {
  animation: spin 0.9s linear infinite;
}

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

.article-list {
  display: grid;
  gap: 12px;
}

.article-card {
  display: block;
  width: 100%;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--soft-border);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-image,
.detail-image {
  display: block;
  width: 100%;
  object-fit: cover;
  background: #e4e7ec;
}

.card-image {
  height: 160px;
  margin: -14px -14px 12px;
  width: calc(100% + 28px);
  border-radius: 8px 8px 0 0;
}

.article-card h2 {
  margin: 8px 0;
  font-size: 18px;
  line-height: 1.35;
}

.summary {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #3d4a5c;
  font-size: 15px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.meta,
.tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1849a9;
  font-size: 12px;
  font-weight: 700;
}

.relevance {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.relevance-high {
  background: #ecfdf3;
  color: var(--green);
}

.relevance-mid {
  background: #eef4ff;
  color: #1849a9;
}

.relevance-low {
  background: #fffaeb;
  color: var(--amber);
}

.score-high {
  background: #ecfdf3;
  color: var(--green);
}

.score-mid {
  background: #fffaeb;
  color: var(--amber);
}

.score-low {
  background: #fef3f2;
  color: var(--red);
}

.hidden {
  display: none;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  padding: 10px 13px 10px 10px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.08);
}

.detail {
  padding: 16px;
  border: 1px solid var(--soft-border);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.detail-image {
  max-height: 360px;
  margin: -16px -16px 16px;
  width: calc(100% + 32px);
  aspect-ratio: 16 / 9;
  border-radius: 8px 8px 0 0;
}

.detail h2 {
  margin: 10px 0 14px;
  font-size: 25px;
  line-height: 1.3;
}

.detail > p {
  margin: 0;
  color: #263241;
  font-size: 17px;
  line-height: 1.85;
}

.detail-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--soft-border);
}

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.detail p {
  line-height: 1.7;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--soft-border);
}

.source-link,
.copy-link-button,
.delete-article-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 36px;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 750;
}

.source-link {
  border: 1px solid var(--black);
  background: var(--black);
  color: #fff;
  text-decoration: none;
}

.copy-link-button {
  gap: 6px;
  border: 1px solid #d6e2f0;
  background: #f8fbff;
  color: #0b4ea2;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.copy-link-button:active {
  transform: translateY(1px);
}

.copy-link-button.is-copied {
  border-color: #abefc6;
  background: #ecfdf3;
  color: var(--green);
}

.delete-article-button {
  border: 1px solid #fecdca;
  background: #fff8f7;
  color: var(--red);
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.delete-article-button:disabled {
  cursor: progress;
  opacity: 0.75;
}

.delete-article-button:active {
  transform: translateY(1px);
}

.copy-fallback {
  display: grid;
  flex: 1 0 100%;
  gap: 7px;
  margin-top: 2px;
  padding: 9px;
  border: 1px solid #d6e2f0;
  border-radius: 8px;
  background: #f8fbff;
}

.copy-fallback p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.copy-fallback input {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--soft-border);
  border-radius: 7px;
  color: #334155;
  background: white;
  font: inherit;
  font-size: 12px;
}

@media (min-width: 640px) {
  .topbar {
    padding-inline: calc((100vw - 760px) / 2 + 16px);
  }

  main {
    padding-inline: 16px;
  }
}
