/* The language sites: plain and readable, until their makeover. */
:root {
  --paper: #faf8f4;
  --card: #fffdf9;
  --ink: #22201c;
  --muted: #6b665d;
  --line: #e3ddd2;
  --soft: #f0ebe2;
  --accent: #8a3b2a;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ja: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", "Noto Sans CJK JP", "Source Han Sans JP", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1916; --card: #211f1b; --ink: #ece7de; --muted: #a39d92; --line: #36332d; --soft: #2a2823; --accent: #e09a83;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1a1916; --card: #211f1b; --ink: #ece7de; --muted: #a39d92; --line: #36332d; --soft: #2a2823; --accent: #e09a83;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--sans); }
:lang(ja) { font-family: var(--ja); }
a { color: var(--accent); }
h1, h2 { line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.7rem; margin: 1.2rem 0 .6rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .6rem; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .9rem; }
.lead { font-size: 1.05rem; }
.early { color: var(--muted); }
.error { color: var(--accent); font-weight: 600; }

/* The strip atop every page */
.strip { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .5rem 16px; border-bottom: 1px solid var(--line); background: var(--card); font-size: .95rem; }
.strip a { text-decoration: none; }
.strip a[aria-current] { color: var(--ink); }
.strip-name { font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.strip-search input { width: 14rem; max-width: 100%; }
.strip-me { margin-left: auto; }
.member-mark { color: var(--accent); }

main { padding: 0 16px 3rem; }
.page { max-width: 760px; margin: 0 auto; }
.page.wide { max-width: 1100px; }
.foot { max-width: 760px; margin: 0 auto; padding: 1.5rem 16px 3rem; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); }

input[type=search], textarea { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .6rem; }
textarea { width: 100%; line-height: 1.7; }
button, .button { font: inherit; color: var(--paper); background: var(--accent); border: 0; border-radius: 6px; padding: .35rem .9rem; cursor: pointer; text-decoration: none; }
.chip { font-size: .8rem; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 99px; padding: .1rem .7rem; vertical-align: middle; }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.big-search { display: flex; gap: .5rem; margin: 1rem 0; }
.big-search input { flex: 1; min-width: 0; font-size: 1.1rem; }

.site-name { font-size: 2.6rem; font-weight: 500; margin-bottom: .2rem; }
.levels { padding-left: 1.2rem; }
.level-list { list-style: none; padding: 0; }
.level-list li { margin: 0 0 1rem; }
.level-list li > a { font-weight: 600; }
.level-list p { margin: .2rem 0 0; }

/* Lists of words */
.rows { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .8rem; padding: .45rem .3rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.row:hover { background: var(--soft); }
.r-word { font-size: 1.2rem; }
.r-reading { color: var(--muted); }
.r-gloss { flex: 1; min-width: 12rem; }
.r-how { color: var(--muted); font-style: italic; }
.tag { font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 .5rem; white-space: nowrap; text-decoration: none; }

/* A word's page */
.word-head .big { font-size: 3rem; font-weight: 500; margin: 1.5rem 0 0; }
.big-reading { font-size: 1.3rem; color: var(--muted); margin: 0; }
.gloss { font-size: 1.15rem; margin: .4rem 0; }
.entry { margin: 0 0 1rem; }
.entry-head { margin: 0 0 .2rem; }
.entry-head .reading { font-size: 1.1rem; }
.kind, .notes { color: var(--muted); font-style: italic; font-size: .9rem; }
.also { color: var(--muted); font-size: .9rem; }
.senses { margin: 0; padding-left: 1.6rem; }
.example { margin: 0 0 1rem; }
.example .line { display: block; font-size: 1.2rem; }
.example .en { display: block; color: var(--muted); }
.source { font-size: .8rem; color: var(--muted); }
table.forms { border-collapse: collapse; font-size: .95rem; margin: 0 0 1rem; }
table.forms th, table.forms td { border-bottom: 1px solid var(--line); padding: .2rem .7rem .2rem 0; text-align: left; vertical-align: top; }
table.forms th { font-weight: 500; color: var(--muted); }
.table-wrap { overflow-x: auto; }

/* A text's words */
.text { font-size: 1.35rem; line-height: 2.3; }
.text .line { margin: 0 0 .8rem; }
a.w { color: inherit; text-decoration: none; border-radius: 3px; }
a.w:hover, a.w.active { background: var(--soft); }
a.w.this { color: var(--accent); }
rt { font-size: .5em; color: var(--muted); user-select: none; }
.no-ruby rt { display: none; }
.reading-bar { margin: 0 0 .5rem; }

/* A level's words */
.grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .5rem; }
.cell { display: flex; flex-direction: column; height: 100%; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: inherit; text-decoration: none; }
.cell:hover, .cell.active { border-color: var(--muted); }
.c-word { font-size: 1.25rem; }
.c-reading { font-size: .8rem; color: var(--muted); }
.c-gloss { font-size: .8rem; line-height: 1.35; margin-top: .2rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pager { display: flex; justify-content: space-between; }
.crumbs { margin: 1rem 0 0; font-size: .9rem; }

/* The popup */
.pop { position: absolute; z-index: 10; width: min(22rem, calc(100vw - 24px)); padding: .7rem .9rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgb(0 0 0 / 12%); font-size: .95rem; }
.pop-word { margin: 0 0 .5rem; }
.pop-item + .pop-item { border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .5rem; }
.pop-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .6rem; }
.pop-head a { font-size: 1.3rem; }
.pop-reading { color: var(--muted); }
.pop-how { margin: .1rem 0; color: var(--muted); font-style: italic; }
.pop ol { margin: .3rem 0 0; padding-left: 1.3rem; }
.pop-close { position: absolute; top: .3rem; right: .4rem; color: var(--muted); background: none; padding: 0 .3rem; font-size: 1.2rem; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .strip-search { order: 9; flex-basis: 100%; }
  .strip-search input { width: 100%; }
  .word-head .big { font-size: 2.4rem; }
}
