:root {
  --bg: #eef4f0;
  --text: #1c1c1e;
  --text2: #636366;
  --text3: #8e8e93;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.08);
  --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --accent: #34c759;
  --accent2: #30d158;
  --blue: #007aff;
  --danger: #ff3b30;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body {
  padding-bottom: calc(24px + var(--safe-bottom));
}

.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

.blob-a {
  width: 280px;
  height: 280px;
  top: -80px;
  left: -60px;
  background: rgba(144, 238, 180, 0.55);
}

.blob-b {
  width: 240px;
  height: 240px;
  top: 120px;
  right: -70px;
  background: rgba(180, 220, 255, 0.45);
}

.blob-c {
  width: 200px;
  height: 200px;
  bottom: 80px;
  left: 20%;
  background: rgba(255, 210, 170, 0.35);
}

.phone-shell {
  position: relative;
  z-index: 1;
  max-width: 430px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-top)) 16px 0;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inset);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--radius-xl);
  margin-bottom: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  color: #248a3d;
  background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(255,255,255,0.5));
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text3);
}

.conn-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.online {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(52, 199, 89, 0.65);
}

.dot.offline {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.4);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero {
  padding: 20px 18px;
  border-radius: var(--radius-xl);
}

.hero-label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hero h2 {
  margin: 8px 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text3);
  line-height: 1.45;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.glass-tile {
  appearance: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 16px 14px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inset);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 118px;
  font: inherit;
  color: inherit;
}

.glass-tile:active {
  transform: scale(0.97);
  box-shadow: 0 4px 16px rgba(31, 38, 135, 0.06), var(--glass-inset);
}

.glass-tile.active {
  border-color: rgba(52, 199, 89, 0.45);
  background: rgba(255, 255, 255, 0.82);
}

.tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tile-icon.ipa { background: linear-gradient(145deg, #dff5ea, #f3fff8); }
.tile-icon.plugin { background: linear-gradient(145deg, #e5efff, #f5f9ff); }
.tile-icon.sub { background: linear-gradient(145deg, #fff0e8, #fff8f3); }
.tile-icon.wechat { background: linear-gradient(145deg, #dff5ea, #eafff3); }

.wechat-panel {
  border-radius: var(--radius-xl);
  padding: 4px;
}

.wechat-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 12px;
}

.wechat-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(145deg, #dff5ea, #f0fff6);
  box-shadow: 0 4px 14px rgba(52, 199, 89, 0.12);
}

.wechat-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wechat-meta strong {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.wechat-badge {
  display: inline-block;
  width: fit-content;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(52, 199, 89, 0.12);
  padding: 3px 8px;
  border-radius: 999px;
}

#wechatSelectedSub {
  font-size: 12px;
  color: var(--text3);
}

.wechat-change {
  border: none;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.more-panel { padding: 14px; }

.more-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.more-tab {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
}

.more-tab.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(52, 199, 89, 0.35);
}

.file-btn.wide {
  display: flex;
  width: 100%;
  justify-content: center;
  margin: 0;
  padding: 14px;
  border-radius: 16px;
}

.sheet {
  width: 100%;
  max-width: 430px;
  max-height: 78vh;
  border-radius: 28px 28px 0 0;
  padding: 12px 18px calc(18px + var(--safe-bottom));
  text-align: left;
  animation: slideUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  margin: 0 auto 14px;
}

.sheet h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.sheet-sub {
  margin: 6px 0 16px;
  font-size: 13px;
  color: var(--text3);
  text-align: center;
}

.version-list {
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.52);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: transform 0.15s ease;
}

.version-item:active { transform: scale(0.98); }

.version-item.active {
  border-color: rgba(52, 199, 89, 0.45);
  background: rgba(52, 199, 89, 0.1);
}

.version-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.version-item-main strong {
  display: block;
  font-size: 16px;
}

.version-item-main span {
  font-size: 12px;
  color: var(--text3);
}

.version-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.version-tag.ok {
  color: var(--accent);
  background: rgba(52, 199, 89, 0.12);
}

.version-tag.miss {
  color: var(--danger);
  background: rgba(255, 59, 48, 0.1);
}

.sheet-close { margin-top: 4px; }

#versionModal {
  align-items: flex-end;
  padding: 0;
}

#versionModal .sheet {
  border-radius: 28px 28px 0 0;
}


.tile-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tile-sub {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
}

.text-btn {
  border: none;
  background: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 8px;
  font-weight: 600;
}

.field-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text3);
}

.select-panel .field-label { margin-top: 14px; }
.select-panel .field-label:first-child { margin-top: 0; }

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
  font-size: 14px;
}

.section-label {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 0.02em;
}

.liquid-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.liquid-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text3);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px dashed rgba(255, 255, 255, 0.75);
}

.liquid-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  padding: 0;
  cursor: pointer;
  text-align: left;
  background: linear-gradient(145deg, rgba(255,255,255,0.88), rgba(255,255,255,0.52));
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    0 8px 24px rgba(31, 38, 135, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.liquid-btn:active {
  transform: scale(0.98);
}

.liquid-btn.active {
  border-color: rgba(52, 199, 89, 0.55);
  background: linear-gradient(145deg, rgba(223, 255, 233, 0.95), rgba(255, 255, 255, 0.72));
  box-shadow:
    0 10px 28px rgba(52, 199, 89, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 0 0 1px rgba(52, 199, 89, 0.12);
}

.liquid-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.65) 48%, transparent 65%);
  transform: translateX(-120%);
  animation: liquidShine 4s ease-in-out infinite;
  pointer-events: none;
}

.liquid-btn.active .liquid-shine {
  animation-duration: 2.8s;
}

