* { margin: 0; padding: 0; box-sizing: border-box; }

/* === Theme Variables === */
:root {
    --bg: #e8eaed;
    --bg-grad: linear-gradient(160deg, #dfe5ed 0%, #e6e4e0 50%, #e0e6eb 100%);
    --bar-bg: rgba(255,255,255,0.78);
    --bar-border: rgba(0,0,0,0.06);
    --card: rgba(255,255,255,0.7);
    --card-border: rgba(0,0,0,0.07);
    --card-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    --inset-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
    --text: #1e1e1e;
    --text-secondary: #4a4a4a;
    --text-muted: #8a8a8a;
    --input-bg: rgba(255,255,255,0.6);
    --input-border: rgba(0,0,0,0.1);
    --input-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
    --code-bg: rgba(0,0,0,0.025);
    --code-text: #333;
    --accent: #4a90a4;
    --accent-hover: #3c7a8c;
    --dropdown-bg: rgba(255,255,255,0.94);
    --dropdown-border: rgba(0,0,0,0.08);
    --dropdown-hover: rgba(0,0,0,0.04);
    --scroll-thumb: #c0c0c0;
    --divider: rgba(0,0,0,0.06);
    --btn-bg: rgba(255,255,255,0.65);
    --btn-border: rgba(0,0,0,0.08);
    --copy-accent: #3b82c4;
    --jar-accent: #2d9d6f;
    --local-accent: #c0792a;
    --home-accent: #8b5fc7;
    --footer-text: #888;
    --blur: 18px;
}

[data-theme="dark"] {
    --bg: #1a1d23;
    --bg-grad: linear-gradient(160deg, #171a20 0%, #1e2028 50%, #1a1e26 100%);
    --bar-bg: rgba(34,37,44,0.85);
    --bar-border: rgba(255,255,255,0.06);
    --card: rgba(40,43,50,0.8);
    --card-border: rgba(255,255,255,0.06);
    --card-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 1px 4px rgba(0,0,0,0.15);
    --inset-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
    --text: #e4e6ea;
    --text-secondary: #a0a4ab;
    --text-muted: #6b6f78;
    --input-bg: rgba(0,0,0,0.2);
    --input-border: rgba(255,255,255,0.08);
    --input-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
    --code-bg: rgba(0,0,0,0.15);
    --code-text: #bcc1c9;
    --accent: #6bb3c6;
    --accent-hover: #5a9eaf;
    --dropdown-bg: rgba(48,51,58,0.96);
    --dropdown-border: rgba(255,255,255,0.06);
    --dropdown-hover: rgba(255,255,255,0.05);
    --scroll-thumb: #4a4e56;
    --divider: rgba(255,255,255,0.06);
    --btn-bg: rgba(50,53,60,0.7);
    --btn-border: rgba(255,255,255,0.06);
    --copy-accent: #5b9fd4;
    --jar-accent: #4dba8a;
    --local-accent: #d4943e;
    --home-accent: #a578e0;
    --footer-text: #5a5e66;
}

body {
    background: var(--bg-grad, var(--bg));
    background-attachment: fixed;
    color: var(--text);
    font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.35s, color 0.35s;
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.028;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* --- View Transition: circle expand from button --- */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}
::view-transition-new(root) {
    clip-path: circle(0px at var(--vt-x, 50%) var(--vt-y, 50%));
    animation: vtCircleIn 0.35s ease-out forwards;
}
::view-transition-old(root) {
    z-index: 1;
}
::view-transition-new(root) {
    z-index: 9999;
}
@keyframes vtCircleIn {
    to { clip-path: circle(var(--vt-r, 100vmax) at var(--vt-x, 50%) var(--vt-y, 50%)); }
}

/* --- Floating glow orbs background --- */
.glow-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    will-change: transform;
}
.g1 {
    width: 500px; height: 500px;
    background: rgba(74,144,164,0.22);
    top: -5%; left: -5%;
    animation: glowDrift1 22s ease-in-out infinite alternate;
}
.g2 {
    width: 420px; height: 420px;
    background: rgba(124,159,245,0.18);
    top: 40%; right: -8%;
    animation: glowDrift2 26s ease-in-out infinite alternate;
}
.g3 {
    width: 350px; height: 350px;
    background: rgba(167,139,250,0.15);
    bottom: -5%; left: 30%;
    animation: glowDrift3 20s ease-in-out infinite alternate;
}

[data-theme="dark"] .g1 { background: rgba(74,144,164,0.15); }
[data-theme="dark"] .g2 { background: rgba(124,159,245,0.12); }
[data-theme="dark"] .g3 { background: rgba(167,139,250,0.10); }

@keyframes glowDrift1 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.15); }
}
@keyframes glowDrift2 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-50px, -30px) scale(1.1); }
}
@keyframes glowDrift3 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, -50px) scale(1.2); }
}

