@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,200..800;1,6..72,200..800&family=Zen+Old+Mincho:wght@400;700&family=Noto+Serif+KR:wght@300;400;600;700&family=EB+Garamond:ital,wght@0,400..700;1,400..700&family=Gentium+Book+Plus:ital,wght@0,400;0,700;1,400&display=swap');
@font-face {
    font-family: 'BookkGothic';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2302@1.0/BookkGothic-Lt.woff2') format('woff2');
    font-weight: 300;
    font-display: swap;
}
@font-face {
    font-family: 'BookkGothic';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2302@1.0/BookkGothic-Bd.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'BookkMyungjo';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2302@1.0/BookkMyungjo-Lt.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'BookkMyungjo';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2302@1.0/BookkMyungjo-Bd.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
  color-scheme: light dark;

  --color-bg:            #fdfcf9;
  --color-bg-alt:        #f3f0e8;
  --color-text:          #1c1b18;
  --color-accent:        #639c59;
  --color-on-accent:     #fff;

  --color-border:        #e9e5db;
  --color-border-strong: #d5cfc1;
  --color-rule:          #bdb6a6;

  --color-muted:         #625e56;
  --color-muted-2:       #736e65;
  --color-muted-3:       #8a857b;
  --color-muted-4:       #a19b90;
  --color-muted-5:       #4a4740;

  --shadow-color:        rgba(0, 0, 0, .08);

  --font-latin:  'Newsreader', 'EB Garamond', 'Gentium Book Plus';
  --font-body:   var(--font-latin), 'BookkGothic', 'Zen Old Mincho', 'Shippori Mincho B1',
                 'Noto Serif KR', 'Apple SD Gothic Neo', 'Malgun Gothic', serif;
  --font-hanja:  var(--font-latin), 'Zen Old Mincho', 'Shippori Mincho B1', var(--font-body);
  --font-ipa:    'Gentium Book Plus', 'Charis SIL', 'Doulos SIL', 'Lucida Grande', 'Noto Serif', serif;

  --weight-regular: 350;
  --weight-bold:    650;

  --radius:    10px;
  --radius-sm: 4px;
  --pill:      999px;

  --fs-ui:      .9rem;
  --fs-caption: .875rem;

  --ink: var(--color-text);

  --top-h: 52px;
  --pw: 520px;
  --ph: 600px;
  --colh: 572px;
  --colgap: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg:            #16161a;
    --color-bg-alt:        #201f24;
    --color-text:          #e7e5e0;
    --color-accent:        #9cbb5e;
    --color-on-accent:     #16161a;

    --color-border:        #2c2c30;
    --color-border-strong: #3d3c41;
    --color-rule:          #4a494e;

    --color-muted:         #b7b5b0;
    --color-muted-2:       #9a9994;
    --color-muted-3:       #85837e;
    --color-muted-4:       #706e69;
    --color-muted-5:       #c9c7c2;

    --shadow-color:        rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; user-select: none; }
input { user-select: text; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body { height: 100%; margin: 0; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-optical-sizing: auto;
  word-break: keep-all;
  overflow-wrap: break-word;
  overflow: hidden;
}

b, strong { font-weight: var(--weight-bold); }

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.top {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 14px 16px 10px;
  pointer-events: none;
}
.top__in {
  display: flex; align-items: center; gap: 8px;
  max-width: 100%;
  pointer-events: auto;
}

#dictSel {
  -webkit-appearance: none; appearance: none;
  font-family: var(--font-body);
  font-size: var(--fs-ui);
  font-weight: var(--weight-regular);
  color: var(--color-text);
  background-color: var(--color-bg-alt);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a857b' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9em center;
  background-size: 10px 6px;
  border: 1px solid transparent;
  border-radius: var(--pill);
  height: 2.2rem;
  padding: 0 2.1em 0 1.1em;
  max-width: 38vw;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
#dictSel:hover { border-color: var(--color-border-strong); }
#dictSel:focus {
  outline: none;
  background-color: var(--color-bg);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 16%, transparent);
}
#dictSel[hidden] { display: none; }

.find { position: relative; width: min(300px, 58vw); }
.find input {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--fs-ui);
  font-weight: var(--weight-regular);
  color: var(--color-text);
  background: var(--color-bg-alt);
  border: 1px solid transparent;
  border-radius: var(--pill);
  height: 2.2rem;
  text-align: center;
  padding: .1em .8em 0;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.find input::-webkit-search-cancel-button,
