:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f1f2f5;
  --text: #222222;
  --muted: #8f96a3;
  --line: #ececf0;
  --accent: #ff4757;
  --accent-soft: #ff6b81;
  --accent-light: #fff3f4;
  --warn: #ffd86b;
  --bad: #ff6b6b;
  --ad-bg: #fff7e6;
  --ad-text: #b8741a;
  --shadow: 0 8px 22px rgba(28, 38, 50, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.modal-open {
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.page {
  width: min(480px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 142px;
  margin-bottom: 12px;
  padding: 22px 18px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  box-shadow: 0 12px 26px rgba(255, 71, 87, .22);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, .74);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .14);
  flex: 0 0 auto;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.hero p {
  color: rgba(255, 255, 255, .86);
}

.main-domain {
  margin-top: 5px;
  color: rgba(255, 255, 255, .94);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.primary,
.route-open,
.route-copy,
.ghost {
  height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 15px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.primary {
  color: var(--accent);
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
}

.panel,
.route-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
  margin-bottom: 12px;
}

.notice-panel {
  background: var(--ad-bg);
  border-color: #ffe2b0;
  padding: 8px 12px;
}

.notice-panel p {
  color: var(--ad-text);
}

.notice-panel .panel-title {
  margin-bottom: 2px;
  font-size: 13px;
}

.notice-scroll {
  position: relative;
  overflow: hidden;
  min-height: 20px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.notice-marquee-text {
  --notice-gap: 42px;
  display: inline-flex;
  width: max-content;
  min-width: max-content;
  white-space: nowrap;
  will-change: transform;
  animation: notice-marquee 24s linear infinite;
  font-size: 12px;
  line-height: 20px;
}

.notice-item {
  flex: 0 0 auto;
  padding-right: var(--notice-gap);
}

.notice-panel:hover .notice-marquee-text {
  animation-play-state: paused;
}

@keyframes notice-marquee {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-33.3333%);
  }
}

.panel-title {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.install-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(18, 21, 28, .48);
  backdrop-filter: blur(8px);
}

.install-modal.hidden {
  display: none;
}

.install-dialog {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 71, 87, .22);
  border-radius: 12px;
  padding: 22px 16px 16px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(18, 21, 28, .2);
  text-align: center;
}

.install-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(255, 71, 87, .2);
}

.install-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.install-dialog h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 22px;
}

.install-dialog p {
  color: #7f5560;
  font-size: 14px;
  font-weight: 700;
}

.install-lead {
  max-width: 330px;
  margin: 0 auto;
}

.install-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  text-align: left;
}

.install-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff7f8;
  padding: 11px 10px;
}

.install-card b {
  display: block;
  color: var(--accent);
  font-size: 14px;
  line-height: 1.2;
}

.install-card ol {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #6f5960;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.65;
}

.install-card li {
  padding-left: 2px;
}

.install-dialog .primary {
  width: 100%;
  margin-top: 16px;
  color: #fff;
  background: var(--accent);
}

.ghost {
  color: #666;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.routes {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.domain-section {
  display: grid;
  gap: 10px;
}

.domain-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 0;
}

.domain-section-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.domain-section-head p {
  margin-top: 2px;
  font-size: 12px;
}

.domain-section-head span {
  flex: none;
  color: #999;
  font-size: 12px;
}

.domain-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.featured-grid {
  grid-template-columns: 1fr;
}

.route-card {
  padding: 14px;
}

.domain-card {
  min-width: 0;
  padding: 12px;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.domain-card .route-open,
.domain-card .route-copy {
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.domain-card:active {
  transform: scale(.985);
  border-color: var(--accent);
}

.featured-section .domain-card {
  border-color: rgba(255, 71, 87, .3);
  background: linear-gradient(180deg, #fff, #fff5f6);
  box-shadow: 0 10px 24px rgba(255, 71, 87, .1);
}

.domain-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.domain-text {
  min-width: 0;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  font-weight: 950;
  line-height: 1.15;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.featured-grid .domain-text {
  font-size: 28px;
}

.domain-sub {
  margin-top: 7px;
  color: #999;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.featured-section .domain-sub {
  color: #9f6b73;
  font-size: 12px;
  font-weight: 800;
}

.route-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.route-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 17px;
  font-weight: 900;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  border-radius: 999px;
  color: #8a5200;
  background: var(--warn);
  font-size: 12px;
  font-weight: 900;
}

.route-desc {
  margin-top: 4px;
}

.route-url {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #666;
  background: var(--panel-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.route-open {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 16px rgba(255, 71, 87, .2);
}

.featured-section .route-open {
  font-size: 13px;
}

.route-copy {
  color: #666;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.ok {
  background: var(--accent);
}

.dot.bad {
  background: var(--bad);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  min-width: 150px;
  max-width: calc(100vw - 32px);
  padding: 11px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(34, 34, 34, .92);
  border: 0;
  box-shadow: var(--shadow);
  text-align: center;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.child-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f4f6fb, #dfe4ee);
  color: #252b38;
}

.child-lock-overlay.on {
  display: flex;
}

.child-lock-maint {
  text-align: center;
  padding: 26px 24px;
}

.child-lock-maint b {
  display: block;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.child-lock-maint span {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: #697386;
}

.child-lock-fab {
  --tap-progress: 0%;
  position: fixed;
  z-index: 5002;
  left: auto;
  top: auto;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: conic-gradient(#ff4757 var(--tap-progress), rgba(255, 255, 255, .28) 0), linear-gradient(135deg, #ff6b81, #ff4757);
  box-shadow: 0 8px 22px rgba(22, 29, 43, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.child-lock-fab:active {
  cursor: grabbing;
  transform: scale(.96);
}

.child-lock-fab .lock-ico {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  line-height: 1;
}

.child-lock-fab.locked {
  background: conic-gradient(#2f3542 var(--tap-progress), rgba(255, 255, 255, .28) 0), linear-gradient(135deg, #57606f, #2f3542);
}

.child-lock-fab i {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .7);
  pointer-events: none;
}

.child-lock-toast {
  position: fixed;
  z-index: 5003;
  left: 50%;
  bottom: 78px;
  max-width: min(360px, calc(100vw - 32px));
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  background: rgba(20, 24, 32, .9);
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  transition: opacity .18s ease, transform .18s ease;
}

.child-lock-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 560px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
    padding-top: 18px;
  }

  .primary {
    width: 100%;
  }

  .install-modal {
    align-items: end;
    padding: 14px;
  }

  .install-dialog {
    width: 100%;
    max-height: calc(100vh - 28px);
    overflow: auto;
  }

  .install-steps {
    grid-template-columns: 1fr;
  }

  .domain-grid {
    gap: 7px;
  }

  .domain-card {
    padding: 10px;
  }

  .domain-text {
    font-size: 16px;
  }

  .featured-grid .domain-text {
    font-size: 24px;
  }
}
