/* ============================================
   あなたを〇〇に例えると？診断 - style.css
   モバイルファースト / ポップ & 清潔感のあるデザイン
   ============================================ */

:root {
  --color-primary: #ff7a59;
  --color-primary-dark: #e85f3e;
  --color-accent: #4fc3c9;
  --color-bg: #fef9f4;
  --color-card: #ffffff;
  --color-text: #33313e;
  --color-text-light: #7a7787;
  --color-border: #f0e6da;
  --color-ad-bg: #e9e9ec;
  --color-ad-text: #9a98a3;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-soft: 0 8px 24px rgba(255, 122, 89, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #fff4ec 0%, #fef9f4 40%);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.app-wrap {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- 画面切り替え ---------- */
.screen {
  display: none;
  flex-direction: column;
  padding: 20px 20px 32px;
  animation: fadeIn 0.35s ease;
}

.screen.is-active {
  display: flex;
}

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

/* ---------- 広告枠プレースホルダー ---------- */
.ad-space {
  width: 100%;
  min-height: 90px;
  max-height: 250px;
  margin: 16px 0;
  background: var(--color-ad-bg);
  border: 1px dashed #c9c7cf;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-space-label {
  font-size: 0.8rem;
  color: var(--color-ad-text);
  letter-spacing: 0.05em;
}

/* ---------- 画面1：トップ ---------- */
.top-header {
  text-align: center;
  margin-bottom: 8px;
}

.app-title {
  font-size: 1.6rem;
  line-height: 1.4;
  color: var(--color-primary-dark);
  margin: 8px 0 12px;
  font-weight: 800;
}

.app-desc {
  font-size: 0.92rem;
  color: var(--color-text-light);
  line-height: 1.7;
  margin: 0;
}

.start-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-top: 12px;
  box-shadow: var(--shadow-soft);
}

.input-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text);
}

.nickname-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fffdfb;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s ease;
}

.nickname-input:focus {
  border-color: var(--color-primary);
}

.input-error {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.82rem;
  color: #e5484d;
}

/* ---------- ボタン共通 ---------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 15px 20px;
  font-size: 1.02rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  box-shadow: 0 6px 16px rgba(232, 95, 62, 0.35);
  margin-top: 6px;
}

.btn-secondary {
  background: #fff;
  color: var(--color-primary-dark);
  border: 2px solid var(--color-primary);
}

.btn-share {
  background: #14171a;
  color: #fff;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

/* ---------- 画面2：診断中アニメーション ---------- */
#screen-loading {
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.loading-wrap {
  text-align: center;
}

.loading-spinner {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
}

.loading-spinner span {
  position: absolute;
  inset: 0;
  border: 5px solid transparent;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loading-spinner span:nth-child(2) {
  border-top-color: var(--color-accent);
  animation-delay: -0.3s;
  inset: 8px;
}

.loading-spinner span:nth-child(3) {
  border-top-color: #ffd166;
  animation-delay: -0.6s;
  inset: 16px;
}

.loading-spinner span:nth-child(4) {
  border-top-color: #ff9f7a;
  animation-delay: -0.9s;
  inset: 24px;
}

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

.loading-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.dots span {
  animation: blink 1.4s infinite;
  opacity: 0;
}

.dots span:nth-child(1) { animation-delay: 0s; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 20%   { opacity: 0; }
  50%       { opacity: 1; }
  100%      { opacity: 0; }
}

/* ---------- 画面3：結果画面 ---------- */
.result-header {
  text-align: center;
  margin-bottom: 4px;
}

.result-lead {
  font-size: 0.85rem;
  color: var(--color-text-light);
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 4px 0;
}

.result-title {
  font-size: 1.5rem;
  color: var(--color-primary-dark);
  font-weight: 800;
  line-height: 1.4;
  margin: 4px 0 16px;
}

.result-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 240px;
  background: linear-gradient(135deg, #ffe3d3, #ffd6e6);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}

.result-emoji {
  font-size: 4.5rem;
  line-height: 1;
}

.result-desc {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 18px 18px;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--color-text);
  box-shadow: var(--shadow-soft);
  white-space: pre-wrap;
}

/* ---------- 共通フッター ---------- */
.app-footer {
  margin-top: auto;
  padding: 24px 20px 28px;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--color-text-light);
  border-top: 1px solid var(--color-border);
}

.app-footer p {
  margin: 0 0 10px;
}

.app-footer a {
  color: var(--color-primary-dark);
  font-weight: 700;
}

.footer-copy {
  letter-spacing: 0.05em;
}

/* ---------- プライバシーポリシーページ ---------- */
.legal-page {
  display: flex;
  flex-direction: column;
  padding: 24px 20px 32px;
}

.legal-title {
  font-size: 1.4rem;
  color: var(--color-primary-dark);
  font-weight: 800;
  margin: 8px 0 16px;
}

.legal-page h2 {
  font-size: 1.05rem;
  color: var(--color-text);
  margin: 24px 0 8px;
}

.legal-page p, .legal-page li {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--color-text);
  margin: 0 0 8px;
}

.legal-date {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.back-link {
  display: inline-block;
  margin-top: 24px;
  color: var(--color-primary-dark);
  font-weight: 700;
}

/* ---------- レスポンシブ（少し大きい画面） ---------- */
@media (min-width: 480px) {
  .app-wrap {
    margin: 24px 0;
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    min-height: calc(100vh - 48px);
  }
}
