@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
  --bg: #f3efe5;
  --panel: #fffdf7;
  --ink: #22211f;
  --muted: #6f675c;
  --line: #d8cfbe;
  --accent: #0f766e;
  --accent-soft: #d7f3ee;
  --warn: #8f4e1f;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(38, 34, 27, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 10%, #fbe6b8 0 20%, transparent 21%),
    radial-gradient(circle at 15% 0%, #cbe9de 0 24%, transparent 25%),
    var(--bg);
}

.app {
  max-width: 1240px;
  margin: 28px auto;
  padding: 18px;
}

.hero {
  position: relative;
  background: linear-gradient(135deg, #fff8e9, #ffffff 35%, #ecfaf6);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 24px;
}

.hero-meta {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 11px;
  color: #2d2b27;
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.github-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(38, 34, 27, 0.12);
}

.github-link svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

.title {
  margin: 0 0 6px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(24px, 3.2vw, 38px);
  letter-spacing: 0;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-usage {
  margin-top: 14px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-usage-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.notice-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.controls {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.torrent-dropzone {
  border: 2px dashed #b8b09f;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f7fbfa);
  padding: 18px;
  min-height: 132px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.torrent-dropzone:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 12px 22px rgba(15, 118, 110, 0.12);
}

.torrent-dropzone.is-dragover {
  border-color: var(--accent);
  background: linear-gradient(180deg, #f6fffd, #eaf8f4);
  box-shadow: 0 14px 26px rgba(15, 118, 110, 0.16);
}

.dropzone-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #2a2925;
}

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

#path-input {
  width: 100%;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

#parse-btn {
  width: fit-content;
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

#parse-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.25);
}

.chip-list {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sample-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 11px;
  max-width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.layout {
  margin-top: 16px;
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1fr);
}

.result-panel {
  grid-area: auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.filename {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #3d3a35;
  word-break: break-all;
}

.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #0f5a54;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.field-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 3px;
}

.field-value {
  font-size: 15px;
  font-weight: 600;
  color: #2e2b26;
  word-break: break-word;
}

.field-value.is-empty {
  color: #9a9186;
  font-weight: 400;
}

.panel-title {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
}

.result-toolbar {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 10px;
}

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

.toolbar-field {
  display: grid;
  gap: 6px;
}

.toolbar-field-sm {
  min-width: 120px;
}

.toolbar-input,
.toolbar-select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  padding: 8px 10px;
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

.toolbar-input:focus,
.toolbar-select:focus {
  outline: 2px solid rgba(15, 118, 110, 0.22);
  outline-offset: 1px;
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pager-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #2e2b26;
  cursor: pointer;
  padding: 6px 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 600;
}

.pager-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: #0f5a54;
}

.pager-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.page-summary,
.page-info {
  margin: 0;
  color: #4f4a42;
  font-size: 13px;
}

.page-info {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.table-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  background: #fff;
}

.result-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

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

.result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f7f2;
  color: #3f3a31;
  font-family: "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0;
  white-space: nowrap;
}

.result-table tr:last-child td {
  border-bottom: 0;
}

.result-table td.path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  min-width: 280px;
  max-width: 480px;
  word-break: break-all;
}

.result-table td.confidence {
  white-space: nowrap;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: #0f5a54;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 9px 10px;
  display: grid;
  gap: 8px;
}

.history-link {
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: #2f2d29;
  padding: 0;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-all;
}

.history-score {
  justify-self: start;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff4dc;
  color: var(--warn);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
}

@media (max-width: 900px) {
  .hero-usage {
    grid-template-columns: 1fr;
  }

  .result-toolbar-row {
    grid-template-columns: 1fr;
  }

  .toolbar-field-sm {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .app {
    margin: 16px auto;
    padding: 10px;
  }

  .hero,
  .panel {
    padding: 14px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}
