/* Retain the original page layout and light palette. */
:root { color-scheme: light; }
.wx-modal-open { overflow: hidden; }
.input-native:focus, .input-native:focus-visible { outline: none; box-shadow: none; }
.input-shell:focus-within { border-color: var(--border); box-shadow: var(--shadow-sm); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.modal-sheet:focus { outline: none; }

/* Same local outline icon font and blue as the original secondary actions. */
.wx-toolbar { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); display: flex; gap: 4px; z-index: 10; }
.wx-tool { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--accent); font: inherit; cursor: pointer; }
.wx-tool i { font-size: 17px; line-height: 1; }
.wx-tool:hover { background: rgba(0, 113, 227, .06); }
.wx-tool:active { background: rgba(0, 113, 227, .1); }
.wx-tool:disabled { opacity: .5; cursor: wait; }

/* Added dialogs use the existing modal surface, typography and buttons. */
.wx-dialog-heading { margin: 0 30px 18px 0; flex-shrink: 0; }
.wx-dialog-heading .modal-subheading { font-size: 12px; line-height: 1.6; margin-top: 5px; }
.wx-notice-sheet { max-width: 420px; padding: 25px 22px 20px; }
.wx-notice-heading { margin-bottom: 12px; }
.wx-notice-copy { font-size: 13px; line-height: 1.8; color: #57657b; text-align: left; white-space: normal; overflow-wrap: anywhere; padding: 0 0 4px; }
.wx-notice-copy :is(h1,h2,h3,h4,h5,h6) { position: relative; margin: 16px 0 6px; padding-left: 10px; font-size: 13.5px; font-weight: 600; line-height: 1.7; color: var(--accent); }
.wx-notice-copy :is(h1,h2,h3,h4,h5,h6)::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; border-radius: 2px; background: currentColor; }
.wx-notice-copy > :first-child { margin-top: 0; }
.wx-notice-copy p { margin: 6px 0; }
.wx-notice-copy :is(ul,ol) { margin: 6px 0; padding-left: 25px; }
.wx-notice-copy ul { list-style: disc; }
.wx-notice-copy ol { list-style: decimal; }
.wx-notice-copy li { padding-left: 1px; margin: 3px 0; }
.wx-notice-copy li::marker { color: #91b5f3; }
.wx-notice-copy :is(strong,b) { font-weight: 600; }
.wx-notice-copy hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.wx-notice-copy blockquote { margin: 10px 0; padding-left: 10px; border-left: 2px solid var(--border-strong); }
.wx-notice-copy code { font-family: var(--font-mono); font-size: 11.5px; overflow-wrap: anywhere; }
.wx-notice-copy pre { margin: 8px 0; white-space: pre-wrap; font: 11.5px/1.7 var(--font-mono); }
[data-theme="dark"] .wx-notice-copy { color: #bac4d2; }
.wx-notice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex-shrink: 0; }
.wx-notice-actions button { height: 40px; font-size: 13px; font-weight: 500; border-radius: var(--radius-sm); margin-top: 10px; }
.wx-history-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.wx-history-row:first-child { padding-top: 0; }
.wx-history-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; color: var(--text-secondary); font-size: 10px; }
.wx-history-meta>span { color: var(--success); }
.wx-history-code { display: block; margin-top: 8px; font: 12px/1.7 var(--font-mono); color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.wx-history-actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 9px; }
.wx-history-actions button { border: 0; background: transparent; color: var(--accent); padding: 6px 0; font: 12px var(--font-sans); cursor: pointer; }
.wx-history-actions i { margin-right: 4px; }
.wx-local-hint { flex-shrink: 0; font-size: 10px; line-height: 1.7; color: var(--text-tertiary); margin-top: 16px; text-align: center; }
.wx-empty { padding: 16px 0 22px; text-align: center; }
.wx-empty-icon { display: block; font-size: 26px; color: var(--text-tertiary); margin-bottom: 12px; }
.wx-empty h3 { font-size: 14px; font-weight: 500; }
.wx-empty p { margin-top: 8px; color: var(--text-secondary); font-size: 12px; line-height: 1.7; }
.wx-game-sheet { max-width: 700px; height: min(680px, calc(100dvh - 40px)); min-height: 0; padding-bottom: 16px; }
.wx-game-frame { display: block; flex: 1; width: 100%; min-height: 0; border: 0; background: var(--surface); }

