/* The word card (spec 2026-10-21-tap-a-word §6, §7), opened by js/words.js: a popover by
   the word on wide screens, a bottom sheet like the chapter list under 700px. Tokens only. */

/* Words in the Chinese: tappable, and the open one outlined */
html.js .zh .w { border-radius: 4px; cursor: pointer; }
@media (hover: hover) {
  html.js .zh .w:hover { background: var(--surface-2); }
}
.zh .w.on { outline: 2px solid var(--focus); outline-offset: 2px; }

/* The card: interface text in the UI font (spec 2026-10-21-desktop-polish §4); only the characters are Kai. */
.word-card { position: fixed; top: 0; left: 0; z-index: 30; width: min(22rem, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: var(--space-3) var(--space-4); border: 1px solid var(--glass-edge); border-radius: var(--radius); background: var(--glass); color: var(--text); box-shadow: 0 0.75rem 2rem var(--scrim), var(--glass-shine); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); font: var(--step-0)/1.5 var(--font-ui); animation: word-in 0.14s ease-out; }
.word-card[hidden], .word-card [hidden] { display: none; }
.word-zh { margin: 0; font: 400 2.6rem/1.2 var(--font-zh); letter-spacing: 0.08em; }
.word-zh:focus { outline: none; }
.word-zh:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 4px; }
.word-py { margin: var(--space-1) 0 var(--space-3); color: var(--text-muted); font-size: var(--step-1); }
.word-label { margin: 0 0 var(--space-1); color: var(--text-muted); font: 600 0.75rem/1.4 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; }
.word-gloss { margin: 0; font-size: var(--step-1); line-height: 1.35; }
.word-note { margin: var(--space-2) 0 0; }
.word-other { margin-top: var(--space-3); color: var(--text-muted); }
.word-other ul { margin: 0; padding: 0; list-style: none; font: var(--step--1)/1.5 var(--font-ui); }
.word-count { margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--line); font: var(--step--1)/1.5 var(--font-ui); }
.word-count p { margin: 0; }
.word-count .word-muted { color: var(--text-muted); }
/* "Key term: 道" link to the term page */
.word-term { margin: var(--space-2) 0 0; font: 600 var(--step--1)/1.5 var(--font-ui); }
.word-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); margin: var(--space-3) 0 0; }
.word-actions button { min-height: 2.5rem; padding: 0 var(--space-3); border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text); font: 600 var(--step--1) var(--font-ui); cursor: pointer; }
.word-actions .word-play { border-color: var(--red); background: var(--red); color: var(--on-red); }
/* Traditional characters on: the simplified form in brackets after the word */
.word-zh .word-alt { margin-left: var(--space-1); color: var(--text-muted); font-size: 0.5em; letter-spacing: 0; }
/* Share this line: the status ("Link copied") and the picture to download, when there is no share sheet */
.word-share-out { margin: 0; text-align: right; color: var(--text-muted); font: var(--step--1)/1.5 var(--font-ui); overflow-wrap: anywhere; }
.word-share-status:not(:empty), .word-share-dl:not([hidden]) { display: inline-block; margin-top: var(--space-2); }
.word-share-dl { font-weight: 600; }

/* Chinese pages: the label is not upper-cased, so it gets a step more size. */
:lang(zh) .word-label { font-size: var(--step--1); letter-spacing: 0.1em; }

/* Narrow screens: a bottom sheet, as the chapter list, docked on top of the player bar
   (js/words.js sets bottom and max-height from the bar's position) */
@media (max-width: 699.98px) {
  .word-card { top: auto; right: 0; bottom: 0; left: 0; width: auto; max-height: 70dvh; border-width: 1px 0 0; border-radius: var(--sheet-radius) var(--sheet-radius) 0 0; animation-name: word-up; animation-duration: 0.2s; }
}

@keyframes word-in { from { opacity: 0; transform: translateY(0.25rem); } }
@keyframes word-up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) {
  .word-card { animation: none; }
}
