/* ========================================
   🌈 カラーテーマ & 基本変数
======================================== */
:root {
  --bg: #f6f7fb;
  --card: #fff;
  --text: #222;
  --muted: #6b7280;
  --primary: #1a73e8;
  --primary-ghost: #e8f0fe;
  --border: #e5e7eb;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --radius: 14px;
}

/* ========================================
   🧱 リセット & ベース
======================================== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding-bottom: env(safe-area-inset-bottom);
}
img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}
input,
button,
select {
  font-size: 16px;
}

/* ========================================
   🧭 レイアウト
======================================== */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ========================================
   🏷️ ヘッダー/フッター
======================================== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.site-header h1 {
  margin: 0;
  padding: 20px 0 4px;
  font-size: 1.6rem;
}
.lead {
  margin: 0 0 16px;
  color: var(--muted);
}
.site-footer {
  margin: 24px 0;
  color: var(--muted);
  text-align: center;
}

/* ========================================
   📦 カード（共通）
======================================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 16px 0;
}
.card h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  row-gap: 6px;
  margin-bottom: 8px;
}
.head-actions {
  display: flex;
  gap: 8px;
}

/* ========================================
   🧩 入力
======================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}
.field input,
.field select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
}

/* ========================================
   🔘 ボタン・アクション（共通）
======================================== */
.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  row-gap: 8px;
  gap: 10px;
  margin-top: 20px;
}
#sendBtn {
  min-width: 200px;
  text-align: center;
}
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: #111;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.btn.ghost {
  background: var(--primary-ghost);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.msg {
  min-height: 1.4em;
  color: var(--primary);
}
.meta {
  color: var(--muted);
  font-size: 0.95rem;
}

/* busy状態の視覚ヒント（送信ボタン） */
#sendBtn[aria-busy='true'] {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
}
#sendBtn[aria-busy='true']::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: rgba(255, 255, 255, 1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* フォーカスリング（共通） */
.star:focus-visible,
.btn:focus-visible,
.more-btn:focus-visible,
.clear-mini:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ========================================
   📊 ランキング（共通のベース）
======================================== */
.ranking {
  padding-left: 22px;
  margin: 10px 0;
}
.ranking li {
  margin: 6px 0;
}
.badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.8rem;
  color: #fff;
  background: #10b981;
  border-radius: 999px;
  padding: 2px 8px;
}
.badge.muted {
  background: #9ca3af;
}
.em {
  font-weight: 700;
}

/* 共通リンク（マニュアルなどでも使用） */
.help-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--primary);
  text-decoration: none;
}

/* スクロールしても動かない（固定ヘッダー） */
.site-header {
  position: sticky; /* 画面上部に張り付く */
  top: 0;
  z-index: 1000;
}

/* ロゴ + タイトルの横並び */
.site-header__inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.site-header__logo img {
  display: block;
  width: 80px;
  height: 60px;
  object-fit: contain;
}

.site-header__title {
  font-weight: 700;
  font-size: 1.6rem; /* ← 好みで調整 */
  line-height: 1.2;
}

/* ========================================
   📱 レスポンシブ（共通）
======================================== */
@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }
}