/* Full authorization data remains expanded; no nested scroll box. */
.wx-result-success { max-width: 420px; max-height: calc(100dvh - 24px); padding: 20px; }
.wx-result-success .modal-scroll-area { flex: 0 1 auto; gap: 12px; padding-bottom: 0; }
.wx-result-success .modal-scroll-area>* { flex-shrink: 0; }
.wx-success-heading { margin-bottom: 16px; padding: 0 20px; }
.wx-success-heading .modal-heading { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 18px; font-weight: 600; }
.wx-success-heading .modal-heading i { font-size: 21px; color: var(--success); font-weight: 400; }
.wx-success-heading .modal-subheading { font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.wx-result-message { font-size: 11px; line-height: 1.6; color: var(--text-secondary); }
.wx-op-section { padding-top: 10px; border-top: 1px solid var(--border); }
.wx-op-section .info-label-sm { color: var(--text-secondary); font-size: 10px; font-weight: 400; letter-spacing: 0; margin-bottom: 6px; }
.wx-result-success .op-code-block { max-height: none; overflow: visible; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; line-height: 1.6; padding: 8px 10px; user-select: text; }
.wx-result-success>.btn-modal-primary { height: 42px; margin-top: 12px; font-size: 14px; font-weight: 500; border-radius: var(--radius-sm); }

:root[data-theme="dark"] { color-scheme: dark; --bg: #18181b; --surface: #242427; --surface-secondary: #2c2c30; --text-primary: #f0f0f2; --text-secondary: #a7a7af; --text-tertiary: #85858e; --accent: #64a8f4; --accent-hover: #7bb7fb; --accent-press: #4d95e7; --border: rgba(255,255,255,.09); --border-strong: rgba(255,255,255,.14); }
[data-theme="dark"] .ambient-stage { background: var(--bg); }
[data-theme="dark"] .brand-tag, [data-theme="dark"] .modal-close-btn { background: rgba(255,255,255,.06); }
[data-theme="dark"] .input-clear { background: #44444b; color: var(--text-secondary); }
[data-theme="dark"] .modal-sheet { box-shadow: 0 20px 60px rgba(0,0,0,.3); }
[data-theme="dark"] .btn-modal-primary, [data-theme="dark"] .btn-main { color: #fff; background: #0071e3; }
[data-theme="dark"] .api-switch, [data-theme="dark"] .api-option, [data-theme="dark"] .code-snippet { background: var(--surface-secondary); border-color: var(--border); }
[data-theme="dark"] .api-switch-title, [data-theme="dark"] .api-option-name, [data-theme="dark"] .api-mode-title { color: var(--text-primary); }
[data-theme="dark"] .api-option-desc, [data-theme="dark"] .api-mode-hint { color: var(--text-secondary); }
[data-theme="dark"] .api-option.active { background: #24364b; border-color: #416f9d; }
[data-theme="dark"] .api-option-tag, [data-theme="dark"] .api-switch-current { background: #253c51; color: #9bcbfa; }
[data-theme="dark"] .api-option-tag.warn { background: #4a3b27; color: #edc997; }

@media(max-width:600px) {
 .overlay:has(.wx-result-success) { padding: 12px; }
 .wx-result-success { padding: 18px; }
 .wx-game-sheet { padding: 20px 12px 10px; height: calc(100dvh - 40px); }
 .wx-game-sheet .wx-dialog-heading { margin-left: 8px; }
}
@media(max-height:650px) and (max-width:600px) {
 .wx-result-success { padding: 16px; }
 .wx-success-heading { margin-bottom: 10px; }
 .wx-result-success .modal-scroll-area { gap: 9px; }
 .wx-result-success .op-code-block { line-height: 1.5; }
 .wx-result-success>.btn-modal-primary { height: 40px; margin-top: 10px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation: none!important; transition: none!important; } }

.wx-game-entry:disabled { opacity: .55; cursor: wait; }

/* Compact secondary rows, matching the supplied pale-gray reference. */
.form-section > .api-switch { min-height: 42px; padding: 0 13px; border-radius: 12px; background: #f1f3f6; border-color: #e3e7ed; box-shadow: none; }
.form-section > .api-switch:hover { background: #eceff3; }
.form-section > .api-switch:active { background: #e8ecf1; }
.api-switch .api-switch-main { gap: 8px; }
.api-switch .api-switch-icon { width: 17px; height: 20px; border-radius: 0; background: transparent; color: #8c9bb0; font-size: 15px; }
.api-switch .api-switch-title { color: #65758c; font-size: 12.5px; font-weight: 600; }
.api-switch .api-switch-name { font-size: 12px; color: var(--accent); }
.api-switch .api-switch-current { gap: 8px; background: transparent; }
.api-switch .api-switch-current > i { color: #bcc5d2; font-size: 13px; }
.api-switch:not(.wx-game-entry) .api-switch-name { display: inline-flex; align-items: center; gap: 6px; }
.api-switch:not(.wx-game-entry) .api-switch-name::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(0,113,227,.06); }
.wx-game-entry .api-switch-name { color: #8c9bb0; font-weight: 500; }
[data-theme="dark"] .form-section > .api-switch { background: #292b30; border-color: #383c43; }
[data-theme="dark"] .form-section > .api-switch:hover { background: #30333a; }
[data-theme="dark"] .api-switch .api-switch-title { color: #bac4d2; }
[data-theme="dark"] .api-switch .api-switch-icon, [data-theme="dark"] .wx-game-entry .api-switch-name { color: #93a2b8; }
