:root {
  color-scheme: light dark;
  font-family: "Hiragino Sans", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  --surface: rgba(255, 255, 255, 0.08);
  --border: rgba(0, 0, 0, 0.1);
}

body {
  margin: 0;
  padding: 1.5rem;
  background: radial-gradient(circle at top, #3d63ff22, transparent 65%);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(8px);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

label span {
  font-weight: 600;
}

select,
input,
button {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

button {
  cursor: pointer;
  background: #335dff;
  color: #fff;
  border: none;
}

button.secondary {
  background: #606060;
}

/* 模擬ログインフォームで利用する補助的なスタイル */
button:disabled {
  cursor: not-allowed;
  background: #94a3b8;
}

.muted {
  margin-top: 0.5rem;
  color: #cbd5f5;
  font-size: 0.9rem;
}

.helper {
  margin-top: 0.25rem;
  color: #cbd5f5;
  font-size: 0.85rem;
}

.login-form [data-tone="success"] {
  color: #4ade80;
}

.login-form [data-tone="error"] {
  color: #fca5a5;
}

pre {
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  overflow: auto;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  font-size: 0.85rem;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.log-entry {
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(99, 102, 241, 0.4);
}

.log-entry.success {
  border-color: rgba(34, 197, 94, 0.5);
}

.log-entry.error {
  border-color: rgba(239, 68, 68, 0.5);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.table thead {
  background: rgba(148, 163, 184, 0.2);
}

.definition-list {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr;
  gap: 0.5rem 1rem;
}

.definition-list dt {
  font-weight: 700;
}

.definition-list dd {
  margin: 0;
}

.custom-turnstile-badge {
  position: fixed;
  right: 1.75rem;
  bottom: 1.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  pointer-events: none;
  z-index: 999;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.custom-turnstile-badge[data-state="retry"] {
  border-color: rgba(220, 38, 38, 0.35);
  box-shadow: 0 12px 28px rgba(185, 28, 28, 0.18);
}

.custom-turnstile-badge[data-state="action"] {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(30, 64, 175, 0.2);
}

.custom-turnstile-spinner {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgba(30, 64, 175, 0.25);
  border-top-color: rgba(30, 64, 175, 0.9);
  animation: spin 0.8s linear infinite;
}

.custom-turnstile-message {
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.custom-turnstile-badge[data-state="action"] .custom-turnstile-spinner,
.custom-turnstile-spinner.is-hidden {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .custom-turnstile-badge {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #e2e8f0;
    box-shadow: 0 12px 30px rgba(3, 7, 18, 0.55);
  }

  .custom-turnstile-badge[data-state="action"] {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(94, 234, 212, 0.25);
  }

  .custom-turnstile-spinner {
    border-color: rgba(94, 234, 212, 0.25);
    border-top-color: rgba(94, 234, 212, 0.85);
  }
}

@media (max-width: 640px) {
  .custom-turnstile-badge {
    right: 1rem;
    bottom: 1rem;
    font-size: 0.8rem;
    padding: 0.55rem 0.85rem;
  }
}

.custom-turnstile-slot {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 130px;
}

.custom-turnstile-hidden-slot {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
}

.custom-turnstile-visible-slot {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 80px;
  opacity: 1;
  overflow: visible;
}

.is-hidden {
  display: none !important;
}

.accordion summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.accordion summary::after {
  content: "▼";
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.accordion[open] summary::after {
  transform: rotate(-180deg);
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion > *:not(summary) {
  margin-top: 1rem;
}

.csp-inline {
  display: block;
  margin-top: 0.25rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  white-space: normal;
  word-break: break-all;
}

.csp-snippet {
  display: block;
  margin: 0.25rem 0 0.75rem;
  padding: 0.5rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: normal;
  word-break: break-all;
}

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