:root {
  --color-bg: #f6f3ee;
  --color-surface: #ffffff;
  --color-text: #2a2420;
  --color-text-muted: #756a61;
  --color-primary: #7a5230;
  --color-primary-dark: #5e3f24;
  --color-secondary: #2a2420;
  --color-border: #e6ded3;
  --color-accent: #b08968;
  --color-star: #c9922f;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(42, 36, 32, 0.08);
  --max-width: 480px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
}

.screen--active {
  display: flex;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px;
}

/* ---------- スタート画面 ---------- */

.start-card {
  margin: auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.logo__main {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--color-primary-dark);
}

.logo__sub {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.start-lead {
  font-size: 16px;
  color: var(--color-text);
}

.start-note {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: -4px;
}

/* ---------- ボタン共通 ---------- */

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  width: 100%;
}

.btn--primary:disabled {
  background: #d8cfc3;
  color: #a89d8f;
  cursor: not-allowed;
}

.btn--secondary {
  background: var(--color-secondary);
  color: #fff;
  width: 100%;
}

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

.btn--small {
  padding: 10px 18px;
  font-size: 13px;
}

/* ---------- 進捗表示 ---------- */

.progress {
  margin-bottom: 18px;
}

.progress__bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  transition: width 0.25s ease;
}

.progress__text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* ---------- 質問画面 ---------- */

.question-card {
  flex: 1;
}

.question-title {
  font-size: 19px;
  margin: 0 0 6px;
  line-height: 1.5;
}

.question-hint {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0 0 20px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option__mark {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--color-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
}

.option--single .option__mark {
  border-radius: 999px;
}

.option.is-selected {
  border-color: var(--color-primary);
  background: #f7efe6;
}

.option.is-selected .option__mark {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ---------- 星評価 ---------- */

.star-picker {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 24px;
}

.star {
  appearance: none;
  border: none;
  background: none;
  font-size: 40px;
  line-height: 1;
  color: var(--color-border);
  cursor: pointer;
  padding: 4px;
}

.star.is-active {
  color: var(--color-star);
}

/* ---------- ナビゲーションボタン ---------- */

.nav-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.nav-buttons .btn--ghost {
  flex: 0 0 auto;
  min-width: 92px;
}

.nav-buttons .btn--primary {
  flex: 1;
}

/* ---------- ローディング画面 ---------- */

.loading-card {
  margin: auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: var(--color-text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---------- プレビュー画面 ---------- */

.preview-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preview-title {
  font-size: 18px;
  margin: 0;
  text-align: center;
}

.preview-stars {
  text-align: center;
  font-size: 24px;
  color: var(--color-star);
  letter-spacing: 2px;
}

.preview-text-wrap {
  position: relative;
}

.preview-textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--color-accent);
  padding: 14px 40px 14px 14px;
  font-size: 15px;
  line-height: 1.8;
  font-family: inherit;
  color: var(--color-text);
  background: #fbfaf8;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.preview-textarea:focus {
  outline: none;
  border-style: solid;
  border-color: var(--color-primary);
  background: #fff;
}

.preview-edit-icon {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.preview-edit-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  margin: -8px 0 0;
}

.preview-note {
  font-size: 12px;
  color: var(--color-text-muted);
  background: #f3ede4;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0;
}

.preview-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.copy-feedback {
  min-height: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--color-primary-dark);
  margin: 0;
}

.preview-disclaimer {
  font-size: 11.5px;
  color: var(--color-text-muted);
  text-align: center;
  margin: 0;
}

.preview-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

/* ---------- レスポンシブ調整 ---------- */

@media (min-width: 520px) {
  .app {
    padding-top: 48px;
  }
}
