:root {
  --ink: #152033;
  --ink-soft: #5a6478;
  --ink-muted: #7b8499;
  --surface: #ffffff;
  --surface-soft: #f7f8fb;
  --bg: #eef1f6;
  --bg-accent-a: #d9ebe8;
  --bg-accent-b: #f3e6dc;
  --border: #e2e7f0;
  --border-strong: #cfd7e6;
  --assistant: #0f766e;
  --assistant-soft: #e8f6f4;
  --assistant-hover: #0b5f59;
  --assistant-ring: rgba(15, 118, 110, 0.22);
  --generate: #c05621;
  --generate-soft: #fdf1e9;
  --generate-hover: #9f4518;
  --generate-ring: rgba(192, 86, 33, 0.22);
  --danger-bg: #fdf2f2;
  --danger-border: #f0caca;
  --danger-text: #9b2c2c;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(21, 32, 51, 0.04), 0 10px 28px rgba(21, 32, 51, 0.06);
  --shadow-soft: 0 8px 20px rgba(21, 32, 51, 0.05);
  --font: "Outfit", "Noto Sans JP", sans-serif;
  --space-page: clamp(1.25rem, 3vw, 2.5rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 90% 55% at 8% -8%, var(--bg-accent-a) 0%, transparent 55%),
    radial-gradient(ellipse 80% 45% at 96% 0%, var(--bg-accent-b) 0%, transparent 50%),
    linear-gradient(180deg, #f5f7fb 0%, var(--bg) 100%);
  line-height: 1.7;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-page) clamp(1rem, 3vw, 1.5rem) 4rem;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
  padding: 0.75rem 0 0.25rem;
}

.app-title {
  margin: 0;
  font-size: clamp(1.85rem, 4.2vw, 2.65rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--ink);
}

.app-tagline {
  margin: 0.75rem auto 0;
  max-width: 28rem;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  color: var(--ink-soft);
  font-weight: 400;
  line-height: 1.65;
}

/* Two-column main */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.25rem, 2.5vw, 1.75rem);
  align-items: start;
}

/* Panels (cards) */
.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: clamp(1.35rem, 2.5vw, 1.9rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel-assistant {
  border-top: 4px solid var(--assistant);
}

.panel-generate {
  border-top: 4px solid var(--generate);
}

.panel-header h2 {
  margin: 0.55rem 0 0.55rem;
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.panel-desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

.panel-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.panel-assistant .panel-badge {
  background: var(--assistant-soft);
  color: var(--assistant);
}

.panel-generate .panel-badge {
  background: var(--generate-soft);
  color: var(--generate);
}

/* Form fields */
.panel-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.field-input {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  width: 100%;
  min-height: 48px;
  appearance: none;
}

select.field-input {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.4rem;
}

.field-input:hover {
  border-color: #b7c2d6;
}

.field-input:focus {
  outline: none;
  border-color: var(--assistant);
  box-shadow: 0 0 0 4px var(--assistant-ring);
  background: #fff;
}

.panel-generate .field-input:focus {
  border-color: var(--generate);
  box-shadow: 0 0 0 4px var(--generate-ring);
}

.field-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.65;
}

.field-textarea::placeholder {
  color: var(--ink-muted);
}

/* Upload zone */
.upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1.6rem 1.1rem;
  border: 1.5px dashed #b9c5d8;
  border-radius: var(--radius);
  background: var(--surface-soft);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.upload-zone:hover,
.upload-zone.is-dragover {
  border-color: var(--assistant);
  background: var(--assistant-soft);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}

.upload-zone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.upload-icon {
  color: var(--assistant);
  display: flex;
  margin-bottom: 0.15rem;
}

.upload-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 22rem;
}

.upload-zone.has-file .upload-text {
  color: var(--assistant);
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 650;
  padding: 0.95rem 1.35rem;
  min-height: 52px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: #fff;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn-assistant {
  background: var(--assistant);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.28);
}

.btn-assistant:hover {
  background: var(--assistant-hover);
}

.btn-generate {
  background: var(--generate);
  box-shadow: 0 8px 18px rgba(192, 86, 33, 0.28);
}

.btn-generate:hover {
  background: var(--generate-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Result / sample output */
.result-box {
  background: var(--assistant-soft);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  border: 1px solid #c7e5e1;
}

.result-title {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.result-body {
  font-size: 0.98rem;
  color: var(--ink);
  line-height: 1.75;
}

.result-body p {
  margin: 0 0 0.55rem;
}

.result-body ul {
  margin: 0;
  padding-left: 1.25rem;
}

.result-body li {
  margin-bottom: 0.45rem;
}

.result-body li:last-child {
  margin-bottom: 0;
}

.result-box.is-flash {
  animation: flash 0.5s ease;
}

.result-box.is-loading {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.result-box.is-error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.result-placeholder {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.notice-box {
  background: var(--generate-soft);
  border: 1px solid #efd2bf;
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  font-size: 0.95rem;
  color: var(--ink);
}

.notice-box.is-error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.notice-box p {
  margin: 0;
  line-height: 1.65;
}

@keyframes flash {
  0%,
  100% {
    background: var(--assistant-soft);
  }
  40% {
    background: #d7f1ed;
  }
}

/* Preview section */
.preview-section {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.preview-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.preview-placeholder {
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.15rem;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.2)),
    repeating-linear-gradient(
      -45deg,
      #fafbfd,
      #fafbfd 10px,
      #f2f5f9 10px,
      #f2f5f9 20px
    );
}

.preview-page {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.preview-meta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--generate);
  background: var(--generate-soft);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.preview-label {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink-soft);
}

.preview-note {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
  max-width: 12.5rem;
  line-height: 1.5;
}

/* Tablet */
@media (max-width: 960px) {
  .main-grid {
    grid-template-columns: 1fr;
    gap: 1.35rem;
  }

  .preview-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Phone */
@media (max-width: 640px) {
  .app-header {
    margin-bottom: 1.5rem;
  }

  .panel {
    gap: 1.25rem;
    padding: 1.2rem;
  }

  .panel-form {
    gap: 1.1rem;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
  }

  .upload-zone {
    padding: 1.35rem 0.9rem;
  }

  .field-input,
  .btn {
    font-size: 1rem;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn,
  .field-input,
  .upload-zone {
    transition: none;
  }

  .result-box.is-flash {
    animation: none;
  }
}
