:root {
    --bg: #eef3f8;
    --surface: #ffffff;
    --surface-soft: #f7fafd;
    --text: #202124;
    --muted: #5f6368;
    --line: #d8dee8;
    --line-soft: #edf1f6;
    --blue: #1a73e8;
    --blue-hover: #155fc0;
    --blue-soft: #e8f0fe;
    --green: #137333;
    --green-soft: #e6f4ea;
    --red: #b3261e;
    --red-soft: #fce8e6;
    --shadow: 0 18px 44px rgba(42, 64, 96, .14);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: linear-gradient(180deg, rgba(232, 240, 254, .92), rgba(248, 250, 253, .96) 360px), var(--bg);
    color: var(--text);
    font-family: Tahoma, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.65;
}

a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 700;
}

.appbar {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid rgba(216, 222, 232, .74);
    padding: 0 34px;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #202124;
}

.brand:hover {
    color: #202124;
}

.brand-mark {
    width: 42px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: conic-gradient(from 45deg, #4285f4, #34a853, #fbbc04, #ea4335, #4285f4);
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(26, 115, 232, .22);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 18px;
    line-height: 1.2;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.appbar nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.appbar nav a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 7px 13px;
    color: #3c4043;
    font-size: 13px;
}

.appbar nav a:hover {
    border-color: var(--line);
    background: #fff;
}

.shell {
    width: min(100% - 40px, 1220px);
    margin: 26px auto 36px;
    display: grid;
    gap: 16px;
}

.tool-head {
    display: block;
    border: 1px solid rgba(216, 222, 232, .82);
    border-radius: 8px;
    padding: 26px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(248, 250, 253, .9)), #fff;
    box-shadow: var(--shadow);
}

.tool-head h1 {
    margin: 0 0 7px;
    color: #1f2937;
    font-size: clamp(30px, 4vw, 46px);
    font-weight: 700;
    line-height: 1.12;
}

.tool-head p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.feature-strip {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.feature-strip span {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 11px;
    background: #fff;
    color: #3c4043;
    font-size: 12px;
    font-weight: 800;
}

.notice {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(42, 64, 96, .08);
}

.notice.success {
    border-color: #ceead6;
    background: var(--green-soft);
    color: var(--green);
}

.notice.error {
    border-color: #f4c7c3;
    background: var(--red-soft);
    color: var(--red);
}

.translator {
    display: grid;
    gap: 16px;
    border: 1px solid rgba(216, 222, 232, .92);
    border-radius: 8px;
    padding: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow);
}

.language-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
    gap: 12px;
    align-items: end;
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: 16px;
}

label {
    min-width: 0;
    display: grid;
    gap: 7px;
    color: #3c4043;
    font-weight: 800;
}

label span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

label small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 11px 13px;
    background: var(--surface-soft);
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
}

textarea {
    min-height: clamp(260px, 36vh, 410px);
    resize: vertical;
    line-height: 1.8;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, .12);
}

button,
.audio-panel a {
    min-height: 42px;
    width: fit-content;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    padding: 9px 22px;
    background: var(--blue);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

button:hover,
.audio-panel a:hover {
    background: var(--blue-hover);
    box-shadow: 0 6px 16px rgba(26, 115, 232, .22);
    transform: translateY(-1px);
}

.swap {
    width: 44px;
    min-width: 44px;
    padding: 0;
    background: #fff;
    color: var(--blue);
    border: 1px solid var(--line);
    font-size: 20px;
}

.swap:hover {
    background: var(--blue-soft);
    color: var(--blue);
    box-shadow: none;
}

button.secondary {
    background: transparent;
    color: var(--blue);
    padding-inline: 12px;
}

button.secondary:hover {
    background: var(--blue-soft);
    color: var(--blue);
    box-shadow: none;
}

.text-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.text-panel {
    min-width: 0;
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid var(--line-soft);
    padding-top: 16px;
}

.audio-panel {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(42, 64, 96, .1);
}

.audio-panel audio {
    width: 100%;
}

.site-footer {
    width: min(100% - 40px, 1220px);
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 auto 24px;
    border-top: 1px solid rgba(216, 222, 232, .9);
    color: var(--muted);
    font-size: 13px;
}

.site-footer a {
    color: #3c4043;
}

@media (max-width: 860px) {
    .text-grid,
    .audio-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .appbar {
        position: static;
        padding: 14px 16px;
        align-items: flex-start;
        flex-direction: column;
    }

    .appbar nav {
        width: 100%;
    }

    .appbar nav a {
        flex: 1;
        justify-content: center;
    }

    .shell,
    .site-footer {
        width: min(100% - 24px, 1220px);
    }

    .shell {
        margin-top: 14px;
    }

    .tool-head,
    .translator {
        padding: 14px;
    }

    .language-row {
        grid-template-columns: 1fr;
    }

    .swap {
        justify-self: start;
    }

    .actions {
        align-items: stretch;
        flex-direction: column;
    }

    .actions button {
        width: 100%;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
    }
}