@keyframes liquidShine {
  0%, 100% { transform: translateX(-120%); }
  50% { transform: translateX(120%); }
}

.liquid-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.liquid-icon {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,1), 0 4px 12px rgba(0,0,0,0.05);
  flex-shrink: 0;
}

.liquid-icon-img {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.liquid-btn.multi.active {
  border-color: rgba(52, 199, 89, 0.55);
}

.liquid-check {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #34c759;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.plugin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.plugin-tab {
  border: none;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.55);
  color: var(--text2);
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.plugin-tab.active {
  background: rgba(52, 199, 89, 0.16);
  color: #248a3d;
  border-color: rgba(52, 199, 89, 0.35);
}

.liquid-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.liquid-text strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liquid-text em {
  font-style: normal;
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.glass-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.glass-input:focus {
  border-color: rgba(52, 199, 89, 0.5);
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.12);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 48px;
}

.file-list.empty {
  color: var(--text3);
  font-size: 13px;
  padding: 8px 0;
}

.file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.85);
  font-size: 13px;
}

.file-chip span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip .size {
  color: var(--text3);
  font-size: 11px;
  flex-shrink: 0;
}

.inject-btn {
  position: relative;
  width: 100%;
  border: none;
  cursor: pointer;
  padding: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255,255,255,0.85), rgba(255,255,255,0.55));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 10px 30px rgba(52, 199, 89, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  transition: transform 0.18s ease;
}

.inject-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.inject-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.inject-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 0%, rgba(52, 199, 89, 0.22), transparent 55%);
  pointer-events: none;
}

.inject-text {
  position: relative;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.inject-btn.running .inject-text::after {
  content: "…";
  animation: dots 1.2s steps(3, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  33% { content: "."; }
  66% { content: ".."; }
  100% { content: "..."; }
}

.log-panel { display: none; }

.progress-panel {
  padding: 18px 16px 16px;
}

.progress-panel.hidden {
  display: none;
}

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.progress-label {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.02em;
}

.progress-pct {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #34c759 0%, #30b0c7 55%, #5ac8fa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.liquid-progress-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.liquid-progress-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(52, 199, 89, 0.25), transparent 70%);
  pointer-events: none;
}

.liquid-progress-fill {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(48, 209, 88, 0.85) 0%,
    rgba(52, 199, 89, 0.95) 35%,
    rgba(100, 210, 255, 0.9) 100%
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 0 12px rgba(52, 199, 89, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.liquid-progress-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 45%,
    transparent 70%
  );
  animation: liquidProgressShine 2.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes liquidProgressShine {
  0% { transform: translateX(-120%); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateX(220%); opacity: 0; }
}

.progress-hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text2);
  text-align: center;
}

.options-panel {
  padding: 14px 16px 16px;
}

.ios-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
}

.ios-switch-row:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.ios-switch-label {
  font-size: 15px;
  font-weight: 550;
  color: var(--text);
}

.ios-switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-switch {
  position: relative;
  flex-shrink: 0;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.32);
  transition: background 0.22s ease;
}

.ios-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.22s ease;
}

.ios-switch-input:checked + .ios-switch {
  background: #34c759;
}

.ios-switch-input:checked + .ios-switch::after {
  transform: translateX(20px);
}

.history-panel {
  padding-bottom: 14px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.history-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text3);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.82);
}

.history-main {
  flex: 1;
  min-width: 0;
}

.history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.14);
  color: var(--text2);
}

.history-badge.queued {
  background: rgba(142, 142, 147, 0.16);
  color: #636366;
}

.history-badge.running {
  background: rgba(255, 149, 0, 0.16);
  color: #c93400;
}

.history-badge.done {
  background: rgba(52, 199, 89, 0.16);
  color: #248a3d;
}

.history-badge.error {
  background: rgba(255, 59, 48, 0.14);
  color: #d70015;
}

.history-action {
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.14);
  color: #248a3d;
  border: 1px solid rgba(52, 199, 89, 0.22);
}

.history-action:active {
  transform: scale(0.97);
}

.log-box {
  margin: 0;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.75);
  min-height: 140px;
  max-height: 220px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text2);
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-overflow-scrolling: touch;
}

.bg-banner {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  max-width: calc(100% - 32px);
}

.bg-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent2);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal {
  width: 100%;
  max-width: 390px;
  border-radius: 28px;
  padding: 28px 22px 22px;
  text-align: center;
  animation: slideUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), #28a745);
  box-shadow: 0 8px 24px rgba(52, 199, 89, 0.35);
}

.modal-icon.error {
  background: linear-gradient(145deg, #ff6b6b, var(--danger));
  box-shadow: 0 8px 24px rgba(255, 59, 48, 0.3);
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.modal p {
  margin: 0;
  font-size: 14px;
  color: var(--text2);
  line-height: 1.5;
}

.inject-btn.pulse-done {
  animation: pulse-done 1.2s ease-in-out infinite;
}

@keyframes pulse-done {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.45);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(52, 199, 89, 0);
  }
}

.modal-sub {
  margin-top: 6px !important;
  font-size: 12px !important;
  color: var(--text3) !important;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.glass-btn {
  border: none;
  cursor: pointer;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 700;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.glass-btn.ghost {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.85);
  color: var(--text2);
}

.glass-btn.primary {
  background: linear-gradient(145deg, var(--accent), #28a745);
  color: #fff;
  box-shadow: 0 6px 20px rgba(52, 199, 89, 0.35);
}

.glass-btn.full { width: 100%; margin-top: 20px; }

.hidden { display: none !important; }

@media (min-width: 768px) {
  body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 24px;
  }

  .phone-shell {
    width: 390px;
  }

  .modal-backdrop {
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
