:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --surface: #fffdf8;
  --ink: #292421;
  --muted: #685e59;
  --accent: #662f40;
  --accent-deep: #532334;
  --accent-wash: #f2e9e7;
  --line: #dcd6ca;
  --sage: #496052;
  --gold: #8f672b;
  --sans: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans CJK JP", Meiryo, Arial, sans-serif;
  --display: "Iowan Old Style", Baskerville, "Times New Roman", "Noto Serif CJK JP", serif;
  --jserif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", "Times New Roman", serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: weight;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, select, input, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button, a, input, select, summary, textarea { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
i[data-i] { display: inline-flex; flex: none; align-items: center; justify-content: center; }
i[data-i] svg { width: 1em; height: 1em; stroke: currentColor; stroke-width: 1.65; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.skip-link { position: fixed; top: -60px; left: 8px; padding: 10px 20px; background: white; color: var(--accent); z-index: 20; }
.skip-link:focus { top: 8px; }
.header-inner, main { width: min(92%, 1240px); margin: 0 auto; }
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner, .brand, .primary-nav, .header-actions, .primary-nav button, .top-add, .privacy-button,
.hero-label, .hero-actions, .hero-actions button, .stat, .stat-value, .stat-icon, .section-top,
.collection-tools, .transfer-link, .search, .toolbar, .filters, .sort, .word-top, .meaning,
.sound, .fav, .card-footer, .topic, .status { display: flex; align-items: center; }
.header-inner { height: 68px; gap: clamp(22px, 5vw, 78px); }
.brand { gap: 9px; color: var(--accent); font: 600 32px/1 var(--display); letter-spacing: -.064em; text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.header-actions { margin-left: auto; gap: 15px; }
.primary-nav { align-self: stretch; gap: 24px; }
.primary-nav button { align-self: stretch; position: relative; gap: 7px; border: 0; padding: 0 2px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 600; }
.primary-nav button.nav-active { color: var(--accent); }
.primary-nav button.nav-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent); }
.primary-nav i, .hero-actions i, .transfer-link i, .top-add i { font-size: 17px; }
.header-inner button:hover, .transfer-link:hover, .sort:hover { color: var(--accent-deep); }
.top-add, .review-start { justify-content: center; gap: 8px; color: white; background: var(--accent); border: 1px solid var(--accent); border-radius: 7px; min-height: 43px; padding: 9px 17px; font-size: 13px; font-weight: 650; }
.header-inner .top-add:hover, .review-start:hover { color: white; background: var(--accent-deep); }
.privacy-button { justify-content: center; width: 42px; height: 44px; padding: 0; border: none; background: transparent; color: var(--muted); }
.privacy-button svg { width: 20px; height: 20px; }
.privacy-button:hover { color: var(--accent); background: var(--accent-wash); border-radius: 7px; }
main { padding: 26px 0 52px; }
.hero { position: relative; isolation: isolate; overflow: hidden; display: grid; align-content: center; min-height: 260px; border: 1px solid #ddcdc1; border-radius: 13px; padding: 28px clamp(24px, 4.3vw, 64px); background: linear-gradient(100deg,#f6eae0 0%,#f2e1d5 57%,#ecd3c4 90%); }
.hero-art { position: absolute; inset: 0 0 0 auto; width: 54%; z-index: -1; pointer-events: none; mask-image: linear-gradient(to right, transparent, black 26%); }
.hero-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 54%; }
.hero-text { position: relative; width: fit-content; max-width: 60%; }
.hero-label { gap: 9px; font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--accent); margin: 0; }
.hero-label span { width: 22px; height: 1px; background: currentColor; }
.hero h1 { margin: 5px 0 4px; font: 500 clamp(64px, 6.4vw, 93px)/.99 var(--display); letter-spacing: -.071em; color: #38262a; }
.hero h1 span { color: #9a5365; }
.hero-description { margin: 9px 0 0; font-size: 14px; font-weight: 500; color: #534540; letter-spacing: .025em; line-height: 1.65; }
.hero-description span { display: inline-block; }
.hero-actions { gap: 19px; margin-top: 22px; }
.review-start { min-height: 42px; }
.review-start span { font: 16px/1 Arial, sans-serif; margin-left: 6px; }
.import-help, .transfer-link { min-height: 42px; gap: 7px; font-size: 13px; font-weight: 600; color: #55433f; background: transparent; border: 0; padding: 5px 1px; }
.import-help:hover, .transfer-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.stats { margin: 17px 0 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 16px 0; }
.stat { gap: 15px; min-width: 0; padding: 0 clamp(15px, 3vw, 45px); }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-icon { width: 42px; height: 42px; border-radius: 50%; justify-content: center; background: #f4e9e8; color: var(--accent); font-size: 20px; }
.stat:nth-child(2) .stat-icon { background: #e9eee4; color: var(--sage); }
.stat:nth-child(3) .stat-icon { background: #f5edda; color: var(--gold); }
.stat-copy { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value { align-items: baseline; gap: 6px; white-space: nowrap; }
.stat-value strong { font: 500 35px/.98 var(--display); letter-spacing: -.04em; font-variant-numeric: lining-nums tabular-nums; }
.stat-value small { font-size: 11px; color: var(--muted); }
.section-top, .toolbar { justify-content: space-between; gap: 12px; }
.section-top { margin-bottom: 17px; }
.collection h2 { display: flex; gap: 10px; align-items: center; margin: 0; font: 700 26px/1.4 var(--jserif); letter-spacing: -.035em; }
.collection h2 span { font: 600 12px/1.25 var(--sans); letter-spacing: 0; color: var(--accent); padding: 3px 8px; border-radius: 20px; background: #eee2df; }
.collection-tools { gap: 18px; }
.transfer-link { color: var(--muted); font-size: 12px; }
.search { border: 1px solid #d0c9bc; border-radius: 7px; color: var(--muted); padding: 7px 10px; width: 216px; min-height: 39px; background: var(--surface); gap: 9px; }
.search input { width: 100%; border: none; outline: none; min-width: 0; padding: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.search input::placeholder { color: var(--muted); }
.search kbd { border: 1px solid #ded9ce; border-radius: 3px; padding: 1px 5px; font: 11px/1.2 monospace; }
.toolbar { padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.filters { gap: 4px; }
.filters button { color: #635956; white-space: nowrap; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 6px 13px; min-height: 36px; font-size: 13px; }
.filters button:hover { background: #eee7de; }
.filters button.active { color: var(--accent); font-weight: 650; background: var(--accent-wash); border-color: #d7bdc0; }
.sort { flex: none; color: var(--muted); gap: 4px; font-size: 12px; }
.sort select { color: inherit; height: 36px; padding: 0 17px 0 3px; appearance: none; border: 0; background: transparent; font-size: inherit; cursor: pointer; }
.sort i:last-child { font-size: 12px; margin-left: -18px; pointer-events: none; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.word-card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 20px 22px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.word-card:hover, .word-card:focus-within { border-color: #bca9a5; box-shadow: 0 4px 15px #47372f0c; }
.word-top { gap: 3px; padding-right: 27px; min-height: 39px; }
.word-title { border: 0; padding: 0; background: transparent; color: var(--accent); font: 500 clamp(28px, 2.6vw, 39px)/1.12 var(--display); letter-spacing: -.045em; text-align: left; overflow-wrap: anywhere; }
.sound, .fav { justify-content: center; flex: none; min-width: 34px; min-height: 34px; padding: 6px; border: 0; background: transparent; color: #7d746b; border-radius: 50%; }
.sound { font-size: 16px; }
.fav { position: absolute; right: 12px; top: 18px; font-size: 18px; }
.sound:hover, .fav:hover { background: #f4ece5; color: var(--accent); }
.fav.on, .fav.on svg { color: #93682d; fill: #dbb974; }
.meaning { gap: 8px; min-height: 22px; margin: 6px 0 0; font-size: 14px; color: #463d39; line-height: 1.55; }
.pos { flex: none; color: #774456; background: #f3e8eb; font-size: 10px; font-weight: 650; padding: 2px 6px; border-radius: 3px; }
.pos.noun { color: #4d5c71; background: #e9edf0; }
.pos.verb { color: #4a6150; background: #e8eee4; }
.example { flex: 1; margin: 17px 0 16px; padding-left: 11px; border-left: 2px solid #ceb7ac; }
.example-label { color: #77675f; font: 650 9px/1.2 Arial, sans-serif; letter-spacing: .13em; }
.example p { margin: 5px 0 2px; color: #352f2e; font: 17px/1.4 var(--display); overflow-wrap: anywhere; }
.example mark { background: transparent; color: var(--accent); font-weight: bold; }
.example .jp { font: 12px/1.65 var(--sans); color: var(--muted); margin: 4px 0 0; }
.card-footer { justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid #e6e1d8; color: var(--muted); font-size: 11px; }
.topic, .status { gap: 6px; min-width: 0; }
.topic-text { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.topic i { font-size: 13px; }
.status { flex: none; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #ac7756; }
.status.known::before { background: var(--sage); }
.empty { grid-column: 1 / -1; padding: 34px 18px; font-size: 14px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; }
#toast { position: fixed; z-index: 20; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; width: max-content; max-width: calc(100% - 26px); transform: translateX(-50%); border-radius: 8px; padding: 11px 16px; box-shadow: 0 5px 20px #29242125; background: #402d32; color: white; pointer-events: none; font-size: 13px; line-height: 1.6; }
#toast:empty { display: none; }
@media (min-width: 1650px) { main { padding-top: 34px; } .hero { min-height: 300px; } }
@media (max-width: 1000px) {
  .stat-copy { display: block; }
  .stat-label { font-size: 12px; }
  .stat-value { margin-top: 3px; }
  .stat-value strong { font-size: 30px; }
}
@media (max-width: 880px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .header-inner { gap: 26px; }
  .primary-nav { gap: 14px; }
  .hero { min-height: 232px; }
  .hero-art { width: 50%; }
}
@media (max-width: 680px) {
  .header-inner, main { width: min(calc(100% - 32px), 540px); }
  .header-inner { height: 57px; gap: 12px; }
  .primary-nav { display: none; }
  .brand { font-size: 29px; gap: 7px; }
  .brand svg { width: 24px; height: 24px; }
  .header-actions { gap: 4px; }
  .privacy-button { height: 42px; width: 38px; }
  .top-add { font-size: 12px; padding: 6px 10px; min-height: 38px; gap: 5px; }
  main { padding-top: 16px; }
  .hero { min-height: 0; padding: 19px 17px 13px; border-radius: 10px; }
  .hero-art { width: 49%; height: 100%; mask-image: linear-gradient(90deg, transparent, black 27%); }
  .hero-art img { object-position: 51% center; }
  .hero-text { max-width: 68%; }
  .hero-label { font-size: 10px; letter-spacing: .1em; gap: 5px; }
  .hero-label span { width: 13px; }
  .hero h1 { font-size: clamp(44px, 11vw, 65px); margin: 7px 0 0; }
  .hero-description { font-size: 11px; line-height: 1.65; max-width: 17em; margin-top: 7px; }
  .hero-actions { gap: 5px; margin-top: 15px; width: fit-content; padding: 0; }
  .review-start { min-height: 39px; font-size: 11px; padding: 7px 9px; gap: 5px; }
  .review-start span { margin-left: 0; font-size: 13px; }
  .hero-actions i { font-size: 14px; }
  .import-help { font-size: 11px; min-height: 39px; padding: 6px 8px; border-radius: 6px; background: #f7ede3ef; border: 1px solid #d4c2b3; gap: 5px; }
  .stats { margin: 10px 0 24px; padding: 11px 0; border-radius: 8px; }
  .stat { padding: 0 10px; gap: 6px; justify-content: center; }
  .stat-icon { width: 25px; height: 25px; font-size: 14px; }
  .stat-copy { width: auto; }
  .stat-label { display: block; font-size: 10px; white-space: nowrap; }
  .stat-value { gap: 3px; line-height: 1; margin-top: 4px; }
  .stat-value strong { font-size: 24px; }
  .stat-value small { font-size: 10px; }
  .section-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 7px; }
  .collection h2 { font-size: 23px; }
  .collection-tools { display: contents; }
  .transfer-link { grid-column: 2; grid-row: 1; min-height: 38px; font-size: 11px; }
  .search { grid-column: 1 / -1; min-height: 41px; width: 100%; }
  .search input { font-size: 16px; }
  .search input::placeholder { font-size: 13px; }
  .search kbd { display: none; }
  .toolbar { gap: 4px; margin-bottom: 10px; padding-bottom: 7px; }
  .filters { gap: 1px; }
  .filters button { font-size: 11px; min-height: 37px; padding: 6px 8px; }
  .sort { font-size: 11px; gap: 2px; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .word-card { padding: 15px 17px 0; }
  .word-title { font-size: 32px; }
  .word-top { min-height: 41px; }
  .fav { right: 8px; top: 11px; }
  .fav, .sound { min-height: 42px; min-width: 42px; }
  .example { margin: 13px 0; }
  .card-footer { padding: 8px 0; }
}
@media (max-width: 368px) {
  .header-inner, main { width: calc(100% - 24px); }
  .stat { padding: 0 5px; gap: 4px; }
  .stat-icon { width: 22px; height: 22px; }
  .sort > i:first-child { display: none; }
  .filters button { padding: 6px; }
  .hero { padding-left: 13px; }
  .hero h1 { font-size: 39px; }
  .hero-art { width: 43%; object-position: 49% center; }
  .hero-actions button { white-space: nowrap; }
  .hero-actions .review-start span, .hero-actions .import-help i { display: none; }
  .hero-text { max-width: 70%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
