/* Memonatra smart suggestions: a quiet card under the Word field, plus one-click
   hint rows under each field they can fill. */
.we-smart-suggest,
.we-hint {
    --sg-accent: var(--primary-color, #9c9bff);
    --sg-text: #e2e8f0;
    --sg-muted: var(--text-secondary, #94a3b8);
    --sg-line: rgba(255, 255, 255, 0.08);
    --sg-fill: rgba(255, 255, 255, 0.035);
}

/* ------------------------------------------------------------------ card */
.we-smart-suggest {
    display: none;
    margin: 8px 0 16px;
    border-radius: 12px;
    background: var(--sg-fill);
    border: 1px solid var(--sg-line);
    color: var(--sg-text);
    overflow: hidden;
}

.we-smart-suggest.is-active {
    display: block;
    animation: weSgIn 0.22s ease-out;
}

@keyframes weSgIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.we-sg-head {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 4px 4px 0;
}

.we-sg-toggle {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 6px 4px 6px 12px;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
}

button.we-sg-toggle {
    cursor: pointer;
    border-radius: 10px;
}

button.we-sg-toggle:focus-visible,
.we-sg-close:focus-visible,
.we-sg-action:focus-visible,
.we-sg-link:focus-visible,
.we-hint-chip:focus-visible,
.we-hint-line:focus-visible,
.we-hint-undo:focus-visible {
    outline: 2px solid var(--sg-accent);
    outline-offset: 2px;
}

.we-sg-spark {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sg-accent);
    opacity: 0.85;
    flex: none;
    vertical-align: middle;
}

.we-sg-spark.is-loading {
    animation: weSgPulse 1s ease-in-out infinite alternate;
}

@keyframes weSgPulse {
    from { opacity: 0.25; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1.1); }
}

.we-sg-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sg-muted);
}

.we-sg-word {
    margin-left: 4px;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    color: var(--sg-text);
}

.we-sg-status {
    font-size: 12px;
    color: var(--sg-muted);
}

.we-sg-chevron {
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--sg-muted);
    border-bottom: 1.5px solid var(--sg-muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}

.we-smart-suggest.is-collapsed .we-sg-chevron {
    transform: rotate(-45deg);
}

.we-sg-close {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 0;
    background: none;
    color: var(--sg-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.we-sg-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sg-text);
}

.we-phonetic-badge {
    font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
    font-size: 12px;
    color: #c4c3ff;
}

.we-pos-badge {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sg-muted);
    padding: 1px 6px;
    border: 1px solid var(--sg-line);
    border-radius: 4px;
}

.we-sg-body {
    padding: 2px 12px 12px;
}

.we-smart-suggest.is-collapsed .we-sg-body {
    display: none;
}

.we-sg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.we-sg-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid var(--sg-line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--sg-text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.we-sg-action:hover {
    background: rgba(255, 255, 255, 0.08);
}

.we-autofill-btn {
    border-color: rgba(156, 155, 255, 0.35);
    color: #c4c3ff;
}

.we-audio-btn.is-playing {
    border-color: var(--sg-accent);
    color: #fff;
}

.we-sg-related {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--sg-text);
}

.we-sg-foot {
    border-top: 1px solid var(--sg-line);
    margin-top: 10px;
    padding-top: 9px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.we-sg-lookup {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    font-size: 12px;
}

.we-sg-lookup-label {
    color: var(--sg-muted);
    margin-right: 2px;
}

.we-sg-link {
    color: #c4c3ff;
    text-decoration: none;
    border-bottom: 1px solid rgba(196, 195, 255, 0.3);
    padding: 3px 0;
}

.we-sg-link:hover {
    color: #fff;
    border-bottom-color: currentColor;
}

.we-suggest-source {
    font-size: 10px;
    letter-spacing: 0.03em;
    color: var(--sg-muted);
    opacity: 0.7;
}

/* ----------------------------------------------------------- hint rows */
.we-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: -4px 0 14px;
    color: var(--sg-text);
    animation: weSgIn 0.2s ease-out;
}

.we-hint[hidden] {
    display: none;
}

.we-hint-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--sg-muted);
}

.we-hint-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px dashed rgba(156, 155, 255, 0.35);
    background: transparent;
    color: #c4c3ff;
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.we-hint-chip:hover {
    background: rgba(156, 155, 255, 0.12);
    border-style: solid;
}

.we-hint-chip.is-ghost {
    color: var(--sg-muted);
    border-color: var(--sg-line);
}

.we-hint-chip.is-auto {
    border-style: solid;
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.08);
    color: #86efac;
    cursor: default;
    padding-right: 4px;
}

.we-hint-undo {
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: inherit;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}

.we-hint-undo:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

/* Full-width hint lines: definition and examples */
.we-hint-explanation,
.we-hint-examples {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.we-hint-line {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 8px 34px 8px 10px;
    border-radius: 8px;
    border: 1px dashed rgba(156, 155, 255, 0.28);
    background: transparent;
    color: var(--sg-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.we-hint-line:hover {
    background: rgba(156, 155, 255, 0.08);
    border-style: solid;
}

.we-hint-line .we-hint-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.we-hint-text {
    font-size: 13px;
    line-height: 1.45;
}

.we-hint-explanation .we-hint-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.we-hint-sub {
    font-size: 12px;
    line-height: 1.45;
    color: var(--sg-muted);
}

.we-hint-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.we-hint-add {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    font-size: 16px;
    color: #c4c3ff;
}

@media (max-width: 480px) {
    .we-sg-body { padding: 2px 10px 10px; }
    .we-hint-chip { font-size: 14px; min-height: 34px; }
    .we-sg-action { min-height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
    .we-smart-suggest.is-active,
    .we-hint,
    .we-sg-spark.is-loading { animation: none; }
}
