/* style.css — veil-drop Frontend */

/* ─── リセット & カスタムプロパティ ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #0d1117;
  --color-surface: #161b22;
  --color-surface-2: #1c2128;
  --color-border: #30363d;
  --color-text: #e6edf3;
  --color-text-muted: #8b949e;
  --color-accent: #58a6ff;
  --color-success: #3fb950;
  --color-warning: #d29922;
  --color-error: #f85149;
  --color-badge-bg: #1a2d1a;
  --color-badge-border: #3fb950;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* ─── ベース ─────────────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ─── レイアウト ─────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ─── ヘッダー ───────────────────────────────────────────────────────────── */
header {
  text-align: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-accent);
}

.subtitle {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* ─── Zero-Trust バッジ ──────────────────────────────────────────────────── */
.zero-trust-badge {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--color-badge-bg);
  border: 1px solid var(--color-badge-border);
  border-radius: var(--radius-lg);
}

.badge-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}

.badge-text strong {
  color: var(--color-success);
  font-size: 0.9375rem;
  display: block;
  margin-bottom: 0.25rem;
}

.badge-text p {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* ─── ステートパネル ─────────────────────────────────────────────────────── */
.state-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.hidden {
  display: none !important;
}

/* ── ローディング ── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── 成功 ── */
.success-icon {
  font-size: 2.5rem;
}

#state-success h2 {
  font-size: 1.25rem;
  color: var(--color-success);
}

.secret-box {
  width: 100%;
}

#secret-output {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  padding: 0.875rem 1rem;
  resize: vertical;
  cursor: default;
  outline: none;
  transition: border-color 0.2s;
}

#secret-output:focus {
  border-color: var(--color-accent);
}

/* ─── ボタン ─────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-accent);
  color: #0d1117;
  font-weight: 700;
  font-size: 0.9375rem;
  border: none;
  border-radius: var(--radius);
  padding: 0.625rem 1.5rem;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

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

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  display: inline-block;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}

button:disabled { opacity: 0.6; cursor: wait; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.btn-secondary:hover {
  background: rgba(88, 166, 255, 0.1);
}

/* ─── コピーフィードバック ───────────────────────────────────────────────── */
.copy-feedback {
  color: var(--color-success);
  font-size: 0.875rem;
  font-weight: 600;
}

/* ─── 警告ボックス ───────────────────────────────────────────────────────── */
.warning-box {
  width: 100%;
  background: rgba(210, 153, 34, 0.1);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: #e3b341;
  text-align: left;
  line-height: 1.5;
}

/* ─── エラー ─────────────────────────────────────────────────────────────── */
.error-icon {
  font-size: 2.5rem;
}

#state-error h2 {
  color: var(--color-error);
  font-size: 1.25rem;
}

.error-message {
  background: var(--color-surface-2);
  border: 1px solid var(--color-error);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-error);
  width: 100%;
  text-align: left;
  word-break: break-all;
}

.error-hint {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.error-hint code {
  background: var(--color-surface-2);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--color-accent);
}

/* ─── Info ───────────────────────────────────────────────────────────────── */
.info-icon {
  font-size: 2.5rem;
}

#state-no-payload h2 {
  font-size: 1.25rem;
}

#state-no-payload p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

#state-no-payload code {
  background: var(--color-surface-2);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--color-accent);
}

/* ─── フッター ───────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

footer a {
  color: var(--color-accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ─── アクセシビリティ ───────────────────────────────────────────────────── */
.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;
}

/* ─── レスポンシブ ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.5rem;
  }

  .state-panel {
    padding: 1.5rem 1rem;
  }
}
