.back-link {
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #cbd4df;
    text-decoration: none;
    font-size: 13px;
    background: rgba(255,255,255,.035);
}
.back-link:hover { color: var(--text); border-color: rgba(121,242,191,.35); }

.relay-page {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding: 62px 0 34px;
}
.relay-intro { margin-bottom: 28px; }
.relay-intro h1 {
    margin: 0;
    font-size: clamp(36px, 7vw, 64px);
    line-height: 1.04;
    letter-spacing: -.05em;
}
.relay-intro > p:last-child {
    max-width: 690px;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
}
.relay-card {
    padding: clamp(22px, 5vw, 38px);
    border: 1px solid var(--line);
    border-radius: 26px;
    background: linear-gradient(145deg, rgba(24,30,40,.94), rgba(12,16,22,.92));
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
.relay-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.relay-card-head h2 { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.expiry-badge {
    flex: 0 0 auto;
    padding: 8px 10px;
    border: 1px solid rgba(121,242,191,.2);
    border-radius: 10px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
    background: rgba(121,242,191,.055);
}
.code-input {
    height: auto;
    min-height: 78px;
    padding: 8px 18px;
    border-radius: 17px;
    text-align: center;
    font: 800 clamp(33px, 9vw, 51px)/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .12em;
    font-variant-numeric: tabular-nums;
}
.code-input::placeholder { color: #3f4956; }
.code-hint {
    margin: 9px 0 20px;
    color: #727e8d;
    font-size: 12px;
    text-align: center;
}
.mode-switch {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(0,0,0,.22);
    overflow: hidden;
}
.mode-slider {
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 5px;
    width: calc(50% - 5px);
    border-radius: 11px;
    background: linear-gradient(135deg, #9dffd5, #48d99f);
    box-shadow: 0 8px 24px rgba(54,217,154,.18);
    transition: transform .23s cubic-bezier(.2,.8,.2,1);
}
.mode-switch.send-active .mode-slider { transform: translateX(100%); }
.mode-button {
    position: relative;
    z-index: 1;
    min-height: 44px;
    border: 0;
    border-radius: 11px;
    color: var(--muted);
    font-weight: 900;
    background: transparent;
    transition: color .2s ease;
}
.mode-button.active { color: #07120d; }
.action-area { margin-top: 20px; animation: area-in .2s ease; }
@keyframes area-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.quiet-state,
.loading-state {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    color: #74808e;
    text-align: center;
}
.spinner {
    width: 17px;
    height: 17px;
    border: 2px solid rgba(121,242,191,.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.relay-message {
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.025);
}
.relay-message strong { display: block; margin-bottom: 7px; }
.relay-message p { margin: 0; color: #aeb8c4; line-height: 1.65; }
.relay-message.error { border-color: rgba(255,126,138,.25); background: rgba(255,126,138,.055); }
.relay-message.success { border-color: rgba(121,242,191,.22); background: rgba(121,242,191,.05); }
.secondary-button {
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #dbe3eb;
    background: rgba(255,255,255,.045);
}
.secondary-button:hover { border-color: rgba(121,242,191,.32); }
.relay-message .secondary-button { margin-top: 13px; }
.take-result {
    padding: 16px;
    border: 1px solid rgba(121,242,191,.2);
    border-radius: 15px;
    background: rgba(121,242,191,.045);
}
.result-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}
.result-heading strong,
.result-heading span { display: block; }
.result-heading span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.result-heading .secondary-button { margin: 0; }
#result-text {
    min-height: 280px;
    max-height: 62vh;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Microsoft YaHei", monospace;
}
.send-form { gap: 11px; }
.send-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.send-heading span { color: #7e8997; font-size: 12px; }
.send-heading span.over-limit { color: var(--danger); font-weight: 800; }
#send-content { min-height: 300px; max-height: 62vh; }
.security-note { margin: -2px 0 2px; color: #737f8d; font-size: 12px; line-height: 1.55; }
.sent-code-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding: 12px 13px;
    border-radius: 11px;
    background: rgba(0,0,0,.23);
}
.sent-code-row code { color: var(--accent); font-size: 20px; font-weight: 900; letter-spacing: .08em; }
.sent-code-row .secondary-button { margin: 0; }
.expiry-text { margin-top: 10px !important; font-size: 12px; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.relay-footer { width: min(760px, calc(100% - 32px)); }

@media (max-width: 560px) {
    .relay-page { width: min(100% - 22px, 760px); padding-top: 42px; }
    .relay-card { border-radius: 20px; }
    .code-input { min-height: 68px; letter-spacing: .06em; }
    .result-heading { align-items: flex-start; flex-direction: column; }
    .sent-code-row { align-items: stretch; flex-direction: column; }
    .sent-code-row code { text-align: center; }
}
