:root {
  color-scheme: light;
  --paper: #ffffff;
  --line: #d8d8d8;
  --line-soft: #ececec;
  --text: #202124;
  --muted: #5f6368;
  --blue: #1a0dab;
  --link: #1a0dab;
  --cyan: #007f9e;
  --magenta: #b01568;
  --sense-red: #c5221f;
  --green: #137333;
  --gold: #8a6518;
  --danger: #b3261e;
  --focus: #1a73e8;
  --hit: #fff2a8;
  --target: #ffe082;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  line-height: 1.4;
}

input {
  font: inherit;
  color: inherit;
}

input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.search-zone {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 16px 16px 8px;
}

#app[data-mode="home"] .search-zone {
  padding-top: 22vh;
}

.brand {
  font-family: serif;
  font-size: 56px;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  user-select: none;
}

.brand sup {
  font-size: 0.55em;
  font-weight: 800;
  vertical-align: super;
  line-height: 0;
  color: var(--sense-red);
}

#app[data-mode="article"] .brand {
  font-size: 22px;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 560px;
}

#query {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  outline: none;
}

#suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 4;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--paper);
  max-height: 60vh;
  overflow-y: auto;
}

.suggestion {
  padding: 5px 10px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion:hover,
.suggestion[aria-selected="true"] {
  background: var(--line-soft);
}

.suggestion-empty {
  padding: 6px 10px;
  color: var(--muted);
}

.status {
  min-height: 1em;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  width: 100%;
  max-width: 560px;
}

.status[data-tone="error"] {
  color: var(--danger);
}

#app[data-mode="home"] .status {
  visibility: hidden;
}

.article-zone {
  min-width: 0;
  padding: 0 16px 32px;
}

#app:not([data-has-article="true"]) .article-zone {
  display: none;
}

.article-header {
  max-width: 760px;
  margin: 0 auto 8px;
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--line-soft);
}

.article-header h1 {
  margin: 0;
  font-weight: 400;
}

.article-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.article-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 0 24px;
  overflow-wrap: break-word;
  word-break: normal;
}

.article-body br {
  display: block;
  margin: 7px 0 0;
  content: "";
}

.article-body br:has(+ .sense-number),
.article-body br:has(+ .record-anchor + .sense-number) {
  margin-top: 16px;
}

.tag-hw {
  color: var(--blue);
  font-weight: 700;
}

.tag-hm {
  color: var(--sense-red);
  font-size: 0.65em;
  font-style: normal;
  font-weight: 800;
  line-height: 0;
  vertical-align: super;
}

.tag-in {
  font-size: 0.75em;
  vertical-align: sub;
  line-height: 0;
}

.tag-su {
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
}

.oed-table {
  display: block;
  margin: 8px 0;
  border-collapse: collapse;
}

.oed-table td {
  padding: 1px 18px 1px 0;
  vertical-align: baseline;
}

.tag-pi,
.tag-fr {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  font-size: 0.85em;
  margin: 0 0.15em;
  line-height: 1.1;
}

.tag-nu {
  display: block;
  border-bottom: 1px solid currentColor;
  padding: 0 0.25em;
}

.tag-dn {
  display: block;
  padding: 0 0.25em;
}

.tag-ph {
  color: var(--cyan);
}

.tag-ps {
  color: var(--magenta);
  font-style: italic;
}

.tag-cf,
.tag-vd,
.tag-ve,
.tag-il,
.tag-i {
  font-style: italic;
}

.tag-vf {
  color: var(--green);
  font-weight: 700;
}

.tag-vfl {
  font-style: normal;
}

.tag-la,
.tag-pt {
  color: var(--magenta);
}

.tag-bl {
  font-weight: 700;
}

.tag-sub .tag-bl,
.query-hit {
  color: var(--blue);
  font-weight: 800;
}

.query-hit {
  background: var(--hit);
  padding: 0 1px;
}

.tag-x,
.tag-xid {
  color: inherit;
  font-variant-caps: small-caps;
  font-weight: 650;
}

.ref-link {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
  cursor: pointer;
}

.ref-link:hover {
  text-decoration-thickness: 2px;
}

.tag-xs {
  color: var(--cyan);
}

.tag-q,
.tag-qt,
.tag-w,
.tag-bib,
.tag-qd,
.tag-lc {
  color: var(--blue);
}

.tag-qd {
  font-weight: 800;
}

.tag-a {
  color: var(--blue);
  font-variant-caps: small-caps;
}

.tag-w {
  font-style: italic;
}

.tag-gr {
  color: var(--sense-red);
  font-style: italic;
  font-weight: 700;
}

.tag-gk {
  color: var(--gold);
  font-style: italic;
}

.tag-b {
  font-weight: 700;
}

.sense-number {
  color: var(--sense-red);
  font-weight: 800;
}

.record-anchor {
  display: inline;
  font-size: 0;
  line-height: 0;
  opacity: 0;
}

.record-anchor.target-record {
  display: inline-block;
  width: 0;
  height: 0;
  position: relative;
}

.record-anchor.target-record::before {
  content: "";
  position: absolute;
  left: -10px;
  top: -2px;
  width: 4px;
  height: 1.4em;
  background: var(--target);
  animation: target-flash 1.6s ease-out;
}

@keyframes target-flash {
  0% { background: var(--sense-red); }
  60% { background: var(--sense-red); }
  100% { background: var(--target); }
}

#download-card {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.95);
  padding: 24px;
  z-index: 10;
  text-align: center;
}

#download-card[hidden] {
  display: none;
}

#download-card h2 {
  margin: 0;
  font-weight: 400;
  font-size: 22px;
}

#download-card p {
  margin: 0;
  max-width: 480px;
  color: var(--muted);
  line-height: 1.5;
}

#download-progress {
  width: min(480px, 80vw);
  height: 8px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  overflow: hidden;
}

#download-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--blue);
  transition: width 200ms linear;
}

#download-progress-text {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#app[data-loading="true"] .search-zone,
#app[data-loading="true"] .article-zone {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

@media (max-width: 700px) {
  #app[data-mode="home"] .search-zone {
    padding-top: 14vh;
  }

  .brand {
    font-size: 44px;
  }

  #app[data-mode="article"] .brand {
    font-size: 20px;
  }
}
