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

:root {
  --bg: #fafafa;
  --surface: #fff;
  --border: #e4e4e7;
  --text: #18181b;
  --text-secondary: #71717a;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --accent-text: #1e40af;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --red-text: #991b1b;
  --orange: #d97706;
  --orange-bg: #fffbeb;
  --orange-text: #92400e;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --green-text: #166534;
  --gray-pill-bg: #f4f4f5;
  --gray-pill-text: #52525b;
  --focus: #2563eb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --surface: #18181b;
    --border: #27272a;
    --text: #fafafa;
    --text-secondary: #a1a1aa;
    --accent: #60a5fa;
    --accent-light: #172554;
    --accent-text: #93bbfd;
    --red: #f87171;
    --red-bg: #2a1215;
    --red-text: #fca5a5;
    --orange: #fbbf24;
    --orange-bg: #2a2210;
    --orange-text: #fcd34d;
    --green: #4ade80;
    --green-bg: #0f2a18;
    --green-text: #86efac;
    --gray-pill-bg: #27272a;
    --gray-pill-text: #a1a1aa;
    --focus: #60a5fa;
  }
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 56px 20px 80px;
}

/* Hero */
.hero {
  margin-bottom: 32px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.lead {
  color: var(--text-secondary);
  font-size: 0.93rem;
  margin-bottom: 28px;
}

.input-row {
  display: flex;
  gap: 8px;
}

#input-domain {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "Noto Sans Mono",
    monospace;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

#input-domain:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 25%, transparent);
}

#input-domain::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.btn-primary {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-primary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.input-error {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--red);
}

/* Provider banner */
.provider-banner {
  background: var(--accent-light);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.provider-banner-label {
  font-size: 0.8rem;
  color: var(--accent-text);
  font-weight: 500;
}

.provider-banner-value {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent-text);
}

.provider-banner-value.mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 0.95rem;
}

/* SaaS list */
.saas-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.saas-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 12px;
}

.saas-row + .saas-row {
  border-top: 1px solid var(--border);
}

.saas-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.saas-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.saas-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.propagation-note {
  font-size: 0.78rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Pills */
.pill {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.pill-ok {
  background: var(--green-bg);
  color: var(--green-text);
}

.pill-missing {
  background: var(--red-bg);
  color: var(--red-text);
}

.pill-warn {
  background: var(--orange-bg);
  color: var(--orange-text);
}

.pill-unknown {
  background: var(--gray-pill-bg);
  color: var(--gray-pill-text);
}

/* Unlock area */
.unlock-area {
  margin-top: 16px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.93rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.btn-link:hover {
  text-decoration: underline;
}

.btn-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.unlock-form {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

#input-email {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

#input-email:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 25%, transparent);
}

#input-email::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.93rem;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.btn-secondary:hover {
  opacity: 0.88;
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.email-note {
  width: 100%;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Guides */
.guides {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.guide-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 14px;
}

.guide-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.guide-where {
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.guide-record {
  margin-bottom: 14px;
}

.record-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.record-line {
  display: flex;
  padding: 8px 14px;
  gap: 12px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.record-line + .record-line {
  border-top: 1px solid var(--border);
}

.record-key {
  flex-shrink: 0;
  width: 64px;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.record-val {
  flex: 1;
}

.copy-target {
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}

.copy-target:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.copy-target:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.copy-hint {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
  opacity: 0.6;
  font-family: system-ui, sans-serif;
  align-self: center;
}

.copy-target.copied .copy-hint {
  color: var(--green);
  opacity: 1;
}

.guide-steps {
  margin-bottom: 14px;
}

.guide-steps ol {
  padding-left: 20px;
  font-size: 0.9rem;
}

.guide-steps li {
  margin-bottom: 4px;
}

.guide-notes {
  list-style: none;
}

.guide-notes li {
  font-size: 0.85rem;
  color: var(--orange);
  padding-left: 0;
}

.guide-error,
.guide-empty {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Footer */
footer {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Mobile */
@media (max-width: 480px) {
  .container {
    padding: 36px 16px 64px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .input-row {
    flex-direction: column;
  }

  .btn-primary {
    width: 100%;
  }

  .saas-row {
    padding: 12px 14px;
  }

  .record-line {
    flex-direction: column;
    gap: 2px;
  }

  .record-key {
    width: auto;
  }
}
