* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: #f4f7fc; color: #0b1a33; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Microsoft YaHei', sans-serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible { outline: 3px solid #8ec7ff; outline-offset: 3px; }
.calculator-header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; flex-shrink: 0; min-height: 66px; padding: 10px 28px; background: #fff; border-bottom: 1px solid #e7edf5; }
.calculator-plan { justify-self: start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px; color: #16803d; background: #eaf8ef; font-size: .8rem; font-weight: 500; }
.calculator-plan strong { font-size: .85rem; font-style: italic; font-weight: 800; }
.calculator-title { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; font-size: 1.325rem; font-weight: 700; line-height: 1.4; }
.calculator-title-icon { display: grid; place-items: center; width: 36px; height: 36px; color: #006acd; font-size: 1.65rem; }
.calculator-open-link { display: inline-flex; align-items: center; gap: 6px; justify-self: end; color: #69798d; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.calculator-open-link:hover { color: #006acd; }
.calculator-main { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; padding: 32px 24px 16px; }
.calculator-wrapper { display: flex; flex: 1 0 auto; align-items: center; justify-content: center; width: 100%; min-width: 0; }
.rmb-card { width: 100%; max-width: 1000px; min-width: 0; padding: 28px; border: 1px solid #e5ebf3; border-radius: 24px; background: #fff; box-shadow: 0 12px 40px rgba(18,61,107,.06); }
.tool-intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid #e7edf5; }
.section-kicker { display: block; margin-bottom: 7px; color: #8895a7; font-size: .75rem; }
.tool-intro h2 { margin: 0 0 8px; color: #315d8d; font-size: 1.4rem; }
.tool-intro p { margin: 0; color: #69798d; font-size: .85rem; line-height: 1.8; }
.local-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid #dcece4; border-radius: 9px; color: #648977; font-size: .73rem; background: #f5faf7; white-space: nowrap; }
.local-badge span { color: #5eae81; font-size: .5rem; }
.direction-switch { display: inline-flex; flex-wrap: wrap; gap: 5px; max-width: 100%; margin-bottom: 26px; padding: 5px; border-radius: 12px; background: #f0f4fa; }
.direction-button { padding: 10px 16px; border: 0; border-radius: 9px; background: transparent; color: #69798d; font-size: .85rem; line-height: 1.5; }
.direction-button.is-active { background: #fff; color: #006acd; font-weight: 600; box-shadow: 0 2px 8px rgba(18,61,107,.07); }
.direction-button:hover { color: #006acd; }
.conversion-layout { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); gap: 16px; }
.amount-panel { min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; min-height: 30px; margin-bottom: 10px; }
.panel-heading h3 { margin: 0; color: #315d8d; font-size: .95rem; font-weight: 600; }
.text-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.text-actions button { padding: 4px 0; border: 0; color: #6f849d; background: transparent; font-size: .75rem; }
.text-actions button:hover { color: #006acd; }
textarea { display: block; width: 100%; min-height: 180px; max-height: 420px; padding: 18px; resize: vertical; border: 1px solid #dce5f0; border-radius: 16px; background: #f8faff; color: #0b1a33; font: 500 1.08rem/1.9 system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif; overflow-wrap: anywhere; }
textarea[readonly] { background: #f4f7fc; color: #315d8d; }
textarea:focus { outline: none; border-color: #006acd; box-shadow: 0 0 0 3px #e7f2ff; }
textarea[aria-invalid="true"] { border-color: #d9505e; }
textarea::placeholder { color: #98a5b6; font-size: .9rem; font-weight: 400; }
.field-hint { margin: 10px 0 0; color: #8895a7; font-size: .73rem; line-height: 1.8; }
.swap-wrap { display: flex; justify-content: center; align-items: center; padding-top: 3px; }
.swap-button { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; padding: 0; border: 1px solid #dce5f0; border-radius: 50%; color: #006acd; background: #eef4fe; font-size: 1.4rem; }
.swap-button:hover { background: #dce8fa; }
.result-badge { color: #8895a7; font-size: .73rem; }
.conversion-options { margin-top: 22px; }
.conversion-options label { display: inline-flex; align-items: center; gap: 7px; color: #69798d; font-size: .8rem; cursor: pointer; }
.conversion-options input { margin: 0; accent-color: #006acd; }
.tool-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; }
.run-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 20px; border: 1px solid #dce5f0; border-radius: 10px; font-size: .85rem; font-weight: 600; line-height: 1.5; }
.button.primary { color: #fff; background: #006acd; border-color: #006acd; box-shadow: 0 4px 14px rgba(0,106,205,.15); }
.button.primary:hover { background: #0059b3; }
.button.secondary { color: #536f8b; background: #fff; }
.button.secondary:hover:not(:disabled) { color: #006acd; background: #eef4fe; border-color: #bfd6ec; }
.shortcut-hint { color: #96a3b5; font-size: .7rem; }
.tool-status { min-height: 24px; margin: 22px 0 0; padding-top: 16px; border-top: 1px solid #eef2f8; color: #69798d; font-size: .8rem; line-height: 1.8; overflow-wrap: anywhere; }
.tool-status.is-error { color: #c63646; }
.calculator-tips { flex-shrink: 0; width: 100%; max-width: 1000px; margin-top: auto; padding: 18px 8px 0; border-top: 1px solid #e7edf5; color: #66758a; font-size: .8rem; line-height: 1.9; }
.calculator-tips h2 { margin: 0 0 12px; color: #69798d; font-size: .9rem; font-weight: 600; }
.tips-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.tips-grid p { margin: 0; }
.tips-grid strong { display: block; margin-bottom: 5px; color: #536f8b; font-weight: 600; }
.digit-reference { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 22px; margin-top: 20px; padding: 16px 0 4px; border-top: 1px solid #e7edf5; color: #8895a7; font-size: .78rem; }
@media (max-width: 767.98px) {
    .calculator-header { padding: 8px 16px; gap: 10px; }
    .calculator-plan { padding: 5px 8px; font-size: .72rem; }
    .calculator-title { gap: 7px; font-size: 1.175rem; }
    .calculator-open-link { font-size: .8rem; }
    .calculator-main { padding: 24px 16px 16px; gap: 20px; }
    .rmb-card { padding: 22px; }
    .conversion-layout, .tips-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .swap-wrap { padding: 0; }
    .swap-button { transform: rotate(90deg); }
    textarea { min-height: 150px; }
    .tips-grid { gap: 18px; }
}
@media (max-width: 575.98px) {
    .calculator-header { grid-template-columns: minmax(0, 1fr) auto; }
    .calculator-title { grid-column: 1 / -1; grid-row: 1; }
    .calculator-plan { grid-column: 1; grid-row: 2; }
    .calculator-open-link { grid-column: 2; grid-row: 2; }
    .rmb-card { padding: 18px 16px; border-radius: 22px; }
    .tool-intro h2 { font-size: 1.25rem; }
    .direction-switch { display: flex; width: 100%; }
    .direction-button { flex: 1 1 140px; padding: 10px 8px; font-size: .8rem; }
    .shortcut-hint { display: none; }
    .tool-actions { gap: 10px; }
    .run-actions { flex: 1; }
    .run-actions .button { width: 100%; }
    .button { padding: 10px 14px; }
}