/* --- Page Layout --- */
.page-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 20px;
}

/* --- Top Bar --- */
.top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 920px;
    padding: 14px 22px;
    margin-bottom: 0;
    background: var(--bar-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--card-border);
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    z-index: 20;
    box-shadow: 0 -1px 0 rgba(255,255,255,0.06) inset;
    transition: background 0.3s, border-color 0.3s;
}

.top-bar-center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.top-bar-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.5px;
    white-space: nowrap;
    line-height: 1.3;
}

.title-accent {
    background: linear-gradient(135deg, var(--accent), #7c9ff5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    padding: 0 2px;
    margin: 0 1px;
}

.top-bar-sub {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.top-bar-qr {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.top-bar-qr img {
    display: block;
    width: 36px;
    height: 36px;
    max-width: 36px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.15s, box-shadow 0.15s;
}

.top-bar-qr:hover img {
    transform: scale(1.08);
    box-shadow: 0 3px 12px rgba(0,0,0,0.12);
}

/* --- Top Bar Actions --- */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.top-bar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    cursor: pointer;
}

.top-bar-btn:hover {
    background: var(--dropdown-hover);
    color: var(--accent);
    border-color: var(--accent);
}

/* --- Theme Toggle --- */
.theme-toggle {
    width: 32px;
    height: 32px;
    border: 1px solid var(--btn-border);
    border-radius: 8px;
    background: var(--btn-bg);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    padding: 0;
}

.theme-toggle:hover {
    background: var(--dropdown-hover);
    border-color: var(--accent);
}

.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* --- Container (Glass Card) --- */
.container {
    background: var(--card);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--card-border);
    border-top: 1px solid var(--divider);
    padding: 22px 28px;
    border-radius: 0 0 14px 14px;
    width: 100%;
    max-width: 920px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--card-shadow);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* --- Top Section --- */
.top-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-container {
    position: relative;
    flex: 1;
}

.input-field {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-shadow: var(--input-shadow), 0 1px 3px rgba(0,0,0,0.04);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.3s;
}

.input-field::placeholder { color: var(--text-muted); }

.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74,144,164,0.1), var(--input-shadow);
}

.decrypt-button {
    padding: 11px 26px;
    border: none;
    background: linear-gradient(135deg, var(--accent) 0%, #5bb8c9 100%);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(74,144,164,0.25), inset 0 1px 0 rgba(255,255,255,0.15);
    transition: box-shadow 0.2s, transform 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
    letter-spacing: 0.3px;
}

.decrypt-button:hover { box-shadow: 0 4px 16px rgba(74,144,164,0.35), inset 0 1px 0 rgba(255,255,255,0.2); transform: translateY(-1px); }
.decrypt-button:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(74,144,164,0.2), inset 0 2px 4px rgba(0,0,0,0.1); }

