:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --ink: #1b1a17;
  --muted: #6b6257;
  --line: #d8cfc0;
  --card: #fffdf7;
  --accent: #b33d2e;
  --accent-2: #225f7a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: #fffaf0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.1;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

button {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 18px;
  border: 1px solid #9f2f25;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font: inherit;
  cursor: pointer;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.status {
  min-height: 22px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.comic-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.poster-link {
  display: block;
  background: #e8decf;
}

.poster {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
}

.meta {
  padding: 14px;
}

.meta h2 {
  font-size: 17px;
  line-height: 1.35;
}

.meta p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.source {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent-2);
  text-decoration: none;
  font-size: 14px;
}

.source:hover {
  text-decoration: underline;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

input {
  min-width: 0;
  flex: 1;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.check-row input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

pre {
  overflow: auto;
  margin: 16px 0 0;
  min-height: 160px;
  padding: 12px;
  border-radius: 6px;
  background: #241c16;
  color: #fffdf7;
  font-size: 13px;
  line-height: 1.55;
}

.contact-main {
  width: min(760px, calc(100% - 32px));
}

.contact-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: clamp(18px, 4vw, 32px);
}

.contact-form {
  display: grid;
  gap: 18px;
}

.contact-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

textarea {
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
}

.form-status {
  min-height: 22px;
  color: var(--muted);
}

.form-status[data-state="ok"] {
  color: #2e6a4f;
}

.form-status[data-state="error"] {
  color: var(--accent);
}

.admin-messages {
  margin-top: 18px;
}

.messages-table-wrap {
  overflow: auto;
  margin-top: 14px;
  min-height: 80px;
  color: var(--muted);
}

.messages-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: var(--ink);
  font-size: 13px;
}

.messages-table th,
.messages-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.messages-table th {
  background: #fff7e8;
  color: var(--muted);
  font-weight: 800;
}

.message-cell {
  max-width: 360px;
  white-space: normal;
  line-height: 1.55;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.stats-row span {
  display: block;
  padding: 10px;
  border-radius: 6px;
  background: #fff7e8;
  color: var(--ink);
  font-weight: 800;
}

.table-title {
  margin: 16px 0 8px;
  font-size: 16px;
}
