:root {
  color: #17211b;
  background: #eef5f0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top right, rgb(37 211 102 / 16%), transparent 34rem),
    linear-gradient(180deg, #f7fbf8 0%, #edf4ef 100%);
}

button, input { font: inherit; }

.page-shell {
  width: min(100% - 32px, 1040px);
  margin: 0 auto;
  padding: max(30px, env(safe-area-inset-top)) 0 max(36px, env(safe-area-inset-bottom));
}

.hero { max-width: 780px; margin: 0 0 24px; }
.eyebrow, .step-label {
  margin: 0 0 7px;
  color: #15743b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.hero h1 { margin: 0; font-size: clamp(30px, 5vw, 48px); line-height: 1.08; letter-spacing: -.035em; }
.hero-copy { max-width: 680px; margin: 14px 0 0; color: #526158; font-size: 16px; line-height: 1.7; }

.panel {
  border: 1px solid #d8e4db;
  border-radius: 18px;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 14px 36px rgb(32 72 48 / 8%);
}
.environment-panel, .log-panel { padding: 22px; }
.section-heading, .target-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
h2 { margin: 0; font-size: 20px; }
.local-only-badge, .target-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 6px 11px;
  border-radius: 999px;
  color: #116a35;
  background: #e0f5e7;
  font-size: 12px;
  font-weight: 800;
}
.target-chip { width: 34px; padding: 0; font-size: 15px; }
.target-chip-alt { color: #285b92; background: #e6f0fb; }

.environment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}
.environment-item { min-width: 0; padding: 13px 14px; border-radius: 12px; background: #f4f8f5; }
.environment-item dt { margin-bottom: 5px; color: #69766e; font-size: 12px; }
.environment-item dd { overflow-wrap: anywhere; margin: 0; font-size: 14px; font-weight: 650; }
.environment-item.wide { grid-column: 1 / -1; }

.instructions { margin: 18px 0; padding: 18px 20px; border-left: 4px solid #25d366; border-radius: 0 12px 12px 0; color: #415047; background: rgb(255 255 255 / 65%); }
.instructions ol { margin: 9px 0 0; padding-left: 21px; line-height: 1.7; }

.target-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.target-card { min-width: 0; padding: 22px; }
.target-card label { display: block; margin: 20px 0 8px; color: #3d4c43; font-size: 13px; font-weight: 750; }
.target-card input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #bdccc1;
  border-radius: 10px;
  outline: none;
  color: #17211b;
  background: #fff;
}
.target-card input:focus { border-color: #159447; box-shadow: 0 0 0 3px rgb(37 211 102 / 15%); }
.target-card input.is-invalid { border-color: #d44848; box-shadow: 0 0 0 3px rgb(212 72 72 / 10%); }
.field-error { min-height: 20px; margin: 7px 0 4px; color: #b42c2c; font-size: 12px; line-height: 1.5; }

.action-grid { display: grid; gap: 9px; }
.test-action, .small-action {
  appearance: none;
  border: 1px solid #bfd0c3;
  border-radius: 10px;
  color: #173c25;
  background: #fff;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}
.test-action { display: flex; min-height: 47px; align-items: center; justify-content: center; padding: 10px 12px; font-size: 14px; font-weight: 750; }
.test-action.primary { border-color: #159447; color: #fff; background: #159447; }
.test-action.xmb-action { border-color: #7c3aed; color: #5b21b6; background: #f5f3ff; }
.test-action:hover { border-color: #159447; }
.test-action:active { transform: translateY(1px); }
.test-action[aria-disabled="true"] { border-color: #d7ddd9; color: #879189; background: #f1f3f2; cursor: not-allowed; }

.log-panel { margin-top: 18px; }
.log-heading { align-items: center; }
.log-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.small-action { min-height: 38px; padding: 8px 12px; font-size: 13px; font-weight: 700; }
.small-action.danger { border-color: #e4bcbc; color: #a22b2b; }
.status-message { min-height: 22px; margin: 16px 0 10px; color: #3f5c48; font-size: 13px; }
.status-message.is-error { color: #b42c2c; }
#diagnostic-log {
  min-height: 190px;
  max-height: 420px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border-radius: 12px;
  color: #d9f8e3;
  background: #13251a;
  font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

footer { padding: 22px 4px 0; color: #6f7c74; font-size: 12px; line-height: 1.7; text-align: center; }

@media (max-width: 760px) {
  .target-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page-shell { width: min(100% - 20px, 1040px); padding-top: max(22px, env(safe-area-inset-top)); }
  .hero { margin-bottom: 18px; }
  .hero-copy { font-size: 14px; }
  .environment-panel, .target-card, .log-panel { padding: 17px; border-radius: 15px; }
  .environment-grid { grid-template-columns: 1fr; }
  .environment-item.wide { grid-column: auto; }
  .section-heading { align-items: flex-start; }
  .local-only-badge { max-width: 110px; text-align: center; }
  .instructions { padding: 15px 15px 15px 17px; font-size: 13px; }
  .log-heading { display: block; }
  .log-actions { margin-top: 14px; }
  .small-action { flex: 1; }
}
