.mcm-tool {
    --mcm-paper: #eef5f9;
    --mcm-paper-strong: #dcebf3;
    --mcm-ink: #0f1a23;
    --mcm-muted: #2f4f60;
    --mcm-accent: #69a3bc;
    --mcm-accent-strong: #4f8197;
    --mcm-warm: #69a3bc;
    --mcm-border: #9bbfcf;
    --mcm-error: #9f3b25;

    position: relative;
    overflow: hidden;
    max-width: 920px;
    margin: 1.75rem auto;
    padding: clamp(1rem, 2.4vw, 2rem);
    border: 1px solid var(--mcm-border);
    border-radius: 22px;
    background:
        radial-gradient(130% 110% at 0% 0%, #f8fcff 0%, var(--mcm-paper) 54%, #edf6fb 100%),
        linear-gradient(160deg, rgba(105, 163, 188, 0.12), rgba(15, 26, 35, 0.08));
    box-shadow:
        0 18px 38px -26px rgba(13, 46, 70, 0.42),
        0 6px 16px -10px rgba(20, 35, 52, 0.22);
    color: var(--mcm-ink);
    font-family: 'Avenir Next', 'Trebuchet MS', 'Segoe UI', sans-serif;
    line-height: 1.5;
    animation: mcm-surface-in 420ms ease-out both;
}

.mcm-tool::before,
.mcm-tool::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.35;
}

.mcm-tool::before {
    width: 220px;
    height: 220px;
    top: -110px;
    right: -80px;
    background: radial-gradient(circle, rgba(105, 163, 188, 0.28), rgba(105, 163, 188, 0));
}

.mcm-tool::after {
    width: 200px;
    height: 200px;
    bottom: -120px;
    left: -95px;
    background: radial-gradient(circle, rgba(15, 26, 35, 0.22), rgba(15, 26, 35, 0));
}

.mcm-header {
    position: relative;
    margin-bottom: 0.9rem;
}

.mcm-title {
    margin: 0;
    font-size: clamp(1.35rem, 2.1vw, 1.95rem);
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.mcm-subtitle {
    margin: 0.5rem 0 0;
    max-width: 64ch;
    color: var(--mcm-muted);
    font-size: 0.98rem;
}

.mcm-field {
    position: relative;
    display: block;
    margin-top: 0.95rem;
}

.mcm-label {
    display: inline-block;
    margin-bottom: 0.35rem;
    font-size: 0.86rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #415061;
    font-weight: 700;
}

.mcm-help {
    margin: 0.35rem 0 0;
    color: var(--mcm-muted);
    font-size: 0.86rem;
}

.mcm-textarea {
    width: 100%;
    min-height: 170px;
    padding: 0.9rem 1rem;
    border: 1px solid #bfcad7;
    border-radius: 14px;
    background: #ffffff;
    color: var(--mcm-ink);
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
    resize: vertical;
}

.mcm-textarea::placeholder {
    color: #8391a0;
}

.mcm-textarea--output {
    background: #f4f8fb;
    font-family: 'Consolas', 'Lucida Console', 'Courier New', monospace;
}

.mcm-textarea--output[readonly] {
    cursor: text;
}

.mcm-swap-wrap {
    display: flex;
    justify-content: center;
    margin-top: 0.9rem;
}

.mcm-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-top: 0.95rem;
}

.mcm-btn {
    appearance: none;
    border: 1px solid #000000;
    border-radius: 12px;
    background: #000000;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: transform 120ms ease, filter 140ms ease, box-shadow 140ms ease;
    box-shadow: 0 9px 16px -12px rgba(0, 0, 0, 0.68);
}

.mcm-btn:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

.mcm-btn:active {
    transform: translateY(0);
}

.mcm-btn--swap {
    min-width: min(100%, 290px);
    background: #000000;
    box-shadow: 0 9px 16px -12px rgba(0, 0, 0, 0.68);
}

.mcm-btn--ghost {
    background: #000000;
    border-color: #000000;
    color: #ffffff;
    box-shadow: 0 9px 16px -12px rgba(0, 0, 0, 0.68);
}

.mcm-btn--ghost:hover {
    filter: brightness(1.04);
    background: #000000;
}

.mcm-status,
.mcm-hint {
    margin: 0.65rem 0 0;
    font-size: 0.9rem;
    min-height: 1.3rem;
}

.mcm-status {
    color: #1d3542;
    font-weight: 600;
}

.mcm-hint {
    color: var(--mcm-error);
}

.mcm-textarea:focus-visible,
.mcm-btn:focus-visible {
    outline: 3px solid #69a3bc;
    outline-offset: 2px;
}

.mcm-textarea:focus-visible {
    border-color: #69a3bc;
    box-shadow: 0 0 0 4px rgba(105, 163, 188, 0.24);
}

.mcm-reveal {
    opacity: 0;
    transform: translateY(10px);
    animation: mcm-reveal-in 500ms ease forwards;
}

.mcm-reveal--1 {
    animation-delay: 30ms;
}

.mcm-reveal--2 {
    animation-delay: 90ms;
}

.mcm-reveal--3 {
    animation-delay: 150ms;
}

.mcm-reveal--4 {
    animation-delay: 210ms;
}

.mcm-reveal--5 {
    animation-delay: 270ms;
}

@keyframes mcm-surface-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mcm-reveal-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 700px) {
    .mcm-tool {
        margin: 1rem 0;
        border-radius: 18px;
    }

    .mcm-textarea {
        min-height: 150px;
    }

    .mcm-actions {
        flex-direction: column;
    }

    .mcm-btn,
    .mcm-btn--swap {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mcm-tool,
    .mcm-reveal {
        animation: none;
    }

    .mcm-btn {
        transition: none;
    }
}
