/**
 * My Words — personal photo vocabulary (page styles, REDESIGN)
 *
 * Scoped under .my-words-root. A library PAGE (not a practice widget): no
 * practice chrome. Anatomy = title → pale-green dashed Add box → inset words
 * container (tabs + search + view toggle + rows/cards) → bottom actions. Add/Edit
 * + Practice picker are bottom sheets (one shared pattern).
 *
 * COLOR GRAMMAR (spec §3): one color = one meaning.
 *   green  = ACTION  (Add / Save / Say it / Practice)
 *   blue   = selection/state (active tab, selected chip, focus)
 *   cyan   = audio / listen only
 *   red    = the favorite heart
 *
 * Real fleet typeface via var(--as-font). Mobile-first, 44px+ touch targets,
 * no !important, prefers-reduced-motion + focus-visible aware. Pairs with
 * my-words-page.js.
 *
 * @package Aphasia_Exercises
 */

.my-words-root {
    /* Fleet-aligned where the fleet already matches spec §3 (blue, audio, border,
       muted, ink); spec greens/red used directly (My Words owns green=action,
       distinct from the fleet's green=correct — reconciliation is a later call). */
    --mw-ink: var(--as-text, #283044);
    --mw-accent: var(--as-read-accent, #2563eb);
    --mw-accent-deep: var(--as-read-text, #1d4ed8);
    --mw-accent-soft: var(--as-read-bg, #dce8fe);
    --mw-audio: var(--as-audio, #0e9bb5);
    --mw-audio-deep: #0b7e93;
    --mw-audio-soft: #e0f5f9;
    --mw-action: #2e9e5b;
    --mw-action-deep: #1f7d45;
    --mw-action-soft: #eef8f1;
    --mw-action-border: #bfe2cd;
    --mw-love: #e23b53;
    /* Border + inset are deepened a step from the fleet's very-light values so the
       section boundaries are easy to perceive for the aphasia/low-vision audience
       (was #e4e9f1 / #f5f8fc — too subtle to see at a glance). Same blue-gray
       family, just darker; keeps the look calm, not boxy. */
    --mw-tile-border: #cdd7e5;
    --mw-muted: var(--as-text-muted, #7c8aa0);
    --mw-inset: #e7edf7;
    --mw-surface: #ffffff;
    --mw-danger: var(--as-danger, #dc2626);
    --mw-danger-dark: #b91c1c;
    --mw-shadow: 0 1px 2px rgba(40, 48, 68, .10), 0 8px 22px rgba(40, 48, 68, .10);
    --mw-radius: 16px;

    display: block;
    max-width: 880px;
    margin: 0 auto;
    color: var(--mw-ink);
    font-family: var(--as-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    /* Sane base line-height for the whole widget — otherwise text elements that
       don't set their own (row name, etc.) inherit the Elementor kit's ~40px
       global line-height and rows/pills balloon. */
    line-height: 1.5;
}

.my-words-root *,
.my-words-root *::before,
.my-words-root *::after { box-sizing: border-box; }

/* Drop the theme's redundant hero title on a page hosting this shortcode. The
   `has-my-words` body class is set server-side (PHP body_class filter) — a plain
   class selector, NEVER body:has() (which froze this React+Elementor renderer —
   live incident 2026-06-28). */
body.has-my-words .entry-title { display: none; }

/* ---------------- Boot / states ---------------- */
.my-words-root .mw-boot,
.my-words-root .mw-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 16px;
    text-align: center;
    color: var(--mw-muted);
}

.my-words-root .mw-boot-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--mw-accent-soft);
    border-top-color: var(--mw-accent);
    border-radius: 50%;
    animation: mwSpin 0.8s linear infinite;
}

@keyframes mwSpin { to { transform: rotate(360deg); } }

/* ---------------- Page title ---------------- */
.my-words-root .mw-page-title {
    margin: 4px 2px 18px;
    font-size: clamp(1.6rem, 5vw, 1.95rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

/* ---------------- (a) Add box ---------------- */
.my-words-root .mw-addbox { margin-bottom: 20px; }

.my-words-root .mw-addbox-collapsed {
    appearance: none;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--mw-action-soft);
    border: 2px dashed var(--mw-action-border);
    color: var(--mw-action-deep);
    font-family: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    text-transform: none;
    padding: 18px;
    min-height: 60px;
    border-radius: var(--mw-radius);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.my-words-root .mw-addbox-collapsed:hover {
    background: #e6f4ec;
    border-color: var(--mw-action);
}

.my-words-root .mw-add-plus { font-size: 1.4rem; font-weight: 800; line-height: 1; }

.my-words-root .mw-addbox-expanded {
    background: var(--mw-action-soft);
    border: 2px dashed var(--mw-action-border);
    border-radius: var(--mw-radius);
    padding: 16px;
}

.my-words-root .mw-addbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.my-words-root .mw-addbox-title { font-weight: 700; font-size: 0.95rem; color: var(--mw-action-deep); }

.my-words-root .mw-add-sources {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.my-words-root .mw-source-btn {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--mw-surface);
    border: 1.5px solid var(--mw-action-border);
    border-radius: 12px;
    padding: 16px 8px;
    min-height: 84px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: none;
    color: var(--mw-ink);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.my-words-root .mw-source-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--mw-shadow);
    border-color: var(--mw-action);
}

.my-words-root .mw-source-btn:disabled { opacity: 0.55; cursor: progress; }

.my-words-root .mw-source-ico { color: var(--mw-action-deep); }

.my-words-root .mw-addbox-busy { margin: 12px 2px 0; font-size: 0.86rem; color: var(--mw-action-deep); }

/* Small ✕ close (add box, sheet head) */
.my-words-root .mw-x {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--mw-muted);
    font-size: 1.15rem;
    line-height: 1;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.my-words-root .mw-x:hover { background: rgba(0, 0, 0, 0.06); color: var(--mw-ink); }

/* Hidden file input (shared) */
.my-words-root .mw-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    pointer-events: none;
}

/* ---------------- (b) Words container ---------------- */
/* One cohesive white card holding two clearly-separated blocks: the segmented
   TAB control on top, and a tinted SEARCH+LIST subgroup below. Flex COLUMN
   pinned to the top so it always hugs its content and NEVER spreads children
   down the page (robust even if an ancestor/Elementor gives it extra height). */
.my-words-root .mw-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 12px;
    background: var(--mw-surface);
    /* Slightly thicker border than the inner elements so the outer card reads as a
       clearly bounded section (paired with the deepened border color + shadow). */
    border: 1.5px solid var(--mw-tile-border);
    border-radius: var(--mw-radius);
    box-shadow: var(--mw-shadow);
    padding: 12px;
}

/* Search + view-toggle + the word list, grouped as ONE tinted subgroup so the
   search visibly belongs WITH the list it filters (reads "search → its list",
   not a floating box). White rows pop against this inset panel. */
.my-words-root .mw-listgroup {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--mw-inset);
    border: 1px solid var(--mw-tile-border);
    border-radius: 12px;
    padding: 10px;
}

/* Tabs = SEGMENTED CONTROL: both tabs share one bordered, tinted track; each
   splits the width (flex:1) so it clearly reads as a two-tab control, not loose
   text; the active tab is filled blue. */
.my-words-root .mw-tabs2 {
    display: flex;
    gap: 4px;
    background: var(--mw-inset);
    border: 1px solid var(--mw-tile-border);
    border-radius: 12px;
    padding: 4px;
}

.my-words-root .mw-tab-btn {
    flex: 1;
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: none;
    color: var(--mw-muted);
    padding: 8px 10px;
    min-height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: color 0.12s ease, background-color 0.12s ease;
}

.my-words-root .mw-tab-btn:hover:not(.is-active) { color: var(--mw-ink); }

.my-words-root .mw-tab-btn.is-active { color: #fff; background: var(--mw-accent); }

.my-words-root .mw-tab-count {
    font-size: 0.78rem;
    font-weight: 700;
    background: #e7edf6;
    color: var(--mw-muted);
    border-radius: 999px;
    padding: 1px 8px;
    min-width: 22px;
    text-align: center;
}

.my-words-root .mw-tab-btn.is-active .mw-tab-count { background: rgba(255, 255, 255, 0.25); color: #fff; }

/* Controls (search + view toggle) — a full-width row at the top of the list
   subgroup. flex:0 0 auto so it hugs its content height (never let the search's
   own flex-basis inflate it in this column context — the old row→column mobile
   bug). Search grows to fill; the view toggle sits at the right. */
.my-words-root .mw-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    justify-content: space-between;
}

.my-words-root .mw-search {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
}

.my-words-root .mw-search-ico { position: absolute; left: 11px; color: var(--mw-muted); pointer-events: none; }

.my-words-root .mw-search-input {
    width: 100%;
    height: 42px;
    padding: 0 36px;
    border: 1.5px solid var(--mw-tile-border);
    border-radius: 10px;
    background: var(--mw-surface);
    color: var(--mw-ink);
    font-size: 0.95rem;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.my-words-root .mw-search-input:focus-visible {
    outline: none;
    border-color: var(--mw-accent);
    box-shadow: 0 0 0 3px var(--mw-accent-soft);
}

.my-words-root .mw-search-input::-webkit-search-decoration,
.my-words-root .mw-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.my-words-root .mw-search-clear {
    position: absolute;
    right: 8px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: var(--mw-muted);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.my-words-root .mw-search-clear:hover { background: rgba(0, 0, 0, 0.12); color: var(--mw-ink); }

.my-words-root .mw-view-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    border: 1.5px solid var(--mw-tile-border);
    border-radius: 10px;
    background: var(--mw-surface);
    overflow: hidden;
}

.my-words-root .mw-view-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--mw-muted);
    width: 42px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.my-words-root .mw-view-btn:hover { color: var(--mw-ink); }

.my-words-root .mw-view-btn.is-active { background: var(--mw-accent); color: #fff; }

/* ---------------- Topic pill ---------------- */
.my-words-root .mw-topic-pill {
    display: inline-block;
    /* align-self so the pill stays content-width inside the flex-column card body
       instead of stretching full width; explicit line-height so it doesn't
       inherit the Elementor kit's huge global line-height (~40px → a 45px pill). */
    align-self: flex-start;
    background: var(--mw-accent-soft);
    color: var(--mw-accent-deep);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.5;
    padding: 2px 9px;
    border-radius: 999px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.my-words-root .mw-topic-pill.is-custom { background: #efeafe; color: #6b46c1; }

/* ---------------- Heart (favorite = red) ---------------- */
.my-words-root .mw-heart { color: var(--mw-muted); }
.my-words-root .mw-heart.is-on { color: var(--mw-love); }

/* ---------------- Quick (rows) view ---------------- */
.my-words-root .mw-rows { display: flex; flex-direction: column; gap: 8px; }

.my-words-root .mw-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--mw-surface);
    border: 1px solid var(--mw-tile-border);
    border-radius: 12px;
    padding: 8px 10px;
}

.my-words-root .mw-row-thumb-btn {
    appearance: none;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    line-height: 0;
}

.my-words-root .mw-row-thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--mw-accent-soft);
    display: block;
}

.my-words-root .mw-row-noimg { display: block; }

.my-words-root .mw-row-rec {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--mw-audio);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.my-words-root .mw-row-rec-ico { width: 13px; height: 13px; }

.my-words-root .mw-row-main { flex: 1; min-width: 0; }

.my-words-root .mw-row-name {
    font-weight: 700;
    font-size: 0.98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-words-root .mw-row-name.is-unnamed,
.my-words-root .mw-card-word.is-unnamed { color: var(--mw-muted); font-style: italic; font-weight: 600; }

.my-words-root .mw-row-main .mw-topic-pill { margin-top: 3px; }

.my-words-root .mw-row-actions { display: flex; gap: 2px; flex-shrink: 0; }

.my-words-root .mw-icon-btn {
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mw-muted);
    transition: background 0.12s ease;
}

.my-words-root .mw-icon-btn:hover { background: var(--mw-inset); color: var(--mw-ink); }
.my-words-root .mw-icon-btn.mw-heart:hover { color: var(--mw-love); }
.my-words-root .mw-icon { width: 20px; height: 20px; }

/* ---------------- Card view ---------------- */
.my-words-root .mw-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.my-words-root .mw-card {
    position: relative;
    background: var(--mw-surface);
    border: 1px solid var(--mw-tile-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--mw-shadow);
    display: flex;
    flex-direction: column;
}

.my-words-root .mw-card-img-btn {
    appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    background: var(--mw-accent-soft);
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.my-words-root .mw-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.my-words-root .mw-card-noimg { width: 100%; height: 100%; background: var(--mw-accent-soft); }

.my-words-root .mw-card-speak {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--mw-audio);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.my-words-root .mw-card-speak.has-rec { background: var(--mw-audio); color: #fff; }

.my-words-root .mw-card-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.my-words-root .mw-card-word {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Corner controls: edit (blue) top-left, heart (red) top-right (spec §5.7) */
.my-words-root .mw-card-edit,
.my-words-root .mw-card-fav {
    position: absolute;
    top: 8px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--mw-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.12s ease, color 0.12s ease;
    z-index: 2;
}

.my-words-root .mw-card-edit { left: 8px; color: var(--mw-accent-deep); }
.my-words-root .mw-card-edit:hover { background: var(--mw-accent); color: #fff; }
.my-words-root .mw-card-edit-ico { width: 18px; height: 18px; }

.my-words-root .mw-card-fav { right: 8px; }
.my-words-root .mw-card-fav-ico { width: 20px; height: 20px; }

/* Reorder (card view, My Words tab, no search) */
.my-words-root .mw-card-move {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 0 10px 10px;
    margin-top: auto;
}

.my-words-root .mw-move-btn {
    appearance: none;
    cursor: pointer;
    border: 1px solid var(--mw-tile-border);
    border-radius: 9px;
    background: #fff;
    color: var(--mw-accent-deep);
    width: 44px;
    height: 38px;
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.my-words-root .mw-move-btn:hover:not(:disabled) { background: var(--mw-accent-soft); border-color: var(--mw-accent); }
.my-words-root .mw-move-btn:disabled { opacity: 0.3; cursor: default; }
.my-words-root .mw-move-pos { font-size: 0.78rem; font-weight: 700; color: var(--mw-muted); min-width: 3ch; text-align: center; }

/* ---------------- Empty / no-results ---------------- */
.my-words-root .mw-empty { text-align: center; padding: 18px 16px; }
.my-words-root .mw-empty-msg { margin: 0 auto; color: var(--mw-muted); max-width: 42ch; font-size: 0.9rem; }

.my-words-root .mw-noresults { text-align: center; padding: 32px 16px; color: var(--mw-muted); }
.my-words-root .mw-noresults-msg { margin: 0 0 12px; font-size: 0.98rem; }

/* ---------------- (c) Bottom actions ---------------- */
.my-words-root .mw-bottom {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 22px;
}

.my-words-root .mw-btn-action,
.my-words-root .mw-btn-neutral {
    appearance: none;
    border: 0;
    border-radius: 14px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    text-transform: none;
    padding: 15px;
    min-height: 52px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.my-words-root .mw-btn-action { background: var(--mw-action); color: #fff; }
.my-words-root .mw-btn-action:hover:not(:disabled) { background: var(--mw-action-deep); }
.my-words-root .mw-btn-action:disabled { background: #cfd8e3; cursor: not-allowed; }

.my-words-root .mw-btn-neutral { background: var(--mw-surface); color: var(--mw-ink); border: 1.5px solid var(--mw-tile-border); }
.my-words-root .mw-btn-neutral:hover:not(:disabled) { background: var(--mw-inset); }
.my-words-root .mw-btn-neutral:disabled { opacity: 0.5; cursor: not-allowed; }

.my-words-root .mw-btn-ico { line-height: 0; }

/* ---------------- Generic small buttons (confirm / upsell) ---------------- */
.my-words-root .mw-btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 10px 18px;
    min-height: 44px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.my-words-root .mw-btn-ghost { background: transparent; color: var(--mw-muted); border-color: var(--mw-tile-border); }
.my-words-root .mw-btn-ghost:hover { background: var(--mw-inset); }
.my-words-root .mw-btn-danger { background: var(--mw-danger); color: #fff; }
.my-words-root .mw-btn-danger:hover { background: var(--mw-danger-dark); }
.my-words-root .mw-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- Bottom sheet (wizard + picker) ---------------- */
.my-words-root .mw-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 26, 40, 0.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100000;
}

.my-words-root .mw-sheet {
    background: var(--mw-surface);
    width: 100%;
    max-width: 560px;
    border-radius: 22px 22px 0 0;
    padding: 14px 18px 26px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
    max-height: 92vh;
    overflow-y: auto;
    animation: mwSheetUp 0.25s cubic-bezier(.22, 1, .36, 1);
}

@keyframes mwSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.my-words-root .mw-sheet-grab {
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: #d6deea;
    margin: 0 auto 12px;
}

.my-words-root .mw-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.my-words-root .mw-step-label { font-size: 0.82rem; font-weight: 700; color: var(--mw-muted); }

.my-words-root .mw-dots { display: flex; gap: 6px; align-items: center; }
.my-words-root .mw-dot { width: 8px; height: 8px; border-radius: 50%; background: #d6deea; transition: width 0.15s ease, background 0.15s ease; }
.my-words-root .mw-dot.is-on { background: var(--mw-accent); width: 22px; border-radius: 999px; }

/* Anchored wizard photo — fixed zone, no reflow between steps (spec §14) */
.my-words-root .mw-wiz-photo-wrap {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 14px auto 18px;
}

.my-words-root .mw-wiz-photo {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    object-fit: cover;
    cursor: pointer;
    background: var(--mw-accent-soft);
    border: 1px solid var(--mw-tile-border);
    display: block;
}

.my-words-root .mw-cam-badge {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--mw-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mw-ink);
    pointer-events: none;
}

.my-words-root .mw-cam-badge-ico { width: 20px; height: 20px; }

.my-words-root .mw-wiz-photo-busy {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 18px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--mw-ink);
}

/* Fixed-height body zone so steps don't jump */
.my-words-root .mw-wiz-body {
    min-height: 132px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.my-words-root .mw-wiz-input {
    width: 100%;
    border: 1.5px solid var(--mw-tile-border);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 1.1rem;
    font-family: inherit;
    text-align: center;
    color: var(--mw-ink);
    background: #fff;
}

.my-words-root .mw-wiz-input:focus { outline: none; border-color: var(--mw-accent); box-shadow: 0 0 0 3px var(--mw-accent-soft); }

.my-words-root .mw-wiz-prompt { margin: 0 0 4px; font-weight: 700; font-size: 1.05rem; text-align: center; }

.my-words-root .mw-wiz-topic { justify-content: flex-start; }

.my-words-root .mw-cat-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.my-words-root .mw-cat-chip {
    appearance: none;
    cursor: pointer;
    background: #fff;
    border: 1.5px solid var(--mw-tile-border);
    border-radius: 999px;
    padding: 9px 15px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: none;
    color: var(--mw-ink);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.my-words-root .mw-cat-chip:hover { border-color: var(--mw-accent); }
.my-words-root .mw-cat-chip.is-active { background: var(--mw-accent); border-color: var(--mw-accent); color: #fff; }

/* "Add your own topic" reads as an action (green) */
.my-words-root .mw-cat-chip-new { color: var(--mw-action-deep); border-color: var(--mw-action-border); background: var(--mw-action-soft); }
.my-words-root .mw-cat-chip-new:hover { border-color: var(--mw-action); }
.my-words-root .mw-cat-chip-new.is-active { background: var(--mw-action); border-color: var(--mw-action); color: #fff; }

.my-words-root .mw-chip-emoji { font-size: 1rem; line-height: 1; }

.my-words-root .mw-newtopic { margin-top: 4px; }

/* Wizard nav footer */
.my-words-root .mw-wiz-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}

.my-words-root .mw-nav-back {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--mw-muted);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: none;
    cursor: pointer;
    padding: 10px;
    min-height: 44px;
}

.my-words-root .mw-nav-back[hidden] { visibility: hidden; display: block; }

.my-words-root .mw-nav-skip {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--mw-accent);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: none;
    text-decoration: underline;
    cursor: pointer;
    padding: 10px;
    min-height: 44px;
}

.my-words-root .mw-nav-next {
    appearance: none;
    background: var(--mw-action);
    color: #fff;
    border: 0;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    text-transform: none;
    padding: 13px 28px;
    min-height: 48px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.my-words-root .mw-nav-next:hover:not(:disabled) { background: var(--mw-action-deep); }
.my-words-root .mw-nav-next:disabled { opacity: 0.6; cursor: not-allowed; }

/* Delete-this-word (edit mode) */
.my-words-root .mw-wiz-del {
    appearance: none;
    display: block;
    margin: 16px auto 0;
    border: 0;
    background: transparent;
    color: var(--mw-muted);
    font-family: inherit;
    font-size: 0.86rem;
    text-transform: none;
    cursor: pointer;
    padding: 8px;
}

.my-words-root .mw-wiz-del:hover { color: var(--mw-danger); }

.my-words-root .mw-wiz-del-confirm {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    font-weight: 600;
}

/* ---------------- Say-it (voice) control ---------------- */
.my-words-root .mw-sayit-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.my-words-root .mw-sayit {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 14px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    text-transform: none;
    padding: 15px 26px;
    min-width: 200px;
    min-height: 52px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.my-words-root .mw-sayit-go { background: var(--mw-action); color: #fff; }
.my-words-root .mw-sayit-go:hover { background: var(--mw-action-deep); }
.my-words-root .mw-sayit-redo { background: var(--mw-surface); color: var(--mw-action-deep); border: 1.5px solid var(--mw-action-border); }
.my-words-root .mw-sayit-redo:hover { background: var(--mw-action-soft); }
.my-words-root .mw-sayit-rec { background: var(--mw-love); color: #fff; cursor: default; animation: mwPulse 1s ease-in-out infinite; }
.my-words-root .mw-sayit-ico { line-height: 0; }

.my-words-root .mw-rec-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    display: inline-block;
}

@keyframes mwPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(226, 59, 83, 0.5); }
    50% { box-shadow: 0 0 0 12px rgba(226, 59, 83, 0); }
}

.my-words-root .mw-recorded-flag {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--mw-action-deep);
    font-weight: 700;
    font-size: 0.9rem;
}

.my-words-root .mw-recorded-check { color: var(--mw-action); line-height: 0; }
.my-words-root .mw-recorded-check-ico { width: 16px; height: 16px; }

.my-words-root .mw-recorded-remove {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--mw-muted);
    font-family: inherit;
    font-size: 0.82rem;
    text-transform: none;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 6px;
    margin-left: 4px;
}

.my-words-root .mw-recorded-remove:hover { color: var(--mw-danger); }

.my-words-root .mw-sayit-note { margin: 0; color: var(--mw-muted); font-size: 0.9rem; text-align: center; }
.my-words-root .mw-rec-err { margin: 0; color: var(--mw-danger-dark); font-size: 0.85rem; text-align: center; }

/* Premium upsell (free users) */
.my-words-root .mw-rec-upsell {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--mw-action-border);
    border-radius: var(--mw-radius);
    background: var(--mw-action-soft);
    color: var(--mw-ink);
    font-size: 0.88rem;
    line-height: 1.4;
}

.my-words-root .mw-rec-lock { color: var(--mw-action-deep); line-height: 0; margin-top: 2px; }
.my-words-root .mw-rec-upsell-link { font-weight: 800; color: var(--mw-action-deep); text-decoration: underline; }

/* ---------------- Practice picker ---------------- */
.my-words-root .mw-picker-title { margin: 6px 0 4px; font-size: 1.25rem; font-weight: 800; text-align: center; }
.my-words-root .mw-picker-sub { margin: 0 0 18px; color: var(--mw-muted); font-size: 0.92rem; text-align: center; }

.my-words-root .mw-picker-grid { display: flex; flex-direction: column; gap: 10px; }

.my-words-root .mw-picker-opt {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    text-transform: none;
    padding: 14px;
    border: 1.5px solid var(--mw-tile-border);
    border-radius: var(--mw-radius);
    background: var(--mw-surface);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.my-words-root .mw-picker-opt:hover { border-color: var(--mw-accent); background: var(--mw-inset); }

/* Featured (Naming) = green action card */
.my-words-root .mw-picker-opt.is-featured { border: 2px solid var(--mw-action); background: var(--mw-action-soft); }
.my-words-root .mw-picker-opt.is-featured:hover { background: #e6f4ec; }

.my-words-root .mw-picker-ico {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--mw-accent-soft);
    font-size: 1.5rem;
    line-height: 1;
}

.my-words-root .mw-picker-opt.is-featured .mw-picker-ico { background: #fff; }
.my-words-root .mw-picker-ico.is-audio { background: var(--mw-audio-soft); color: var(--mw-audio-deep); }
.my-words-root .mw-picker-ico-svg { width: 24px; height: 24px; }

/* flex:1 + min-width:0 lets the text column shrink so long labels/descriptions
   wrap within the row instead of overflowing. white-space:normal is REQUIRED:
   the option row is a <button>, and the Elementor kit sets white-space:nowrap on
   buttons, which INHERITS into the desc — without this the description renders on
   one line and spills off the modal's right edge on mobile. */
.my-words-root .mw-picker-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; white-space: normal; }

.my-words-root .mw-picker-opt-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--mw-ink);
}

.my-words-root .mw-picker-tag {
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--mw-action);
    border-radius: 999px;
    padding: 2px 8px;
}

.my-words-root .mw-picker-desc { font-size: 0.85rem; color: var(--mw-muted); white-space: normal; }
/* Fixed column: never shrink or wrap, so the row's text body owns the wrapping. */
.my-words-root .mw-picker-arrow { flex-shrink: 0; color: var(--mw-muted); font-size: 1.1rem; }

/* ---------------- Upsell modal (centered) ---------------- */
.my-words-root .mw-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 26, 40, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100000;
}

.my-words-root .mw-modal {
    background: var(--mw-surface);
    border-radius: 18px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.my-words-root .mw-modal-upsell { text-align: center; }
.my-words-root .mw-upsell-ico { font-size: 2.4rem; }
.my-words-root .mw-modal-title { margin: 6px 0 8px; font-size: 1.2rem; font-weight: 700; }
.my-words-root .mw-modal-sub { margin: 0 0 18px; color: var(--mw-muted); }
.my-words-root .mw-modal-actions { display: flex; justify-content: center; gap: 10px; }
.my-words-root .mw-modal-upsell .mw-btn-action { border-radius: 999px; text-decoration: none; }

/* ---------------- Error ---------------- */
.my-words-root .mw-error {
    margin: 14px 0 0;
    color: var(--mw-danger-dark);
    background: #fde8e8;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
}

/* ---------------- Toast ---------------- */
.my-words-root .mw-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    background: var(--mw-ink);
    color: #fff;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 100001;
    animation: mwToastIn 0.25s ease;
}

@keyframes mwToastIn { from { opacity: 0; transform: translateX(-50%) translateY(16px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ---------------- Focus visibility ---------------- */
.my-words-root button:focus-visible,
.my-words-root a:focus-visible,
.my-words-root input:focus-visible,
.my-words-root .mw-wiz-photo:focus-visible {
    outline: 3px solid var(--mw-accent);
    outline-offset: 2px;
}

/* ---------------- Elementor kit-proofing (icon buttons) ----------------
   The kit's global button rule applies padding (15px 50px) and a min-width
   (~100px) to ANY button that doesn't declare its own — which ballooned our
   small icon/corner buttons (✎ ♥ in rows + on cards, reorder arrows, the ✕ and
   search-clear, the view toggle) into ~100px blobs that overlapped the photo.
   Re-declaring padding + min-width here wins on plain specificity (two classes
   beat the kit's one-class rule) — no !important needed. Width/height are
   already set on each button; this just stops the kit from inflating them. */
.my-words-root .mw-icon-btn,
.my-words-root .mw-card-edit,
.my-words-root .mw-card-fav,
.my-words-root .mw-move-btn,
.my-words-root .mw-view-btn,
.my-words-root .mw-x,
.my-words-root .mw-search-clear {
    min-width: 0;
    padding: 0;
}

/* ---------------- Responsive ---------------- */
@media (min-width: 600px) {
    .my-words-root .mw-cards { grid-template-columns: repeat(3, 1fr); }
}

/* Larger screens: the segmented tab control shouldn't stretch across the full
   ~880px card — pull it to content width on the left so it reads as a tidy
   two-tab control. (Mobile-first default = full-width split, flex:1 per tab.) */
@media (min-width: 601px) {
    .my-words-root .mw-tabs2 { align-self: flex-start; }
    .my-words-root .mw-tab-btn { flex: 0 0 auto; padding: 8px 22px; }
}

@media (max-width: 420px) {
    .my-words-root .mw-wiz-photo-wrap { width: 128px; height: 128px; }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
    .my-words-root .mw-boot-spinner,
    .my-words-root .mw-sheet,
    .my-words-root .mw-toast,
    .my-words-root .mw-sayit-rec { animation: none; }
    .my-words-root * { transition: none; }
}