/* --- Content --- */
.main-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.content-area {
    width: 100%;
    height: 420px;
    background: var(--code-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--code-text);
    resize: vertical;
    overflow: auto;
    white-space: pre;
    word-wrap: normal;
    font-family: 'Cascadia Mono', Consolas, 'Courier New', monospace;
    outline: none;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.06), 0 1px 0 rgba(255,255,255,0.5);
    transition: border-color 0.2s, background 0.3s, color 0.3s;
}

.content-area::placeholder { color: var(--text-muted); }
.content-area:focus { border-color: var(--accent); }

.content-area::-webkit-scrollbar { width: 6px; height: 6px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }

/* --- Content Toolbar --- */
.content-toolbar {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: background 0.3s, border-color 0.3s;
}
.content-toolbar.active { display: flex; }

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid var(--card-border);
    border-radius: 7px;
    background: var(--input-bg);
    color: var(--text-secondary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.tb-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--input-bg);
}
.tb-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(74,144,164,0.25);
}
.tb-btn svg { flex-shrink: 0; opacity: 0.8; }
.tb-btn:hover svg,
.tb-btn.active svg { opacity: 1; }

.tb-sep {
    width: 1px;
    height: 18px;
    background: var(--divider);
    margin: 0 4px;
    flex-shrink: 0;
}

.toolbar-stats {
    width: 100%;
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Cascadia Mono', Consolas, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 2px 4px;
    border-top: 1px solid var(--divider);
    margin-top: 2px;
}
.toolbar-stats:empty { display: none; border-top: none; margin-top: 0; padding: 0; }

/* Search bar */
.search-bar {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    transition: background 0.3s, border-color 0.3s;
}
.search-bar.active { display: flex; }

.search-input {
    flex: 1;
    padding: 5px 10px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.search-count {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Cascadia Mono', Consolas, monospace;
    white-space: nowrap;
    min-width: 40px;
    text-align: center;
}

.search-nav {
    padding: 3px 8px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    background: var(--btn-bg);
    color: var(--text-secondary);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
}
.search-nav:hover { background: var(--dropdown-hover); color: var(--text); }

.search-close {
    padding: 3px 8px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}
.search-close:hover { color: var(--text); }

/* Search highlight */
.json-view mark {
    background: rgba(255,213,79,0.4);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}
.json-view mark.current {
    background: rgba(255,152,0,0.6);
    outline: 1px solid rgba(255,152,0,0.8);
}

/* --- Search Info Bar (inline, second row of search-bar) --- */
.search-info-bar {
    display: none;
    width: 100%;
    align-items: center;
    gap: 8px;
    padding: 5px 2px 2px;
    border-top: 1px solid var(--divider);
    margin-top: 2px;
}
.search-info-bar.active { display: flex; }
.search-info-bar.copied .sib-copy-btn { background: #34c759; }

.sib-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--text-secondary);
}

