:root {
    color-scheme: light;
    --ink: #1d2534;
    --muted: #748094;
    --line: #dfe5ee;
    --accent: #4967db;
    --accent-soft: #edf1ff;
    --success: #228557;
    --danger: #b63d4b;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: #f4f7fb; }
body {
    min-height: 100vh;
    margin: 0;
    background: radial-gradient(circle at 12% -10%, rgba(115,139,229,.16), transparent 34%), #f4f7fb;
    color: var(--ink);
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    -webkit-tap-highlight-color: transparent;
}
button, textarea, input { font: inherit; }
.translate-shell {
    width: min(100% - 28px, 920px);
    margin: 0 auto;
    padding: calc(18px + env(safe-area-inset-top)) 0 calc(32px + env(safe-area-inset-bottom));
}
.app-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 12px;
    padding-left: 74px;
}
.app-header p { margin: 0 0 3px; color: #7d89a0; font-size: 10px; font-weight: 850; letter-spacing: .13em; }
.app-header h1 { margin: 0; font-size: clamp(23px, 4vw, 32px); line-height: 1.08; }
.header-pills { display: flex; gap: 7px; }
.version-pill, .api-pill, .settings-link {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,.76);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.settings-link {
    min-width: 28px;
    display: grid;
    place-items: center;
    color: #566176;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
}
.api-pill.ready { border-color: #bce4ce; background: #ecf8f1; color: var(--success); }
.language-panel, .search-panel {
    margin-bottom: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 8px 28px rgba(37,49,73,.055);
}
.section-heading, .results-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 9px;
}
.section-heading h2, .results-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.save-status { color: var(--success); font-size: 10px; font-weight: 750; text-align: right; }
.save-status.saving { color: var(--muted); }
.save-status.error { color: var(--danger); }
.language-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.language-choice {
    position: relative;
    min-width: 0;
    min-height: 63px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 3px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fbfcfe;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.language-choice:active { transform: scale(.98); }
.language-choice.selected { border-color: #9fafea; background: var(--accent-soft); }
.language-choice input { position: absolute; opacity: 0; pointer-events: none; }
.language-mark {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #e9edf4;
    color: #4f5b70;
    font-size: 11px;
    font-weight: 850;
}
.selected .language-mark { background: #dce4ff; color: #3e58c4; }
.language-choice strong { max-width: 100%; overflow: hidden; font-size: 9px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.language-choice i {
    position: absolute;
    top: 3px;
    right: 4px;
    color: transparent;
    font-style: normal;
    font-size: 9px;
    font-weight: 900;
}
.language-choice.selected i { color: var(--accent); }
.search-panel label { display: block; margin-bottom: 5px; color: #566176; font-size: 10px; font-weight: 800; }
#sourceText {
    width: 100%;
    min-height: 76px;
    resize: vertical;
    padding: 9px 11px;
    border: 1px solid #d7dee9;
    border-radius: 11px;
    background: #fbfcfe;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.4;
    outline: none;
}
#sourceText:focus { border-color: #879ce5; box-shadow: 0 0 0 3px rgba(73,103,219,.11); }
.voice-hint {
    min-height: 22px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 2px 0;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}
.voice-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #a8b1c0;
}
.voice-hint.is-processing { color: #566176; }
.voice-hint.is-processing .voice-dot { background: #6f85dd; animation: voice-pulse 1s ease-in-out infinite; }
.voice-hint.is-recording { color: var(--danger); }
.voice-hint.is-recording .voice-dot { background: #df4054; animation: voice-pulse .75s ease-in-out infinite; }
#sourceText.is-recording { border-color: #e46e7c; box-shadow: 0 0 0 3px rgba(182,61,75,.13); }
@keyframes voice-pulse { 50% { opacity: .35; transform: scale(.75); } }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 7px; }
.form-actions span { color: var(--muted); font-size: 10px; }
.action-buttons {
    display: flex;
    align-items: center;
    gap: 7px;
}
.form-actions button {
    min-width: 108px;
    min-height: 36px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}
.article-mode-button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border: 1px solid #ccd5ee;
    border-radius: 10px;
    background: #f6f8ff;
    color: #465fc4;
    font-weight: 800;
    text-decoration: none;
}
.history-search-button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 11px;
    border: 1px solid #d5dbe7;
    border-radius: 10px;
    background: #fff;
    color: #59657a;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}
.form-actions button:disabled { opacity: .6; cursor: wait; }
.notice {
    margin: 12px 0;
    padding: 11px 13px;
    border: 1px solid #bce4ce;
    border-radius: 10px;
    background: #ecf8f1;
    color: var(--success);
    font-size: 12px;
}
.notice.error { border-color: #f0c2c8; background: #fff0f2; color: var(--danger); }
.results-section {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 7px 22px rgba(37,49,73,.045);
}
.results-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.results-table th,
.results-table td {
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
.results-table thead th {
    background: #f7f9fc;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}
.results-table thead th:first-child,
.results-table tbody th {
    width: 28%;
}
.results-table tbody th {
    color: #4d586d;
    font-size: 12px;
    font-weight: 800;
}
.results-table tbody td {
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    user-select: text;
}
.results-table tbody tr:last-child th,
.results-table tbody tr:last-child td {
    border-bottom: 0;
}
.results-table tr.has-error td {
    color: var(--danger);
}
.results-table tr.is-copyable td {
    position: relative;
    padding-right: 58px;
    cursor: pointer;
    transition: background .16s ease;
}
.results-table tr.is-copyable td::after {
    content: "复制";
    position: absolute;
    top: 11px;
    right: 12px;
    color: #8a94a6;
    font-size: 9px;
    font-weight: 800;
}
.results-table tr.is-copyable td:active,
.results-table tr.is-copyable td:focus-visible { background: #f3f6ff; outline: none; }
.results-table tr.is-copied td { background: #eef8f2; }
.results-table tr.is-copied td::after { content: "已复制"; color: var(--success); }
.results-table .pronunciation-row:first-of-type th,
.results-table .pronunciation-row:first-of-type td {
    border-top: 2px solid #dfe5f1;
}
.results-table .pronunciation-row th {
    color: #5368aa;
    background: #f8f9ff;
}
.results-table .pronunciation-row td {
    color: #293858;
    background: #fcfcff;
    font-weight: 650;
}
.results-table .pronunciation-row.is-loading td {
    color: var(--muted);
    font-weight: 500;
}
.results-table .pronunciation-row.has-error td {
    color: var(--danger);
    font-weight: 500;
}
.pronunciation-primary {
    color: #293858;
}
.pronunciation-secondary {
    display: inline;
    margin-left: 0.7em;
    color: var(--muted);
    font-size: 0.9em;
    font-weight: 500;
}
.settings-shell {
    max-width: 620px;
}
.settings-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 13px;
}
.settings-header p {
    margin: 0;
    color: var(--muted);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .09em;
}
.settings-header h1 {
    margin: 1px 0 0;
    font-size: 23px;
    line-height: 1.1;
}
.settings-back {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    font-size: 28px;
    line-height: 1;
    text-decoration: none;
}
.settings-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(37,49,73,.055);
}
.settings-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: #f7f9fc;
}
.settings-intro strong {
    font-size: 13px;
}
.settings-intro span {
    color: var(--muted);
    font-size: 10px;
    text-align: right;
}
.settings-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 58px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
}
.settings-row:last-child {
    border-bottom: 0;
}
.settings-row label {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.settings-row input {
    width: 19px;
    height: 19px;
    accent-color: var(--accent);
}
.settings-mark {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--accent-soft);
    color: #3e58c4;
    font-size: 10px;
    font-weight: 850;
}
.settings-row strong {
    font-size: 13px;
}
.order-buttons {
    display: flex;
    gap: 5px;
}
.order-buttons button {
    width: 34px;
    height: 34px;
    border: 1px solid #d7dee9;
    border-radius: 8px;
    background: #f8f9fc;
    color: #526078;
    font-size: 15px;
    font-weight: 800;
}
.order-buttons button:disabled {
    opacity: .25;
}
.settings-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 11px;
}
.settings-actions a,
.settings-actions button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-radius: 10px;
    font-weight: 800;
    text-decoration: none;
}
.settings-actions a {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
}
.settings-actions button {
    border: 0;
    background: var(--accent);
    color: #fff;
}
@media (max-width: 640px) {
    .translate-shell { width: min(100% - 14px, 920px); padding-top: calc(10px + env(safe-area-inset-top)); }
    .app-header { align-items: flex-start; padding-left: 64px; }
    .header-pills { flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
    .language-panel, .search-panel { padding: 10px; border-radius: 12px; }
    .section-heading p { font-size: 9px; }
    .save-status { max-width: 92px; font-size: 8px; }
    .language-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
    .language-choice { min-height: 55px; padding: 5px 1px; border-radius: 9px; }
    .language-mark { width: 27px; height: 27px; border-radius: 8px; font-size: 10px; }
    .language-choice strong { font-size: 8px; }
    #sourceText { min-height: 66px; }
    .form-actions { align-items: stretch; flex-direction: column; gap: 6px; }
    .action-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 5px; }
    .form-actions button, .history-search-button, .article-mode-button { min-width: 0; padding: 0 6px; font-size: 10px; }
    .results-table th, .results-table td { padding: 9px 10px; }
    .results-table thead th:first-child, .results-table tbody th { width: 25%; }
    .results-table tbody td { font-size: 13px; }
    .settings-shell { width: min(100% - 18px, 620px); }
    .settings-intro { padding: 10px 11px; }
    .settings-row { min-height: 54px; padding: 7px 9px; }
}
