@font-face{font-family:"Nunito";src:url("vendor/nunito-latin-400-normal.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"Nunito";src:url("vendor/nunito-latin-600-normal.woff2") format("woff2");font-weight:600;font-style:normal;font-display:swap}
@font-face{font-family:"Nunito";src:url("vendor/nunito-latin-700-normal.woff2") format("woff2");font-weight:700;font-style:normal;font-display:swap}
@font-face{font-family:"Nunito";src:url("vendor/nunito-latin-800-normal.woff2") format("woff2");font-weight:800;font-style:normal;font-display:swap}

:root{
  --bg:#FFFDF7;
  --surface:#FFFFFF;
  --ink:#211D17;
  --ink-2:#4C463A;
  --muted:#8F8778;
  --line:#F1E7D3;
  --line-strong:#E7D9BC;
  --yellow:#F7B500;
  --yellow-dark:#C98F00;
  --yellow-soft:#FFF4D3;
  --yellow-softer:#FFFBF0;
  --radius:22px;
  --radius-sm:14px;
  --shadow:0 10px 30px rgba(74, 58, 18, .06);
}

*{box-sizing:border-box}
[hidden]{display:none !important}
html{scroll-behavior:smooth}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:"Nunito","SF Pro Rounded",ui-rounded,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,-apple-system,sans-serif;
  font-size:16px;
  line-height:1.65;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
a{color:inherit;text-decoration:none}
button{font-family:inherit;color:inherit}
::selection{background:var(--yellow-soft)}

.shell{min-height:100vh;display:flex;flex-direction:column}

/* ---------- top bar ---------- */
.topbar{
  position:sticky;top:0;z-index:40;
  display:flex;align-items:center;gap:24px;
  height:66px;padding:0 clamp(16px,4vw,40px);
  background:rgba(255,253,247,.88);
  backdrop-filter:saturate(1.4) blur(14px);
  -webkit-backdrop-filter:saturate(1.4) blur(14px);
  border-bottom:1px solid var(--line);
}
.brand{display:flex;align-items:center;gap:9px;border-radius:12px}
.brand-mark{display:flex;width:26px;height:26px}
.brand-name{font-size:17px;font-weight:700;letter-spacing:.02em}
.nav{display:flex;gap:2px;margin-left:8px}
.nav a{
  padding:7px 14px;border-radius:999px;
  font-size:14.5px;color:var(--muted);
  transition:background .16s ease,color .16s ease;
}
.nav a:hover{color:var(--ink)}
.nav a.active{background:var(--yellow-soft);color:var(--ink);font-weight:600}
.due-pill{
  margin-left:auto;display:flex;align-items:center;gap:8px;
  height:36px;padding:0 15px;border-radius:999px;
  border:1px solid var(--line-strong);background:var(--surface);
  font-size:13.5px;color:var(--ink-2);cursor:pointer;
  transition:border-color .16s ease,background .16s ease;
}
.due-pill:hover{border-color:var(--yellow);background:var(--yellow-softer)}
.due-dot{width:7px;height:7px;border-radius:50%;background:var(--yellow)}

/* ---------- layout ---------- */
.app{
  width:100%;max-width:780px;
  margin:0 auto;padding:clamp(32px,6vw,56px) 22px 80px;
  flex:1;
}
.foot{
  display:flex;justify-content:center;gap:8px;flex-wrap:wrap;
  padding:26px 20px 34px;
  font-size:12.5px;color:var(--muted);
}
.foot-dot{opacity:.6}

/* ---------- typography ---------- */
h1,h2,h3,h4,p{margin:0}
.page-title{
  font-size:clamp(26px,4vw,32px);font-weight:700;letter-spacing:-.02em;
  line-height:1.3;
}
.page-sub{margin-top:10px;color:var(--muted);font-size:14.5px}
.eyebrow{
  font-size:12px;letter-spacing:.12em;color:var(--muted);
  font-weight:600;text-transform:uppercase;
}
.section-title{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  margin:34px 0 14px;font-size:13px;color:var(--muted);font-weight:600;
  letter-spacing:.08em;
}

/* ---------- search ---------- */
.search-block{margin-top:26px}
.search-row{
  display:flex;align-items:center;gap:6px;
  height:64px;padding:0 10px 0 18px;
  background:var(--surface);
  border:1.5px solid var(--line-strong);
  border-radius:20px;
  transition:border-color .16s ease,box-shadow .16s ease;
  position:relative;
}
.search-row:focus-within{
  border-color:var(--yellow);
  box-shadow:0 0 0 4px var(--yellow-soft);
}
.search-row svg{flex:none;color:var(--muted)}
.search-input{
  flex:1;min-width:0;border:0;outline:0;background:transparent;
  font-family:inherit;font-size:19px;color:var(--ink);
  padding:0 6px;
}
.search-input::placeholder{color:#B9B0A0}
.search-btn{
  flex:none;height:44px;padding:0 20px;border:0;border-radius:14px;
  background:var(--yellow);color:#231A00;font-size:14.5px;font-weight:700;
  cursor:pointer;transition:background .16s ease;
}
.search-btn:hover{background:#FFC32A}
.search-try{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  margin-top:20px;font-size:13px;color:var(--muted);
}
.search-try .chip{background:transparent;border-color:var(--line);color:var(--ink-2)}
.search-try .chip:hover{background:var(--yellow-softer);border-color:var(--yellow)}
.search-hint{
  display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  margin-top:12px;font-size:13px;color:var(--muted);
}
.auto-toggle{
  display:inline-flex;align-items:center;gap:8px;
  padding:5px 12px;border-radius:999px;background:var(--yellow-softer);
  border:1px solid var(--line);cursor:pointer;font-size:12.5px;color:var(--ink-2);
  user-select:none;
}
.auto-toggle input{accent-color:var(--yellow);width:14px;height:14px;margin:0}

.suggest{
  position:absolute;left:0;right:0;top:calc(100% + 8px);
  background:var(--surface);border:1px solid var(--line-strong);
  border-radius:18px;box-shadow:var(--shadow);
  padding:6px;max-height:340px;overflow:auto;
  z-index:30;
}
.suggest[hidden]{display:none}
.suggest-item{
  display:flex;align-items:baseline;gap:12px;
  padding:10px 12px;border-radius:12px;cursor:pointer;
}
.suggest-item:hover,.suggest-item.focus{background:var(--yellow-softer)}
.suggest-item .w{font-weight:650;font-size:15.5px}
.suggest-item .t{
  color:var(--muted);font-size:13px;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;
}
.suggest-empty{padding:14px;color:var(--muted);font-size:13.5px}

/* ---------- cards ---------- */
.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:clamp(22px,4vw,32px);
}
.card + .card{margin-top:16px}

/* ---------- word detail ---------- */
.word-card{margin-top:22px}
.word-head{display:flex;align-items:flex-start;gap:20px;flex-wrap:wrap}
.word-main{min-width:0;flex:1}
.word-title{
  font-size:clamp(34px,6vw,44px);font-weight:700;letter-spacing:-.03em;
  line-height:1.15;word-break:break-word;
}
.word-meta{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:10px}
.phon{color:var(--muted);font-size:15px;letter-spacing:.01em}
.tag{
  font-size:11.5px;letter-spacing:.04em;font-weight:600;
  padding:3px 9px;border-radius:999px;color:#8A6200;background:var(--yellow-soft);
}
.icon-btn{
  display:inline-flex;align-items:center;justify-content:center;
  width:34px;height:34px;border-radius:50%;
  border:1px solid var(--line-strong);background:var(--surface);
  color:var(--ink-2);cursor:pointer;
  transition:background .16s ease,border-color .16s ease;
}
.icon-btn:hover{background:var(--yellow-softer);border-color:var(--yellow)}
.icon-btn.spinning svg{animation:pulse 1s infinite}
@keyframes pulse{50%{opacity:.35}}

.word-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.deck-select{
  height:42px;padding:0 34px 0 14px;border-radius:999px;
  border:1px solid var(--line-strong);background:var(--surface);
  font-family:inherit;font-size:13.5px;color:var(--ink-2);
  appearance:none;cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' stroke='%238F8778' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 13px center;
}
.added-note{
  display:flex;align-items:center;gap:8px;
  font-size:13.5px;color:var(--yellow-dark);font-weight:600;
}

.defs{margin-top:26px;display:flex;flex-direction:column;gap:8px}
.def{display:flex;gap:12px;align-items:baseline}
.def .pos{
  flex:none;min-width:32px;font-size:12.5px;font-weight:700;
  color:var(--yellow-dark);padding-top:2px;
}
.def .cn{font-size:16.5px;color:var(--ink)}
.divider{height:1px;background:var(--line);margin:26px 0}

.blocks{display:flex;flex-direction:column;gap:28px}
.block-label{
  font-size:12px;letter-spacing:.1em;color:var(--muted);
  font-weight:600;margin-bottom:12px;
}
.ex{
  padding-left:14px;border-left:2px solid var(--yellow);
  display:flex;flex-direction:column;gap:2px;
}
.ex + .ex{margin-top:12px}
.ex-en{font-size:15.5px;color:var(--ink)}
.ex-en b{font-weight:700}
.ex-cn{font-size:13.5px;color:var(--muted)}
.def-en{font-size:14.5px;color:var(--ink-2)}
.def-en + .def-en{margin-top:8px}
.def-en .pos-en{color:var(--yellow-dark);font-style:italic;margin-right:6px}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.chip{
  font-size:13px;padding:5px 12px;border-radius:999px;
  background:var(--yellow-softer);border:1px solid var(--line);
  color:var(--ink-2);cursor:pointer;
}
.chip:hover{border-color:var(--yellow)}
.muted{color:var(--muted)}
.small{font-size:13px}
.loading-line{height:12px;border-radius:6px;background:linear-gradient(90deg,#F8F1E2,#FFF9EE,#F8F1E2);background-size:200% 100%;animation:shimmer 1.4s infinite}
@keyframes shimmer{0%{background-position:0 0}100%{background-position:-200% 0}}

/* ---------- buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  height:44px;padding:0 20px;border-radius:999px;
  border:1px solid transparent;background:transparent;
  font-size:14.5px;font-weight:600;cursor:pointer;
  transition:background .16s ease,border-color .16s ease,color .16s ease;
  white-space:nowrap;
}
.btn-primary{background:var(--yellow);color:#231A00}
.btn-primary:hover{background:#FFC32A}
.btn-ghost{background:var(--surface);border-color:var(--line-strong);color:var(--ink-2)}
.btn-ghost:hover{border-color:var(--yellow);background:var(--yellow-softer)}
.btn-quiet{color:var(--muted);padding:0 10px;height:38px;font-weight:500}
.btn-quiet:hover{color:var(--ink)}
.btn-danger{color:#B4462F}
.btn[disabled]{opacity:.45;cursor:not-allowed}
.btn-sm{height:36px;padding:0 14px;font-size:13px}
.btn-block{width:100%}

/* ---------- decks ---------- */
.deck-grid{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:14px;margin-top:24px;
}
.deck{
  position:relative;text-align:left;
  background:var(--surface);border:1px solid var(--line);
  border-radius:18px;padding:20px;cursor:pointer;
  transition:border-color .16s ease,transform .16s ease;
  display:flex;flex-direction:column;align-items:stretch;gap:12px;
  font-family:inherit;
}
.deck:hover{border-color:var(--yellow);transform:translateY(-1px)}
.deck-name{
  font-size:16.5px;font-weight:650;color:var(--ink);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  padding-right:20px;
}
.deck-meta{display:flex;align-items:baseline;gap:6px;font-size:13px;color:var(--muted)}
.deck-meta strong{font-size:22px;color:var(--ink);font-weight:700;letter-spacing:-.01em}
.deck-due{color:var(--yellow-dark);font-weight:600}
.bar{height:7px;border-radius:999px;background:#F1E3C2;overflow:hidden}
.bar > i{display:block;height:100%;border-radius:999px;background:var(--yellow);transition:width .3s ease}
.deck-new{
  border-style:dashed;border-color:var(--line-strong);color:var(--muted);
  align-items:center;justify-content:center;display:flex;flex-direction:column;gap:6px;
  font-size:14px;min-height:132px;
}
.deck-new:hover{color:var(--ink);border-color:var(--yellow);background:var(--yellow-softer)}
.empty{
  padding:46px 24px;text-align:center;color:var(--muted);font-size:14px;
  border:1px dashed var(--line-strong);border-radius:var(--radius);
  background:rgba(255,255,255,.5);
}
.empty strong{display:block;color:var(--ink-2);font-size:15px;margin-bottom:6px}

/* deck detail */
.detail-head{display:flex;align-items:flex-start;gap:16px;flex-wrap:wrap}
.detail-head .grow{flex:1;min-width:220px}
.back{
  display:inline-flex;align-items:center;gap:6px;
  font-size:13.5px;color:var(--muted);margin-bottom:18px;
}
.back:hover{color:var(--ink)}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:24px 0 12px}
.filter-input{
  height:40px;flex:1;min-width:160px;
  border:1px solid var(--line-strong);border-radius:12px;
  padding:0 14px;background:var(--surface);
  font-family:inherit;font-size:14px;outline:none;
}
.filter-input:focus{border-color:var(--yellow)}
.word-list{
  background:var(--surface);border:1px solid var(--line);
  border-radius:18px;overflow:hidden;
}
.word-row{
  display:flex;align-items:center;gap:12px;
  padding:12px 18px;border-bottom:1px solid var(--line);
}
.word-row:last-child{border-bottom:0}
.word-row:hover{background:#FFFCF4}
.word-row input[type=checkbox]{accent-color:var(--yellow);width:16px;height:16px;flex:none}
.word-row .w{font-weight:600;font-size:15.5px;min-width:120px}
.word-row .t{color:var(--muted);font-size:13px;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.word-row .box{
  font-size:11.5px;color:var(--yellow-dark);background:var(--yellow-soft);
  border-radius:999px;padding:2px 8px;flex:none;
}
.word-row .box.new{background:#F3F0E9;color:#8F8778}
.row-link{cursor:pointer}
.list-foot{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:14px 18px;background:var(--yellow-softer);border-top:1px solid var(--line)}

/* ---------- review ---------- */
.review-wrap{display:flex;flex-direction:column}
.review-top{display:flex;align-items:center;gap:14px;margin-bottom:26px}
.review-top .bar{flex:1}
.review-count{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.flash{
  flex:0 0 auto;display:flex;flex-direction:column;
  background:var(--surface);border:1px solid var(--line);
  border-radius:26px;padding:clamp(26px,6vw,46px);
  min-height:300px;cursor:pointer;
  transition:border-color .16s ease;
}
.flash:hover{border-color:var(--line-strong)}
.flash-face{flex:1;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:14px;text-align:center}
.flash-word{font-size:clamp(34px,7vw,52px);font-weight:700;letter-spacing:-.03em;line-height:1.15}
.flash-hint{margin-top:18px;font-size:12.5px;color:var(--muted)}
.flash-back{width:100%;display:flex;flex-direction:column;gap:18px;text-align:left}
.rate-row{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:22px}
.rate{
  height:52px;border-radius:14px;border:1px solid var(--line-strong);
  background:var(--surface);font-size:14px;font-weight:600;cursor:pointer;
  transition:background .16s,border-color .16s,transform .1s;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
}
.rate small{font-size:11px;color:var(--muted);font-weight:500}
.rate:hover{border-color:var(--yellow);background:var(--yellow-softer)}
.rate:active{transform:scale(.985)}
.rate.good{border-color:var(--yellow);background:var(--yellow-soft)}
.summary{display:flex;flex-direction:column;align-items:center;gap:18px;text-align:center;padding:40px 20px}
.summary .big{font-size:52px;font-weight:700;letter-spacing:-.03em}
.summary-grid{display:flex;gap:26px;margin-top:4px}
.summary-grid div{display:flex;flex-direction:column;gap:2px;font-size:12.5px;color:var(--muted)}
.summary-grid strong{font-size:20px;color:var(--ink)}
.focus-ring:focus-visible{outline:3px solid var(--yellow-soft);outline-offset:2px}

/* ---------- import ---------- */
.drop{
  margin-top:24px;padding:44px 24px;text-align:center;
  border:1.5px dashed var(--line-strong);border-radius:20px;
  background:rgba(255,255,255,.6);cursor:pointer;
  transition:border-color .16s,background .16s;
}
.drop:hover,.drop.over{border-color:var(--yellow);background:var(--yellow-softer)}
.drop-icon{
  width:46px;height:46px;margin:0 auto 12px;border-radius:14px;
  background:var(--yellow-soft);display:flex;align-items:center;justify-content:center;
  color:var(--yellow-dark);
}
.drop strong{font-size:15.5px}
.drop p{margin-top:6px;font-size:13px;color:var(--muted)}
.paste-area{
  width:100%;min-height:120px;margin-top:14px;padding:14px;
  border:1px solid var(--line-strong);border-radius:16px;
  background:var(--surface);font-family:inherit;font-size:14px;line-height:1.7;
  outline:none;resize:vertical;
}
.paste-area:focus{border-color:var(--yellow)}
.import-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:16px}
.hint-list{margin:14px 0 0;padding-left:18px;color:var(--muted);font-size:13px;line-height:1.9}
.hint-list code{background:var(--yellow-softer);padding:1px 6px;border-radius:6px;font-size:12.5px}

/* ---------- toast ---------- */
.toast{
  position:fixed;left:50%;bottom:30px;transform:translate(-50%,12px);
  background:#211D17;color:#FFF8E6;font-size:13.5px;
  padding:11px 18px;border-radius:999px;
  box-shadow:0 12px 30px rgba(33,29,23,.18);
  opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;
  z-index:100;max-width:calc(100vw - 40px);text-align:center;
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast button{
  margin-left:10px;background:none;border:0;color:var(--yellow);
  font-weight:700;cursor:pointer;font-size:13px;
}

/* ---------- responsive ---------- */
@media (max-width:640px){
  .topbar{gap:10px;padding:0 16px;height:60px}
  .nav{margin-left:2px}
  .nav a{padding:6px 10px;font-size:13.5px}
  .due-label{display:none}
  .app{padding:28px 16px 64px}
  .search-row{height:58px;padding-left:14px}
  .search-input{font-size:17px}
  .search-btn{padding:0 14px;height:40px}
  .word-head{gap:14px}
  .word-tools{width:100%}
  .deck-select{flex:1}
  .word-row .t{display:none}
  .rate-row{grid-template-columns:1fr}
  .rate{height:46px}
  .flash{min-height:300px}
  .due-pill{padding:0 13px}
  .foot{flex-direction:column;gap:2px;align-items:center}
  .foot-dot{display:none}
  .toast{font-size:13px;padding:10px 16px;bottom:22px}
  .flash{min-height:270px}
  #newDeckBtn{padding:0 16px;height:40px}
}
@media (max-width:359px){
  .brand-name{display:none}
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms !important;transition-duration:.01ms !important}
}
