.sarg-phonetic {
    --sarg-orange: #f58213;
    --sarg-orange-2: #ff9f2e;
    --sarg-black: #07090c;
    --sarg-panel: #11161e;
    --sarg-panel-2: #151c26;
    --sarg-line: #353d49;
    --sarg-text: #f7f7f7;
    --sarg-muted: #a7b0bd;
    --sarg-danger: #ff4f4f;
    width: 100%;
    box-sizing: border-box;
    padding: clamp(18px, 3vw, 34px);
    color: var(--sarg-text);
    background:
        linear-gradient(rgba(245,130,19,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245,130,19,.035) 1px, transparent 1px),
        radial-gradient(circle at 15% 0%, rgba(245,130,19,.12), transparent 38%),
        #090c11;
    background-size: 32px 32px, 32px 32px, auto, auto;
    border: 1px solid #232933;
    border-radius: 20px;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    box-shadow: 0 16px 45px rgba(0,0,0,.35);
}

.sarg-phonetic * { box-sizing: border-box; }

.sarg-phonetic__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.sarg-phonetic__eyebrow {
    display: inline-block;
    color: var(--sarg-orange-2);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .16em;
    margin-bottom: 4px;
}

.sarg-phonetic__title {
    margin: 0;
    color: #fff;
    font-size: clamp(1.7rem, 4vw, 2.55rem);
    line-height: 1.05;
    font-weight: 850;
}

.sarg-phonetic__subtitle {
    margin: 8px 0 0;
    color: var(--sarg-muted);
    font-size: .98rem;
}

.sarg-phonetic__badge {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 3px solid var(--sarg-orange);
    color: var(--sarg-orange);
    font-weight: 900;
    letter-spacing: .04em;
    background: #050607;
    box-shadow: 0 0 0 6px rgba(245,130,19,.08), inset 0 0 20px rgba(245,130,19,.08);
}

.sarg-phonetic__panel {
    background: linear-gradient(180deg, rgba(22,29,40,.98), rgba(14,19,27,.98));
    border: 1px solid #303844;
    border-radius: 17px;
    padding: clamp(16px, 2.5vw, 28px);
    margin-top: 18px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}

.sarg-phonetic__input-panel { border-top: 3px solid var(--sarg-orange); }

.sarg-phonetic__label-row,
.sarg-phonetic__section-heading,
.sarg-phonetic__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.sarg-phonetic__label,
.sarg-phonetic__cards-title {
    color: #d9dde5;
    font-size: .83rem;
    font-weight: 800;
    letter-spacing: .055em;
}

.sarg-phonetic__label span,
.sarg-phonetic__cards-title span { color: var(--sarg-orange); }

.sarg-phonetic__switch {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--sarg-muted);
    font-size: .83rem;
    cursor: pointer;
    user-select: none;
}

.sarg-phonetic__switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sarg-phonetic__switch-ui {
    width: 38px;
    height: 21px;
    border-radius: 20px;
    background: #303743;
    border: 1px solid #454e5d;
    position: relative;
    transition: .2s ease;
}

.sarg-phonetic__switch-ui::after {
    content: "";
    width: 15px;
    height: 15px;
    position: absolute;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #fff;
    transition: .2s ease;
}

.sarg-phonetic__switch input:checked + .sarg-phonetic__switch-ui {
    background: var(--sarg-orange);
    border-color: var(--sarg-orange);
}

.sarg-phonetic__switch input:checked + .sarg-phonetic__switch-ui::after { transform: translateX(17px); }

