:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-soft: #f2f3f5;
  --surface-hover: #fafafa;
  --ink: #15161a;
  --ink-soft: #2f3136;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #18191c;
  --danger: #8b2e2e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-float: 0 16px 50px rgba(17, 24, 39, 0.12);
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --max: 1240px;
  --dock-height: 111px;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.detail-open { overflow: hidden; }

button,
input,
select { font: inherit; color: inherit; }

button { cursor: pointer; }
button:disabled { cursor: default; }

a { color: inherit; }

code,
.ipa,
.mono { font-family: var(--mono); }

code {
  padding: 0.08em 0.32em;
  border-radius: 4px;
  background: var(--surface-soft);
  font-size: 0.9em;
}

::selection { background: #dfe3e8; }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  border-bottom: 1px solid transparent;
  background: var(--bg);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 24px 8px;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.035em;
}

.wordmark-name {
  font-size: 23px;
  font-weight: 650;
}

.wordmark-dot {
  font-size: 27px;
  font-weight: 650;
  line-height: 1;
  color: var(--faint);
}

.wordmark-sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transform: translateY(-1px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.text-button {
  border: 0;
  background: none;
  padding: 6px 2px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.text-button:hover { color: var(--ink); }

/* ------------------------------------------------------------ search dock */

.search-dock {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 247, 248, 0.9);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
}

.search-dock-inner {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 24px 0;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-field {
  display: flex;
  align-items: center;
  flex: 1 1 0%;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-field:focus-within {
  border-color: #8b9099;
  box-shadow: 0 0 0 3px rgba(21, 22, 26, 0.07);
}

.search-input {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  height: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 0 10px 0 14px;
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.search-input::-webkit-search-cancel-button { display: none; }
.search-input::placeholder { color: var(--faint); }

.clear-button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  margin-right: 6px;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  border-radius: 6px;
}
.clear-button:hover { background: var(--surface-soft); color: var(--ink); }

.search-submit {
  flex: 0 0 auto;
  height: 44px;
  min-width: 92px;
  border: 0;
  border-radius: 10px;
  padding: 0 20px;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 550;
  letter-spacing: 0.005em;
  transition: background 0.15s ease;
}
.search-submit:hover { background: #000; }

.search-help {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 24px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}
.search-help code { font-size: 11px; }

.link-button,
.example-link {
  border: 0;
  background: none;
  padding: 2px 0;
  color: var(--ink-soft);
  font-size: 11.5px;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.link-button:hover,
.example-link:hover { text-decoration-color: var(--ink); }

.search-examples {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.search-examples[hidden] { display: none; }

/* ------------------------------------------------------------------- tabs */

.section-nav {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.section-nav-inner {
  display: flex;
  align-items: stretch;
  gap: 26px;
  overflow-x: auto;
  padding: 2px 0 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.section-nav-inner::-webkit-scrollbar { display: none; }

.nav-tab {
  position: relative;
  flex: 0 0 auto;
  border: 0;
  background: none;
  padding: 9px 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
  white-space: nowrap;
  letter-spacing: 0.002em;
  transition: color 0.15s ease;
}
.nav-tab:hover { color: var(--ink); }
.nav-tab.active {
  color: var(--ink);
  font-weight: 600;
}
.nav-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--ink);
  border-radius: 2px 2px 0 0;
}

/* ------------------------------------------------------------------- main */

.main {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 96px;
  outline: none;
}

.panel { animation: panel-in 0.18s ease; }
.panel[hidden] { display: none !important; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.section-head > div { min-width: 0; }

.section-eyebrow {
  margin: 0 0 5px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 620;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.section-desc {
  max-width: 660px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.result-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 370px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.layout > * { min-width: 0; }

/* --------------------------------------------------------------- results */

.results-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfc;
}

.results-toolbar-label {
  color: var(--faint);
  font-size: 11px;
}

.sort-control {
  border: 0;
  background: transparent;
  padding: 3px 18px 3px 4px;
  color: var(--muted);
  font-size: 11.5px;
  outline: none;
  border-radius: 4px;
}
.sort-control:focus { color: var(--ink); }

.results-list { margin: 0; padding: 0; list-style: none; }

.result-row {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 15px 11px;
  text-align: left;
  transition: background 0.12s ease;
}
.result-row:last-child { border-bottom: 0; }
.result-row:hover { background: var(--surface-hover); }
.result-row.active {
  background: #f3f4f6;
  box-shadow: inset 2px 0 0 var(--accent);
}

.result-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.result-word {
  overflow: hidden;
  color: var(--ink);
  font-size: 16.5px;
  font-weight: 570;
  letter-spacing: -0.012em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-ipa {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}
.result-meta .dot { color: #d1d5db; }

.result-flag {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.result-flag.offensive { color: var(--danger); }

mark {
  background: #e8eaed;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ------------------------------------------------------------- pagination */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  background: #fbfbfc;
}

.page-button {
  min-width: 32px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
}
.page-button:hover { background: var(--surface-soft); color: var(--ink); }
.page-button.active { background: var(--ink); color: #fff; }
.page-button:disabled { opacity: 0.35; }
.page-gap { padding: 0 4px; color: var(--faint); font-size: 12px; }

/* ----------------------------------------------------------------- detail */

.detail-shell {
  position: sticky;
  top: calc(var(--dock-height) + 16px);
  align-self: start;
  min-width: 0;
}

.detail-card {
  min-width: 0;
  max-height: calc(100vh - var(--dock-height) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px 30px 30px;
  scrollbar-width: thin;
}

.word-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 54px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1;
  opacity: 0.28;
  transform: translateY(-50%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: opacity 0.15s ease, background 0.15s ease;
}
.word-nav:hover:not(:disabled) {
  opacity: 1;
  background: #fff;
}
.word-nav:disabled {
  opacity: 0;
  pointer-events: none;
}
.word-nav-prev { left: -16px; }
.word-nav-next { right: -16px; }

.detail-topbar { display: none; }

.entry-head { padding-bottom: 20px; border-bottom: 1px solid var(--line); }

.entry-word {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(32px, 4.2vw, 44px);
  font-weight: 620;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.ipa-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 13px;
}

.ipa-item { display: inline-flex; align-items: baseline; gap: 6px; }
.ipa-label {
  color: var(--faint);
  font-family: var(--font);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ipa-value { font-family: var(--mono); font-size: 13.5px; }

.entry-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  border-radius: 5px;
  background: var(--surface-soft);
  padding: 0 7px;
  color: #4b5563;
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}
.badge.level { background: #eceef1; color: #30343a; }
.badge.defining { background: #eef2ef; color: #34513f; }
.badge.offensive { background: #f7ecec; color: var(--danger); }
.badge.auto { background: #f4f4f5; color: var(--muted); }

.entry-summary {
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.65;
}

.warning-box {
  margin: 18px 0 0;
  border-left: 2px solid #b45b5b;
  padding: 7px 0 7px 12px;
  color: #6f3232;
  font-size: 12.5px;
}

.senses { margin-top: 4px; }

.sense {
  padding: 20px 0 2px;
  border-bottom: 1px solid var(--line);
}
.sense:last-child { border-bottom: 0; }

.sense-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.sense-pos {
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.sense-level,
.sense-grammar,
.sense-register {
  color: var(--faint);
  font-size: 10.5px;
}

.def-list {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.def-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 6px;
}

.def-number {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.75;
}

.def-text {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.def-example {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12.5px;
  font-style: italic;
  line-height: 1.55;
}

.def-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.label-chip {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

.entry-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.meta-block h3 {
  margin: 0 0 4px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.meta-block p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chip-list li {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink-soft);
  font-size: 11px;
}

.source-line {
  margin-top: 18px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 340px;
  padding: 40px 24px;
  text-align: center;
}
.empty-state h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
}
.empty-state p {
  max-width: 340px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.loading-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
  font-size: 13px;
}

.skeleton {
  border-radius: 5px;
  background: linear-gradient(90deg, #f0f1f3 25%, #f7f8f9 37%, #f0f1f3 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

/* -------------------------------------------------------------- reference */

.ref-stack { display: grid; gap: 16px; }

.ref-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

.ref-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.ref-card > p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.ref-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fcfcfd;
}
.ref-tile h4 { margin: 0 0 3px; font-size: 13px; font-weight: 600; }
.ref-tile p { margin: 0; color: var(--muted); font-size: 12px; }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 12.5px;
}
th, td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  background: #fafafa;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}
td { color: var(--ink-soft); }
tr:last-child td { border-bottom: 0; }
td .ipa { color: var(--ink-soft); white-space: nowrap; }

.converter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.field { display: grid; gap: 4px; }
.field span {
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.field input,
.field select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  padding: 0 9px;
  font-size: 13px;
  outline: none;
}
.field input:focus,
.field select:focus { border-color: #8b9099; box-shadow: 0 0 0 3px rgba(21, 22, 26, 0.06); }

.converter-result {
  margin-top: 12px;
  border-radius: 7px;
  background: var(--surface-soft);
  padding: 11px 14px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13.5px;
}

.mini-head {
  margin: 24px 0 10px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------- illustrated words */

.illustration-layout {
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.illustration-index {
  display: grid;
  gap: 7px;
}

.illustration-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 7px;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.illustration-card:hover { border-color: var(--line-strong); background: #fcfcfd; }
.illustration-card.active { border-color: #9ca3af; background: #f3f4f6; }

.illustration-thumb {
  display: block;
  grid-row: 1 / span 2;
  width: 88px;
  height: 58px;
  overflow: hidden;
  border-radius: 6px;
  background: #fafafa;
}
.illustration-thumb svg { width: 100%; height: 100%; color: #6b7280; }

.illustration-card-title {
  display: block;
  grid-column: 2;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.illustration-card-meta {
  display: block;
  grid-column: 2;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.illustration-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

.illustration-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.illustration-title {
  margin: 0;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 620;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.illustration-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.85fr);
  gap: 20px;
  align-items: start;
  padding-top: 18px;
}

.illustration-canvas {
  position: relative;
  aspect-ratio: 640 / 420;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfcfd;
  padding: 10px;
}
.illustration-canvas > svg {
  display: block;
  width: 100%;
  height: 100%;
  color: #30343a;
}
.illustration-canvas > svg .hotspot { pointer-events: none; }

.hotspot {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid #b8bcc2;
  border-radius: 50%;
  background: #fff;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.14);
  transform: translate(-50%, -50%);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.hotspot:hover { border-color: var(--ink); }
.hotspot.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.parts-panel { min-width: 0; }

.parts-title {
  margin: 0 0 8px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.part-list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.part-item {
  border-bottom: 1px solid var(--line);
  padding: 9px 6px 10px;
  transition: background 0.12s ease;
}
.part-item.active { background: #f3f4f6; }

.part-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.part-number {
  flex: 0 0 auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.part-name {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.part-name small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 400;
}
.part-name:hover { text-decoration: underline; text-underline-offset: 3px; }

.part-def {
  margin: 3px 0 0 25px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.part-note {
  margin: 2px 0 0 25px;
  color: var(--faint);
  font-size: 11px;
  font-style: italic;
}

.part-lookup {
  margin: 4px 0 0 25px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink-soft);
  font-size: 10.5px;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.part-lookup:hover { text-decoration-color: var(--ink); }

.illustration-chip {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink-soft);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.illustration-chip:hover { text-decoration-color: var(--ink); }

/* --------------------------------------------------------------- grammar */

.grammar-tabs {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.grammar-tabs::-webkit-scrollbar { display: none; }

.grammar-tab {
  position: relative;
  flex: 0 0 auto;
  border: 0;
  background: none;
  padding: 8px 0 11px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 450;
  white-space: nowrap;
}
.grammar-tab:hover { color: var(--ink); }
.grammar-tab.active { color: var(--ink); font-weight: 600; }
.grammar-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--ink);
}

.grammar-section + .grammar-section { margin-top: 14px; }

.grammar-section > p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 9px;
}

.grammar-rule {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
  padding: 13px 15px 14px;
}

.grammar-rule h4 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

.rule-pattern {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 8px;
  border-radius: 4px;
  background: var(--surface-soft);
  padding: 2px 6px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.grammar-rule p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.rule-examples {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.rule-examples li {
  border-left: 2px solid var(--line);
  padding-left: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}
.rule-examples .example-note {
  display: block;
  color: var(--faint);
  font-size: 10.5px;
}

.rule-mistake {
  margin: 9px 0 0;
  border-radius: 5px;
  background: #fbf5f5;
  padding: 5px 8px;
  color: #6f3232;
  font-size: 11px;
  line-height: 1.5;
}

.tense-map {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 16px;
}

.tense-pie-wrap {
  display: grid;
  justify-items: center;
  gap: 8px;
}
.tense-pie {
  position: relative;
  width: 176px;
  height: 176px;
}
.tense-pie svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.tense-pie-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}
.tense-pie-center small {
  display: block;
  color: var(--faint);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tense-legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 10.5px;
}
.tense-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tense-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.tense-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.tense-column { display: grid; align-content: start; gap: 6px; }
.tense-column h4 {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tense-column h4 .tense-dot { margin-right: 4px; }
.tense-cell {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fcfcfd;
  padding: 9px 10px;
}
.tense-cell strong { display: block; font-size: 11.5px; font-weight: 600; }
.tense-cell span { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; line-height: 1.4; }

@media (max-width: 980px) {
  .illustration-layout { grid-template-columns: 1fr; }
  .illustration-detail { order: -1; }
  .illustration-index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .illustration-stage { grid-template-columns: 1fr; }
  .illustration-canvas { max-width: 640px; }
  .tense-map { grid-template-columns: 1fr; justify-items: start; }
}

@media (max-width: 620px) {
  .illustration-index { grid-template-columns: 1fr; }
  .illustration-detail { padding: 16px; }
  .tense-grid { grid-template-columns: 1fr; }
  .grammar-tabs { gap: 18px; }
}

/* ----------------------------------------------------------------- dialog */

.about-dialog {
  width: min(660px, calc(100vw - 28px));
  max-height: min(82vh, 760px);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}
.about-dialog::backdrop { background: rgba(17, 24, 39, 0.32); }

.about-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.about-head h2 { margin: 0; font-size: 19px; font-weight: 620; letter-spacing: -0.02em; }
.dialog-close {
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
}
.dialog-close:hover { color: var(--ink); border-color: #b8bcc2; }

.about-body {
  max-height: calc(82vh - 62px);
  overflow-y: auto;
  padding: 22px;
  font-size: 13px;
  line-height: 1.65;
}
.about-body p { margin: 0 0 14px; color: var(--muted); }
.about-body h3 {
  margin: 22px 0 7px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
}
.about-stats div { background: #fcfcfd; padding: 12px; }
.about-stats dt {
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.about-stats dd { margin: 3px 0 0; font-size: 15px; font-weight: 600; }

.about-sources { margin: 0; padding-left: 18px; color: var(--muted); }
.about-sources li { margin-bottom: 4px; }
.about-fine { margin-top: 18px !important; font-size: 11.5px; }
.about-meta { margin-top: 8px !important; color: var(--faint) !important; font-size: 10.5px; }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 200;
  max-width: calc(100vw - 32px);
  transform: translate(-50%, 10px);
  border-radius: 999px;
  background: #1b1c20;
  padding: 8px 14px;
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------------- responsive */

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .detail-shell { position: static; }
  .word-nav { display: none; }
  .detail-card {
    position: fixed;
    inset: 0;
    z-index: 100;
    max-height: none;
    border: 0;
    border-radius: 0;
    padding: 0 20px calc(40px + env(safe-area-inset-bottom));
    overflow-y: auto;
    display: none;
  }
  body.detail-open .detail-card { display: block; }
  .detail-topbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 -20px 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    padding: max(12px, env(safe-area-inset-top)) 20px 12px;
  }
  .back-button {
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: #fff;
    padding: 6px 10px;
    color: var(--ink);
    font-size: 12px;
  }
  .detail-topbar-label {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .swipe-hint {
    margin-left: auto;
    flex: 0 0 auto;
    color: var(--faint);
    font-size: 10px;
    letter-spacing: 0.03em;
  }
}

@media (max-width: 720px) {
  .topbar-inner { padding: max(12px, env(safe-area-inset-top)) 16px 6px; }
  .search-dock-inner { padding: 10px 16px 0; }
  .section-nav { padding: 0 16px; }
  .section-nav-inner { gap: 22px; mask-image: none; -webkit-mask-image: none; }
  .main { padding: 22px 16px 80px; }
  .search-submit { min-width: 70px; padding: 0 14px; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .result-count { align-self: flex-start; }
  .detail-card { padding-left: 16px; padding-right: 16px; }
  .detail-topbar { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .entry-word { font-size: 34px; }
  .converter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-meta { grid-template-columns: 1fr; }
  .ref-card { padding: 18px 16px; }
  .search-examples { flex-basis: 100%; }
}

@media (max-width: 430px) {
  .wordmark-sub { display: none; }
  .search-field { height: 42px; }
  .search-submit { height: 42px; min-width: 62px; padding: 0 11px; font-size: 12.5px; }
  .search-help { gap: 6px; font-size: 11px; }
  .nav-tab { font-size: 12.5px; }
  .result-row { padding: 11px 13px 10px; }
  .result-word { font-size: 16px; }
  .pagination { gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .topbar, .search-dock, .pagination, .toast, .about-dialog { display: none !important; }
  body { background: #fff; }
  .layout { display: block; }
  .results-card { display: none; }
  .detail-card {
    position: static;
    max-height: none;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}
