/* =========================
   Base
========================= */

:root {
  --background: #f5f3ef;
  --surface: #ffffff;
  --text: #242424;
  --muted: #6f6b65;
  --border: #d8d3cb;
  --accent: #3f5f58;
  --accent-hover: #314c46;
  --accent-soft: #edf2f0;
  --focus: #9db6af;
  --disabled: #b8b5b0;
  --shadow: 0 8px 24px rgba(32, 28, 22, 0.07);
  --radius-large: 18px;
  --radius-medium: 12px;
  --radius-small: 8px;
}

/* =========================
   Reset / global
========================= */

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Hiragino Sans",
    "Hiragino Kaku Gothic ProN",
    "Yu Gothic",
    "Meiryo",
    sans-serif;
  line-height: 1.6;
}

button,
textarea,
input {
  font: inherit;
}

/* =========================
   Layout
========================= */

.app {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.app-header {
  margin-bottom: 20px;
}

.app-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 7vw, 2.5rem);
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.app-description {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  margin-top: 16px;
  padding: 20px 16px;
  background: var(--surface);
  border: 1px solid rgba(216, 211, 203, 0.8);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
}

.section-title {
  margin: 0 0 18px;
  font-size: 1.15rem;
}

/* =========================
   Form
========================= */

.form-group {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}

.form-group > label,
.form-group > legend {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
  font-weight: 700;
}

.field-help {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 13px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: #fff;
  color: var(--text);
  line-height: 1.65;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

textarea::placeholder {
  color: #9a958f;
}

textarea:focus-visible,
input[type="radio"]:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.radio-group {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.radio-option:hover {
  background: #faf9f7;
}

.radio-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.radio-option input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

/* =========================
   Buttons
========================= */

button {
  width: 100%;
  min-height: 48px;
  padding: 11px 16px;
  border-radius: var(--radius-medium);
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.05s ease;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.secondary-button {
  margin-top: 14px;
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
}

.secondary-button:hover:not(:disabled) {
  background: var(--accent-soft);
}

button:disabled {
  border-color: var(--disabled);
  background: #efeeec;
  color: #8c8882;
  cursor: not-allowed;
}

/* =========================
   Result
========================= */

.result-card {
  scroll-margin-top: 12px;
}

.result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.result-header .section-title {
  margin: 0;
}

.copy-status {
  min-height: 1.5em;
  margin: 0;
  color: var(--accent);
  font-size: 0.85rem;
  text-align: right;
}

.result-textarea {
  min-height: 260px;
  background: #faf9f7;
}

/* =========================
   Footer
========================= */

.app-footer {
  padding: 20px 8px 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.app-footer p {
  margin: 0;
}

/* =========================
   Desktop enhancement
========================= */

@media (min-width: 640px) {
  .app {
    padding-top: 40px;
    padding-bottom: 56px;
  }

  .card {
    padding: 28px;
  }

  .radio-group {
    grid-template-columns: repeat(3, 1fr);
  }

  .primary-button,
  .secondary-button {
    width: auto;
    min-width: 180px;
  }

  .primary-button {
    display: block;
    margin-left: auto;
  }

  .secondary-button {
    display: block;
    margin-left: auto;
  }
}
