:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #15241f;
    background: #f4f1e9;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 10% 0%, #fffdf4 0, transparent 34rem), #f4f1e9; }
a { color: inherit; }
.topbar { min-height: 76px; padding: 0 max(22px, calc((100% - 1440px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 2rem; background: rgba(255,255,255,.9); border-bottom: 1px solid #dce1da; backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: baseline; gap: .7rem; text-decoration: none; }
.brand strong { font-family: Georgia, serif; font-size: 1.55rem; color: #174d40; }
.brand span { color: #68736e; font-size: .83rem; }
.topbar nav { display: flex; align-items: center; gap: .35rem; }
.topbar nav a { padding: .62rem .82rem; border-radius: 999px; text-decoration: none; color: #48544f; font-size: .9rem; }
.topbar nav a:hover, .topbar nav .active { background: #edf3ef; color: #174d40; }
.topbar nav .learn-link { background: #e6a84c; color: #2e2517; font-weight: 750; }
.page-shell { width: min(1440px, calc(100% - 36px)); margin: 0 auto 4rem; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding: 3.2rem 1rem 2rem; }
.eyebrow { margin: 0 0 .7rem; letter-spacing: .16em; font-size: .72rem; font-weight: 800; color: #a46420; }
.hero h1 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(2rem, 5vw, 4.1rem); font-weight: 500; color: #173e34; }
.hero p:last-child { margin-bottom: 0; color: #65716c; }
.metrics { display: flex; gap: .7rem; }
.metrics span { display: grid; padding: .75rem 1rem; min-width: 100px; border: 1px solid #d8ded8; border-radius: 12px; background: rgba(255,255,255,.66); color: #6a746f; font-size: .75rem; }
.metrics strong { font-size: 1.15rem; color: #234f43; }
.search { display: grid; grid-template-columns: 1fr auto; gap: .7rem; margin: 0 1rem 1.4rem; padding: .65rem; background: #fff; border: 1px solid #d8ddd7; border-radius: 16px; box-shadow: 0 14px 40px rgba(32,58,48,.08); }
.search input { min-width: 0; border: 0; outline: 0; padding: .7rem 1rem; font: inherit; font-size: 1.02rem; background: transparent; }
.search button, .practice-button { border: 0; border-radius: 11px; background: #176b58; color: #fff; padding: .82rem 1.35rem; font: inherit; font-weight: 760; cursor: pointer; text-decoration: none; }
.dictionary-grid { display: grid; grid-template-columns: minmax(280px, 390px) minmax(0, 1fr); min-height: 680px; margin: 0 1rem; overflow: hidden; border: 1px solid #d8ddd7; border-radius: 18px; background: rgba(255,255,255,.82); box-shadow: 0 20px 55px rgba(32,58,48,.07); }
.results-pane { border-right: 1px solid #dfe3df; background: rgba(248,249,245,.8); }
.pane-heading { display: flex; align-items: center; justify-content: space-between; padding: 1.15rem 1.2rem; border-bottom: 1px solid #e1e5e1; }
.pane-heading h2 { margin: 0; font-size: 1rem; }
.pane-heading span { color: #7c8781; font-size: .8rem; }
.result-list { max-height: 920px; overflow: auto; }
.result-item { display: grid; gap: .26rem; padding: .95rem 1.2rem; border-bottom: 1px solid #e4e7e3; text-decoration: none; }
.result-item:hover { background: #fff; }
.result-item.selected { background: #e8f1ed; box-shadow: inset 4px 0 #24715f; }
.result-word { font-family: Georgia, serif; font-size: 1.18rem; color: #173f34; }
.result-gloss { color: #53615b; font-size: .88rem; line-height: 1.4; }
.matched-form, .result-domain { color: #97703d; font-size: .72rem; }
.detail-pane { padding: clamp(1.3rem, 3.3vw, 3rem); background: rgba(255,255,255,.75); }
.entry-header { display: flex; justify-content: space-between; align-items: start; gap: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid #dfe3df; }
.entry-kind { margin: 0 0 .35rem; text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; font-weight: 800; color: #a26a28; }
.entry-header h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.2rem, 5vw, 4.6rem); font-weight: 500; color: #16493c; }
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.tag-row span { padding: .22rem .52rem; border-radius: 999px; background: #edf1ed; color: #58645f; font-size: .75rem; }
.tag-row .ipa { font-family: Georgia, serif; background: #fff2d9; color: #7d592b; }
.tag-row.subtle { margin-top: .8rem; }
.sense-list { display: grid; gap: 1rem; margin-top: 1.4rem; }
.sense-card { display: grid; grid-template-columns: 30px 1fr; gap: .8rem; padding: 1.15rem; border: 1px solid #e0e4df; border-radius: 13px; background: #fff; }
.sense-number { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #205e4f; color: #fff; font-size: .77rem; font-weight: 800; }
.sense-card h3, .expression-detail h3 { margin: 0 0 .45rem; font-size: 1.15rem; color: #183f35; }
.definition-zh, .definition-fr { margin: .35rem 0; line-height: 1.72; }
.definition-fr { color: #5d6964; }
blockquote { margin: .85rem 0 .3rem; padding: .75rem 1rem; border-left: 3px solid #e3aa55; background: #fff9ed; color: #3d4c46; font-family: Georgia, serif; line-height: 1.6; }
.example-zh { margin: .25rem 0; color: #7a756b; font-size: .88rem; }
.detail-section { margin-top: 2rem; }
.detail-section > h3 { margin-bottom: .8rem; color: #294a41; }
.expression-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.expression-grid a { display: grid; gap: .25rem; padding: .85rem 1rem; border: 1px solid #e0e4df; border-radius: 10px; background: #fff; text-decoration: none; }
.expression-grid a:hover { border-color: #76a393; }
.expression-grid span { color: #68736e; font-size: .83rem; }
.form-cloud { display: flex; flex-wrap: wrap; gap: .45rem; }
.form-cloud span, .form-cloud a { padding: .37rem .65rem; border: 1px solid #d9dfda; border-radius: 8px; background: #fff; color: #36584f; text-decoration: none; font-size: .84rem; }
.conjugation-help { margin: -.25rem 0 1rem; color: #69756f; font-size: .88rem; }
.conjugation-groups { display: grid; gap: .8rem; }
.conjugation-group { min-width: 0; overflow: hidden; border: 1px solid #dce2dc; border-radius: 12px; background: #fff; }
.conjugation-group > summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; cursor: pointer; list-style: none; background: #f3f7f3; }
.conjugation-group > summary::-webkit-details-marker { display: none; }
.conjugation-group > summary::before { content: '＋'; flex: 0 0 auto; color: #397261; font-weight: 800; }
.conjugation-group[open] > summary::before { content: '−'; }
.conjugation-group > summary span { display: grid; gap: .18rem; margin-right: auto; }
.conjugation-group > summary strong { color: #214b3f; font-size: .98rem; }
.conjugation-group > summary small { color: #6f7b75; font-size: .78rem; font-weight: 400; }
.conjugation-group > summary b { flex: 0 0 auto; padding: .25rem .52rem; border-radius: 999px; background: #e3eee8; color: #356353; font-size: .72rem; }
.conjugation-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: .85rem; padding: .9rem; align-items: start; }
.conjugation-card { min-width: 0; overflow: hidden; border: 1px solid #dfe5df; border-radius: 10px; background: #fff; }
.conjugation-card > header { padding: .85rem 1rem .7rem; border-top: 3px solid #6d9b8b; border-bottom: 1px solid #e4e8e4; background: #fafbf8; }
.conjugation-card h4 { margin: 0; color: #2d5046; font-size: .97rem; }
.conjugation-card header span { color: #94704b; font-family: Georgia, serif; font-size: .78rem; }
.conjugation-usage { min-height: 2.7em; margin: 0; padding: .7rem 1rem; color: #66726c; font-size: .79rem; line-height: 1.45; }
.conjugation-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.conjugation-table th, .conjugation-table td { padding: .42rem .75rem; border-top: 1px solid #edf0ed; text-align: left; vertical-align: baseline; }
.conjugation-table th { width: 31%; color: #76827c; font-size: .76rem; font-weight: 650; }
.conjugation-table td { color: #173f34; font-family: Georgia, serif; font-size: .92rem; font-weight: 650; overflow-wrap: anywhere; }
.conjugation-example { display: grid; gap: .18rem; margin: .7rem; padding: .65rem .75rem; border-left: 3px solid #dfa551; background: #fff9ed; }
.conjugation-example strong { color: #3c5048; font-family: Georgia, serif; font-size: .82rem; line-height: 1.4; }
.conjugation-example span { color: #837765; font-size: .76rem; line-height: 1.35; }
.expression-detail { margin-top: 1.4rem; padding: 1.3rem; border: 1px solid #dfe3df; border-radius: 13px; background: #fff; }
.empty-card, .detail-empty, .no-results { padding: 3rem; text-align: center; color: #6f7b75; }
.empty-card { margin: 1rem; border: 1px solid #dde1dc; border-radius: 16px; background: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 820px) {
    .topbar { min-height: 68px; padding: .7rem 1rem; align-items: flex-start; }
    .brand span { display: none; }
    .topbar nav { gap: 0; }
    .topbar nav a { padding: .5rem .55rem; font-size: .78rem; }
    .hero { align-items: start; padding-top: 2rem; }
    .metrics { display: none; }
    .dictionary-grid { grid-template-columns: 1fr; }
    .results-pane { border-right: 0; border-bottom: 1px solid #dfe3df; }
    .result-list { max-height: 320px; }
    .expression-grid { grid-template-columns: 1fr; }
    .conjugation-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
}

@media (max-width: 520px) {
    .page-shell { width: 100%; }
    .hero { padding-inline: 1rem; }
    .hero h1 { font-size: 2.25rem; }
    .search, .dictionary-grid { margin-inline: .65rem; }
    .detail-pane { padding: 1.1rem; }
    .entry-header { display: grid; }
    .practice-button { justify-self: start; }
    .conjugation-group > summary { align-items: flex-start; }
    .conjugation-group > summary b { display: none; }
    .conjugation-list { grid-template-columns: 1fr; padding: .65rem; }
}