.sib-copy-btn {
    flex-shrink: 0;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    color: #fff;
    padding: 4px 14px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    min-height: 30px;
    transition: background 0.15s, opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.sib-copy-btn:hover { opacity: 0.88; }
.sib-copy-btn:active { opacity: 0.75; }

@media (max-width: 640px) {
    .content-toolbar { padding: 5px 8px; }
    .toolbar-left { gap: 4px; }
    .tb-btn { padding: 7px 12px; }
    .toolbar-stats { font-size: 10px; }
    .search-bar { padding: 5px 8px; }
    .sib-copy-btn { min-height: 36px; padding: 5px 16px; font-size: 13px; }
    .main-section { gap: 6px; }
    .json-view { flex-grow: 1; height: auto; min-height: 0; }
    .msg-overlay { flex-grow: 1; height: auto; min-height: 0; }
}

/* --- Message Overlay (错误/等待/提示 居中显示) --- */
.msg-overlay {
    display: none;
    width: 100%;
    height: 420px;
    background: var(--code-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--inset-shadow);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    transition: background 0.3s, border-color 0.3s;
}
.msg-overlay.active { display: flex; }

.msg-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 4px;
}
.msg-icon.error   { background: rgba(255,59,48,0.12); color: #ff3b30; }
.msg-icon.warn    { background: rgba(255,149,0,0.12); color: #ff9500; }
.msg-icon.info    { background: rgba(74,144,164,0.12); color: var(--accent); }
.msg-icon.loading { background: rgba(74,144,164,0.12); color: var(--accent); animation: spin 1s linear infinite; }

.msg-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.msg-detail {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 420px;
    line-height: 1.6;
}
.msg-suggestion {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 400px;
    line-height: 1.5;
    padding: 8px 14px;
    background: var(--input-bg);
    border-radius: 6px;
    border: 1px solid var(--input-border);
}
.msg-suggestion:empty { display: none; }
.msg-url {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Cascadia Mono', Consolas, monospace;
    word-break: break-all;
    max-width: 420px;
}
.msg-url:empty { display: none; }

@media (max-width: 640px) {
    .msg-overlay { height: 300px; padding: 16px; }
}

/* --- Progress Panel --- */
.progress-panel {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 420px;
    background: var(--code-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--inset-shadow);
    transition: background 0.3s, border-color 0.3s;
}
.progress-panel.active { display: flex; }

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}
.progress-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.progress-pct {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    font-family: 'Cascadia Mono', Consolas, monospace;
    background: rgba(74,144,164,0.1);
    padding: 3px 10px;
    border-radius: 10px;
    line-height: 1;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: var(--input-bg);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), #5ec4d4);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(74,144,164,0.25);
}
.progress-fill.success { background: linear-gradient(90deg, #34c759, #30d158); box-shadow: 0 0 8px rgba(52,199,89,0.25); }
.progress-fill.error   { background: linear-gradient(90deg, #ff3b30, #ff6b6b); box-shadow: 0 0 8px rgba(255,59,48,0.25); }

.progress-status {
    font-size: 12px;
    color: var(--text-muted);
    margin: 8px 0 14px;
    min-height: 16px;
    font-family: 'Cascadia Mono', Consolas, monospace;
    flex-shrink: 0;
    transition: color 0.2s;
}

.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    overflow-y: auto;
    margin: 0 -6px;
    padding: 0 6px;
}

@keyframes stepIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    background: transparent;
    transition: background 0.15s;
    animation: stepIn 0.25s ease-out both;
}

/* Phase heading */
.step-item.heading {
    font-weight: 700;
    color: var(--text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 14px 12px 6px;
    margin-top: 4px;
    gap: 8px;
    position: relative;
}
.step-item.heading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 12px;
    right: 12px;
    height: 1px;
    background: var(--divider);
}
.step-item.heading:first-child { margin-top: 0; padding-top: 6px; }
.step-item.heading:first-child::before { display: none; }

/* Compact mode for file download steps */
.step-item.compact {
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.4;
    gap: 8px;
    animation-duration: 0.15s;
}
.step-item.compact .step-icon {
    width: 16px;
    height: 16px;
    font-size: 9px;
}
.step-item.compact .step-text { font-family: 'Cascadia Mono', Consolas, monospace; }
.step-item.compact .step-label { font-family: inherit; }

.step-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    margin-top: 1px;
}
.step-icon.info    { background: rgba(74,144,164,0.12); color: var(--accent); }
.step-icon.success { background: rgba(52,199,89,0.12); color: #34c759; }
.step-icon.error   { background: rgba(255,59,48,0.12); color: #ff3b30; }
.step-icon.warn    { background: rgba(255,149,0,0.12); color: #ff9500; }
.step-icon.skip    { background: rgba(142,142,147,0.08); color: #8e8e93; }
.step-icon.loading { background: rgba(74,144,164,0.12); color: var(--accent); animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.step-text { flex: 1; word-break: break-all; }
.step-text .step-label { color: var(--text-muted); font-size: 12px; }
.step-text .step-size {
    color: var(--accent);
    font-size: 11px;
    font-family: 'Cascadia Mono', Consolas, monospace;
    background: rgba(74,144,164,0.08);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.step-item.done { background: rgba(52,199,89,0.04); }
.step-item.fail { background: rgba(255,59,48,0.04); }

.progress-summary {
    margin-top: 10px;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.7;
}
.progress-summary.success { background: rgba(52,199,89,0.07); color: #34c759; border: 1px solid rgba(52,199,89,0.12); }
.progress-summary.error   { background: rgba(255,59,48,0.07); color: #ff3b30; border: 1px solid rgba(255,59,48,0.12); }
.progress-summary.warn    { background: rgba(255,149,0,0.07); color: #ff9500; border: 1px solid rgba(255,149,0,0.12); }
.progress-summary .summary-title { font-weight: 700; display: block; margin-bottom: 4px; }
.progress-summary .summary-detail { color: var(--text-secondary); font-size: 12px; }

.progress-steps::-webkit-scrollbar { width: 5px; }
.progress-steps::-webkit-scrollbar-track { background: transparent; }
.progress-steps::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }

@media (max-width: 640px) {
    .progress-panel { height: 300px; padding: 16px; }
    .step-item.compact { padding: 3px 8px; font-size: 11px; }
    .step-item.compact .step-icon { width: 14px; height: 14px; font-size: 8px; }
}

/* --- Bottom Buttons --- */
.bottom-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid var(--divider);
}

.bottom-section > button,
.bottom-section > a {
    flex: 1;
    min-width: 0;
}

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: filter 0.15s, box-shadow 0.15s;
}

.action-button svg { flex-shrink: 0; opacity: 0.85; }
.action-button:hover { filter: brightness(1.08); box-shadow: 0 3px 12px rgba(0,0,0,0.16); }
.action-button:active { filter: brightness(0.95); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.action-button:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }

.btn-copy  { background: var(--copy-accent); }
.btn-jar   { background: var(--jar-accent); }
.btn-local { background: var(--local-accent); }
.btn-home  { background: var(--home-accent); }

/* --- Dropdown --- */
.suggestions-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    background: var(--dropdown-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--dropdown-border);
    border-radius: 8px;
    z-index: 10;
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    animation: dropSlideIn 0.15s ease-out;
    -webkit-overflow-scrolling: touch;
}
@keyframes dropSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.suggestions-dropdown::-webkit-scrollbar { width: 5px; }
.suggestions-dropdown::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }

.suggestion-item {
    color: var(--text-secondary);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    border-bottom: 1px solid var(--divider);
    transition: background 0.12s;
}
.suggestion-item .sg-name {
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.suggestion-item .sg-url {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Cascadia Mono', Consolas, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item:active { background: var(--dropdown-hover); }
.suggestion-item:hover .sg-name, .suggestion-item:active .sg-name { color: var(--accent); }

/* --- Page Footer --- */
.page-footer {
    width: 100%;
    max-width: 920px;
    margin-top: 16px;
    padding: 0 0 4px;
    text-align: center;
}

.page-footer .copyright {
    font-size: 12px;
    color: var(--footer-text);
}
.page-footer .footer-sub {
    font-size: 11px;
    color: var(--footer-text);
    opacity: 0.55;
    margin-top: 3px;
}

/* === Responsive === */
@media (max-width: 640px) {
    .page-wrapper { padding: 30px 0 0; height: 100dvh; justify-content: flex-start; overflow: hidden; box-sizing: border-box; }
    .top-bar { padding: 10px 14px; gap: 10px; margin-bottom: 0; border-radius: 10px 10px 0 0; border-bottom: none; flex-shrink: 0; width: 100%; max-width: 100%; box-sizing: border-box; }
    .top-bar-title { font-size: 14px; letter-spacing: 0.3px; }
    .top-bar-sub { font-size: 10px; }
    .top-bar-qr img { width: 30px; height: 30px; border-radius: 6px; }
    .top-bar-btn { width: 28px; height: 28px; border-radius: 6px; }
    .top-bar-btn svg { width: 13px; height: 13px; }
    .top-bar-actions { gap: 4px; }
    .theme-toggle { width: 28px; height: 28px; padding: 0; }
    .container { padding: 18px; padding-bottom: 12px; gap: 12px; border-radius: 0 0 10px 10px; border-top: none; flex-grow: 1; overflow: hidden; display: flex; flex-direction: column; }
    .top-section { flex-direction: column; align-items: stretch; flex-shrink: 0; }
    .decrypt-button { width: 100%; }
    .input-container { width: 100%; }
    .content-area { flex-grow: 1; height: auto; min-height: 0; }
    .bottom-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .bottom-section > button,
    .bottom-section > a { flex-basis: auto; flex-grow: 0; }
    .page-footer { gap: 8px; }
    /* 下拉列表移动端适配 */
    .suggestions-dropdown { max-height: 200px; border-radius: 6px; }
    .suggestion-item { padding: 12px 14px; font-size: 14px; }
    .suggestion-item .sg-url { white-space: normal; word-break: break-all; font-size: 11px; }
    /* 移动端性能优化：关闭高耗 GPU 效果 */
    body::after { display: none; }
    .glow { animation: none; filter: blur(80px); opacity: 0.12; }
    .top-bar, .container { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
    .content-area { will-change: auto; }
}

@media (max-width: 400px) {
    .action-button { font-size: 12px; padding: 9px 12px; }
}

/* --- QR Popup --- */
.qr-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0,0,0,0.45);
    align-items: center;
    justify-content: center;
    animation: qrFadeIn 0.2s ease-out;
}
.qr-popup.active { display: flex; }
.qr-popup-card {
    background: var(--card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    animation: qrScaleIn 0.25s ease-out;
    max-width: 260px;
}
.qr-popup-card img {
    width: 180px;
    height: 180px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    display: block;
    margin: 0 auto 12px;
}
.qr-popup-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.qr-popup-text strong {
    color: var(--text);
}
@keyframes qrFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes qrScaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* --- Decrypt button loading state --- */
.decrypt-button.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}
.decrypt-button .btn-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}
.decrypt-button.loading .btn-spinner { display: inline-block; }

/* --- JSON Syntax Highlight (read-only overlay) --- */
.json-view {
    display: none;
    width: 100%;
    height: 420px;
    background: var(--code-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--code-text);
    overflow: auto;
    white-space: pre;
    word-wrap: normal;
    font-family: 'Cascadia Mono', Consolas, 'Courier New', monospace;
    box-shadow: var(--inset-shadow);
    transition: border-color 0.2s, background 0.3s;
    cursor: text;
    user-select: text;
    outline: none;
    caret-color: var(--accent);
}
.json-view.active { display: block; }
.json-view::-webkit-scrollbar { width: 6px; height: 6px; }
.json-view::-webkit-scrollbar-track { background: transparent; }
.json-view::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }

.json-view .jk { color: #9b2c2c; font-weight: 500; }  /* key — 深红 */
.json-view .js { color: #2d8f6f; }  /* string value — 绿 */
.json-view .jn { color: #2563eb; }  /* number — 蓝 */
.json-view .jb { color: #b45309; font-style: italic; }  /* bool/null — 橙棕+斜体 */
.json-view .jc { color: var(--text-muted); }  /* colon */
.json-view .jp { color: #6b7280; }  /* brackets, comma — 灰 */

[data-theme="dark"] .json-view .jk { color: #f07178; font-weight: 500; }
[data-theme="dark"] .json-view .js { color: #c3e88d; }
[data-theme="dark"] .json-view .jn { color: #82aaff; }
[data-theme="dark"] .json-view .jb { color: #ffcb6b; font-style: italic; }
[data-theme="dark"] .json-view .jc { color: #676e7b; }
[data-theme="dark"] .json-view .jp { color: #676e7b; }


@media (max-width: 640px) {
    .json-view { height: 300px; }
} 