.sarg-phonetic__input {
    width: 100%;
    min-height: 94px;
    resize: vertical;
    margin-top: 17px;
    padding: 18px 20px;
    color: #fff;
    caret-color: var(--sarg-orange);
    background: #080b10;
    border: 1px solid #3b4654;
    border-radius: 13px;
    outline: none;
    font: 500 1.05rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.sarg-phonetic__input::placeholder { color: #6f7a8a; }
.sarg-phonetic__input:focus {
    border-color: var(--sarg-orange);
    box-shadow: 0 0 0 3px rgba(245,130,19,.14);
}

.sarg-phonetic__toolbar { margin-top: 16px; }
.sarg-phonetic__buttons { display: flex; flex-wrap: wrap; gap: 10px; }

.sarg-phonetic__btn,
.sarg-phonetic__mini-btn {
    appearance: none;
    border: 1px solid #424b59;
    color: #f3f5f8;
    background: #252c36;
    border-radius: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.sarg-phonetic__btn {
    min-height: 44px;
    padding: 0 18px;
    font-size: .82rem;
}

.sarg-phonetic__btn:hover,
.sarg-phonetic__mini-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--sarg-orange);
}

.sarg-phonetic__btn--primary {
    color: #141414;
    background: var(--sarg-orange);
    border-color: var(--sarg-orange);
    box-shadow: 0 8px 20px rgba(245,130,19,.22);
}

.sarg-phonetic__btn--primary:hover { background: var(--sarg-orange-2); }
.sarg-phonetic__btn--danger { color: #ff7c7c; border-color: rgba(255,79,79,.55); background: rgba(255,79,79,.06); }

.sarg-phonetic__counter {
    color: #747f8f;
    font: .8rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: nowrap;
}

.sarg-phonetic__result-actions { display: flex; gap: 8px; }
.sarg-phonetic__mini-btn { padding: 7px 11px; font-size: .72rem; }
.sarg-phonetic__mini-btn:disabled { opacity: .42; cursor: not-allowed; }

.sarg-phonetic__result {
    margin-top: 16px;
    min-height: 100px;
    padding: 20px;
    display: flex;
    align-items: center;
    background: #080b10;
    border: 1px solid #323b47;
    border-radius: 13px;
    color: #f6f7f9;
    line-height: 1.75;
    font-size: 1rem;
}

.sarg-phonetic__empty { width: 100%; text-align: center; color: #778295; }
.sarg-phonetic__result-text { width: 100%; }
.sarg-phonetic__result-word { color: #fff; }
.sarg-phonetic__result-sep { color: var(--sarg-orange); padding: 0 .25em; }

.sarg-phonetic__cards-wrap { margin-top: 25px; }
.sarg-phonetic__section-heading--cards { padding: 0 4px 10px; }
.sarg-phonetic__cards-title { font-size: .95rem; color: #d8dde6; }

.sarg-phonetic__cards {
    min-height: 160px;
    padding: 20px;
    border: 1px dashed rgba(245,130,19,.52);
    border-radius: 15px;
    background: rgba(17,22,30,.82);
}

.sarg-phonetic__cards-empty {
    min-height: 118px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    text-align: center;
    color: #778295;
}

.sarg-phonetic__mic { font-size: 2rem; filter: grayscale(1); opacity: .8; }

.sarg-phonetic__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
    gap: 10px;
}

.sarg-phonetic__card {
    position: relative;
    min-height: 94px;
    padding: 12px 10px;
    border-radius: 11px;
    background: #0a0e14;
    border: 1px solid #333d49;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
}

.sarg-phonetic__card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--sarg-orange);
}

.sarg-phonetic__char {
    color: var(--sarg-orange-2);
    font: 900 1.35rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.sarg-phonetic__word {
    margin-top: 8px;
    color: #f0f2f5;
    font-size: .82rem;
    font-weight: 750;
}

.sarg-phonetic__footer-note {
    margin-top: 14px;
    color: #727d8d;
    font-size: .76rem;
    text-align: center;
}

.sarg-phonetic__toast {
    position: fixed;
    z-index: 99999;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 10px);
    padding: 10px 15px;
    border-radius: 8px;
    color: #111;
    background: var(--sarg-orange);
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transition: .2s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,.4);
}

.sarg-phonetic__toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
    .sarg-phonetic { padding: 16px; border-radius: 14px; }
    .sarg-phonetic__header { align-items: flex-start; }
    .sarg-phonetic__badge { width: 58px; height: 58px; font-size: .86rem; }
    .sarg-phonetic__label-row,
    .sarg-phonetic__section-heading,
    .sarg-phonetic__toolbar { align-items: flex-start; flex-direction: column; }
    .sarg-phonetic__toolbar { gap: 12px; }
    .sarg-phonetic__counter { align-self: flex-end; }
    .sarg-phonetic__result-actions { width: 100%; }
    .sarg-phonetic__mini-btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .sarg-phonetic *, .sarg-phonetic *::before, .sarg-phonetic *::after { transition: none !important; }
}
