/* Speak trainer on the website (speak-web.js). Organic palette from styles.css; mirrors the app's look. */
.gms-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(58, 46, 34, 0.5); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.gms-overlay[hidden] { display: none; }
.gms-panel { position: relative; width: 100%; max-width: 460px; max-height: 94vh; display: flex; flex-direction: column; background: var(--beige); border: 1.5px solid var(--border); border-radius: 24px; box-shadow: 0 12px 40px var(--shadow); color: var(--text-main); }
.gms-top { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1rem 0.2rem; }
.gms-close { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--text-muted); padding: 0.35rem 0.5rem; line-height: 1; }
.gms-close:hover { color: var(--text-main); }
.gms-track { flex: 1; height: 8px; border-radius: 999px; background: var(--beige-darker); overflow: hidden; }
.gms-track[hidden] { display: none; }
.gms-fill { height: 100%; width: 0; background: var(--btn-bg); border-radius: 999px; transition: width 0.3s; }
.gms-body { position: relative; padding: 0.6rem 1.4rem 1.4rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.85rem; }
.gms-h { font-size: 1.35rem; margin: 0.2rem 0 0; color: var(--accent-dark); }
.gms-kicker { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.gms-msg { margin: 0; line-height: 1.5; }
.gms-hint { margin: 0; font-size: 0.88rem; color: var(--text-muted); line-height: 1.45; }
.gms-error { margin: 0; color: var(--error-red); font-size: 0.9rem; }
.gms-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: center; }
.gms-between { justify-content: space-between; }
.gms-btn { display: inline-block; border: none; border-radius: 999px; padding: 0.8rem 1.4rem; font: inherit; font-weight: 700; cursor: pointer; background: var(--btn-bg); color: #fff; text-decoration: none; text-align: center; }
.gms-btn:hover { background: var(--btn-hover); }
.gms-btn:disabled { opacity: 0.5; cursor: default; }
.gms-btn-ghost { background: transparent; color: var(--btn-bg); border: 1.5px solid var(--btn-bg); }
.gms-btn-ghost:hover { background: rgba(198, 113, 57, 0.1); }
.gms-btn-sm { padding: 0.5rem 1rem; font-size: 0.88rem; }
.gms-levels { display: flex; flex-direction: column; gap: 0.5rem; }
.gms-choice { display: flex; flex-direction: column; gap: 0.1rem; text-align: left; font: inherit; padding: 0.65rem 0.9rem; border-radius: 14px; border: 1.5px solid var(--border); background: var(--card-bg); cursor: pointer; }
.gms-choice span { font-size: 0.85rem; color: var(--text-muted); }
.gms-choice.on { border-color: var(--btn-bg); background: #ffe1d0; }
.gms-seg { display: flex; gap: 0.4rem; }
.gms-seg-btn { flex: 1; padding: 0.55rem; border-radius: 999px; border: 1.5px solid var(--border); background: var(--card-bg); font: inherit; font-weight: 600; cursor: pointer; }
.gms-seg-btn.on { border-color: var(--btn-bg); background: #ffe1d0; }
.gms-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.gms-chips-center { justify-content: center; }
.gms-chip-more { background: transparent; border: 1.5px dashed var(--border); color: var(--text-muted); }

/* Preview card on the vocabulary page: this week's theme and the next words, above the drill button. */
.gms-summary { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; text-align: center; background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 16px; padding: 1.1rem 1rem 1.2rem; }
.gms-sticker { width: 96px; height: 96px; object-fit: contain; margin: -0.2rem 0 -0.3rem; }
.gms-sum-text { font-size: 1.15rem; font-weight: 700; color: var(--accent-dark); }
.gms-sum-line { font-size: 0.88rem; color: var(--text-muted); }
.gms-sum-btn { font-size: 1.15rem; padding: 0.75rem 2.25rem; }
/* Practice page: the "Start exercise" card uses the same layout and button size as the word drill card. */
.gms-summary .ready-btn-row { justify-content: center; }
#exerciseCard .btn-primary, #exerciseCard .btn-secondary { font-size: 1.15rem; padding: 0.75rem 2.25rem; }
#exerciseCard .gms-kicker { margin: 0; }
.gms-chip { padding: 0.35rem 0.8rem; border-radius: 999px; background: var(--beige-dark); font-size: 0.9rem; }
.gms-chip-btn { border: 1.5px solid transparent; font: inherit; font-size: 0.9rem; cursor: pointer; }
.gms-chip-btn.on { background: #ffe1d0; border-color: var(--btn-bg); font-weight: 700; }
.gms-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 0.5rem; }
.gms-stat { background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 14px; padding: 0.6rem 0.4rem; text-align: center; display: flex; flex-direction: column; }
.gms-stat b { font-size: 1.4rem; color: var(--accent-dark); }
.gms-stat span { font-size: 0.72rem; color: var(--text-muted); }
.gms-card { background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 14px; padding: 0.75rem 0.9rem; display: flex; flex-direction: column; gap: 0.3rem; }
.gms-card-t { font-weight: 700; color: var(--accent-dark); }
.gms-links { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.gms-link { background: none; border: none; cursor: pointer; font: inherit; font-size: 0.88rem; color: var(--text-muted); text-decoration: underline; padding: 0; }
.gms-party { font-size: 3.2rem; text-align: center; }
.gms-tag { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 0.25rem 0.7rem; border-radius: 999px; background: #ffe1d0; color: #643312; }
.gms-tag-phrase { background: #e1eecc; color: #3d472b; }
.gms-tag-reverse { background: var(--beige-darker); color: #474238; }
.gms-count { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.gms-big { font-size: 2.3rem; line-height: 1.1; font-weight: 700; color: var(--text-main); word-break: break-word; }
.gms-big-long { font-size: 1.6rem; }
.gms-sub { font-size: 1.05rem; color: var(--text-muted); }
.gms-sub-answer { color: #3d472b; font-weight: 700; }
.gms-translit { font-weight: 600; color: #8c491a; }
.gms-idle { margin: 0.4rem 0; text-align: center; color: var(--text-muted); min-height: 3.2em; }
.gms-limit { background: var(--error-bg); color: var(--error-red); border-radius: 10px; padding: 0.5rem 0.7rem; font-size: 0.85rem; }
.gms-limit[hidden] { display: none; }
.gms-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 0.3rem; }
.gms-side { flex: 1; display: flex; }
.gms-side:last-child { justify-content: flex-end; }
.gms-round { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; background: none; border: none; cursor: pointer; font: inherit; color: var(--text-muted); }
.gms-round span { width: 52px; height: 52px; border-radius: 50%; background: var(--card-bg); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.gms-round i { font-style: normal; font-size: 0.75rem; max-width: 84px; }
.gms-round:disabled { opacity: 0.4; cursor: default; }
.gms-mic { --lvl: 0; width: 84px; height: 84px; border-radius: 50%; border: none; cursor: pointer; background: var(--btn-bg); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 calc(6px + var(--lvl) * 14px) rgba(246, 160, 107, 0.45); transition: box-shadow 0.09s; touch-action: none; user-select: none; }
.gms-mic.rec { background: #8c491a; }
.gms-mic:disabled { opacity: 0.6; cursor: default; }
.gms-mic-label { margin: 0.2rem 0 0; text-align: center; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.gms-spin { width: 28px; height: 28px; border: 3px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; border-radius: 50%; animation: gms-spin 0.8s linear infinite; }
@keyframes gms-spin { to { transform: rotate(360deg); } }
.gms-result { display: flex; flex-direction: column; gap: 0.7rem; background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 16px; padding: 0.9rem; }
.gms-result-head { display: flex; align-items: center; gap: 0.8rem; }
.gms-ring { width: 62px; height: 62px; border-radius: 50%; border: 5px solid var(--btn-bg); display: flex; align-items: center; justify-content: center; flex: none; }
.gms-ring.ok { border-color: #8fa073; }
.gms-ring b { font-size: 1.2rem; }
.gms-verdict { font-weight: 700; font-size: 1.1rem; line-height: 1.2; }
.gms-passed { font-size: 0.82rem; color: var(--text-muted); }
.gms-wchips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.gms-wchip { padding: 0.2rem 0.75rem; border-radius: 999px; font-size: 1.05rem; }
.gms-wchip-a, .gms-legend .a::before { background: #ccdbb2; color: #272e1b; }
.gms-wchip-b, .gms-legend .b::before { background: #ffe1d0; color: #643312; }
.gms-wchip-c, .gms-legend .c::before { background: #8c491a; color: #f9f4ed; }
.gms-legend { display: flex; gap: 0.8rem; font-size: 0.75rem; color: var(--text-muted); }
.gms-legend span::before { content: ''; display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-right: 0.3em; }
.gms-confirm { background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 14px; padding: 0.7rem; }
.gms-confirm p { margin: 0 0 0.5rem; font-size: 0.9rem; }
.gms-overlay-note { position: absolute; inset: 0; background: rgba(245, 234, 216, 0.9); display: flex; align-items: center; justify-content: center; font-weight: 600; }
@media (max-width: 520px) {
  .gms-overlay { padding: 0; }
  .gms-panel { max-width: none; height: 100%; max-height: none; border-radius: 0; border: none; }
  .gms-body { flex: 1; }
}

/* Exercise card and word drill card side by side on desktop (practice ready screen); a hidden card leaves the other full width */
.gms-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.gms-cards > .gms-summary { margin: 0; }
.gms-cards > #speakSummary { display: flex; }
.gms-cards > #speakSummary > .gms-summary { flex: 1; }
.practice-card--ready:has(.gms-cards > #speakSummary:not([style*="display: none"])) { max-width: 920px !important; }
