:root {
    color-scheme: dark;
    --bg: #08101d;
    --panel: #111c2d;
    --panel-soft: #152338;
    --line: #26364d;
    --text: #f5f7fb;
    --muted: #91a0b5;
    --accent: #ff9e44;
    --accent-strong: #ff7a1a;
    --green: #55d68b;
    --red: #ff6b6b;
    --blue: #63a9ff;
    font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 85% -10%, rgba(255, 126, 28, 0.18), transparent 32rem),
        linear-gradient(180deg, #0b1525 0%, var(--bg) 70%);
    color: var(--text);
}

button,
input,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.shell {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: max(24px, env(safe-area-inset-top)) 18px max(44px, env(safe-area-inset-bottom));
}

.hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 2px 24px;
}

.brand-mark {
    display: grid;
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    place-items: center;
    border: 1px solid rgba(255, 158, 68, 0.48);
    border-radius: 16px;
    background: linear-gradient(145deg, var(--accent), var(--accent-strong));
    box-shadow: 0 12px 35px rgba(255, 122, 26, 0.22);
    color: #111827;
    font-size: 28px;
    font-weight: 900;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    margin-top: 3px;
    font-size: clamp(25px, 7vw, 38px);
    letter-spacing: -0.04em;
}

h2 {
    margin-top: 3px;
    font-size: 20px;
}

.eyebrow {
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.subtitle {
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.notice {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    margin-bottom: 16px;
    padding: 13px 15px;
    border: 1px solid rgba(255, 158, 68, 0.24);
    border-radius: 14px;
    background: rgba(255, 158, 68, 0.07);
    color: #d7deea;
    font-size: 13px;
    line-height: 1.55;
}

.notice-dot {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(255, 158, 68, 0.13);
}

.card {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(17, 28, 45, 0.94);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.16);
}

.composer {
    padding: 20px;
}

.field-head,
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.field-head label {
    color: #dce3ee;
    font-size: 13px;
    font-weight: 700;
}

.message-head {
    margin-top: 21px;
}

input[type="password"],
input[type="text"],
textarea {
    width: 100%;
    margin-top: 9px;
    border: 1px solid var(--line);
    border-radius: 13px;
    outline: none;
    background: #0b1524;
    color: var(--text);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

input[type="password"],
input[type="text"] {
    height: 47px;
    padding: 0 14px;
}

#pairing-code {
    text-align: center;
    letter-spacing: 0.35em;
    font-size: 20px;
    font-weight: 800;
}

#pairing-code::placeholder {
    letter-spacing: normal;
    font-size: 13px;
    font-weight: 400;
}

textarea {
    min-height: 130px;
    padding: 14px;
    resize: vertical;
    line-height: 1.65;
}

input:focus,
textarea:focus {
    border-color: rgba(255, 158, 68, 0.72);
    box-shadow: 0 0 0 3px rgba(255, 158, 68, 0.1);
}

.text-button {
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--blue);
    cursor: pointer;
    font-size: 12px;
}

.remember-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
}

.remember-row input {
    accent-color: var(--accent);
}

.char-count {
    color: var(--muted);
    font-size: 11px;
}

.primary-button,
.secondary-button {
    border: 0;
    border-radius: 13px;
    cursor: pointer;
    font-weight: 800;
}

.primary-button {
    display: flex;
    width: 100%;
    height: 50px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    box-shadow: 0 12px 28px rgba(255, 122, 26, 0.2);
    color: #17120e;
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.68;
}

.button-loader {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(20, 15, 10, 0.28);
    border-top-color: #17120e;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.primary-button.loading .button-loader {
    display: block;
}

.form-message {
    min-height: 19px;
    margin-top: 11px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.form-message.error {
    color: var(--red);
}

.form-message.success {
    color: var(--green);
}

.translation-card {
    margin-top: 16px;
    padding: 20px;
}

.source-preview {
    margin-top: 20px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.translation-preview {
    color: var(--text);
    font-size: 18px;
    font-weight: 650;
    line-height: 1.6;
}

.route-line {
    height: 1px;
    margin: 16px 0;
    background: var(--line);
}

.route-line span {
    display: block;
    width: 34%;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.status {
    display: inline-flex;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.status.pending {
    background: rgba(99, 169, 255, 0.13);
    color: #91c3ff;
}

.status.processing {
    background: rgba(255, 158, 68, 0.13);
    color: #ffb56f;
}

.status.sent {
    background: rgba(85, 214, 139, 0.13);
    color: #74e6a3;
}

.status.failed {
    background: rgba(255, 107, 107, 0.13);
    color: #ff8c8c;
}

.queue-section {
    margin-top: 28px;
}

.queue-title {
    padding: 0 3px 13px;
}

.secondary-button {
    padding: 9px 14px;
    border: 1px solid var(--line);
    background: var(--panel-soft);
    color: #dce3ee;
    font-size: 12px;
}

.task-list {
    display: grid;
    gap: 10px;
}

.task-item {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(17, 28, 45, 0.72);
}

.task-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 11px;
}

.task-time {
    color: var(--muted);
    font-size: 11px;
}

.task-source,
.task-translation {
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.task-source {
    color: var(--muted);
    font-size: 12px;
}

.task-translation {
    margin-top: 6px;
    color: #edf2f9;
    font-size: 14px;
}

.empty-state {
    padding: 28px 16px;
    border: 1px dashed var(--line);
    border-radius: 15px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (min-width: 640px) {
    .shell {
        padding-top: 42px;
    }

    .composer,
    .translation-card {
        padding: 25px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
