:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0a0c0b;
  color: #f4f7f5;
  --green: #7bf2aa;
  --panel: rgba(19, 25, 21, 0.92);
  --border: rgba(139, 184, 158, 0.2);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  padding: max(24px, env(safe-area-inset-top)) 18px max(32px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% -12%, rgba(69, 173, 112, 0.33), transparent 35%),
    #090c0a;
}

.shell {
  width: min(100%, 1080px);
  margin: 0 auto;
}

.hero {
  padding: 20px 6px 32px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  margin-bottom: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(123, 242, 170, 0.45);
  border-radius: 13px;
  background: rgba(123, 242, 170, 0.12);
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(36px, 12vw, 64px);
  letter-spacing: -0.07em;
  line-height: 1;
}

.intro {
  max-width: 520px;
  margin: 20px 0 0;
  color: #aebbb4;
  font-size: 15px;
  line-height: 1.75;
}

.control-card,
.advice-card,
.reminder-card {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

.control-card { padding: 20px; }

.connection {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  margin-bottom: 20px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #728078;
  box-shadow: 0 0 0 5px rgba(114, 128, 120, 0.12);
}

body[data-connection="connected"] .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(123, 242, 170, 0.12);
}

.status {
  margin: 0;
  color: #bdc9c2;
  font-size: 13px;
}

.actions {
  display: grid;
  gap: 10px;
}

.button {
  appearance: none;
  border: 1px solid #486154;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 16px;
  padding: 0 18px;
  color: #f4f7f5;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.button:active { transform: scale(0.985); }
.primary { border-color: var(--green); background: var(--green); color: #092112; }
.secondary { background: #19241e; }
.button:disabled { opacity: 0.4; cursor: not-allowed; }
.button.loading span:first-child::after { content: "…"; }

.privacy {
  margin: 17px 2px 0;
  color: #74847b;
  font-size: 11px;
  line-height: 1.6;
}

.binding-status {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #0b100d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.binding-status div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d7e1dc;
  font-size: 14px;
}

.binding-status strong { color: var(--green); }

.text-button {
  appearance: none;
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: var(--green);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.text-button:disabled { opacity: 0.4; cursor: not-allowed; }

.binding-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #0b100d;
}

.binding-panel p { margin: 0 0 10px; color: #aebbb4; font-size: 13px; }
.binding-panel strong { display: block; color: var(--green); font-size: 22px; letter-spacing: 0.06em; }
.binding-qr { width: min(220px, 100%); margin: 0 auto 16px; display: block; border-radius: 12px; }
.qr-placeholder {
  min-height: 150px;
  margin-bottom: 16px;
  border: 1px dashed #486154;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #74847b;
  font-size: 13px;
  text-align: center;
}

.advice-card {
  margin-top: 16px;
  padding: 22px 20px;
  scroll-margin-top: 16px;
}

.reminder-card {
  margin-top: 16px;
  padding: 22px 20px;
}

.section-heading,
.reminder-controls,
.reminder-copy,
.switch-row {
  display: flex;
  align-items: center;
}

.section-heading {
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

h2, h3 { margin: 0; }
h2 { font-size: 22px; }

.reminder-item {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}

.reminder-copy { align-items: flex-start; gap: 12px; }
.reminder-icon { margin: 0; font-size: 22px; }
.reminder-copy h3 { font-size: 16px; }
.reminder-copy h3 span { color: #74847b; font-size: 11px; font-weight: 600; }
.reminder-copy p:not(.reminder-icon) { margin: 7px 0 0; color: #8fa097; font-size: 12px; line-height: 1.6; }

.reminder-controls {
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

.time-field,
.switch-row {
  gap: 9px;
  color: #aebbb4;
  font-size: 12px;
}

.time-field input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  background: #18211c;
  color: #f4f7f5;
  font: inherit;
  font-size: 14px;
}

.switch-row { cursor: pointer; }
.switch-row.compact { flex-direction: column; align-items: flex-end; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 46px;
  height: 27px;
  position: relative;
  border-radius: 999px;
  background: #34423a;
  transition: background 160ms ease;
}
.switch::after {
  content: "";
  width: 21px;
  height: 21px;
  position: absolute;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}
.switch-row input:checked + .switch { background: #42d987; }
.switch-row input:checked + .switch::after { transform: translateX(19px); }
.switch-row input:disabled + .switch { opacity: 0.35; }
.time-field input:disabled { opacity: 0.35; }
.test-push { width: 100%; margin-top: 20px; }
.settings-status { min-height: 18px; margin: 12px 2px 0; color: #8fa097; font-size: 12px; }

.push-history {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.push-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.push-logs { display: grid; gap: 9px; }
.empty-logs { margin: 0; color: #74847b; font-size: 12px; }
.push-log {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0b100d;
}
.push-log strong { font-size: 13px; }
.push-log b { color: var(--green); font-size: 12px; }
.push-log.failed b { color: #ff9f8f; }
.push-log span,
.push-log p { grid-column: 1 / -1; margin: 0; color: #74847b; font-size: 11px; line-height: 1.5; }
.push-log.failed p { color: #c78e84; }

.advice-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--border);
}

.success-badge {
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(123, 242, 170, 0.12);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.result {
  margin-top: 18px;
  overflow: auto;
  color: #d7e1dc;
  font-size: 14px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }

@media (min-width: 760px) {
  body {
    display: grid;
    place-items: center;
    padding: 48px;
  }

  .shell {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(380px, 1.1fr);
    gap: 32px;
    align-items: center;
  }

  .hero { padding: 24px; }
  .control-card { padding: 28px; }
  .advice-card {
    grid-column: 1 / -1;
    padding: 30px;
  }
  .reminder-card {
    grid-column: 1 / -1;
    padding: 30px;
  }

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