:root {
  color-scheme: light;
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --surface: #f7f6f0;
  --panel: #fffef9;
  --ink: #1c2018;
  --muted: #545c4e;
  --green: #365526;
  --line: #d7d9cc;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0 auto;
  padding: 0 clamp(20px, 6vw, 64px);
  max-width: 1220px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 19px;
  font-weight: 750;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--green);
  border-radius: 50%;
  color: var(--green);
}

.brand-letter { border: 0; background: var(--green); color: white; font-size: 13px; font-weight: 800; }

.topbar-label, footer {
  color: var(--muted);
  font-size: 13px;
}

main {
  width: min(100%, 785px);
  margin: clamp(54px, 12vh, 140px) auto 56px;
}

.platforms {
  margin: 0 0 18px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

.platforms span { margin: 0 6px; }

h1 {
  margin: 0;
  font-size: clamp(40px, 7.4vw, 90px);
  line-height: 1.08;
  font-weight: 750;
  letter-spacing: -.065em;
}

h1 span { color: var(--green); }

.intro {
  margin: 24px 0 36px;
  color: var(--muted);
  line-height: 1.65;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 58px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

.primary {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  min-height: 52px;
  padding: 0 18px;
  border: none;
  border-radius: 6px;
  background: var(--green);
  color: white;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.primary:hover { background: #263d1a; }
.primary:disabled { opacity: .65; cursor: wait; }
.status { min-height: 22px; margin: 12px 0; color: var(--muted); font-size: 14px; }
.status.error { color: #952b22; }

.result {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.result img {
  width: min(30%, 160px);
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
}

.metadata { flex: 1; min-width: 0; }
.result-detail { margin: 0 0 6px; color: var(--green); font-size: 13px; }
h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }

footer {
  margin-top: auto;
  padding: 18px 0 26px;
  border-top: 1px solid var(--line);
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.support-note { margin: auto 0 0; padding: 18px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.6; }
footer { margin-top: 0; border-top: 0; }
.back-tools { color: var(--green); text-decoration: none; font-weight: 700; white-space: nowrap; }
.back-tools:hover { text-decoration: underline; }

.feedback-open {
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 2px 0;
  background: transparent;
  color: var(--green);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.footer-actions { display: inline-flex; align-items: center; gap: 18px; }
.admin-link { color: var(--muted); text-decoration: none; white-space: nowrap; }
.admin-link:hover { color: var(--green); text-decoration: underline; }

.admin-body { max-width: 1360px; }
.admin-main { width: min(100%, 1080px); margin: clamp(44px, 8vh, 90px) auto 60px; }
.admin-body { max-width: 1440px; }
.admin-main { width: 100%; }
.admin-shell { display:grid; grid-template-columns:220px minmax(0,1fr); gap:42px; align-items:start; }
.admin-sidebar { position:sticky; top:24px; min-height:calc(100vh - 150px); padding:22px; display:flex; flex-direction:column; justify-content:space-between; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
.sidebar-label { margin:0 0 14px; color:var(--muted); font-size:12px; font-weight:700; }
.admin-sidebar nav { display:grid; gap:7px; }
.menu-item { width:100%; padding:11px 12px; border:0; border-radius:5px; background:transparent; color:var(--muted); font:inherit; font-weight:700; text-align:left; cursor:pointer; }
.menu-item:hover, .menu-item.active { background:#e8ede3; color:var(--green); }
.sidebar-actions { display:grid; gap:8px; padding-top:22px; border-top:1px solid var(--line); }
.sidebar-actions button { border:0; padding:6px 0; background:transparent; color:var(--muted); font:inherit; font-size:13px; text-align:left; cursor:pointer; }
.sidebar-actions button:hover { color:var(--green); }
.admin-content { min-width:0; }
.login-panel { width: min(100%, 460px); margin: 0 auto; }
.admin-title { font-size: clamp(36px, 6vw, 64px); letter-spacing: -.05em; }
.login-panel label { margin-top: 18px; }
.admin-submit { width: 100%; }
.admin-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.admin-heading .platforms { margin-bottom: 8px; }
.admin-actions { display: flex; gap: 10px; }
.secondary { min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; }
.secondary:hover { border-color: var(--green); color: var(--green); }
.feedback-list { display: grid; gap: 12px; }
.feedback-card { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.feedback-card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.feedback-card-head strong { font-size: 18px; }
.feedback-state { padding: 4px 9px; border-radius: 999px; background: #ebece4; color: var(--muted); font-size: 12px; font-weight: 700; }
.state-new { background: #f7e9c8; color: #76520b; }
.state-reviewing { background: #dce9f2; color: #28546e; }
.state-resolved { background: #dcebd6; color: var(--green); }
.feedback-field { display: grid; grid-template-columns: 86px 1fr; gap: 12px; margin-top: 9px; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
.feedback-label { color: var(--ink); font-size: 13px; font-weight: 700; }
.feedback-message > :last-child { color: var(--ink); white-space: pre-wrap; }
.empty-state { padding: 70px 20px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }
.password-hint { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.metric-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:24px 0; }
.metric-card { padding:18px; display:flex; flex-direction:column; gap:8px; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
.metric-card span, .metric-card small { color:var(--muted); font-size:12px; }
.metric-card strong { color:var(--green); font-size:30px; line-height:1; }
.dashboard-block { margin-top:16px; padding:20px; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
.block-heading { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:17px; }
.block-heading h2 { font-size:18px; }
.block-heading span { color:var(--muted); font-size:12px; }
.tool-stats { display:grid; gap:9px; }
.tool-stat-row { padding:14px 0; display:flex; align-items:center; justify-content:space-between; gap:20px; border-top:1px solid var(--line); }
.tool-stat-row:first-child { border-top:0; }
.tool-stat-row > div:first-child { display:flex; flex-direction:column; gap:4px; }
.tool-stat-row > div:first-child span { color:var(--muted); font-size:12px; }
.tool-stat-row > div:last-child { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; }
.tool-stat-row > div:last-child span { padding:5px 8px; border-radius:4px; background:#edf0e9; color:var(--muted); font-size:12px; }
.trend-chart { height:190px; display:grid; grid-template-columns:repeat(7,1fr); gap:10px; align-items:end; padding-top:15px; }
.trend-column { height:100%; display:grid; grid-template-rows:1fr auto; gap:7px; text-align:center; }
.trend-bars { height:100%; display:flex; align-items:end; justify-content:center; gap:4px; border-bottom:1px solid var(--line); }
.bar { width:min(15px,35%); min-height:3px; border-radius:3px 3px 0 0; }
.bar.views { background:#b9c9af; }
.bar.successes { background:var(--green); }
.trend-column small { color:var(--muted); font-size:11px; }
.health-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.error-list { color:var(--muted); }
.error-row { display:flex; justify-content:space-between; gap:18px; padding:10px 0; border-top:1px solid var(--line); font-size:13px; }
.error-row:first-child { border-top:0; }
.error-row span { overflow-wrap:anywhere; }
.error-row strong { flex:none; color:#8a4b35; }
.log-filters { display:grid; grid-template-columns:repeat(5,minmax(125px,1fr)) auto; gap:9px; margin-bottom:16px; }
.log-filters select { min-height:42px; padding:0 10px; border:1px solid var(--line); border-radius:6px; background:white; color:var(--ink); font:inherit; }
.log-filters input { min-height:42px; padding:0 10px; border:1px solid var(--line); border-radius:6px; background:white; color:var(--ink); font:inherit; }
.log-table-wrap { overflow:auto; border:1px solid var(--line); border-radius:6px; }
.log-table { width:100%; min-width:1040px; border-collapse:collapse; font-size:12px; }
.log-table th, .log-table td { padding:10px 12px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
.log-table th { position:sticky; top:0; background:#edf0e9; color:var(--muted); white-space:nowrap; }
.log-table td:nth-child(3) { max-width:260px; overflow-wrap:anywhere; }
.log-pagination { display:flex; justify-content:flex-end; align-items:center; gap:12px; margin-top:13px; color:var(--muted); font-size:12px; }
.log-pagination button:disabled { opacity:.45; cursor:not-allowed; }

dialog {
  width: min(92vw, 560px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgb(28 32 24 / 24%);
}

dialog::backdrop { background: rgb(28 32 24 / 45%); }
.feedback-form { padding: 28px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.dialog-head .platforms { margin-bottom: 6px; }
.dialog-head h2 { font-size: 28px; }
.dialog-close { border: 0; padding: 0 4px; background: transparent; color: var(--muted); font-size: 30px; line-height: 1; cursor: pointer; }
.feedback-form label { margin-top: 17px; }
.feedback-form label span { color: var(--muted); font-size: 12px; font-weight: 400; }
.feedback-form select,
.feedback-form textarea,
.feedback-form input { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); font: inherit; }
.feedback-form select,
.feedback-form input { min-height: 48px; padding: 10px 12px; }
.feedback-form textarea { padding: 12px; resize: vertical; line-height: 1.55; }
.feedback-submit { width: 100%; margin-top: 6px; }
.honeypot { position: absolute; left: -10000px; width: 1px !important; height: 1px; opacity: 0; }

@media (max-width: 540px) {
  .fields { grid-template-columns: 1fr; }
  .result { flex-wrap: wrap; }
  .download { width: 100%; }
  footer { align-items: flex-start; }
  .feedback-form { padding: 22px; }
  .admin-heading { align-items: flex-start; flex-direction: column; }
  .admin-actions { width: 100%; }
  .admin-actions button { flex: 1; }
  .feedback-field { grid-template-columns: 1fr; gap: 2px; }
  .admin-shell { grid-template-columns:1fr; gap:22px; }
  .admin-sidebar { position:static; min-height:0; padding:12px; }
  .admin-sidebar nav { grid-template-columns:1fr 1fr; }
  .sidebar-actions { grid-template-columns:1fr 1fr; padding-top:12px; margin-top:12px; }
  .metric-grid { grid-template-columns:repeat(2,1fr); }
  .health-grid { grid-template-columns:repeat(2,1fr); }
  .log-filters { grid-template-columns:1fr; }
  .tool-stat-row { align-items:flex-start; flex-direction:column; }
  .tool-stat-row > div:last-child { justify-content:flex-start; }
}

@media (min-width:541px) and (max-width:900px) { .metric-grid { grid-template-columns:repeat(2,1fr); } }