.find input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.find input::placeholder { color: var(--color-muted-4); }
.find input:focus {
  outline: none;
  text-align: left;
  background: var(--color-bg);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 16%, transparent);
}

.results {
  position: fixed; z-index: 45;
  max-height: min(62vh, 460px); overflow-y: auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  box-shadow: 0 14px 38px var(--shadow-color), 0 2px 6px var(--shadow-color);
  padding: 5px;
}
.results[hidden] { display: none; }
.results__hit {
  display: block; width: 100%; text-align: left;
  padding: .5em .7em; border-radius: var(--radius-sm);
  background: none; border: 0; color: inherit; font: inherit; cursor: pointer;
  transition: background-color .15s ease;
}
.results__hit:hover, .results__hit[aria-selected='true'] { background: var(--color-bg-alt); }
.results__hw {
  font-family: var(--font-latin), serif;
  font-size: 1rem; font-weight: var(--weight-bold);
  letter-spacing: -.01em;
}
.results__hw sup { font-size: .6em; vertical-align: super; line-height: 0; }
.results__alt { color: var(--color-muted-3); font-size: var(--fs-caption); margin-left: 8px; }
.results__g { color: var(--color-muted-2); font-size: 0.8rem; display: block; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results__folio {
  float: right; color: var(--color-muted-4); font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.results__none { padding: .9em .7em; color: var(--color-muted-3); font-size: var(--fs-caption); }

.stage {
  position: absolute; inset: 0;
  display: flex; justify-content: center; align-items: flex-start;
  padding: calc(var(--top-h) + 10px) 16px 0;
  touch-action: pan-y;
  overflow: hidden;
}

.sheet { width: var(--pw); }

.page {
  width: 100%;
  height: var(--ph);
  color: var(--ink);
  overflow: hidden;
}

.page__head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-latin), serif;
  font-size: 11.5px;
  font-weight: var(--weight-bold);
  letter-spacing: .08em;
  text-transform: lowercase;
  font-variant: small-caps;
  color: var(--color-muted-4);
  height: 23px;
  white-space: nowrap; overflow: hidden;
}
.page__head .rh--last { text-align: right; }
.page__head .rh { flex: 0 1 auto; overflow: hidden; }

.page__body {
  display: flex;
  gap: var(--colgap);
  height: var(--colh);
  align-items: flex-start;
}
.col {
  flex: 1 1 0; min-width: 0; height: 100%;
  position: relative; overflow: hidden;
}

.blk { overflow: hidden; }
.blk__in {
  font-size: 14.2px;
  line-height: 1.4;
  color: var(--ink);
  text-align: left;
  hyphens: none;
  word-break: keep-all;
  overflow-wrap: break-word;
  padding-bottom: 2px;
}

.blk--hw .blk__in { padding-top: 5.5px; text-indent: 0; }
.blk--sense .blk__in,
.blk--etym .blk__in,
.blk--see .blk__in,
.blk--note .blk__in { padding-left: 9px; text-indent: -9px; }
.blk--ex .blk__in {
  padding-left: 16px; text-indent: -7px;
  font-size: 13px;
  color: var(--color-muted-2);
}
.blk--gap .blk__in { height: 6px; padding: 0; }

.hw {
  font-family: var(--font-latin), serif;
  font-weight: var(--weight-bold);
  font-size: 16.4px;
  letter-spacing: -.01em;
  color: var(--ink);
}
.hom { font-size: .6em; font-weight: var(--weight-bold); vertical-align: super; line-height: 0; margin-left: .5px; }
.ipa {
  font-family: var(--font-ipa);
  font-size: 12.2px;
  color: var(--color-muted-3); margin-left: .35em;
}
.pos {
  font-family: var(--font-hanja);
  font-size: 11.2px;
  color: var(--color-accent);
  margin-left: .4em;
  vertical-align: .06em;
}
.infl {
  font-style: italic; font-size: 12.2px;
  color: var(--color-muted-2); margin-left: .4em;
}

.num {
  font-weight: var(--weight-bold); color: var(--color-muted-3);
  font-size: 12px;
  margin-right: .48em;
}
.lbl {
  font-family: var(--font-hanja);
  font-size: 11px;
  color: var(--color-accent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 42%, transparent);
  border-radius: var(--radius-sm);
  padding: .15em .28em .05em; margin-left: .20em; margin-right: .48em;
  vertical-align: .05em;
}
.gloss { font-size: 13.4px; }

