/* ===== リセット・ベース ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:        #E87722;
  --accent-dark:   #c9641a;
  --accent-light:  #fff4ec;
  --success:       #22c55e;
  --warn:          #f59e0b;
  --fail:          #ef4444;
  --bg:            #ffffff;
  --bg-section:    #f8f8f8;
  --bg-note:       #f5f5f5;
  --bg-card:       #ffffff;
  --bg-input:      #ffffff;
  --text:          #1a1a1a;
  --text-dark:     #333333;
  --text-muted:    #666666;
  --border:        #dddddd;
  --border-light:  #eeeeee;
  --radius:        10px;
  --shadow-card:   0 2px 12px rgba(0,0,0,0.07);
  --shadow-hover:  0 4px 20px rgba(232,119,34,0.15);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans JP', 'Hiragino Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

/* ===== コンテナ ===== */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== ヘッダー ===== */
.site-header {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 2px solid var(--accent);
  background: var(--bg);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.3px;
}

.tagline {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== ヒーローセクション ===== */
.hero {
  padding: 56px 0 0;
}

.hero-content {
  text-align: center;
  margin-bottom: 56px;
}

.hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 900;
  line-height: 1.35;
  margin-bottom: 20px;
  color: var(--text);
  letter-spacing: -0.5px;
}

.hero-desc {
  color: var(--text-dark);
  font-size: 0.97rem;
  max-width: 520px;
  margin: 0 auto 36px;
  line-height: 1.85;
}

/* ===== フォーム ===== */
.analyze-form { position: relative; }

.input-group {
  display: flex;
  gap: 8px;
  max-width: 620px;
  margin: 0 auto 10px;
}

.url-input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg-input);
  color: var(--text);
}

.url-input::placeholder { color: #aaaaaa; }

.url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,119,34,0.12);
}

.submit-btn {
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  white-space: nowrap;
}

.submit-btn:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 16px rgba(232,119,34,0.3);
}

.submit-btn:active { transform: scale(0.98); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.input-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 10px;
}

.input-note {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-note);
  border-radius: 6px;
  padding: 8px 14px;
  max-width: 560px;
  line-height: 1.6;
}

/* ===== ローディング ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

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

.spinner {
  width: 52px;
  height: 52px;
  border: 5px solid #ffe8d4;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 20px;
}

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

.loading-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.loading-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.loading-progress {
  width: 240px;
  height: 5px;
  background: #ffe8d4;
  border-radius: 99px;
  overflow: hidden;
  margin: 0 auto;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 0%;
  transition: width 0.5s ease;
}

/* ===== エラーボックス ===== */
.error-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff5f5;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 16px auto 0;
  max-width: 620px;
  font-size: 0.9rem;
}

/* ===== 診断カテゴリセクション ===== */
.categories-preview {
  background: var(--bg-section);
  border-radius: 14px;
  padding: 36px 32px 40px;
  margin-bottom: 0;
}

.categories-preview h2 {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  margin-bottom: 22px;
  text-align: center;
}

.category-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.category-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--text-dark);
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: default;
}

.category-list li:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.cat-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

/* ===== フッター ===== */
.site-footer {
  text-align: center;
  padding: 22px 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  margin-top: 0;
  background: var(--bg-section);
}

.site-footer a { color: var(--accent); }
.site-footer a:hover { color: var(--accent-dark); }

/* ===== 結果画面 ===== */
.result-header {
  text-align: center;
  padding: 40px 0 24px;
}

.result-url {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  word-break: break-all;
}

.result-url a { color: var(--accent); }

.result-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== スコアサークル ===== */
.score-circle-wrap {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

.score-circle {
  position: relative;
  width: 160px;
  height: 160px;
}

.score-circle svg {
  transform: rotate(-90deg);
  width: 160px;
  height: 160px;
}

.score-track {
  fill: none;
  stroke: #eeeeee;
  stroke-width: 12;
}

.score-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 408;
  stroke-dashoffset: 408;
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1);
}

.score-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
}

.score-max {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.score-grade {
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 2px;
}

/* ===== サマリー ===== */
.summary-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-dark);
}

/* ===== カテゴリセクション ===== */
.categories-section { margin-bottom: 32px; }

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

/* ===== バーチャート ===== */
.bar-chart {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.bar-row:last-child { margin-bottom: 0; }

.bar-label {
  width: 160px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-shrink: 0;
  text-align: right;
}

.bar-track {
  flex: 1;
  height: 13px;
  background: #f0f0f0;
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

.bar-score {
  width: 36px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* ===== カテゴリカード ===== */
.category-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.category-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.category-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background 0.15s;
}

.category-card-header:hover { background: var(--accent-light); }
.category-card-header.open { border-bottom-color: var(--border-light); }

.cat-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.cat-score-badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 99px;
}

.cat-chevron {
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.category-card-header.open .cat-chevron { transform: rotate(180deg); }

.category-card-body {
  display: none;
  padding: 16px 20px;
  background: #fafafa;
}

.category-card-body.open { display: block; }

/* ===== Findings ===== */
.finding-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.finding-item:last-child { border-bottom: none; }

.finding-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.finding-text { font-size: 0.88rem; color: var(--text-dark); line-height: 1.55; }

.finding-tip {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.55;
}

/* ===== 改善アドバイス ===== */
.advice-section { margin-bottom: 32px; }

.advice-list { list-style: none; }

.advice-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  padding: 14px 18px;
  margin-bottom: 10px;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-dark);
}

.advice-rank {
  background: var(--fail);
  color: #fff;
  border-radius: 99px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.advice-rank.warn-rank { background: var(--warn); }

/* ===== アクションボタン ===== */
.action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.btn-secondary {
  padding: 11px 24px;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn-secondary:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(232,119,34,0.25);
}

/* ===== hidden ===== */
.hidden { display: none !important; }

/* ===== レスポンシブ ===== */
@media (max-width: 600px) {
  .container { padding: 0 14px; }
  .input-group { flex-direction: column; }
  .submit-btn { justify-content: center; }
  .bar-label { width: 110px; font-size: 0.75rem; }
  .tagline { display: none; }
  .score-circle { width: 130px; height: 130px; }
  .score-circle svg { width: 130px; height: 130px; }
  .score-number { font-size: 2rem; }
  .categories-preview { padding: 28px 16px 32px; }
  .category-list { grid-template-columns: 1fr; }
}
