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

:root {
  color-scheme: light;
  --page: #f4f7fb;
  --panel: #fff;
  --blue: #155dfb;
  --blue-soft: #eff6ff;
  --text: #475569;
  --border: #dbe5f2;
}

body {
  min-height: 100vh;
  padding: 0 15px calc(160px + env(safe-area-inset-bottom, 0px));
  color: var(--text);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.container { position: relative; width: min(100%, 450px); margin: 0 auto; }

.intro-box {
  margin-bottom: 30px;
  text-align: center;
}
.btn-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
  padding: 24px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}
.install-guide-note {
  margin: 0 8px 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
  text-align: center;
}
.support-reminder {
  margin: 0;
  padding: 22px 20px 20px;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 24px rgba(21, 93, 251, .06);
  text-align: center;
}
.support-reminder h2 {
  color: var(--blue);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.5;
}
.support-reminder h2 span { color: #dc2626; }
.support-reminder-copy {
  margin: 8px auto 16px;
  max-width: none;
  color: #dc2626;
  font-size: 14px;
  line-height: 1.75;
  text-align: left;
}
.support-reminder-copy span { display: block; }
.support-reminder-btn {
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid #07c160;
  border-radius: 9px;
  color: #fff;
  background: #07c160;
  font-size: 15px;
  font-weight: 600;
  transition: background .2s ease, transform .2s ease;
}
.support-reminder-btn:active { background: #06ad56; transform: translateY(2px); }
.custom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid var(--blue);
  border-radius: 12px;
  color: #fff;
  background: var(--blue);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}
.custom-btn:active,
.close-btn:active,
.qr-save-btn:active,
.install-close:active,
.copy-address:active,
.scroll-to-bottom:active { background: #0f4ed6; transform: translateY(2px); }

.footer-buttons {
  position: fixed;
  z-index: 10;
  bottom: 0;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 450px);
  gap: 10px;
  padding: 12px 15px calc(15px + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}
.footer-btn {
  min-width: 0;
  height: 48px;
  padding: 0 8px;
  border: 1px solid #07c160;
  border-radius: 10px;
  color: #fff;
  background: #07c160;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}
.footer-btn:last-child { grid-column: 1 / -1; }
.footer-btn:active { background: #06ad56; transform: translateY(2px); }
.scroll-to-bottom {
  position: fixed;
  right: 30px;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border: 1px solid var(--blue);
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 3px 15px rgba(21, 93, 251, .12);
}
.scroll-to-bottom::before {
  content: "";
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border-right: 6px solid #fff;
  border-bottom: 6px solid #fff;
  transform: rotate(45deg);
}

.modal-mask { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; padding: 30px 20px; background: rgba(15, 23, 42, .5); backdrop-filter: blur(4px); }
.modal-mask.show { display: flex; }
.modal-content { position: relative; width: min(100%, 400px); max-height: 80vh; max-height: 80dvh; overflow: auto; padding-top: 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); }
.close-btn { position: absolute; top: 10px; right: 10px; z-index: 1; width: 36px; height: 36px; border: 1px solid var(--blue); border-radius: 50%; color: #fff; font-size: 20px; background: var(--blue); }
.modal-img, .modal-video { display: block; width: 100%; margin-top: 10px; border-radius: 16px 16px 0 0; }
.modal-img { height: auto; }
.guide-modal .modal-content { padding-top: 54px; }
.guide-modal .modal-img { margin-top: 0; border-radius: 0; }
.qr-modal .modal-content { padding-top: 54px; }
.qr-modal .modal-img { margin-top: 0; border-radius: 0; }
.qr-actions { padding: 14px 18px 18px; background: var(--panel); text-align: center; }
.qr-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 22px;
  border: 1px solid var(--blue);
  border-radius: 9px;
  color: #fff;
  background: var(--blue);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}
.qr-save-hint { margin-top: 10px; color: var(--text); font-size: 12px; line-height: 1.6; }
.modal-video { height: 250px; border: 0; background: #0f172a; }
.tutorial-modal .modal-content { padding-top: 54px; }
.tutorial-modal .modal-video { height: min(55vh, 480px); margin-top: 0; border-radius: 0; }
.notice-modal .modal-content { padding-top: 54px; }
.modal-heading {
  margin: 0 20px 14px;
  color: var(--blue);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}
.video-notice { margin: 0; padding: 14px 18px; color: var(--text); background: var(--blue-soft); font-size: 15px; font-weight: 600; line-height: 1.75; }
.video-title { padding: 12px; color: var(--blue); text-align: center; background: var(--blue-soft); }
.tutorial-caption {
  padding: 16px 18px 18px;
  color: #334155;
  background: var(--blue-soft);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.75;
  text-align: left;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.risk-modal .modal-content { display: flex; flex-direction: column; padding-top: 54px; overflow: hidden; }
.risk-modal #modalContent { overflow-y: auto; overscroll-behavior: contain; }
.risk-content { padding: 0 20px 20px; font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; }
.risk-content h2 { margin-bottom: 16px; color: var(--blue); font-size: 20px; text-align: center; }
.risk-content ol { padding-left: 24px; }
.risk-content li { margin-bottom: 12px; padding-left: 2px; }
.risk-warning { margin-top: 18px; padding: 12px; border: 1px solid #bfdbfe; border-radius: 10px; color: var(--blue); background: var(--blue-soft); font-weight: 600; }
.tip-toast { position: fixed; top: 50%; left: 50%; z-index: 30; display: none; width: max-content; max-width: calc(100vw - 40px); padding: 16px 22px; border: 1px solid var(--border); border-radius: 10px; color: var(--blue); background: var(--panel); box-shadow: 0 6px 24px rgba(15, 23, 42, .12); text-align: center; transform: translate(-50%, -50%); }
.tip-toast.show { display: block; }

.install-dialog { width: min(450px, calc(100% - 32px)); max-height: 85vh; max-height: 85dvh; margin: auto; padding: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: 16px; color: var(--text); background: var(--panel); box-shadow: 0 20px 60px rgba(15, 23, 42, .2); }
.install-dialog::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(4px); }
.install-dialog-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--panel); }
.install-dialog-header h2 { color: var(--blue); font-size: 20px; }
.install-close { flex: 0 0 36px; height: 36px; border: 1px solid var(--blue); border-radius: 50%; color: #fff; background: var(--blue); font-size: 24px; }
.install-dialog-body { padding: 16px 18px 18px; font-size: 14px; line-height: 1.7; }
.install-instructions { margin-bottom: 14px; }
.install-addresses { display: grid; gap: 12px; list-style: none; }
.install-addresses li { min-width: 0; padding: 12px; border: 1px solid #bfdbfe; border-radius: 10px; background: var(--blue-soft); }
.install-address-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.install-address-heading h3 { color: var(--blue); font-size: 14px; font-weight: 600; }
.copy-address { min-height: 36px; padding: 4px 12px; border: 1px solid var(--blue); border-radius: 6px; color: #fff; background: var(--blue); font-size: 13px; }
.install-addresses a { display: block; color: var(--blue); overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.install-network-tip { margin-top: 16px; padding: 12px; border-radius: 8px; background: var(--page); }
.install-copy-status { position: fixed; top: 50%; left: 50%; z-index: 2; display: none; max-width: calc(100% - 40px); margin: 0; padding: 12px 18px; border-radius: 10px; color: #fff; background: rgba(15, 23, 42, .86); box-shadow: 0 8px 24px rgba(15, 23, 42, .2); text-align: center; transform: translate(-50%, -50%); pointer-events: none; }
.install-copy-status.show { display: block; }
.copy-fallback { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; font-size: 16px; }
@media (hover: hover) {
  .custom-btn:hover, .close-btn:hover, .qr-save-btn:hover, .install-close:hover, .copy-address:hover { background: #0f4ed6; }
  .support-reminder-btn:hover, .footer-btn:hover { background: #06ad56; }
}
@media (max-width: 420px) {
  .custom-btn { font-size: 16px; }
  .scroll-to-bottom { right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
