:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --primary: #2554d5;
  --primary-soft: rgba(37, 84, 213, 0.12);
  --accent: #f28b30;
  --text: #1f2937;
  --text-light: #4b5563;
  --border: #e5e7eb;
  --success: #059669;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Noto Sans JP", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  line-height: 1.6;
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.app-header {
  background: linear-gradient(120deg, #1e3a8a, #312e81);
  color: #fff;
  padding: 48px 0 64px;
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}

.tagline {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  opacity: 0.84;
  margin-bottom: 12px;
}

.app-header h1 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin: 0 0 12px;
}

.lead {
  margin: 0;
  font-size: 1rem;
  max-width: 640px;
}

.header-highlight {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  text-align: center;
  min-width: 160px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.header-highlight p {
  margin: 0 0 4px;
  font-size: 0.85rem;
  opacity: 0.9;
}

.header-highlight strong {
  font-size: 1.8rem;
  letter-spacing: 0.06em;
}

.app-main {
  margin-top: -44px;
  padding-bottom: 80px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 28px;
}

.form-panel, .result-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
  position: relative;
}

.api-key-card {
  border: 2px solid #3b82f6;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
}

.api-key-card h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e40af;
}

.api-notice {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: #1e3a8a;
  line-height: 1.6;
}

.email-config-card {
  border: 2px solid #10b981;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #d1fae5, #ecfdf5);
}

.email-config-card h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #047857;
}

.email-notice {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: #065f46;
  line-height: 1.6;
}

.webhook-config-card {
  border: 2px solid #8b5cf6;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #ede9fe, #f5f3ff);
}

.webhook-config-card h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #5b21b6;
}

.webhook-notice {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: #6b21a8;
  line-height: 1.6;
}

.progress-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  background: #f8fafc;
}

.progress-card h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 600;
}

.progress-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.progress-list li {
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-light);
  transition: 0.2s ease;
}

.progress-list li.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}

.progress-list li.completed {
  border-color: var(--success);
  color: var(--success);
  background: rgba(5, 150, 105, 0.12);
}

.form-step {
  display: none;
  animation: fadeIn 0.35s ease;
}

.form-step.active {
  display: block;
}

.form-step header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 28px;
}

.step-label {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.form-step h2 {
  margin: 12px 0 12px;
  font-size: 1.45rem;
}

.form-step p {
  margin: 0;
  color: var(--text-light);
  font-size: 0.95rem;
}

.step-tip {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.9rem;
  color: #92400e;
  line-height: 1.6;
}

.step-tip strong {
  display: block;
  margin-bottom: 4px;
  color: #78350f;
}

.field-grid {
  display: grid;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
}

input[type="text"],
textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: 0.2s ease;
  background: #fff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field.error input[type="text"],
.field.error textarea,
.option-list.error {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25);
}

.validation-message {
  font-size: 0.82rem;
  color: #b91c1c;
  margin: -4px 0 0;
}

.field-hint {
  display: block;
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 6px;
  line-height: 1.5;
}

.option-list {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.option-list.multi {
  gap: 10px;
}

.option-list label {
  font-weight: 500;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.5;
}

.option-list input[type="radio"],
.option-list input[type="checkbox"] {
  margin-top: 3px;
}

.inline {
  align-items: center !important;
}

.inline-input {
  margin-top: 8px;
  width: 100%;
}

.form-navigation {
  margin-top: 36px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.nav-btn,
.submit-btn,
.secondary-btn {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-btn {
  background: #e2e8f0;
  color: var(--text);
}

.nav-btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 20px rgba(37, 84, 213, 0.25);
}

.nav-btn:disabled,
.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.nav-btn:not(:disabled):hover,
.submit-btn:not(:disabled):hover,
.secondary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.submit-btn {
  display: none;
  background: linear-gradient(120deg, #2563eb, #7c3aed);
  color: #fff;
  box-shadow: 0 20px 28px rgba(79, 70, 229, 0.32);
}

.submit-btn.visible {
  display: inline-flex;
}

.secondary-btn {
  background: var(--primary-soft);
  color: var(--primary);
}

.secondary-btn.ghost {
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--border);
}

.result-panel {
  background: linear-gradient(160deg, #fef3c7, #fef9e7, #f0f9ff);
  color: #1f2937;
  overflow: hidden;
  border: 3px solid #fbbf24;
  box-shadow: 0 8px 32px rgba(251, 191, 36, 0.2);
}

.result-placeholder {
  display: grid;
  gap: 20px;
  text-align: left;
  color: #374151;
}

.result-placeholder h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #78350f;
}

.preview-card {
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 2px dashed #fbbf24;
}

.preview-card ul {
  padding-left: 18px;
  margin: 12px 0 0;
  color: #4b5563;
}

.result-content {
  display: grid;
  gap: 24px;
}

.result-content.hidden {
  display: none;
}

.result-header {
  border-bottom: 3px solid #fbbf24;
  padding-bottom: 16px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.result-tag {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #92400e;
  background: #fef3c7;
  padding: 4px 12px;
  border-radius: 999px;
  display: inline-block;
}

.result-header h2 {
  margin: 12px 0 8px;
  font-size: 1.8rem;
  color: #78350f;
  font-weight: 700;
}

.result-header p {
  margin: 0;
  color: #4b5563;
}

.result-section {
  background: rgba(255, 255, 255, 0.8);
  border: 3px solid #fbbf24;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 4px 4px 0 rgba(251, 191, 36, 0.3);
  position: relative;
}

.result-section::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 20px;
  width: 40px;
  height: 6px;
  background: #f59e0b;
  border-radius: 3px;
}

.result-section h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.3rem;
  color: #92400e;
  font-weight: 700;
  border-bottom: 2px dotted #fbbf24;
  padding-bottom: 8px;
}

.result-section ul {
  margin: 0;
  padding-left: 24px;
  display: grid;
  gap: 12px;
}

.result-section li {
  position: relative;
  padding-left: 8px;
  line-height: 1.7;
  color: #1f2937;
}

.result-section li::marker {
  color: #f59e0b;
  font-weight: bold;
}

.highlight-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #78350f;
  font-weight: 700;
  font-size: 0.95rem;
  margin-right: 8px;
  margin-bottom: 12px;
  box-shadow: 3px 3px 0 rgba(245, 158, 11, 0.3);
  border: 2px solid #fff;
}

.personal-message {
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  border-left: 5px solid #3b82f6;
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
  box-shadow: 2px 2px 0 rgba(59, 130, 246, 0.2);
}

.personal-message strong {
  color: #1e40af;
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.personal-message p {
  margin: 0;
  line-height: 1.8;
  color: #1e3a8a;
}

.result-footer {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.secondary-btn.primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 3px 3px 0 rgba(37, 99, 235, 0.3);
}

.app-footer {
  padding: 40px 0;
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111827;
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
  display: none;
  z-index: 999;
}

.toast.visible {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .result-panel {
    order: -1;
  }
}

@media (max-width: 720px) {
  .app-header {
    padding: 40px 0 60px;
  }

  .header-inner {
    flex-direction: column;
  }

  .form-panel,
  .result-panel {
    padding: 24px;
  }

  .form-navigation {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-btn,
  .submit-btn,
  .secondary-btn {
    width: 100%;
    justify-content: center;
  }
}