.ex-t { font-style: italic; font-family: var(--font-latin), serif; }
.ex-g::before { content: ' — '; color: var(--color-muted-4); font-style: normal; }

.etym, .see, .note {
  font-size: 12.4px;
  color: var(--color-muted-2);
}
.mark { color: var(--color-muted-4); font-style: normal; margin-right: .3em; }
.xref {
  font-family: var(--font-latin), serif;
  font-style: italic;
  color: var(--color-accent);
  text-decoration: none;
  text-underline-offset: .25em;
  text-decoration-thickness: 1px;
  cursor: pointer;
}
.xref:hover { text-decoration: underline; }

.blk--letter .blk__in {
  display: flex; align-items: center; gap: .7em;
  padding: 15px 0 6px;
}
.blk--letter .blk__in::after {
  content: ''; flex: 1 1 auto; height: 1px;
  background: var(--color-border);
}
.letter {
  flex: 0 0 auto;
  font-family: var(--font-latin), serif;
  font-size: 11.5px;
  font-weight: var(--weight-bold);
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: .2em;
  color: var(--color-muted-4);
  line-height: 1;
}
@keyframes hitfade { from { background: color-mix(in srgb, var(--color-accent) 34%, transparent); } }
.blk.is-hit .blk__in {
  background: color-mix(in srgb, var(--color-accent) 13%, transparent);
  animation: hitfade 1.6s ease-out;
  border-radius: var(--radius-sm);
}

.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 6px 16px 9px;
  font-size: var(--fs-caption); color: var(--color-muted-3);
  pointer-events: none;
}
.statusbar > * { pointer-events: auto; }
.statusbar b { color: var(--color-muted-2); font-weight: var(--weight-regular); }
.statusbar__folio {
  white-space: nowrap; font-variant-numeric: tabular-nums;
  min-width: 4.5em; text-align: center;
}
.statusbar__sep { margin: 0 .3em; color: var(--color-muted-4); }

.pager {
  flex: 0 0 auto;
  width: 1.7rem; height: 1.7rem;
  display: grid; place-items: center;
  border: 0; border-radius: var(--pill);
  background: none;
  color: var(--color-muted-3);
  font: inherit; font-size: 1.15rem; line-height: 1;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease, opacity .15s ease;
}
.pager:hover { background: var(--color-bg-alt); color: var(--color-accent); }
.pager[disabled] { opacity: .28; cursor: default; }
.pager[disabled]:hover { background: none; color: var(--color-muted-3); }

.slider {
  width: min(220px, 34vw);
  accent-color: var(--color-accent);
  -webkit-appearance: none; appearance: none;
  height: 3px; border-radius: var(--pill);
  background: var(--color-border);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 11px; height: 11px; border-radius: var(--pill);
  background: var(--color-accent);
  border: 2px solid var(--color-bg);
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: var(--pill);
  background: var(--color-accent); border: 2px solid var(--color-bg);
  cursor: pointer;
}
.slider::-moz-range-track { height: 3px; border-radius: var(--pill); background: var(--color-border); }

#measure {
  position: absolute; left: -99999px; top: 0;
  visibility: hidden;
  contain: layout style;
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-optical-sizing: auto;
  color: var(--ink);
}

:root[data-cols='1'] .top__in {
  width: calc(var(--pw) - 28px);
  gap: 6px;
}
:root[data-cols='1'] #dictSel {
  flex: 0 1 auto; min-width: 0;
  height: 1.9rem;
  font-size: .8rem;
  padding: 0 1.7em 0 .8em;
  background-position: right .72em center;
  max-width: none;
}
:root[data-cols='1'] .find { flex: 1 1 auto; width: auto; min-width: 0; }
:root[data-cols='1'] .find input { height: 1.9rem; font-size: .8rem; padding: .1em .8em 0; }

@media (max-width: 480px) {
  .top { padding: 11px 14px 8px; }
  .stage { padding-left: 14px; padding-right: 14px; }
  .statusbar { gap: 8px; padding: 5px 14px 7px; }
  .slider { width: min(150px, 34vw); }
}

@media print {
  .top, .statusbar, .results { display: none !important; }
  body { overflow: visible; background: #fff; }
  .stage { position: static; display: block; padding: 0; overflow: visible; }
  .sheet { width: auto; }
  .page { height: auto; break-after: page; }
}
