:root {
  color-scheme: dark;
  --bg: #0d1210;
  --fg: #b8cdbd;
  --body-fg: #afc4b4;
  --fg-bright: #d3e7d8;
  --fg-muted: #71877a;
  --link: #62d6a8;
  --link-hover: #8be9c3;
  --nav-active: #8cffc1;
  --visited: #A3B36A;
  --border: #29382f;
  --header-bg: #151d19;
  --focus: #82e6bc;
  --notice-bg: #191a13;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Noto Sans Mono CJK KR", "Nanum Gothic Coding",
    "Apple SD Gothic Neo", "Malgun Gothic", monospace;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.35;
}

body {
  margin: 0 auto;
  max-width: 1024px;
  padding: 0 .9rem 1.6rem;
}

a { color: var(--link); text-underline-offset: .14em; }
a:visited { color: var(--visited); }
a:hover { color: var(--link-hover); }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.quiet { color: var(--fg-muted); }
h1 {
  margin: .75rem 0 .35rem;
  color: var(--fg-bright);
  font-size: 1.15rem;
  line-height: 1.25;
}

.kids-logo-lockup {
  max-width: 100%;
  margin: .85rem 0 .55rem;
  overflow-x: auto;
  scrollbar-width: thin;
}
.kids-logo-stack {
  display: inline-grid;
}
.kids-logo {
  grid-area: 1 / 1;
  display: block;
  margin: 0;
  color: #70c9a7;
  font-family: inherit;
  font-size: clamp(.72rem, 2.35vw, 1.16rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: .012em;
  filter: drop-shadow(0 0 5px rgb(98 214 168 / 20%));
}
.kids-logo-geometry {
  visibility: hidden;
}
.kids-logo-rendered {
  letter-spacing: 0;
}
.kids-logo-cell {
  display: inline-block;
  width: 1ch;
  margin-right: .012em;
  text-align: center;
}
.kids-logo-emphasis {
  width: 100%;
  transform: translateX(.42px);
  font-weight: 700;
  pointer-events: none;
  filter: none;
}
.kids-logo-labels {
  font-weight: 400;
  letter-spacing: .012em;
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .kids-logo {
    color: transparent;
    background: linear-gradient(100deg, #58c8a0 5%, #8ba7df 36%, #d28ab5 66%, #6bd7c5 95%);
    background-size: 180% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: kids-logo-shimmer 14s ease-in-out infinite;
  }
}

@keyframes kids-logo-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .kids-logo { animation: none; background-position: 50% 50%; }
}

table { width: 100%; border-collapse: collapse; font-size: .92rem; line-height: 1.25; }
th { color: var(--fg-bright); text-align: left; background: var(--header-bg); }
th, td { padding: .18rem .38rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.catalogue-sort {
  display: inline-flex;
  align-items: baseline;
  gap: .2rem;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .14em;
}
.catalogue-sort:hover { text-decoration: underline; }
.catalogue-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sort-indicator { display: inline-block; min-width: .8em; }
th.numeric .catalogue-sort { width: 100%; justify-content: flex-end; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.post-title { width: 48%; }
.date { white-space: nowrap; }
.date-mobile,
.catalogue-description-mobile,
.catalogue-guidance-touch,
.mobile-bottom-nav,
.mobile-bottom-nav-spacer { display: none; }
.registry-missing { background: var(--notice-bg); }
.empty { text-align: center; color: var(--fg-muted); padding: 1rem; }
.row-marker-cell {
  box-sizing: border-box;
  width: 1.25rem;
  min-width: 1.25rem;
  padding-right: 0;
  padding-left: 0;
  color: var(--link);
  text-align: center;
}
.row-selection-marker { visibility: hidden; }
[data-selectable-row][aria-selected="true"] .row-selection-marker { visibility: visible; }

.overlay {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(5 9 7 / 78%);
}
.overlay[hidden] { display: none; }
.overlay-panel {
  position: relative;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: .8rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: 0 0 0 1px rgb(98 214 168 / 8%);
}
.overlay-panel h2 { margin: 0 2rem .55rem 0; font-size: 1rem; }
.shortcut-help-panel { width: min(34rem, calc(100vw - 2rem)); }
.shortcut-help-panel table { font-size: .88rem; }
.shortcut-help-panel th:first-child,
.shortcut-help-panel td:first-child { width: 10rem; white-space: nowrap; }
.shortcut-help-dismiss { margin: .7rem 0 0; color: var(--fg-muted); text-align: right; }
.archive-disclaimer {
  color: var(--fg-muted);
  font-size: .78rem;
  line-height: 1.45;
}
.catalogue-archive-disclaimer { margin: 2.15rem 0 .35rem; text-align: center; }
.site-footer {
  margin: .45rem 0 0;
  font-size: .78rem;
  text-align: center;
}
.coffee-link:visited { color: var(--link); }
.shortcut-help-footer { margin-top: .75rem; font-size: .78rem; }
.shortcut-help-footer hr {
  margin: 0 0 .65rem;
  border: 0;
  border-top: 1px solid var(--border);
}
.shortcut-help-footer .archive-disclaimer {
  margin: 0 0 .5rem;
  text-align: center;
}
.shortcut-help-footer .shortcut-help-coffee { margin: 0; text-align: center; }
.overlay-close {
  position: absolute;
  top: .45rem;
  right: .55rem;
  padding: 0 .3rem;
  border: 1px solid var(--border);
  color: var(--fg);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.pagination, .post-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  margin: .75rem 0;
  line-height: 1.25;
}
.pagination a,
.post-navigation a { text-decoration: none; }
.pagination a:visited,
.post-navigation a:visited { color: var(--link); }
.pagination a .nav-link-label,
.post-navigation a .nav-link-label,
.shortcut-help-launcher .nav-link-label { text-decoration: underline; }
.nav-item-disabled { color: var(--fg-muted); }
.nav-item-disabled kbd {
  color: inherit;
  border-bottom-color: currentColor;
}
.shortcut-help-launcher {
  padding: 0;
  border: 0;
  color: var(--link);
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.shortcut-help-launcher:hover { color: var(--link-hover); }
.post-preview {
  box-sizing: border-box;
  width: min(80ch, 100%);
  margin: 2.1rem auto .8rem;
  border: 1px solid var(--border);
  background: var(--bg);
}
.post-preview[hidden] { display: none; }
.post-preview-header {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: .28rem .45rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg-bright);
  background: var(--header-bg);
  line-height: 1.3;
  white-space: nowrap;
}
.post-preview-heading {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.post-preview-prefix,
.post-preview-separator,
.post-preview-identity { flex: none; }
.post-preview-prefix > [aria-hidden="true"] { color: var(--link); }
.post-preview-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-preview-close {
  flex: none;
  margin-left: .45rem;
  padding: 0 .3rem;
  border: 1px solid var(--border);
  border-radius: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  line-height: 1.1;
  cursor: pointer;
}
.post-preview-close:hover,
.post-preview-close:focus-visible {
  border-color: var(--link);
  color: var(--link);
}
.post-preview-body {
  --post-preview-body-height: 30.82em; /* ~21.3 lines at 1.4 line-height plus vertical padding. */
  position: relative;
  box-sizing: border-box;
  height: var(--post-preview-body-height);
  margin: 0;
  padding: .5rem .6rem;
  overflow: hidden;
  color: var(--body-fg);
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.post-preview-body.is-status {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  text-align: center;
  white-space: normal;
}
.post-preview-body.is-clipped::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4.2em;
  background: linear-gradient(to bottom, transparent, var(--bg));
  content: "";
  pointer-events: none;
}
.catalogue-guidance {
  margin: .15rem 0 .65rem;
  color: var(--fg-muted);
  font-size: .8rem;
}
kbd {
  padding: .02em .28em;
  border: 1px solid var(--border);
  border-bottom-color: var(--fg-muted);
  border-radius: 1px;
  color: var(--fg-bright);
  background: var(--header-bg);
  font: inherit;
}

.post-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: .6em;
  margin: .7rem 0 .5rem;
  color: var(--fg-bright);
  line-height: 1.3;
}
.post-meta-board { grid-column: 1 / -1; }
.post-meta-label {
  display: flex;
  justify-content: space-between;
  white-space: nowrap;
}
.post-meta-value { min-width: 0; overflow-wrap: break-word; }
.post-body {
  margin: .55rem 0;
  padding: .55rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--body-fg);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  tab-size: 8;
}
.unavailable { margin: .8rem 0; padding: .65rem 0; border-block: 1px solid var(--border); }
.provenance {
  margin-top: 1.2rem;
  padding-top: .45rem;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: .82rem;
}
.provenance h2 { font-size: 1rem; }
.provenance dl { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .8rem; }
.provenance dt { font-weight: 600; }
.provenance dd { margin: 0; overflow-wrap: anywhere; }

/* Medium content density: interaction chrome is selected independently below. */
@media (min-width: 651px) and (max-width: 900px) {
  .views { display: none; }
}

/* Phone-compact density wins over medium density for short touch landscapes. */
@media (max-width: 650px),
       (max-height: 500px) and (any-pointer: coarse) {
  :root { font-size: 14.5px; }
  body { padding-inline: .55rem; }
  .board-table { table-layout: fixed; }
  .catalogue-board-column { width: 12ch; }
  .catalogue-count-column { width: 4.5em; }
  .catalogue-latest-date { display: none; }
  .catalogue-board-name {
    display: block;
    width: 12ch;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .catalogue-description-desktop { display: none; }
  .catalogue-description-mobile { display: inline; }
  .author-name, .views { display: none; }
  .post-table { font-size: .88rem; }
  .post-table th, .post-table td { padding-inline: .25rem; }
  .post-title { width: auto; }
  .date-desktop { display: none; }
  .date-mobile { display: inline; }
  .search-board-link {
    display: block;
    width: 12ch;
    max-width: 12ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .post-body { font-size: 1rem; }
}

/* Prevent mobile-browser text autosizing from enlarging landscape metadata values. */
@media (max-height: 500px) and (any-pointer: coarse) {
  .post-meta-value {
    font-size: 1rem;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
}

/* Global archive search */
.search-launcher {
  display: none;
  position: fixed;
  top: .55rem;
  right: .65rem;
  z-index: 20;
  color: var(--link);
  background: var(--header-bg);
  border: 1px solid var(--border);
  font: inherit;
  cursor: pointer;
  line-height: 0;
  padding: .4rem;
}
.search-launcher svg {
  transform: scale(1.25);
  stroke-width: 1.5;
}
.search-overlay-panel { width: min(42rem, calc(100vw - 2rem)); }
.transient-search .search-form { margin-bottom: 0; }
.search-form {
  display: flex;
  gap: .55rem;
  align-items: center;
  max-width: 42rem;
  margin: 0 auto .8rem;
}
.search-form input {
  flex: 1;
  min-width: 0;
  padding: .3rem .45rem;
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--fg-bright);
  background: var(--bg);
  font: inherit;
}
.search-form button {
  padding: .3rem .55rem;
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--link);
  background: var(--header-bg);
  font: inherit;
  cursor: pointer;
}
.search-form input:focus-visible,
.search-form button:focus-visible { border-color: var(--focus); }
.search-sort { color: inherit; }
.search-sort:visited { color: inherit; }
.search-results { margin-top: .35rem; }

/* KIDS touch-interaction policy; keep identical to TOUCH_UI_QUERY in shortcuts.js. */
@media (any-pointer: coarse) and (max-width: 1400px) {
  .search-launcher { display: block; }
  .pagination, .post-navigation { display: none; }
  .catalogue-guidance-desktop { display: none; }
  .catalogue-guidance-touch { display: inline; }
  .row-marker-cell { display: none; width: 0; min-width: 0; padding: 0; border: 0; }
  .shortcut-help { display: none !important; }
  .post-preview { display: none !important; }
  .mobile-bottom-nav-spacer {
    display: block;
    height: calc(44px + env(safe-area-inset-bottom));
  }
  .mobile-bottom-nav {
    position: fixed;
    z-index: 100;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--border);
    background: var(--header-bg);
  }
  .mobile-nav-slot {
    display: flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 .25rem;
    border-right: 1px solid var(--border);
    overflow: hidden;
    color: var(--link);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  a.mobile-nav-slot,
  a.mobile-nav-slot:visited,
  a.mobile-nav-slot:hover {
    color: var(--link);
    text-decoration: none;
  }
  a.mobile-nav-slot {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  a.mobile-nav-slot:active {
    background: var(--nav-active);
    color: var(--bg);
  }
  a.mobile-nav-slot:active * { color: inherit; }
  .mobile-nav-slot:last-child { border-right: 0; }
  .mobile-nav-slot.is-disabled,
  .mobile-nav-empty { color: var(--fg-muted); }
  .transient-search {
    align-items: start;
    padding-top: min(18vh, 8rem);
  }
  .transient-search .overlay-panel { max-height: calc(82vh - 1rem); }
}

/* Wide KIDS touch UI: retain the full bar, but keep its four controls reachable. */
@media (any-pointer: coarse) and (min-width: 700px) and (max-width: 1400px) {
  .mobile-bottom-nav {
    grid-template-columns: repeat(4, 7.5rem);
    justify-content: end;
  }
}
