:root {
    --emoji-navy: var(--brooklyn-ink, #18365f);
    --emoji-navy-deep: var(--brooklyn-ink, #18365f);
    --emoji-blue: var(--brooklyn-blue, #3478c9);
    --emoji-blue-pale: var(--brooklyn-blue-soft, #dcecff);
    --emoji-sky: var(--brooklyn-mist, #eaf2f4);
    --emoji-yellow: var(--brooklyn-yellow, #f5c64e);
    --emoji-yellow-deep: #d7a82e;
    --emoji-ink: var(--brooklyn-ink, #18365f);
    --emoji-muted: var(--brooklyn-ink-soft, #52647b);
    --emoji-line: rgba(24, 54, 95, .3);
    --emoji-panel: var(--brooklyn-paper, #fffaf0);
    --emoji-soft: var(--brooklyn-paper-strong, #fff);
    --emoji-danger: #c94f48;
    --emoji-success: var(--brooklyn-green, #2a9d7c);
    --emoji-radius: var(--brooklyn-radius, 20px);
    --emoji-shadow: var(--brooklyn-shadow, 8px 8px 0 rgba(24, 54, 95, .13));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
    min-width: 320px;
    margin: 0;
    background-color: var(--emoji-sky);
    background-image: radial-gradient(rgba(24, 54, 95, .11) 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--emoji-ink);
    font: 16px/1.55 "Microsoft YaHei UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(52, 120, 201, .4); outline-offset: 3px; }

.emoji-shell { width: min(1136px, calc(100% - 48px)); margin: 0 auto; padding: 48px 0 72px; }
.page-intro { margin-bottom: 30px; }
.page-intro h1 { margin: 0; color: var(--emoji-navy-deep); font-size: 42px; font-weight: 800; line-height: 1.2; letter-spacing: -.035em; }
.page-intro p { width: 100%; max-width: none; margin: 12px 0 0; color: var(--emoji-muted); font-size: 16px; line-height: 1.75; }

.status-panel, .tool-frame, .faq-item { border: 1px solid var(--emoji-line); background: var(--emoji-panel); }
.status-panel { padding: 52px 28px; border: 2px solid var(--emoji-navy); border-radius: var(--emoji-radius); box-shadow: var(--emoji-shadow); text-align: center; }
.status-panel h2 { margin: 14px 0 4px; font-size: 23px; }
.status-panel p { margin: 0 0 18px; color: var(--emoji-muted); }
.status-spinner { display: inline-block; width: 22px; height: 22px; border: 3px solid #d9e4ee; border-top-color: var(--emoji-blue); border-radius: 50%; animation: spin .8s linear infinite; }

.tool-frame {
    overflow: hidden;
    padding: 26px 28px 28px;
    border: 2px solid var(--emoji-navy);
    border-radius: var(--emoji-radius);
    box-shadow: var(--emoji-shadow);
}
.tool-toolbar { display: grid; grid-template-columns: minmax(420px, 1fr) auto; align-items: center; gap: 28px; }
.mode-tabs {
    min-height: 56px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 560px;
    padding: 4px;
    border: 2px solid var(--emoji-navy);
    border-radius: 13px;
    background: #dfe5e9;
    box-shadow: 4px 4px 0 rgba(24, 54, 95, .12);
}
.mode-tabs button {
    min-height: 44px;
    padding: 8px 18px;
    border: 2px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--emoji-muted);
    cursor: pointer;
    font-size: 15px;
    font-weight: 800;
}
.mode-tabs button:hover { color: var(--emoji-blue); }
.mode-tabs button[aria-selected="true"] { color: var(--emoji-navy); }

.style-card { display: grid; grid-template-columns: auto 176px 196px; align-items: center; gap: 12px; }
.style-card > label { color: var(--emoji-navy-deep); font-size: 14px; font-weight: 800; white-space: nowrap; }
.style-picker { position: relative; }
.style-picker::after {
    position: absolute;
    top: 50%;
    right: 16px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--emoji-navy);
    border-bottom: 2px solid var(--emoji-navy);
    content: "";
    pointer-events: none;
    transform: translateY(-70%) rotate(45deg);
}
#styleGrid {
    width: 100%;
    min-height: 48px;
    padding: 8px 40px 8px 14px;
    appearance: none;
    border: 1px solid rgba(24, 54, 95, .36);
    border-radius: 10px;
    background: var(--emoji-soft);
    color: var(--emoji-navy);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
}
#styleGrid:hover { border-color: #7da8d6; }
.style-preview {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 6px 12px;
    border: 1px solid rgba(24, 54, 95, .3);
    border-radius: 10px;
    background: rgba(255, 255, 255, .58);
}
.style-preview span { overflow: hidden; font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; font-size: 20px; letter-spacing: 4px; text-overflow: ellipsis; white-space: nowrap; }

.tool-workspace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 24px; }
.input-column, .output-column { min-width: 0; }
.workspace-panel, .output-column {
    min-height: 460px;
    padding: 0;
}
.output-column { display: flex; flex-direction: column; }
.column-heading { display: flex; min-height: 36px; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.column-heading h2 { margin: 0; color: var(--emoji-navy-deep); font-size: 16px; font-weight: 800; line-height: 1.4; }
.column-heading output, .column-heading > span, .column-heading-actions output { color: var(--emoji-muted); font-size: 13px; font-weight: 700; }
.column-heading-actions { display: flex; align-items: center; gap: 12px; }
.column-heading-actions .example-button { min-height: 40px; padding: 7px 14px; }
.result-meta-tag { max-width: 72%; overflow: hidden; padding: 4px 10px; border: 1px solid rgba(24, 54, 95, .28); border-radius: 999px; background: #fff3c4; color: var(--emoji-navy) !important; text-overflow: ellipsis; white-space: nowrap; }

textarea {
    display: block;
    width: 100%;
    min-height: 322px;
    resize: vertical;
    padding: 17px 18px;
    border: 2px solid rgba(24, 54, 95, .34);
    border-radius: 14px;
    background: var(--emoji-soft);
    color: var(--emoji-ink);
    font-size: 16px;
    line-height: 1.75;
}
textarea::placeholder { color: #8b9caf; }
textarea:hover { border-color: rgba(24, 54, 95, .54); }
#cipherInput { font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; letter-spacing: 1px; }

.action-row { display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; }
.action-row p { max-width: 410px; margin: 0; color: var(--emoji-muted); font-size: 13px; line-height: 1.55; }
.text-input-actions { display: flex; align-items: center; gap: 8px; }
.text-input-actions .button { min-width: 68px; }
.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
}
.button-primary { border-color: var(--emoji-navy); background: var(--emoji-blue); color: var(--emoji-panel); box-shadow: 4px 4px 0 rgba(24, 54, 95, .12); }
.button-primary:hover { background: var(--brooklyn-blue-dark, #225d9f); }
.button-primary:active { box-shadow: 2px 2px 0 rgba(24, 54, 95, .12); }
.button-secondary { border-color: var(--emoji-line); background: #fff; color: var(--emoji-navy); }
.button-secondary:hover { border-color: #82a6ca; background: var(--emoji-blue-pale); }
.button:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; transform: none; }
.seal-button { flex: 0 0 auto; min-width: 142px; }

.drop-zone {
    display: grid;
    min-height: 322px;
    place-items: center;
    align-content: center;
    border: 1px dashed #89a8c6;
    border-radius: 11px;
    background: linear-gradient(135deg, #fff, #f5faff);
    cursor: pointer;
    text-align: center;
}
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--emoji-blue); background: var(--emoji-blue-pale); }
.drop-zone .drop-icon { display: grid; width: 56px; height: 56px; margin-bottom: 12px; place-items: center; border: 1px solid #bed7ef; border-radius: 16px; background: #fff; color: var(--emoji-blue); font-size: 30px; }
.drop-zone strong { color: var(--emoji-navy); font-size: 17px; }
.drop-zone p { margin: 4px 0 0; color: var(--emoji-muted); font-size: 13px; }
.file-card { display: grid; grid-template-columns: 150px 1fr 42px; min-height: 322px; align-items: center; gap: 18px; padding: 18px; border: 1px solid var(--emoji-line); border-radius: 11px; background: var(--emoji-soft); }
.file-card img { width: 150px; height: 150px; border-radius: 9px; background: #eaf0f6; object-fit: contain; }
.file-card strong, .file-card span { display: block; word-break: break-word; }
.file-card span { margin-top: 5px; color: var(--emoji-muted); font-size: 13px; }
.icon-button, .modal-close { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--emoji-line); border-radius: 9px; background: #fff; color: var(--emoji-navy); cursor: pointer; font-size: 24px; }
.decrypt-source-row { display: flex; min-height: 42px; align-items: center; gap: 14px; margin-top: 10px; }
.decrypt-source-row span { overflow: hidden; color: var(--emoji-muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.result-placeholder {
    display: grid;
    flex: 0 0 auto;
    min-height: 322px;
    place-items: center;
    align-content: center;
    padding: 24px;
    border: 2px solid rgba(24, 54, 95, .34);
    border-radius: 14px;
    background: linear-gradient(145deg, #fff, #f8fbff);
    text-align: center;
}
.placeholder-emojis { margin-bottom: 18px; color: var(--emoji-ink); font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; font-size: 28px; letter-spacing: 7px; filter: saturate(.9); }
.result-placeholder strong { color: var(--emoji-navy); font-size: 17px; }
.result-placeholder p { max-width: 360px; margin: 6px 0 0; color: var(--emoji-muted); font-size: 13px; }
.result-content { display: flex; flex: 0 0 auto; min-height: 0; flex-direction: column; }
.result-text { flex: 0 0 322px; height: 322px; max-height: 322px; min-height: 322px; margin: 0; overflow: auto; padding: 17px 18px; border: 2px solid rgba(24, 54, 95, .34); border-radius: 14px; background: #fff; color: var(--emoji-ink); font: 16px/1.75 "Segoe UI Emoji", "Apple Color Emoji", monospace; white-space: pre-wrap; word-break: break-all; }
.result-image { position: relative; display: grid; height: 322px; min-height: 322px; max-height: 322px; overflow: hidden; place-items: center; border: 1px solid var(--emoji-line); border-radius: 11px; background: var(--emoji-soft); }
.result-image img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.result-actions { display: flex; min-height: 56px; align-items: flex-end; justify-content: flex-end; gap: 10px; margin-top: 14px; }

.processing-card { margin-top: 16px; padding: 16px 18px; border: 1px solid #9fc4e8; border-radius: 11px; background: var(--emoji-blue-pale); }
.processing-copy { display: flex; align-items: center; gap: 13px; }
.processing-copy div { flex: 1; }
.processing-copy strong, .processing-copy p { display: block; margin: 0; }
.processing-copy p { color: var(--emoji-muted); font-size: 13px; }
.progress-track { height: 7px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: #d7e5f3; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--emoji-blue); transition: width .16s ease; }
.page-message { margin: 14px 0 0; padding: 11px 14px; border: 1px solid #e2aaaa; border-radius: 9px; background: #fff1f1; color: var(--emoji-danger); font-size: 14px; }
.page-message a { color: inherit; font-weight: 800; text-underline-offset: 2px; }
.page-message[data-kind="info"] { border-color: #a7c8e8; background: var(--emoji-blue-pale); color: var(--emoji-navy); }

.seo-faq { margin-top: 48px; padding: 24px; }
.seo-faq > h2 { margin: 0 0 20px; color: var(--emoji-navy-deep); font-size: 26px; line-height: 1.35; letter-spacing: -.025em; }
.faq-list { display: grid; gap: 10px; }
.faq-item { border-radius: 12px; }
.faq-item summary { position: relative; min-height: 48px; padding: 14px 48px 14px 18px; cursor: pointer; color: var(--emoji-navy); font-weight: 750; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { position: absolute; top: 14px; right: 18px; color: var(--brooklyn-quiet, #6d7888); content: "＋"; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin: 0; padding: 0 18px 18px; color: var(--emoji-muted); line-height: 1.75; }

.modal-backdrop { position: fixed; z-index: 1100; inset: 0; display: grid; overflow: auto; place-items: center; padding: 16px; background: rgba(8, 31, 61, .48); backdrop-filter: blur(3px); }
.settings-dialog {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 24px;
    border: 2px solid var(--emoji-navy);
    border-radius: var(--emoji-radius);
    background: var(--emoji-panel);
    box-shadow: var(--emoji-shadow);
}
.settings-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.settings-dialog h2 { margin: 0; color: var(--emoji-navy-deep); font-size: 24px; line-height: 1.3; }
.settings-dialog > p { margin: 8px 0 20px; color: var(--emoji-muted); font-size: 14px; }
.modal-close { border-color: transparent; border-radius: 50%; }
.modal-close:hover { border-color: var(--emoji-line); background: var(--emoji-blue-pale); }
.complexity-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.complexity-fieldset legend { margin-bottom: 10px; color: var(--emoji-navy-deep); font-size: 14px; font-weight: 800; }
.complexity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.complexity-option { min-width: 0; cursor: pointer; }
.complexity-option input { position: absolute; opacity: 0; pointer-events: none; }
.complexity-option span { display: flex; align-items: center; justify-content: center; padding: 0 10px; color: var(--emoji-navy-deep); font-size: 14px; font-weight: 800; text-align: center; }
.key-section { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 15px 16px; border: 1px solid var(--emoji-line); border-radius: 11px; }
.key-section strong { color: var(--emoji-navy-deep); }
.key-section p { margin: 2px 0 0; color: var(--emoji-muted); font-size: 13px; }
.switch { display: flex; flex: 0 0 auto; min-height: 40px; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; font-weight: 800; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: relative; width: 48px; height: 28px; padding: 3px; border: 2px solid var(--emoji-navy); border-radius: 99px; background: #bfc7d0; transition: background .15s ease; }
.switch span::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; content: ""; transition: transform .15s ease; }
.switch input:checked + span { background: var(--emoji-blue); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid rgba(22, 119, 232, .28); outline-offset: 2px; }
.switch em { color: var(--emoji-navy); font-style: normal; white-space: nowrap; }
.password-field { margin-top: 14px; }
.password-field > label { display: block; margin-bottom: 7px; color: var(--emoji-navy-deep); font-size: 13px; font-weight: 800; }
.password-field > div { display: grid; grid-template-columns: 1fr auto; }
.password-field input { min-width: 0; height: 44px; padding: 8px 12px; border: 1px solid var(--emoji-line); border-radius: 9px 0 0 9px; color: var(--emoji-ink); }
.password-field button { min-width: 62px; border: 1px solid var(--emoji-line); border-left: 0; border-radius: 0 9px 9px 0; background: var(--emoji-soft); color: var(--emoji-navy); cursor: pointer; font-size: 13px; font-weight: 800; }
.password-field p { margin: 5px 0 0; color: var(--emoji-danger); font-size: 13px; }
.settings-dialog footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--emoji-line); }

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(1px, 1px, 1px, 1px) !important; white-space: nowrap !important; }
body.modal-open { overflow: hidden; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1040px) {
    .tool-toolbar { grid-template-columns: 1fr; gap: 16px; }
    .mode-tabs { max-width: none; }
    .style-card { grid-template-columns: auto minmax(160px, 220px) minmax(180px, 240px); justify-content: end; }
}

@media (max-width: 860px) {
    .tool-frame { padding-inline: 22px; }
    .tool-workspace { grid-template-columns: 1fr; gap: 30px; }
    .workspace-panel, .output-column { min-height: 0; }
    .style-card { grid-template-columns: auto minmax(160px, 1fr) minmax(180px, 1fr); }
}

@media (max-width: 640px) {
    .page-intro { margin-bottom: 24px; }
    .tool-frame { padding: 18px; }
    .mode-tabs { gap: 3px; padding: 3px; }
    .mode-tabs button { min-height: 46px; padding: 7px 4px; font-size: 13px; }
    .style-card { grid-template-columns: 1fr 1fr; gap: 9px; }
    .style-card > label { grid-column: 1 / -1; }
    .style-picker, .style-preview { min-width: 0; }
    .style-preview span { font-size: 18px; letter-spacing: 2px; }
    .tool-workspace { margin-top: 20px; }
    textarea, .drop-zone, .file-card, .result-placeholder, .result-text, .result-image { min-height: 260px; }
    .result-text { height: 260px; max-height: 260px; flex-basis: 260px; }
    .result-image { height: 260px; max-height: 260px; }
    .action-row { align-items: stretch; flex-direction: column; }
    .action-row p { max-width: none; }
    .seal-button { width: 100%; }
    .file-card { grid-template-columns: 76px 1fr 40px; gap: 10px; padding: 12px; }
    .file-card img { width: 76px; height: 76px; }
    .decrypt-source-row { align-items: stretch; flex-direction: column; }
    .decrypt-source-row span { white-space: normal; }
    .result-actions { align-items: stretch; flex-direction: column; }
    .settings-dialog { width: min(760px, calc(100vw - 32px)); padding: 24px; }
    .key-section { align-items: flex-start; flex-direction: column; }
    .settings-dialog footer .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
    .button-primary:active { transform: none; }
}
