:root {
  --bg: #0f1117;
  --surface: #181b24;
  --surface-2: #1f2430;
  --border: #2a3142;
  --text: #e8eaef;
  --text-muted: #9aa3b5;
  --accent-ae: #f59e0b;
  --accent-awb: #60a5fa;
  --accent-g: #34d399;
  --accent-l: #a78bfa;
  --radius: 10px;
  --font: "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.hero h1 {
  margin: 0 0 0.2rem;
  font-size: 1.5rem;
  font-weight: 650;
}

.hero .subtitle {
  margin: 0 0 0.65rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.hero .intro {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.hero .intro strong {
  color: var(--text);
  font-weight: 600;
}

.panel { margin-top: 2rem; }

.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.hint {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

@media (min-width: 560px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
}

.card h4 {
  margin: 0 0 0.3rem;
  font-size: 0.88rem;
}

.card p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.filters input,
.filters select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

.filters input { flex: 1; }

.module-block {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.module-header.ae .module-tag {
  color: var(--accent-ae);
  border-color: color-mix(in srgb, var(--accent-ae) 35%, transparent);
  background: color-mix(in srgb, var(--accent-ae) 12%, transparent);
}

.module-header.awb .module-tag {
  color: var(--accent-awb);
  border-color: color-mix(in srgb, var(--accent-awb) 35%, transparent);
  background: color-mix(in srgb, var(--accent-awb) 12%, transparent);
}

.module-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.tag-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.tag-table th,
.tag-table td {
  text-align: left;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tag-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
}

.tag-table tr:last-child td { border-bottom: none; }

.tag-name { font-weight: 500; }

.tonal-hint {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent-l);
  background: color-mix(in srgb, var(--accent-l) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-l) 25%, transparent);
  vertical-align: middle;
}

.tag-scope { width: 4.5rem; }

.scope-badges {
  display: inline-flex;
  gap: 0.25rem;
}

.scope-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 700;
}

.scope-badge--g {
  color: var(--accent-g);
  background: color-mix(in srgb, var(--accent-g) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-g) 30%, transparent);
}

.scope-badge--l {
  color: var(--accent-l);
  background: color-mix(in srgb, var(--accent-l) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-l) 30%, transparent);
}

.tag-ref { width: 4.5rem; }

.ref-gallery { display: flex; gap: 0.3rem; }

.ref-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.ref-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: var(--text-muted);
}

.error { color: #f87171; }

.where-group {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.where-group-title {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.where-group-hint {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.where-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.where-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-l);
  background: color-mix(in srgb, var(--accent-l) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-l) 22%, transparent);
}

.where-cat {
  font-size: 0.62rem;
  font-weight: 700;
  opacity: 0.75;
}
