:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #18202a;
  --muted: #667085;
  --line: #d9e0e7;
  --blue: #2563eb;
  --green: #15803d;
  --red: #b42318;
  --amber: #b76e00;
  --shadow: 0 10px 30px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.topbar {
  min-height: 96px;
  padding: 22px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #111827;
  color: #fff;
}

.eyebrow {
  margin: 0 0 4px;
  color: #a7f3d0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 17px;
}

h3 {
  margin-bottom: 10px;
  font-size: 21px;
  line-height: 1.35;
  letter-spacing: 0;
}

.top-actions,
.button-row,
.toolbar,
.meta-line,
.card-actions,
.script-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-picker {
  display: grid;
  gap: 5px;
  color: #d1d5db;
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 22px;
  padding: 22px;
  max-width: 1480px;
  margin: 0 auto;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel,
.news-card,
.toolbar,
.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.toolbar {
  justify-content: space-between;
  padding: 18px 20px;
  margin-bottom: 14px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.identity {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 6px;
  font-size: 13px;
  color: #344054;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.2);
  border-color: var(--blue);
}

.btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1f2937;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}

.btn:hover {
  border-color: #94a3b8;
}

.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn.ghost {
  background: #f8fafc;
}

.btn.danger {
  background: #fff5f5;
  border-color: #f1b4ad;
  color: var(--red);
}

.btn.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.btn.tiny {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.news-list {
  display: grid;
  gap: 14px;
}

.news-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  padding: 0;
  overflow: hidden;
}

.rank-block {
  background: #f8fafc;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 12px;
}

.rank {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
}

.vote-btn {
  width: 54px;
  height: 38px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  cursor: pointer;
}

.vote-btn.voted {
  background: #ecfdf3;
  border-color: #86efac;
  color: var(--green);
}

.score-line {
  color: var(--muted);
  font-size: 13px;
}

.news-main {
  padding: 18px 20px 20px;
}

.meta-line {
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  color: #7c2d12;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 4px 8px;
}

.edition {
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 4px 8px;
}

.abstract {
  color: #344054;
  line-height: 1.65;
  margin-bottom: 10px;
}

.points {
  margin: 0 0 14px 18px;
  padding: 0;
  color: #475467;
  line-height: 1.55;
}

.card-actions {
  flex-wrap: wrap;
}

.source-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.source-link.disabled {
  pointer-events: none;
  color: #98a2b3;
}

.script-box {
  margin-top: 14px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.script-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.script-version {
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.script-head {
  justify-content: space-between;
  color: #475467;
  font-size: 13px;
  margin-bottom: 10px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  line-height: 1.65;
  color: #1f2937;
}

.image-prompt {
  margin: 12px 0;
  padding: 12px;
  border-left: 4px solid var(--amber);
  background: #fffbeb;
  color: #3f3a2f;
}

.image-prompt p {
  margin: 6px 0 0;
  line-height: 1.55;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .topbar,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    padding: 18px 16px;
    gap: 14px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 16px;
  }

  h3 {
    font-size: 18px;
  }

  .layout {
    display: flex;
    flex-direction: column;
    padding: 14px;
    gap: 14px;
  }

  .content {
    order: 1;
  }

  .side-panel {
    order: 2;
  }

  .news-card {
    grid-template-columns: 1fr;
  }

  .rank-block {
    grid-template-columns: auto auto 1fr;
    width: 100%;
    justify-items: start;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }

  .rank {
    font-size: 20px;
  }

  .score-line {
    justify-self: end;
  }

  .news-main {
    padding: 15px;
  }

  .meta-line {
    gap: 7px;
  }

  .abstract,
  .points {
    font-size: 14px;
  }

  .card-actions {
    align-items: stretch;
  }

  .card-actions .btn,
  .card-actions .source-link {
    flex: 1 1 100%;
    text-align: center;
  }

  .source-link {
    min-height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
  }

  .script-box {
    margin-left: -15px;
    margin-right: -15px;
    padding: 12px 15px;
  }

  .script-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 560px) {
  .top-actions,
  .button-row {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .date-picker {
    width: 100%;
  }

  .toolbar {
    padding: 15px;
  }

  .toolbar select {
    width: 100%;
  }

  .panel {
    padding: 15px;
  }

  .news-list {
    gap: 12px;
  }

  .vote-btn {
    width: 58px;
  }

  .script-version {
    padding: 12px;
  }

  pre {
    font-size: 14px;
    line-height: 1.7;
  }
}
