/* SPDX-License-Identifier: CC0-1.0 */
:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1d2321;
  --muted: #69716d;
  --line: #e2e0d8;
  --accent: #2f6f5e;
  --accent-soft: #e3efe9;
  --osb: #8a4b0f;
  --osm: #1f5c99;
  --warn: #9a6a00;
  --warn-soft: #fbf1d9;
  --pin: #f3f7f5;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816;
    --panel: #1c211f;
    --ink: #e6ebe8;
    --muted: #94a09a;
    --line: #2d3532;
    --accent: #6cc3a8;
    --accent-soft: #1f3a32;
    --osb: #e3a462;
    --osm: #79b2ec;
    --warn: #e6c063;
    --warn-soft: #3a3220;
    --pin: #202925;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* Header */
.top {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 52px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.brand { font-weight: 700; font-size: 18px; color: var(--ink); letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }
.top nav { display: flex; gap: 4px; }
.top nav a {
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 500;
}
.top nav a:hover { text-decoration: none; color: var(--ink); background: var(--bg); }
.top nav a.on { color: var(--accent); background: var(--accent-soft); }

.view { flex: 1; min-height: 0; }

/* Inputs */
input[type=search], select {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
}
input[type=search]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.filters button {
  font: inherit;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}
.filters button.on { background: var(--accent); border-color: var(--accent); color: var(--panel); }

/* Tags view */
.tags-view { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
.search { padding: 14px 14px 8px; border-bottom: 1px solid var(--line); min-width: 0; }
.list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; flex: 1; }
.list li { padding: 7px 14px; cursor: pointer; border-left: 3px solid transparent; }
.list li:hover { background: var(--bg); }
.list li.on { background: var(--accent-soft); border-left-color: var(--accent); }
.list .t { font-family: var(--mono); font-size: 13.5px; word-break: break-all; }
.list .t .eq { color: var(--muted); }
.list .sub { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.list .sub .en { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub .n { flex: none; font-variant-numeric: tabular-nums; }
.list .more { color: var(--muted); font-size: 13px; cursor: default; }
.list .more:hover { background: none; }

.detail { overflow-y: auto; padding: 28px 32px 48px; min-width: 0; }
.empty { max-width: 640px; }
.empty h1 { font-size: 26px; margin: 8px 0 12px; letter-spacing: -0.01em; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; min-width: 130px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

.d-head h1 { font-family: var(--mono); font-size: 24px; margin: 0; font-weight: 600; word-break: break-all; }
.d-head h1 .eq, .d-head h1 .plus { color: var(--muted); }
.list .t .plus, .grid .tagcell .plus { color: var(--muted); }
.d-head .en { font-size: 17px; color: var(--muted); margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
}
.chip b { font-weight: 600; color: var(--muted); }
.chip.osb b { color: var(--osb); }
.chip.osm b { color: var(--osm); }
.links { font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 18px; }

.d-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; }
.d-tools input { max-width: 260px; }
.d-tools label { font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table.grid { border-collapse: collapse; width: 100%; }
.grid th, .grid td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tr:last-child td { border-bottom: none; }
.grid th {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
  font-weight: 600; background: var(--panel); position: sticky; top: 0; z-index: 1;
}
.grid th.osb { color: var(--osb); }
.grid th.osm { color: var(--osm); }
.grid td.lang { white-space: nowrap; width: 1%; }
#detail .grid td.lang { cursor: pointer; }
.grid td.lang .code { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: 6px; }
.grid td.lang .native { display: block; font-size: 12.5px; color: var(--muted); }
.grid tr.pinned td { background: var(--pin); }
.grid tr.pinned td.lang { box-shadow: inset 3px 0 0 var(--accent); }
.grid td.none { color: var(--muted); }
/* "translate" link: shown on row hover, for missing and for existing translations */
.grid td a.fix { font-size: 12.5px; opacity: 0; white-space: nowrap; }
.grid tr:hover td a.fix, .grid td a.fix:focus { opacity: 1; }
@media (hover: none) { .grid td a.fix { opacity: 1; } }
.grid td.diff { background: var(--warn-soft); }
.grid td.same .t::after { content: " ="; color: var(--muted); font-size: 12px; }
.grid .tagcell { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.grid .tagcell a { color: var(--ink); }

/* Language view */
.lang-view { overflow-y: auto; padding: 20px 32px 48px; }
.lang-head { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; margin-bottom: 8px; }
.lang-head label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.lang-head select { min-width: 260px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.lang-head input { max-width: 280px; }
.lang-head .filters { margin: 0 0 4px; }
#lang-summary { margin: 4px 0 12px; }
.lang-table td.en { color: var(--muted); }

/* About */
.about-view { overflow-y: auto; padding: 28px 32px 48px; }
#about { max-width: 760px; }
#about h1 { font-size: 24px; margin-top: 0; }
#about h2 { font-size: 17px; margin-top: 28px; }
#about pre { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 13px; }
#about table.grid { font-size: 13.5px; }

@media (max-width: 760px) {
  .top { gap: 12px; padding: 0 16px; }
  .top nav a { padding: 6px 8px; }
  .tags-view { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); max-height: 42vh; }
  .detail, .lang-view, .about-view { padding: 18px 16px 40px; }
  .tags-view.has-detail .sidebar { max-height: 30vh; }
  .grid th, .grid td { padding: 6px 8px; }
}
