:root {
  --text:             #111111;
  --muted:            #666666;
  --hairline:         #e5e5e5;
  --dot-active:       #22c55e;
  --dot-quiet:        #f59e0b;
  --dot-inactive:     #9ca3af;
  --dot-external:     #60a5fa;
  --pill-active-bg:   #111111;
  --pill-active-text: #ffffff;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: #ffffff;
  max-width: 960px;
  margin: 0 auto;
  padding: 52px 24px 96px;
}

/* ── Header ── */

.site-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.site-nav {
  display: flex;
  gap: 16px;
  font-size: 12px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

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

/* ── Controls ── */

.controls {
  margin-top: 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pills {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pill-group {
  display: flex;
  gap: 4px;
}

.pill {
  padding: 3px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  background: none;
  color: var(--text);
  user-select: none;
  transition: border-color 0.1s;
}


.pill:hover:not(.selected) {
  border-color: #aaaaaa;
}

.pill.selected {
  background: var(--pill-active-bg);
  color: var(--pill-active-text);
  border-color: var(--pill-active-bg);
}

.sub-pills {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
}

.sub-pills.visible {
  display: flex;
  justify-content: center;
}

.sub-pill {
  font-size: 11px;
  padding: 2px 8px;
  color: var(--muted);
  border-color: var(--hairline);
}

.sub-pill.selected {
  background: var(--pill-active-bg);
  color: var(--pill-active-text);
  border-color: var(--pill-active-bg);
}

/* ── About page ── */

.about-body {
  margin-top: 32px;
  max-width: 560px;
}

.about-body p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 20px;
}

.about-body a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.search {
  width: 240px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  outline: none;
  color: var(--text);
  margin-top: 22px;
  margin-bottom: 12px;
}

.search:focus {
  border-color: #aaaaaa;
}

/* ── Meta bar ── */

.meta {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.meta-left,
.meta-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meta-sep {
  color: var(--hairline);
}

.meta-link {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Table ── */

.tool-table {
  margin-top: 28px;
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tool-table th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--text);
}

.tool-table th:first-child {
  width: 24px;
  padding-right: 0;
}

.tool-table td {
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}

.tool-table td:first-child {
  padding-right: 0;
}

.section-header td {
  padding-top: 28px;
  padding-bottom: 6px;
  padding-right: 0;
  border-bottom: 1px solid var(--text);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-header:first-child td {
  padding-top: 12px;
}

.tool-table tr.inactive td {
  opacity: 0.5;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot-active    { background: var(--dot-active); }
.dot-quiet     { background: var(--dot-quiet); }
.dot-inactive  { background: var(--dot-inactive); }
.dot-external  { background: var(--dot-external); }

.tool-name a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.tool-name a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}


.col-date {
  display: none;
}

.tool-table.show-dates .col-date {
  display: table-cell;
}

.tool-desc,
.tool-stage,
.tool-lang,
.tool-modality {
  color: var(--muted);
}

.tool-stage,
.tool-lang,
.tool-modality,
.col-date {
  white-space: nowrap;
}

.col-date {
  color: var(--muted);
  font-size: 12px;
}

.lang-th,
.modality-th {
  position: relative;
}

.lang-header-btn,
.modality-header-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
}

.lang-header-btn:hover,
.lang-header-btn.lang-header-active,
.modality-header-btn:hover,
.modality-header-btn.modality-header-active {
  color: var(--text);
}

.lang-dropdown,
.modality-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  z-index: 100;
  min-width: 130px;
  flex-direction: column;
  padding: 4px 0;
}

.lang-dropdown.open,
.modality-dropdown.open {
  display: flex;
}

.lang-option,
.modality-option {
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 5px 12px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.lang-option:hover,
.modality-option:hover {
  color: var(--text);
  background: var(--hairline);
}

.lang-option.selected,
.modality-option.selected {
  color: var(--text);
  font-weight: 500;
}

#lang-tag {
  font-size: 12px;
  color: var(--muted);
}

.lang-clear {
  font-family: inherit;
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}

/* ── Suggest form ── */

.suggest-form {
  margin-top: 36px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.tool-hint {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
  min-height: 1em;
}

.tool-hint a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.field input,
.field textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  padding: 7px 8px;
  outline: none;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: #aaaaaa;
}

.submit-btn {
  align-self: flex-start;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 16px;
  border: 1px solid var(--text);
  border-radius: 2px;
  background: var(--text);
  color: #fff;
  cursor: pointer;
}

.submit-btn:hover {
  background: #333;
  border-color: #333;
}

.footer {
  margin-top: 52px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
}

.footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hidden { display: none !important; }

/* ── Mobile ── */

@media (max-width: 640px) {
  body {
    padding: 32px 16px 64px;
  }

  .site-nav {
    gap: 10px;
  }

  .controls {
    margin-top: 52px;
    gap: 14px;
  }

  .pills {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }

  .pill-group {
    flex-wrap: wrap;
  }

  .sub-pills.visible {
    justify-content: flex-start;
  }

  .search {
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
  }

  .meta {
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }

  .meta-right {
    display: none;
  }

  .meta-left {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Hide language and modality columns — keep dot, tool name, description */
  .lang-th,
  .tool-lang,
  .modality-th,
  .tool-modality {
    display: none;
  }

  .tool-desc {
    font-size: 12px;
  }

  .tool-table th,
  .tool-table td {
    padding-right: 8px;
  }
}
