/* RSA 与 AES 共用工作区样式：靠分隔线区分密钥、操作和结果，避免将工具区做成嵌套卡片。 */
.crypto-workspace {
    max-width: 1000px;
}

/* 多个组件声明了 grid/flex，必须显式保留原生 hidden 语义，避免作者样式把敏感结果提前显示。 */
.crypto-workspace [hidden] {
    display: none !important;
}

.crypto-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.crypto-section h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

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

.crypto-settings-grid {
    align-items: end;
}

.crypto-field {
    display: grid;
    gap: 8px;
    min-width: 0;
    margin-top: 18px;
    font-weight: 750;
}

.crypto-settings-grid .crypto-field {
    margin-top: 0;
}

.crypto-field select,
.crypto-textarea {
    width: 100%;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 4px;
    font: inherit;
    font-size: var(--tool-input-font);
    line-height: 22px;
}

.crypto-field select {
    min-height: var(--tool-control-height);
    padding: var(--tool-control-padding) 12px;
}

.crypto-textarea {
    min-height: 78px;
    padding: 8px 12px;
    resize: vertical;
    font: 13px/1.65 Consolas, "Courier New", monospace;
    letter-spacing: 0;
}

.crypto-textarea:focus,
.crypto-field select:focus {
    border-color: var(--forest);
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.crypto-output {
    background: var(--surface-soft);
}

.crypto-hint {
    min-height: 22px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.crypto-key-result,
.crypto-result {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.crypto-key-result > label,
.crypto-result > label {
    margin-top: 12px;
    font-weight: 750;
}

.crypto-key-result > label:first-child,
.crypto-result > label:first-child {
    margin-top: 0;
}

.crypto-copy-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.crypto-mode {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(112px, 1fr));
    margin: 20px 0 0;
    padding: 3px;
    background: var(--line);
    border: 0;
    border-radius: 6px;
}

/* 模式名称保留给读屏软件，视觉界面由两个明确选项表达。 */
.crypto-mode legend {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.crypto-mode label {
    position: relative;
    cursor: pointer;
}

.crypto-mode input {
    position: absolute;
    opacity: 0;
}

.crypto-mode span {
    display: grid;
    min-height: var(--tool-control-height);
    padding: var(--tool-control-padding) 12px;
    place-items: center;
    color: var(--muted);
    border-radius: 4px;
    font-weight: 750;
    text-align: center;
    font-size: 14px;
    line-height: 22px;
}

.crypto-mode input:checked + span {
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(34, 37, 34, 0.12);
}

.crypto-mode input:focus-visible + span {
    outline: 3px solid var(--eye);
    outline-offset: 3px;
}

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

@media (max-width: 640px) {
    .crypto-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .crypto-mode {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-width: 0;
        width: 100%;
    }

    .crypto-section {
        margin-top: 20px;
        padding-top: 16px;
    }
}
