/* Vocabulary page + word rows (soft style) */
.words-soft .page-head { align-items: flex-start; }
.ph-search { display: flex; align-items: center; gap: 6px; width: 110px; flex-shrink: 0; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--soft-line); background: var(--surface); color: var(--text-dim); box-shadow: var(--shadow-card); }
.ph-search:focus-within { border-color: var(--accent); }
.ph-search input { flex: 1; min-width: 0; padding: 0; background: none; border: 0; outline: 0; color: var(--text); font-family: var(--font-ui); font-size: 14px; }

.wp-toggles.toggle-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; background: none; border: 0; border-radius: 0; }
.wp-toggles .toggle-btn { flex: none; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); box-shadow: none; color: var(--text); font-size: 12px; }
.wp-toggles .toggle-btn.active { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); border-color: var(--accent); box-shadow: none; }

.word-list.soft { display: block; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-card); }
.soft .word-row { align-items: flex-start; gap: 10px; padding: 12px; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.soft .word-row:last-child { border-bottom: 0; }
.soft .word-row:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); border-color: var(--line); }
.wr-num { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 11px; color: #fff; font-size: 14px; font-weight: 800; }
.wr-num.c0 { background: #F5826B; } .wr-num.c1 { background: #F2B01E; } .wr-num.c2 { background: #5BB98B; } .wr-num.c3 { background: #9B7FD9; }
.wr-num.n4 { font-size: 11px; letter-spacing: -.04em; }
.wr-main { flex: 1; min-width: 0; }
.wr-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.soft .word-row .w { font-size: 16.5px; font-weight: 800; letter-spacing: -.005em; }
.wr-ipa { font-family: var(--font-ipa); font-size: 12.5px; color: var(--text-dim); }
.pos-chip { padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--text-dim); }
.pos-chip[data-pos="noun"] { background: #DDF3E6; color: #2E8B57; }
.pos-chip[data-pos="verb"] { background: #E9E1FA; color: #7455C4; }
.pos-chip[data-pos="adjective"] { background: #DCEBFA; color: #3B7CC4; }
.pos-chip[data-pos="adverb"] { background: #FFE3D8; color: #D2603F; }
.wr-vi { margin-top: 3px; font-size: 13.5px; color: var(--text); }
.wr-vi b { font-weight: 800; margin-right: 4px; }
.wr-ex { margin-top: 2px; font-size: 12.5px; line-height: 1.4; color: var(--text-dim); }
.wr-side { display: flex; flex-direction: column-reverse; align-items: stretch; justify-content: flex-start; gap: 6px; flex: 0 0 76px; width: 76px; padding-top: 2px; }
.wr-side .wr-learn { width: 100%; padding: 8px 0; text-align: center; }
.wr-side .status { height: 22px; align-items: center; justify-content: center; }
.wr-speak { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); cursor: pointer; }
.wr-speak svg { display: none; }
.wr-speak span { font-size: 10.5px; font-weight: 800; letter-spacing: .02em; }
.soft .status { display: flex; align-items: center; justify-content: center; width: 100%; }
.soft .status svg { width: 16px; height: 16px; }
.soft .status .mem-badge { flex-shrink: 0; white-space: nowrap; }
.soft .load-more { padding: 16px; }

@media (min-width: 1040px) {
  .soft .word-row { padding: 16px 20px; }
  .soft .word-row .w { font-size: 18px; }
  .wr-ex { font-size: 13.5px; }
}

/* filter popup */
.ws-search { position: relative; }
.filter-btn { position: relative; }
.fb-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-left: 2px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; }
.fp-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(40, 20, 10, .18); }
.fp-card { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 22px 50px -16px rgba(60, 30, 15, .45); }
.fp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.fp-head b { flex: 1; font-size: 16px; font-weight: 800; }
.fp-head .link-btn { color: var(--accent); font-weight: 700; }
.fp-x { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text-dim); cursor: pointer; }
.fp-label { margin: 12px 0 8px; font-size: 12px; font-weight: 700; color: var(--text-dim); }
.fp-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-card .wp-toggles.toggle-bar { margin: 0; }
.fp-card .pill { border-color: var(--line); box-shadow: none; } .fp-card .pill.active { border-color: transparent; }
.fp-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.fp-rtext { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fp-rtext b { font-size: 14px; font-weight: 800; }
.fp-rtext span { font-size: 12px; line-height: 1.4; color: var(--text-dim); }

.wr-learn { padding: 7px 14px; border: 0; border-radius: 999px; background: var(--btn-bg, var(--accent)); color: var(--accent-ink); font-family: var(--font-ui); font-size: 12.5px; font-weight: 800; cursor: pointer; box-shadow: 0 8px 16px -10px var(--accent); }
.soft .word-row { cursor: pointer; }

/* Library: levels | my decks */
.lib-seg { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 14px; background: var(--surface-2); }
.lib-seg button { border: 0; background: transparent; color: var(--text-dim); font: inherit; font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.lib-seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.lib-seg .n { font-size: 12px; opacity: .7; }
.level-row.deck-row { display: flex; flex-wrap: wrap; overflow: visible; }
.deck-chip { max-width: 100%; min-width: 0; }
.deck-chip .lc-code { font-size: 14px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.lib-empty { font-size: 14px; color: var(--text-dim); margin: 0 0 14px; }

/* The open deck */
.deck-card { margin-bottom: 14px; }
.dc-title h3 { margin: 0 0 4px; font-size: 18px; overflow-wrap: anywhere; }
.dc-title span { font-size: 13px; color: var(--text-dim); }
.dc-desc { margin: 10px 0 0; font-size: 14px; color: var(--text-dim); overflow-wrap: anywhere; }
.dc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dc-actions .btn { width: auto; }

.deck-add .lc-code { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Library catalog ---------- */
.cat-page { display: flex; flex-direction: column; gap: 26px; max-width: 920px; margin-left: auto; margin-right: auto; }
.cat-hero { display: flex; align-items: center; gap: 18px; padding: 22px 24px; }
.ch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ch-main h1 { margin: 0; font-family: var(--font-word); font-size: 30px; line-height: 1.1; }
.ch-main p { margin: 0; color: var(--text-dim); font-size: 14.5px; }
.ch-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ch-actions .ph-search { flex: 1 1 220px; }
.ch-actions .btn { width: auto; display: inline-flex; align-items: center; gap: 6px; }
.ch-img { width: 130px; height: 136px; object-fit: contain; flex-shrink: 0; }
@media (max-width: 560px) { .ch-img { width: 84px; height: 88px; align-self: flex-start; } .cat-hero { padding: 18px; } .ch-main h1 { font-size: 26px; } }
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-top: -8px; scrollbar-width: none; }
.cat-tabs .pill { flex-shrink: 0; }
.cat-sec { display: flex; flex-direction: column; gap: 12px; }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cat-head h2 { margin: 0; font-family: var(--font-word); font-size: 21px; }
.cat-head span { font-size: 13px; color: var(--text-dim); text-align: right; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cat-grid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cat-grid.topics { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.pk-card, .pk-row, .pk-topic { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; color: var(--text); font: inherit; text-align: left; }
button.pk-card, button.pk-row { cursor: pointer; }
.pk-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.pk-card b { font-size: 15px; }
.pk-card > span { font-size: 12.5px; color: var(--text-dim); }
.pk-row { display: flex; align-items: center; gap: 12px; padding: 14px; min-width: 0; }
.pk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pk-main b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-main span { font-size: 12.5px; color: var(--text-dim); }
.pk-tile { height: 70px; border-radius: 14px; display: grid; place-items: center; font-family: var(--font-word); font-weight: 800; font-size: 30px; }
.pk-row .pk-tile { width: 54px; height: 54px; flex-shrink: 0; font-size: 21px; }
.pk-tile.sm { font-size: 13px; line-height: 1.05; text-align: center; padding: 2px; }
.pk-tile.deck { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); }
.pk-tile.big { width: 150px; height: 150px; flex-shrink: 0; border-radius: 28px; font-size: 58px; }
.pk-bar { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pk-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.pk-tag { position: absolute; top: 10px; right: 10px; font-style: normal; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 8px; background: var(--surface-2); color: var(--text-dim); display: inline-flex; align-items: center; gap: 3px; }
.pk-row .pk-tag { position: static; flex-shrink: 0; }
.pk-tag.vip { background: #F7E2A8; color: #5B4300; }
.pk-tag.on { background: var(--accent); color: var(--accent-ink); }
.pk-play { width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; }
.pk-add { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 82px; padding: 14px; border: 2px dashed var(--line); border-radius: 20px; background: transparent; color: var(--text-dim); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.pk-add small { font-weight: 600; opacity: .8; }
.pk-add.muted { cursor: default; font-weight: 600; }
.soon { opacity: 1; }   /* coming-soon packs are shown at full strength (the "Sắp có" tag says it) */
.pk-topic { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px 12px; text-align: center; }
.pk-topic img { width: 60px; height: 60px; object-fit: contain; }
.pk-topic b { font-size: 13.5px; }
.pk-topic .pk-tag { position: static; }
.cat-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); }
.cat-empty img { width: 76px; height: 88px; object-fit: contain; }
.cat-empty > div { flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; }
.cat-empty span { font-size: 13.5px; color: var(--text-dim); }
.cat-empty .btn { width: auto; }

/* ---------- Open pack header ---------- */
.pk-back { margin-bottom: 10px; }
.pk-hero { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin-bottom: 18px; }
.pk-hmain { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pk-sub { font-size: 12.5px; font-weight: 700; color: var(--accent); }
.pk-hmain h1 { margin: 0; font-family: var(--font-word); font-size: 30px; line-height: 1.1; overflow-wrap: anywhere; }
.pk-hmain p { margin: 0; color: var(--text-dim); font-size: 14px; overflow-wrap: anywhere; }
.pk-stats { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13.5px; color: var(--text-dim); }
.pk-stats b { font-family: var(--font-word); font-size: 19px; color: var(--text); }
.pk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.pk-actions .btn { width: auto; display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 560px) { .pk-tile.big { width: 96px; height: 96px; font-size: 38px; border-radius: 22px; } .pk-hmain h1 { font-size: 24px; } }

/* ---------- Share panel ---------- */
.sh-panel { margin: 0 0 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sh-panel .feedback:empty { display: none; }
/* Share panel: one segmented row for the three modes, a link box with a copy icon, and a Share button */
.sh-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.sh-seg button { padding: 9px 6px; border: 0; border-radius: 10px; background: none; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.sh-seg button.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.sh-note { margin: 0; font-size: 13px; line-height: 1.4; color: var(--text-dim); }
.sh-linkrow { display: flex; gap: 8px; align-items: stretch; }
.sh-linkbox { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 0 4px 0 12px; border-radius: 12px; border: 1px solid var(--soft-line); background: var(--surface-2); }
.sh-linkbox span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--text); user-select: all; }
.sh-copy { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--text-dim); cursor: pointer; }
.sh-copy:hover { color: var(--accent); background: var(--surface); }
.sh-copy.ok { color: var(--mint, #2E8B57); }
.sh-share { flex-shrink: 0; width: auto; display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.sh-code { font-size: 12.5px; color: var(--text-dim); }
.sh-code b { color: var(--text); letter-spacing: .08em; margin-left: 4px; }

.cat-sort { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.cat-sort button { border: 0; background: transparent; color: var(--text-dim); font: inherit; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 8px; cursor: pointer; }
.cat-sort button.on { background: var(--surface); color: var(--text); }
.sh-report { align-self: flex-start; font-size: 12.5px; color: var(--text-dim); }


.pk-row.current { border-color: var(--soft-line-accent); }
.home-packs { margin: 0; }
.home-packs .pk-add { min-height: 82px; }

/* ---------- Deck editor ---------- */
.de2 { max-width: 1180px; }
.de2-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
@media (min-width: 1040px) { .de2-layout { grid-template-columns: minmax(0, 1.25fr) minmax(320px, .9fr); } .de2-side { position: sticky; top: 24px; } }
.de2-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.de2-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.de2-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.de2-f.full { grid-column: 1 / -1; }
.de2-f:empty { display: none; }
.de2-f > span { font-size: 13px; font-weight: 700; color: var(--text); }
.de2-f > span em { color: var(--accent); font-style: normal; }
.de2-f > span small { font-weight: 500; color: var(--text-dim); margin-left: 4px; }
.de2 input, .de2 textarea, .de2 select { width: 100%; box-sizing: border-box; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 15px; outline: 0; transition: border-color .15s, background .15s; }
.de2 input:focus, .de2 textarea:focus, .de2 select:focus { border-color: var(--accent); background: var(--surface); }
.de2 textarea { resize: vertical; }
#fIpa { font-family: 'Noto Sans', var(--font-ui); }
.de2-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 14px; background: var(--surface-2); overflow-x: auto; }
.de2-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.de2-tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.de2-tabs button.on svg { color: var(--accent); }
.de2-search { display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--text-dim); }
.de2-search:focus-within { border-color: var(--accent); background: var(--surface); }
.de2 .de2-search input { flex: 1; min-width: 0; border: 0; padding: 13px 0; background: transparent; }
.de2-results { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.de2-res { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.de2-res.added { opacity: .55; cursor: default; }
.de2-add { flex-shrink: 0; display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); font-size: 12px; font-weight: 800; }
.de2-rmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.de2-rtop { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.de2-rtop b { font-family: var(--font-word); font-size: 16.5px; overflow-wrap: anywhere; }
.de2-ipa { font-family: 'Noto Sans', var(--font-ui); font-size: 13px; color: var(--text-dim); }
.de2-lv { margin-left: auto; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 7px; background: var(--surface-2); color: var(--text-dim); }
.de2-vi { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.de2-vi i { color: var(--text-dim); }
.de2-hint { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-dim); }
.de2-hint .link-btn { font-weight: 700; color: var(--accent); }
.de2-paste { margin-top: 10px; }
.de2-formact { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.de2-formact .btn { width: auto; display: inline-flex; align-items: center; gap: 6px; }
.de2-match { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.de2-match img { width: 46px; height: 52px; object-fit: contain; flex-shrink: 0; }
.de2-mtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.de2-mtext b { font-size: 14.5px; }
.de2-mtext > span { font-size: 13px; color: var(--text-dim); }
.de2-mbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.de2-mbtns .btn { width: auto; }
.de2-listcard { display: flex; flex-direction: column; }
.de2-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.de2-row { display: flex; align-items: flex-start; gap: 8px; padding: 11px 12px; border-radius: 14px; background: var(--surface-2); }
.de2-row.editing { box-shadow: 0 0 0 2px var(--accent) inset; }
.de2-tag { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 7px; background: var(--surface); color: var(--text-dim); }
.de2-tag.own { color: var(--accent); }
button.de2-tag { border: 0; font-family: inherit; cursor: pointer; }
button.de2-tag:hover { background: var(--surface-2); color: var(--accent); }
.de2 .de2-ownvi { margin-top: 4px; padding: 8px 10px; font-size: 14px; background: var(--surface); }
.de2-ract { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.de2-ract button { width: 32px; height: 32px; border: 0; border-radius: 9px; background: var(--surface); color: var(--text-dim); display: grid; place-items: center; cursor: pointer; }
.de2-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; text-align: center; font-size: 14px; color: var(--text-dim); }
.de2-empty img { width: 70px; height: 80px; object-fit: contain; }
.de2-listcard .feedback { margin-top: 10px; min-height: 0; }
.de2-save { width: 100%; margin-top: 14px; }
@media (max-width: 560px) { .de2-fields { grid-template-columns: 1fr; } .de2-tabs button span { font-size: 13px; } }
.de2-fromkey { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); display: flex; gap: 6px; align-items: flex-start; }
.de2-fromkey svg { flex-shrink: 0; margin-top: 3px; color: var(--accent); }

/* Deck audio (kitten-tts.js): note + example opt-in in the deck editor, and the background status pill. */
.de2-audio { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.de2-audio p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-dim); display: flex; gap: 6px; align-items: flex-start; }
.de2-audio .btn { align-self: flex-start; }
.de2-audio .btn.on { color: var(--accent); border-color: var(--accent); }
.de2-audio small { font-size: 12px; line-height: 1.4; color: var(--text-dim); }
.tts-sync { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 60; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  box-shadow: var(--shadow-card, 0 8px 24px -10px rgba(0, 0, 0, .3)); font-size: 13px; font-weight: 600; pointer-events: none; }
.tts-sync.ok { color: var(--accent); }
.tts-sync.err { color: var(--text-dim); }
.tts-spin { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: tts-spin .8s linear infinite; }
@keyframes tts-spin { to { transform: rotate(360deg); } }
/* Deck audio progress card (desktop, where clips are made): counts, speed, then a summary that stays until closed. */
.tts-card { flex-direction: column; align-items: stretch; gap: 6px; width: 340px; border-radius: 16px; padding: 12px 14px; pointer-events: auto; font-weight: 500; }
.tts-card .tc-head { display: flex; align-items: center; gap: 8px; }
.tts-card .tc-head b { flex: 1; font-size: 13.5px; }
.tts-card .tc-sub { font-size: 12px; color: var(--text-dim); margin-top: -2px; }
.tts-card .tc-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.tts-card .tc-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s; }
.tts-card .tc-nums { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-dim); }
.tts-card .tc-nums b { color: var(--text); }
.tts-card .tc-x { border: 0; background: none; color: var(--text-dim); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.tts-card .tc-stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 2px 0 0; font-size: 12.5px; }
.tts-card .tc-stats dt { color: var(--text-dim); }
.tts-card .tc-stats dd { margin: 0; text-align: right; font-weight: 600; }
.tts-card.done.ok .tc-head b { color: var(--accent); }
/* The progress card tucked into the corner (× on the card): stays out of the way while studying. */
.tts-mini { position: fixed; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 60; }
@media (min-width: 900px) { .tts-mini { bottom: 20px; right: 20px; } }
.tts-mini .tm-btn { display: flex; align-items: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-card, 0 8px 24px -10px rgba(0, 0, 0, .3)); }
.tts-mini.done .tm-btn { color: var(--accent); justify-content: center; }
.tts-card .tc-close { align-self: flex-end; border: 0; background: none; color: var(--text-dim); font: inherit; font-size: 12px; cursor: pointer; padding: 2px 0 0; text-decoration: underline; }
/* Paste tab: quick (word - meaning) or full with an AI prompt */
.de2-pmodes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.de2-pmodes button { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.de2-pmodes button span { font-size: 12.5px; color: var(--text-dim); }
.de2-pmodes button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.de2-ai { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 16px; font-size: 14px; }
.de2-ai li::marker { font-weight: 800; color: var(--accent); }
.de2-ai small { display: block; margin-top: 4px; font-size: 12.5px; color: var(--text-dim); }
.de2-ai .de2-formact { margin-top: 10px; }
.de2-formact.left { justify-content: flex-start; flex-wrap: wrap; align-items: center; }
.de2-prompt { font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); }
/* Deck editor: name + description in one compact box, and word cards read top to bottom */
.de2-info { display: flex; flex-direction: column; padding: 4px 16px; }
.de2-info input, .de2-info textarea { border: 0; background: transparent; color: var(--text); font: inherit; padding: 10px 0; outline: none; resize: vertical; }
.de2-info .de2-title { font-family: var(--font-word); font-size: 18px; font-weight: 800; border-bottom: 1px solid var(--line); }
.de2-info .de2-desc { font-size: 14px; color: var(--text-dim); min-height: 40px; }
.de2-info input::placeholder, .de2-info textarea::placeholder { color: var(--text-dim); font-weight: 500; opacity: .8; }
.de2-row .de2-rmain { gap: 3px; }
.de2-w { font-family: var(--font-word); font-size: 16.5px; overflow-wrap: anywhere; }
.de2-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.de2-src { font-size: 11px; font-weight: 700; color: var(--text-dim); }
.de2-src.own { color: var(--accent); }
.de2-ex { margin-top: 3px; font-size: 13.5px; font-style: italic; color: var(--text); overflow-wrap: anywhere; }
.de2-exvi { font-size: 13px; color: var(--text-dim); overflow-wrap: anywhere; }
.de2-say { display: flex; gap: 6px; margin-top: 6px; }
.de2-say button { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--soft-line); border-radius: 99px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.de2-say button:hover { color: var(--accent); border-color: var(--accent); }
/* Home "Gói đang học" cards: the card opens the word list, ▶ studies */
.pk-row.tap { cursor: pointer; transition: border-color .15s, transform .15s; }
.pk-row.tap:hover { border-color: var(--accent); }
.pk-row.tap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Phones: deck making is desktop-only, said plainly where the "Tạo bộ từ mới" button would be */
.pk-desktop { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 16px; border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); color: var(--accent); }
.pk-desktop > div { display: flex; flex-direction: column; gap: 3px; color: var(--text); }
.pk-desktop b { font-size: 14.5px; }
.pk-desktop span { font-size: 13px; line-height: 1.45; color: var(--text-dim); }
/* Open pack: secondary actions are buttons on wide screens and a ⋯ menu on phones */
.pk-more { display: none; position: relative; }
.pk-more summary { list-style: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--soft-line); background: var(--surface); color: var(--text); cursor: pointer; }
.pk-more summary::-webkit-details-marker { display: none; }
.pk-more[open] summary { border-color: var(--accent); color: var(--accent); }
.pk-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; padding: 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-card, 0 12px 30px -12px rgba(0, 0, 0, .3)); display: flex; flex-direction: column; }
.pk-menu button { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.pk-menu button:hover { background: var(--surface-2); }
@media (max-width: 699px) {
  .pk-actions .pk-sec { display: none; }
  .pk-more { display: block; }
  .pk-actions { align-items: center; }
}
/* Titles too long for their box scroll sideways in a loop (marquee.js) instead of wrapping */
.mq { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pk-hmain h1.mq { overflow-wrap: normal; }
.mq.on { text-overflow: clip; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
.mq.on .mq-in { display: inline-flex; animation: mq-loop var(--mq-dur, 12s) linear infinite; }
.mq.on .mq-in > span { padding-right: 56px; }
.mq.on:hover .mq-in { animation-play-state: paused; }
@keyframes mq-loop { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .mq.on .mq-in { animation: none; } .mq.on { text-overflow: ellipsis; } }
/* Library: search box with a "Bộ lọc" button holding the pack categories */
.cat-searchrow { position: relative; flex: 1 1 100%; display: flex; align-items: stretch; gap: 8px; min-width: 0; }
.cat-searchrow .ph-search { flex: 1 1 auto; width: auto; min-width: 0; padding: 10px 14px; }
.cat-fbtn { position: relative; flex: 0 0 44px; width: 44px; min-height: 42px; display: grid; place-items: center; border-radius: 14px; border: 1px solid var(--soft-line); background: var(--surface); color: var(--text); cursor: pointer; box-shadow: var(--shadow-card); }
.cat-fbtn:hover, .cat-fbtn.open { border-color: var(--soft-line-accent); color: var(--accent); }
.cat-fbtn.on { color: var(--accent); }
.cat-fdot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.cat-fp { min-width: 260px; }
/* Library header: title and mascot on top, the search row (full width) underneath */
.cat-hero { flex-wrap: wrap; }
.cat-hero > .ch-actions { flex: 1 1 100%; }
/* Library filter menu: grouped options, drops down on wide screens, slides up from the bottom on phones */
.cat-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 320px; max-width: calc(100vw - 32px); padding: 14px; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--soft-line); border-radius: 20px; box-shadow: 0 24px 50px -18px rgba(40, 30, 15, .4); }
.cm-head { display: flex; align-items: center; justify-content: space-between; }
.cm-head b { font-size: 15px; }
.cm-sec { display: flex; flex-direction: column; gap: 6px; }
.cm-label { font-size: 11.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); padding: 0 4px; }
.cm-items { display: flex; flex-direction: column; gap: 2px; }
.cm-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 10px; border: 0; border-radius: 12px; background: none; color: var(--text); font: inherit; font-size: 14.5px; font-weight: 600; text-align: left; cursor: pointer; }
.cm-item > span { flex: 1; }
.cm-item svg { color: var(--text-dim); flex-shrink: 0; }
.cm-item:hover { background: var(--surface-2); }
.cm-item.on { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
.cm-item.on svg { color: var(--accent); }
.cm-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px; }
.cm-chip { padding: 7px 13px; border-radius: 99px; border: 1px solid var(--soft-line); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.cm-chip:hover { border-color: var(--accent); }
.cm-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 699px) {
  .cat-menu { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; max-height: 80vh; overflow-y: auto; z-index: 120;
    border-radius: 24px 24px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); animation: cm-up .2s ease-out; }
  .cm-backdrop { z-index: 110; background: rgba(30, 20, 10, .35); }
  .cm-item { padding: 12px 10px; }
}
@keyframes cm-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
/* Home "Gói đang học" edit mode */
.sh-links { display: flex; align-items: center; gap: 14px; }
.hp-hint { margin: -4px 0 10px; font-size: 13px; color: var(--text-dim); }
.pk-remove { width: 36px; height: 36px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--coral, #E5675A); color: #fff; display: grid; place-items: center; cursor: pointer; }
.home-packs.editing .pk-row { animation: hp-wiggle .25s ease-out; }
@keyframes hp-wiggle { 0% { transform: scale(.98); } 100% { transform: none; } }
/* Under 'Danh sách từ vựng': tells that tapping a word plays it */
.wl-hint { display: flex; align-items: center; gap: 6px; margin: -6px 0 10px; font-size: 13px; color: var(--text-dim); }
.wl-hint svg { color: var(--accent); }
/* Library: 'Xem thêm' under the topics */
.cat-more { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 10px; padding: 10px; border: 0; border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-card); }
.cat-more svg { color: var(--accent); }
/* Deck labels (editor picker, cards, pack header) and the Cộng đồng page */
.dk-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.dk-tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; border: 0; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); font: inherit; font-size: 11.5px; font-weight: 700; }
button.dk-tag { cursor: pointer; }
.pk-hmain .dk-tags { margin-top: -2px; }
.de2-tags { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 12px; border-top: 1px solid var(--soft-line); }
.de2-tlabel { font-size: 13px; font-weight: 700; }
.de2-tlabel small { font-weight: 500; color: var(--text-dim); }
.de2-tgroup { display: flex; flex-direction: column; gap: 5px; }
.de2-tgroup > small { font-size: 11.5px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .03em; }
.de2-tgroup > div { display: flex; flex-wrap: wrap; gap: 6px; }
.de2-tchip { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--soft-line); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.de2-tchip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.de2-tchip:disabled { opacity: .45; cursor: default; }
.comm-search { margin: 4px 0 12px; }
.comm-sorts { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-card); overflow-x: auto; scrollbar-width: none; }
.comm-sorts button { flex: 1; padding: 9px 12px; border: 0; border-radius: 10px; background: none; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.comm-sorts button.on { background: var(--accent); color: var(--accent-ink); }
.comm-active { display: flex; align-items: center; gap: 8px; margin: -2px 0 12px; font-size: 13px; color: var(--text-dim); }
.comm-empty { padding: 30px; text-align: center; color: var(--text-dim); }
.cm-deck .pk-main { gap: 5px; }
/* Sub-pages of the library (Chủ đề, Cộng đồng): compact spacing, back link, title and search sit close together */
.cat-page.sub { gap: 12px; }
.cat-page.sub .pk-back, .cat-page.sub .page-head, .cat-page.sub .comm-search, .cat-page.sub .comm-sorts, .cat-page.sub .comm-active { margin: 0; }
.cat-page.sub .page-head { margin-bottom: 2px; }
@media (max-width: 699px) { .cat-page:not(.sub) { gap: 20px; } }
/* Library header on desktop: title + description and, under them, one row (search · filter · Tạo bộ từ, all 44px tall);
   the mascot on the right standing on the bottom edge, like the roadmap's. Phones keep the stacked layout. */
@media (min-width: 1040px) {
  .cat-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main img" "actions img"; column-gap: 28px; row-gap: 16px; align-items: center; padding: 24px 28px; }
  .cat-hero > .ch-main { grid-area: main; }
  .cat-hero > .ch-actions { grid-area: actions; display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; }
  .cat-hero > .ch-img { grid-area: img; width: 118px; height: 124px; align-self: end; margin-bottom: -24px; }
  .cat-hero .cat-searchrow { flex: 1 1 auto; }
  .cat-hero .cat-searchrow .ph-search { height: 44px; padding: 0 14px; }
  .cat-hero .cat-fbtn { height: 44px; min-height: 44px; }
  .cat-hero .ch-actions > .btn { flex-shrink: 0; height: 44px; margin: 0; padding: 0 18px; font-size: 14.5px; white-space: nowrap; box-shadow: none; }
  .ch-main h1 { font-size: 28px; }
}
/* Library "Theo chủ đề": phones show the first six in the grid; desktop shows every topic on one row that scrolls
   sideways (7–8 visible depending on width), its right edge fading out. */
@media (max-width: 1039px) { .lib-topics:not(.full) > :nth-child(n+7) { display: none; } }
@media (min-width: 1040px) {
  .lib-topics { display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 4px 4px 12px; margin: -4px -4px -12px;
    scrollbar-width: thin; scrollbar-color: var(--soft-line) transparent;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
  .lib-topics > .pk-topic { flex: 0 0 140px; scroll-snap-align: start; }
  .lib-topics::-webkit-scrollbar { height: 6px; }
  .lib-topics::-webkit-scrollbar-thumb { background: var(--soft-line); border-radius: 99px; }
}
/* Deck editor: AI source (list / file) and the integrated model */
.de2-src { margin-top: -4px; }
.de2-file { cursor: pointer; }
.de2-cnt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); }
.de2-cnt select { padding: 6px 8px; border-radius: 10px; border: 1px solid var(--soft-line); background: var(--surface); color: var(--text); font: 700 13px var(--font-ui); }
.de2-aimodel { margin-left: 6px; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); font-size: 11.5px; font-weight: 700; }
.de2-aiwarn { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: #FFF4D6; color: #7A5A12; font-size: 12.5px; line-height: 1.45; }
.de2-aiwarn .icon { flex-shrink: 0; margin-top: 1px; }
/* Deck editor redesign: compact tag row, method cards instead of an overflowing tab strip */
.de2-tags { gap: 10px; }
.de2-trow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.de2-trow .de2-tlabel { margin-right: 4px; }
.de2-tnone { font-size: 12.5px; color: var(--text-dim); }
.de2-tmore { margin-left: auto; font-size: 13px; font-weight: 700; }
.de2-h { margin: 0 0 12px; font-size: 17px; font-weight: 800; }
.de2-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
@media (min-width: 720px) { .de2-methods { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.de2-methods button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px; border-radius: 16px; border: 1px solid var(--soft-line); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.de2-methods button:hover { border-color: var(--soft-line-accent); }
.de2-methods .dm-ico { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin-bottom: 4px; border-radius: 11px; background: var(--surface-2); color: var(--text-dim); }
.de2-methods b { font-size: 14px; font-weight: 800; }
.de2-methods small { font-size: 12px; line-height: 1.3; color: var(--text-dim); }
.de2-methods button.on { border: 2px solid var(--accent); padding: 11px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.de2-methods button.on .dm-ico { background: var(--accent); color: #fff; }
.de2-methods button.ai .dm-ico { background: linear-gradient(135deg, #8B5CF6, #EC4899); color: #fff; }
/* Deck editor, layout A: one centred column, step strip, collapsible name card, segmented add methods, save bar stuck to the bottom */
.de3 { max-width: 820px; margin-left: auto; margin-right: auto; display: flex; flex-direction: column; gap: 16px; }
.de3 .page-head { margin-bottom: 0; }
.de3-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.de3-steps li { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-card); color: var(--text-dim); font-size: 14px; }
.de3-steps li span { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); font-weight: 800; font-size: 13px; }
.de3-steps li.done { color: var(--text); }
.de3-steps li.done span { background: #3BA776; color: #fff; }
.de3-steps li.cur { background: var(--accent); color: var(--accent-ink, #fff); }
.de3-steps li.cur span { background: var(--surface); color: var(--accent); }
.de3-info { padding: 4px 18px; }
.de3-info .de2-info { padding: 0; }
.de3-info .de2-formact { padding-bottom: 12px; }
.de3-strip { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.de3-strip > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.de3-strip b { font-family: var(--font-word); font-size: 17px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de3-strip small { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de3-seg { display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 14px; background: var(--surface-2); }
.de3-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 10px; border: 0; border-radius: 11px; background: transparent; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.de3-seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.de3-seg button.on .icon { color: var(--accent); }
.de3-words .de2-h { display: flex; align-items: baseline; gap: 8px; }
.de3-words #deCount { font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--text-dim); }
.de3 .de2-list { max-height: none; }
.de3-bar { position: sticky; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: flex; flex-direction: column; gap: 8px; }
.de3-bar .feedback { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-card); text-align: left; }
.de3-pill { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 22px; border-radius: 999px; background: #2B2350; color: #fff; box-shadow: 0 14px 30px -12px rgba(30, 20, 60, .5); }
.de3-pill span { flex: 1; font-size: 14px; }
.de3-pill .btn { height: 44px; padding: 0 22px; border-radius: 999px; background: #fff; color: #2B2350; font-weight: 800; box-shadow: none; }
/* Deck editor, table layout: the table is the page, dictionary / AI / paste only fill its rows */
.de4 { max-width: 1240px; }
.de4 .page-head { margin-bottom: 0; }
.de4-card { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.dt-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dt-tool { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--soft-line); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.dt-tool.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); color: var(--accent); }
.dt-tool.ai .icon { color: #8B5CF6; }
.dt-count { margin-left: auto; font-size: 13px; color: var(--text-dim); }
.dt-panel:empty { display: none; }
.dt-panel { padding: 14px; border-radius: 16px; background: color-mix(in srgb, var(--accent) 5%, var(--surface)); border: 1px solid var(--soft-line); }
.dt-aibody { display: flex; flex-direction: column; gap: 10px; }
.dt-aibody small { font-size: 12.5px; color: var(--text-dim); }
.dt-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--soft-line); background: var(--surface); }
.dt { width: 100%; min-width: 1020px; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.dt col.c-n { width: 54px; } .dt col.c-w { width: 190px; } .dt col.c-p { width: 132px; } .dt col.c-i { width: 130px; } .dt col.c-v { width: 220px; } .dt col.c-a { width: 80px; }
.dt thead th { position: sticky; top: 0; z-index: 2; padding: 10px 10px; text-align: left; font-size: 12px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--text-dim); background: var(--surface-2); }
.dt thead th:first-child { text-align: center; }
.dt td { padding: 4px 6px; vertical-align: top; border-top: 1px solid var(--soft-line); }
.dt tbody tr:hover { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.dt tr.fromai { background: color-mix(in srgb, #8B5CF6 7%, transparent); }
.dt tr.bad { background: #FDE9E9; }
.dt .dt-n { padding-top: 15px; text-align: center; font-size: 13px; font-weight: 700; color: var(--text-dim); }
.de4 .dt-in { display: block; width: 100%; box-sizing: border-box; height: 38px; padding: 0 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-size: 14.5px; outline: 0; }
.de4 .dt-in:hover { border-color: var(--soft-line); }
.de4 .dt-in:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.de4 .dt-in::placeholder { color: var(--text-dim); opacity: .55; }
.de4 .dt-in.dt-sub { height: 32px; margin-top: 2px; font-size: 13px; color: var(--text-dim); }
.de4 select.dt-pos { padding: 0 4px; cursor: pointer; }
.dt td:nth-child(2) .dt-in { font-weight: 700; }
.dt-src { display: block; padding: 0 8px; min-height: 0; font-size: 11.5px; font-weight: 700; color: #8B5CF6; }
.dt-src.on { color: var(--accent); }
.dt-src:empty { display: none; }
.dt-act { white-space: nowrap; text-align: right; padding-top: 6px; }
.dt-act button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text-dim); cursor: pointer; }
.dt-act button:hover { background: var(--surface-2); color: var(--text); }
.dt-addrow { display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; border: 1.5px dashed var(--soft-line-accent); border-radius: 12px; background: transparent; color: var(--accent); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.dt-addrow:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
/* Save bar: the count keeps one line, the button its own width (a global .btn rule made it full width) */
main#screen .de3-pill span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
main#screen .de3-pill .btn { flex: none; width: auto; margin: 0; }
/* Table rows: tighter, example translation right under the example */
.dt td { padding: 3px 6px; }
.de4 .dt-in { height: 34px; }
.de4 .dt-in.dt-sub { height: 26px; margin-top: 0; }
.dt .dt-n { padding-top: 12px; }
.de3-info .de2-formact { padding-bottom: 10px; margin-top: -6px; }
/* Deck editor part 1: name, description, labels */
.de5 { max-width: 760px; margin-left: auto; margin-right: auto; display: flex; flex-direction: column; gap: 16px; }
.de5 .page-head { margin-bottom: 0; }
.de5-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; }
.de5-steps li { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-card); color: var(--text-dim); font-weight: 700; font-size: 14px; }
.de5-steps li span { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); font-size: 13px; }
.de5-steps li.cur { background: var(--accent); color: var(--accent-ink, #fff); }
.de5-steps li.cur span { background: var(--surface); color: var(--accent); }
.de5-card { display: flex; flex-direction: column; gap: 18px; padding: 22px; }
.de5-f { display: flex; flex-direction: column; gap: 8px; }
.de5-f > span { font-size: 14px; font-weight: 800; }
.de5-f > span small { font-weight: 500; color: var(--text-dim); }
.de5-f > span em { color: #E5484D; font-style: normal; }
.de5 #deTitle { font-family: var(--font-word); font-size: 18px; font-weight: 800; }
.de5 .de2-tags { border-top: 0; padding: 0; }
.de5-act { display: flex; justify-content: flex-end; }
main#screen .de5-act .btn { width: auto; display: inline-flex; align-items: center; gap: 8px; padding: 0 24px; }
/* Part 1 "Tiếp tục": a pill with the arrow in its own circle, the next step named beside it */
.de5-act { align-items: center; gap: 16px; padding-top: 16px; border-top: 1px solid var(--soft-line); }
.de5-act > span { flex: 1; font-size: 13px; color: var(--text-dim); }
.de5-next { flex: none; display: inline-flex; align-items: center; gap: 14px; height: 52px; padding: 0 6px 0 26px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink, #fff); font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; box-shadow: 0 12px 24px -12px color-mix(in srgb, var(--accent) 70%, transparent); transition: transform .15s, box-shadow .15s; }
.de5-next i { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); color: var(--accent); transition: transform .15s; }
.de5-next:hover { transform: translateY(-1px); box-shadow: 0 16px 28px -12px color-mix(in srgb, var(--accent) 75%, transparent); }
.de5-next:hover i { transform: translateX(3px); }
.de5-next:active { transform: translateY(1px); }
/* Per-word 🔍: ready-made pack data for a typed word */
.dt-wcell { display: flex; align-items: center; gap: 2px; }
.dt-find { flex: none; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--text-dim); cursor: pointer; }
.dt-find:hover { background: var(--surface-2); color: var(--text); }
.dt-find.hit { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.dt-in:placeholder-shown + .dt-find { display: none; }
.dt tr.dt-offer td { border-top: 0; padding: 0 6px 10px; }
.dt-offer-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border: 1px solid var(--soft-line-accent); }
.dt-offer-box img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.dt-offer-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dt-offer-text b { font-size: 14.5px; }
.dt-offer-text span { font-size: 13px; color: var(--text-dim); }
.dt-offer-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
main#screen .dt-offer-btns .btn { width: auto; }
.dt-offer-box.none { background: var(--surface-2); border-color: transparent; font-size: 13.5px; color: var(--text-dim); }
.dt-offer-box.none span { flex: 1; }
/* AI inside the table */
.dt-act .dt-ai { color: #8B5CF6; }
.dt-act .dt-ai:hover { background: color-mix(in srgb, #8B5CF6 12%, transparent); color: #7C3AED; }
.dt col.c-a { width: 112px; }
.dt tr.busy td { opacity: .55; }
.dt tr.busy .dt-n { animation: dtPulse 1s ease-in-out infinite; }
@keyframes dtPulse { 50% { color: #8B5CF6; } }
.dt-tool:disabled { opacity: .6; cursor: default; }
/* Two ways to enter words: table or plain text */
.dt-mode { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); align-self: flex-start; }
.dt-mode button { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border: 0; border-radius: 11px; background: transparent; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.dt-mode button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.dt-mode button.on .icon { color: var(--accent); }
.dt-text { display: flex; flex-direction: column; gap: 8px; }
.dt-text code { padding: 1px 6px; border-radius: 6px; background: var(--surface-2); font-size: 12.5px; }
.de2 .dt-textarea { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; line-height: 1.7; white-space: pre; overflow-x: auto; }
.dt-text small { font-size: 12.5px; color: var(--text-dim); }
/* The word table uses the whole width beside the sidebar */
@media (min-width: 1040px) { main#screen:has(.de4) { max-width: none; padding-left: 32px; padding-right: 32px; } }
main#screen .words-soft.de4 { max-width: none; width: 100%; }
.dt col.c-w { width: 17%; } .dt col.c-p { width: 128px; } .dt col.c-i { width: 12%; } .dt col.c-v { width: 22%; }
.dt-hits { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-hits span { padding: 4px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--soft-line); font-size: 13px; font-weight: 700; }
.dt-hits em { font-style: normal; font-weight: 600; color: var(--text-dim); font-size: 12px; }
/* "Nhập nhanh bằng AI": two options side by side, the reminder under both */
.dt-ai2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dt-aiopt { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--soft-line); }
.dt-aiopt > b { display: flex; align-items: center; gap: 6px; font-size: 14.5px; }
.dt-aiopt > b .icon { color: #8B5CF6; }
.dt-aiwarn { grid-column: 1 / -1; margin: 0; }
/* "Nhập nhanh bằng AI" popup, centred over the table (no backdrop-filter: iOS black-square bug) */
.dt-modal { position: fixed; inset: 0; z-index: 230; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(30, 20, 60, .45); }
.dt-modal-box { position: relative; width: 100%; max-width: 760px; max-height: 88vh; overflow-y: auto; padding: 22px; border-radius: 24px; background: var(--surface); box-shadow: 0 30px 60px -20px rgba(30, 20, 60, .5); }
.dt-modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-right: 40px; }
.dt-modal-head h3 { margin: 0; font-size: 19px; font-weight: 800; }
.dt-modal-head small { font-size: 12.5px; color: var(--text-dim); }
.dt-modal-ico { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(135deg, #8B5CF6, #EC4899); color: #fff; flex: none; }
.dt-modal .dt-aiopt { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
@media (max-width: 640px) { .dt-ai2 { grid-template-columns: 1fr; } }
/* AI popup: tabs for word list / file / empty cells, paste-back box when AI is not set up */
.dt-aitabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 14px; background: var(--surface-2); }
.dt-aitabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; border: 0; border-radius: 11px; background: transparent; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.dt-aitabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.dt-aitabs button.on .icon { color: #8B5CF6; }
.dt-modal .dt-aiopt, .dt-aiback { margin-bottom: 12px; }
.dt-aiback { padding: 14px; border-radius: 14px; border: 1px dashed var(--soft-line-accent); }
.dt-modal-msg { margin: 0 0 12px; text-align: left; }
/* Import popups: numbered sections, format cards, review step, AI-filled cells */
.dt-modal-box { max-width: 820px; }
.im-sec { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; padding: 14px; border-radius: 16px; border: 1px solid var(--soft-line); }
.im-sec small { font-size: 12.5px; color: var(--text-dim); line-height: 1.45; }
.im-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.im-h span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink, #fff); font-size: 13px; font-weight: 800; align-self: center; }
.im-h b { font-size: 15px; }
.im-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.im-btns.end { justify-content: flex-end; }
main#screen .im-btns .btn, .dt-modal .im-btns .btn { width: auto; display: inline-flex; align-items: center; gap: 6px; }
.de2 .im-out { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.6; }
.im-fmt { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.im-fmt > div { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.im-fmt b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.im-fmt code, .rvw code { padding: 2px 6px; border-radius: 6px; background: var(--surface); font-size: 12px; }
.aif-tag { padding: 1px 6px; border-radius: 6px; background: #FFEBD2; color: #B45309; font-weight: 700; font-size: 11.5px; }
.rvw { display: flex; flex-direction: column; gap: 12px; }
.rvw-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.rvw-sum b { font-size: 16px; margin-right: 4px; }
.rvw-sum span { padding: 3px 10px; border-radius: 99px; background: var(--surface-2); font-weight: 700; color: var(--text-dim); }
.rvw-sum span.warn { background: #FFF1D6; color: #A16207; }
.rvw-note { margin: 0; font-size: 13px; color: #A16207; }
.rvw-sec { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--soft-line); }
.rvw-sec > b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.rvw-sec.warn { background: #FFF8EA; border-color: #F5DDAA; }
.rvw-sec.ai { background: #FFF4E8; border-color: #F7D4AE; }
.rvw-sec small { font-size: 12.5px; color: var(--text-dim); }
.rvw-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 120px; overflow-y: auto; }
.rvw-chip { padding: 3px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--soft-line); font-size: 13px; font-weight: 700; }
.rvw-chip em { margin-left: 6px; font-style: normal; font-weight: 600; font-size: 11.5px; color: var(--text-dim); }
.rvw-opt, .rvw-radio label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.rvw-radio { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.de2 .rvw input[type=checkbox], .de2 .rvw input[type=radio] { width: auto; margin: 0; accent-color: var(--accent); }
.de4 .dt-in.aif { background: #FFF1DE; border-color: #F7C88E; }
@media (max-width: 640px) { .im-fmt { grid-template-columns: 1fr; } }
/* Layout F: title + save on top, one input above the table, status line, status column */
.de6 { display: flex; flex-direction: column; gap: 14px; }
.de6-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.de6-head .ph-back, .de6-head > button:first-child { flex: none; }
.de6-title { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 2px; }
.de6-title > div { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.de6-title h1 { margin: 0; font-family: var(--font-word); font-size: 26px; font-weight: 800; line-height: 1.15; }
.de6-title .link-btn { font-size: 13px; font-weight: 700; }
.de6-title small { font-size: 13px; color: var(--text-dim); }
main#screen .de6-save { width: auto; flex: none; height: 46px; padding: 0 26px; border-radius: 999px; }
.de6-card { display: flex; flex-direction: column; gap: 0; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-card); overflow: hidden; }
.de6-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 16px; background: color-mix(in srgb, var(--accent) 4%, var(--surface)); border-bottom: 1px solid var(--soft-line); }
.de6-add { flex: 1 1 360px; min-width: 0; display: flex; align-items: flex-start; gap: 10px; padding: 6px 6px 6px 14px; border: 2px solid var(--accent); border-radius: 14px; background: var(--surface); }
.de6-add > .icon { flex: none; margin-top: 9px; color: var(--accent); }
.de2 .de6-add textarea { flex: 1; min-width: 0; height: 36px; min-height: 36px; padding: 8px 0; border: 0; background: transparent; font-size: 15px; line-height: 1.35; resize: none; box-shadow: none; }
main#screen .de6-add .btn { width: auto; flex: none; height: 36px; }
.de6-tool { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--soft-line); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.de6-tool.on { border-color: var(--accent); color: var(--accent); }
.de6-tool.ai .icon { color: #8B5CF6; }
.de6-status { padding: 10px 16px; font-size: 13px; color: var(--text-dim); border-bottom: 1px solid var(--soft-line); }
.de6-status.ok { color: #23744A; background: #F0FAF4; }
.de6-status.err { color: #A3341F; background: #FFF3EF; }
.de6-status.busy { color: #6D28D9; background: #F6F2FF; }
.de6 .dt-panel { margin: 12px 16px 0; }
.de6 .dt-wrap { border: 0; border-radius: 0; }
.de6 .dt-addrow { margin: 10px 16px 14px; }
.de6 .de2-audio { margin: 0 16px 14px; }
.dt col.c-s { width: 120px; }
.dt .dt-st { padding-top: 12px; }
.st { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.st-pack { background: #E8F6EE; color: #23744A; }
.st-ai { background: #FFF1DE; color: #B45309; }
.st-ai2 { background: #EFE9FE; color: #6D28D9; }
.st-own { background: var(--surface-2); color: var(--text-dim); }
.st-need { background: #FFF3EF; color: #A3341F; }
.st-busy { background: #F6F2FF; color: #6D28D9; animation: dtPulse 1s ease-in-out infinite; }
.de6 .dt tr.fromai { background: transparent; }
/* One page: name, description and labels edited in place above the table */
.de6-head { align-items: flex-start; }
.de2 .de6-name { padding: 4px 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; font-family: var(--font-word); font-size: 26px; font-weight: 800; color: var(--text); }
.de2 .de6-name:hover { border-bottom-color: var(--soft-line); }
.de2 .de6-name:focus { border-bottom-color: var(--accent); background: transparent; }
.de2 .de6-desc { padding: 2px 0; border: 0; border-radius: 0; background: transparent; font-size: 14px; color: var(--text-dim); }
.de2 .de6-desc:focus { background: transparent; color: var(--text); }
.de6-title .de2-tags { padding: 6px 0 0; border-top: 0; }
.de6-count { flex: none; align-self: center; font-size: 13px; color: var(--text-dim); }
.de6-head > .ph-back, .de6-head > button:first-child, main#screen .de6-save { margin-top: 4px; }
/* Flat colours, no gradients */
.dt-modal-ico, .de2-methods button.ai .dm-ico { background: var(--accent); }
/* Labels: chips + a small dropdown */
.tg { padding-top: 6px; }
.tg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tg-chip { display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 4px 0 10px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); font-size: 12.5px; font-weight: 700; }
.tg-chip button { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; }
.tg-chip button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.tg-anchor { position: relative; }
.tg-add { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 99px; border: 1px dashed var(--soft-line-accent); background: var(--surface); color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.tg-add.on { border-style: solid; border-color: var(--accent); }
.tg-hint { font-size: 12.5px; color: var(--text-dim); }
.tg-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: 250px; max-height: 340px; overflow-y: auto; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--soft-line); box-shadow: 0 18px 40px -14px rgba(30, 20, 60, .35); }
.tg-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.tg-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.tg-item:hover:not(:disabled) { background: var(--surface-2); }
.tg-item:disabled { opacity: .4; cursor: default; }
.tg-box { display: flex; align-items: center; justify-content: center; flex: none; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--soft-line-accent); color: var(--accent); }
.tg-item.on .tg-box { border-color: var(--accent); }
.tg-item.on { color: var(--accent); }
.tg-foot { position: sticky; bottom: -6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px -6px -6px; padding: 8px 10px; background: var(--surface); border-top: 1px solid var(--soft-line); }
.tg-foot small { font-size: 12px; color: var(--text-dim); }
main#screen .tg-foot .btn { width: auto; }
/* "Nhập bằng AI": the word list and the AI text side by side on wide screens, stacked on small ones */
.dt-modal-box:has(.im-cols) { max-width: 1180px; }
.im-cols { display: grid; grid-template-columns: 1fr; gap: 14px; }
.im-cols .im-sec { margin-bottom: 0; }
@media (min-width: 900px) {
  .im-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; margin-bottom: 14px; }
  .im-cols .im-sec textarea { flex: 1; min-height: 260px; }
  .im-cols .im-btns.end { margin-top: auto; }
}
/* AI popup: round ✦ button inside the word box, brand shortcuts, paste button in part 2 */
.im-box { position: relative; display: flex; flex-direction: column; flex: 1; }
.im-box textarea { padding-right: 64px; }
.im-go { position: absolute; right: 12px; bottom: 12px; display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink, #fff); cursor: pointer; box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent); transition: transform .15s; }
.im-go:hover:not(:disabled) { transform: scale(1.06); }
.im-go:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.im-go.busy { background: #2B2350; animation: dtPulse 1s ease-in-out infinite; }
.im-gpt-ico { border-radius: 4px; background: #fff; padding: 1px; }
.im-h .im-paste { margin-left: auto; }
@media (min-width: 900px) { .im-cols .im-box textarea { min-height: 260px; } }
.im-go.im-pastebtn { background: var(--surface); color: var(--accent); border: 1px solid var(--soft-line-accent); box-shadow: var(--shadow-card); }
/* Alignment pass: header, toolbar heights, table columns */
.de6-head { align-items: flex-start; gap: 16px; }
.de6-head > button:first-child, .de6-head > .ph-back { margin-top: 2px; }
.de6-title { gap: 4px; }
.de6-right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
main#screen .de6-save { margin-top: 0; }
.de6-count { align-self: flex-end; padding-right: 4px; }
.de6-top { align-items: stretch; }
.de6-add { align-items: center; min-height: 52px; box-sizing: border-box; padding: 0 6px 0 14px; }
.de6-add > .icon { margin-top: 0; }
.de2 .de6-add textarea { padding: 8px 0; align-self: center; }
.de6-tool { height: auto; min-height: 52px; box-sizing: border-box; border-radius: 14px; }
.de6-status, .de6 .dt-panel { margin: 0; }
.de6 .dt-panel { margin: 12px 16px 4px; }
/* header cells line up with the text inside the cell inputs (td 6px + input 8px) */
.dt thead th { padding: 12px 14px; }
.dt thead th:first-child { padding-left: 0; padding-right: 0; text-align: center; }
.dt td { padding: 6px 6px; vertical-align: top; }
.dt .dt-n { padding-top: 14px; text-align: center; }
.dt .dt-st { padding: 13px 14px 0; }
.dt-act { padding-top: 8px; }
.de4 select.dt-pos { padding: 0 6px; }
.de6 .dt-addrow { margin: 12px 16px 16px; }
/* Lookup panel: a full-width band like the status line, not an inset card */
.de6 .dt-panel { margin: 0; padding: 12px 16px; border: 0; border-radius: 0; border-bottom: 1px solid var(--soft-line); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.de6 .dt-panel .dt-aibody { gap: 6px; }
/* Narrow part-of-speech column (abbreviations), speaker under the row number */
.dt col.c-p { width: 76px; }
.dt col.c-n { width: 56px; }
.dt col.c-a { width: 80px; }
.de4 select.dt-pos { padding: 0 4px; text-align: center; font-weight: 700; }
.dt .dt-n { display: table-cell; }
.dt .dt-n span { display: block; }
.dt-say { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: 6px auto 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-dim); cursor: pointer; }
.dt-say:hover { background: var(--surface-2); color: var(--accent); }
/* Meaning / example cells wrap instead of scrolling sideways */
.de4 textarea.dt-wrapin { display: block; width: 100%; height: auto; min-height: 34px; padding: 7px 8px; line-height: 1.4; white-space: pre-wrap; overflow: hidden; resize: none; }
.de4 textarea.dt-wrapin.dt-sub { min-height: 28px; padding: 4px 8px; }
/* Narrow status column; the example column takes the freed width */
.dt col.c-s { width: 92px; }
.dt col.c-w { width: 15%; } .dt col.c-i { width: 10%; } .dt col.c-v { width: 18%; }
.dt .dt-st { padding: 13px 6px 0; }
.st { white-space: normal; line-height: 1.25; padding: 3px 7px; font-size: 11px; }
/* Deck illustration: tile beside the name, grid dropdown; on cards in the library / Cộng đồng */
.pk-tile.pic { background: #fff; overflow: hidden; }
.pk-tile.pic img { width: 100%; height: 100%; object-fit: contain; }
.ic-anchor { position: relative; flex: none; }
.ic-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 72px; height: 72px; border-radius: 18px; border: 1.5px dashed var(--soft-line-accent); background: var(--surface); color: var(--accent); font: inherit; cursor: pointer; overflow: hidden; }
.ic-tile small { font-size: 11.5px; font-weight: 700; }
.ic-tile.has { border: 1px solid var(--soft-line); background: #fff; box-shadow: var(--shadow-card); }
.ic-tile.has img { width: 100%; height: 100%; object-fit: contain; }
.ic-tile.on { border-color: var(--accent); border-style: solid; }
.ic-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 45; width: 360px; max-height: 420px; overflow-y: auto; padding: 6px 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--soft-line); box-shadow: 0 18px 40px -14px rgba(30, 20, 60, .35); }
.ic-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding: 0 2px 6px; }
.ic-item { aspect-ratio: 1; padding: 4px; border-radius: 12px; border: 2px solid transparent; background: #fff; cursor: pointer; }
.ic-item:hover { border-color: var(--soft-line-accent); }
.ic-item.on { border-color: var(--accent); }
.ic-item img { width: 100%; height: 100%; object-fit: contain; }
.ic-menu .tg-foot { margin: 6px -8px -6px; }
/* Description and labels on one line */
.de6-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.de6-meta .de6-desc { flex: 1 1 260px; min-width: 0; }
.de6-meta .tg { padding-top: 0; flex: none; max-width: 100%; }
/* Name and description closer together */
.de6-title { gap: 0; }
.de2 .de6-name { padding: 0 0 2px; line-height: 1.2; }
.de2 .de6-desc { padding: 0; height: 28px; }
.de6-meta { margin-top: -2px; }
.dt td:nth-child(2) textarea.dt-wrapin { font-weight: 700; }
/* Toolbar buttons keep their own height; only the input grows */
.de6-top { align-items: flex-start; }
.de6-tool { height: 52px; min-height: 0; align-self: flex-start; }
.de6-add { align-items: flex-end; padding: 7px 6px 7px 14px; min-height: 52px; }
.de6-add > .icon { align-self: center; }
.de2 .de6-add textarea { height: 36px; min-height: 36px; max-height: 180px; overflow-y: auto; align-self: center; }
/* Phone editor (≤ 760px): name + labels, box 1 (words -> prompt), box 2 (ChatGPT's answer), save bar */
.dm { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.dm-head { display: flex; align-items: center; gap: 12px; }
.dm-head h1 { margin: 0; font-size: 22px; font-family: var(--font-word); font-weight: 800; }
.dm-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.dm-card h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 17px; font-weight: 800; }
.dm-n { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink, #fff); font-size: 14px; }
.dm-top { display: flex; gap: 12px; align-items: flex-start; }
.dm-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dm .ic-menu { width: min(360px, calc(100vw - 48px)); }
.dm .tg-menu { max-width: calc(100vw - 48px); }
.de2 .dm-ta { min-height: 150px; padding: 12px; font-size: 16px; line-height: 1.5; }
.dm-count { font-size: 13px; font-weight: 700; color: var(--accent); }
.dm-hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.dm-have { margin: 0; font-size: 13px; color: var(--text-dim); }
.dm-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
main#screen .dm-btns .btn { width: auto; height: 46px; padding: 0 20px; }
.dm-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); font-size: 13px; line-height: 1.5; color: var(--text); }
.dm-note .icon { flex: none; margin-top: 2px; color: var(--accent); }
.dm-status { min-height: 0; padding: 0 2px; font-size: 14px; line-height: 1.5; }
.dm-status:not(:empty) { padding: 10px 14px; border-radius: 14px; }
.dm-status.ok { background: #F0FAF4; color: #23744A; }
.dm-status.err { background: #FFF3EF; color: #A3341F; }
.dm-bar { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 20; }
main#screen .dm-save { width: 100%; height: 52px; border-radius: 999px; box-shadow: 0 12px 24px -12px color-mix(in srgb, var(--accent) 70%, transparent); }
.dm-prompt { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.dm-prompt-head { display: flex; align-items: baseline; justify-content: space-between; }
.dm-prompt-head small { color: var(--text-dim); }
.de2 .dm-prompt-ta { min-height: 120px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface); }
main#screen .dm-prompt .btn { width: auto; }
.dm-link { display: inline-flex; align-items: center; text-decoration: none; }
/* Phone editor: two steps as tabs, the step-1 check result */
.dm-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); }
.dm-tabs button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 6px 8px; border: 0; border-radius: 12px; background: transparent; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; text-align: left; line-height: 1.2; }
.dm-tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.dm-tabs button:not(.on) .dm-n { background: var(--soft-line-accent); }
main#screen .dm-wide { width: 100%; height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.dm-res { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.dm-res > div > b { display: block; margin-bottom: 6px; font-size: 13.5px; }
.dm-need > b { color: #A3341F; }
.dm-ok { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 0; padding: 12px 14px; border-radius: 14px; background: #F0FAF4; color: #23744A; font-size: 14px; line-height: 1.5; }
.dm-ok .icon { flex: none; margin-top: 3px; }
.dm-ask { margin-top: 4px; padding: 14px; border-radius: 14px; background: #FFF8EA; border: 1px solid #F5DDAA; }
.dm-ask p { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--text); }
.dm-ask p .icon { flex: none; margin-top: 3px; color: #B45309; }
.dm-ask-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
main#screen .dm-ask-btns .btn { width: 100%; height: 48px; }
/* Phone editor: step-1 result as a bottom sheet (no backdrop-filter: iOS) */
.dm-sheet-bg { position: fixed; inset: 0; z-index: 240; display: flex; align-items: flex-end; justify-content: center; background: rgba(30, 20, 60, .45); }
.dm-sheet { position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch; box-sizing: border-box; padding: 8px 16px calc(18px + env(safe-area-inset-bottom, 0px)); border-radius: 24px 24px 0 0; background: var(--surface); box-shadow: 0 -20px 50px -20px rgba(30, 20, 60, .5); display: flex; flex-direction: column; gap: 12px; animation: exUp .22s ease-out; }
.dm-grab { width: 40px; height: 5px; margin: 0 auto 2px; border-radius: 99px; background: var(--soft-line-accent); }
.dm-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.dm-sheet-head b { font-size: 17px; }
.dm-sheet-head .vip-x { position: static; }
#mSheetBody { display: flex; flex-direction: column; gap: 12px; }
.dm-sum { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.dm-sum > div:first-child { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.dm-sum > div:first-child b { font-size: 30px; line-height: 1; font-family: var(--font-word); color: var(--accent); }
.dm-sum > div:first-child span { font-size: 12px; color: var(--text-dim); }
.dm-sum-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dm-sum-chips .st { font-size: 12px; }
.dm-sheet .rvw-chips { max-height: 96px; }
.dm-sheet .dm-status:empty { display: none; }
/* Phone wizard: header with step, progress, guide, method options, saving popup */
.dm-head > div { display: flex; flex-direction: column; }
.dm-head small { font-size: 12.5px; color: var(--text-dim); font-weight: 700; }
.dm-head .ph-back { flex: none; display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.dm-prog { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dm-prog i { height: 5px; border-radius: 99px; background: var(--soft-line-accent); }
.dm-prog i.on { background: var(--accent); }
.dm-flow { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.dm-flow li::marker { font-weight: 800; color: var(--accent); }
.dm-flow b { display: block; font-size: 14.5px; }
.dm-flow span { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.dm-code { display: block; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.dm-q { margin: 4px 2px 0; font-size: 18px; font-weight: 800; }
.dm-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px; border: 0; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.dm-opt > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dm-opt b { font-size: 15.5px; }
.dm-opt small { font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.dm-opt code { font-size: 11.5px; padding: 1px 4px; border-radius: 5px; background: var(--surface-2); }
.dm-opt-ico { flex: none; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 15px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
.dm-saving { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(30, 20, 60, .45); animation: guideFade .2s ease; }
.dm-saving.out { opacity: 0; transition: opacity .2s; }
.dm-saving-box { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 300px; padding: 26px 20px 22px; border-radius: 24px; background: var(--surface); box-shadow: 0 30px 60px -20px rgba(30, 20, 60, .5); text-align: center; }
.dm-saving-box b { font-size: 17px; }
.dm-saving-box span { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.dm-spin { display: flex; gap: 8px; margin-bottom: 6px; }
.dm-spin i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: dmBounce 1s ease-in-out infinite; }
.dm-spin i:nth-child(2) { animation-delay: .15s; }
.dm-spin i:nth-child(3) { animation-delay: .3s; }
@keyframes dmBounce { 0%, 80%, 100% { transform: scale(.55); opacity: .45; } 40% { transform: scale(1); opacity: 1; } }
/* Phone wizard: mascot with a speech bubble filling the empty space of the guide / name steps */
.dm-mascot { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; min-height: 180px; padding-top: 8px; }
.dm-mascot img { width: auto; height: min(26vh, 200px); object-fit: contain; animation: mascotFloat 3s ease-in-out infinite; }
.dm-bubble { position: relative; max-width: 260px; padding: 10px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-card); font-size: 13.5px; font-weight: 700; line-height: 1.45; text-align: center; color: var(--text); }
.dm-bubble::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; background: var(--surface); transform: translateX(-50%) rotate(45deg); border-radius: 0 0 4px 0; }
.dm { min-height: calc(100dvh - 140px); }
/* Format samples and pasted text in the app's own font (the monospace one looked out of place) */
.dm-code, .de2 .im-out, .de2 .dt-textarea, .de2 .de2-prompt, .de2 .dm-prompt-ta { font-family: var(--font-ui); letter-spacing: 0; }
.dm-code { padding: 10px 12px; font-size: 13.5px; font-weight: 600; line-height: 1.6; color: var(--text); }
.dm-code-head { font-weight: 800; }
.dm-pipe { font-style: normal; font-weight: 800; color: var(--accent); padding: 0 3px; }
.dm-opt code, .dt-text code, .im-fmt code, .rvw code { font-family: var(--font-ui); font-weight: 700; }
