/* =========================================================
   chousei — デザインシステム
   フォントは全て Noto Sans JP（ゴシック）で統一。
   アクセントは緑1色のみ。集計の色は同系色のトーン違い。
   ========================================================= */

:root {
  /* タイポ：フィボナッチ・タイプスケール */
  --fs-xs: 13px;
  --fs-sm: 16px;
  --fs-base: 18px;
  --fs-md: 21px;
  --fs-lg: 34px;
  --fs-xl: clamp(34px, 6vw, 55px);
  --fs-xxl: 89px;

  /* カラー */
  --text: #404040;
  --sub: #6b6b6b;
  --line: #d8d3c9;
  --white: #ffffff;
  --warm: #f8f5f0;
  --dark: #2d2d2d;
  --accent: #3e6b54; /* 森の緑：唯一のアクセント */
  --accent-ink: #2c4d3c;

  /* 集計ヒート（アクセント同系のトーン違い） */
  --heat-1: rgba(62, 107, 84, 0.16); /* 1人以上 */
  --heat-2: rgba(62, 107, 84, 0.42); /* 半分以上 */
  --heat-3: var(--accent); /* 全員 */

  --sun: #b5524b;
  --sat: #4a6a86;

  --shadow-sm: 0 2px 10px rgba(45, 45, 45, 0.08);
  --shadow-md: 0 10px 30px rgba(45, 45, 45, 0.12);
  --shadow-lg: 0 24px 60px rgba(45, 45, 45, 0.2);

  --radius: 14px;
  --maxw: 960px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", system-ui, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.8;
  color: var(--text);
  background: var(--warm);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--accent-ink);
}

/* ---------- ヘッダー / フッター ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-name {
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: 0.04em;
}

.header-cta {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--accent);
  border: 2px solid var(--accent);
  padding: 7px 16px;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}

.header-cta:hover {
  background: var(--accent);
  color: var(--white);
}

.site-footer {
  margin-top: 64px;
  padding: 28px clamp(16px, 4vw, 40px);
  background: var(--dark);
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--fs-xs);
  text-align: center;
}

.site-footer p {
  margin: 0;
}

/* ---------- レイアウト ---------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 40px);
}

.loading {
  color: var(--sub);
  padding: 40px 0;
}

.hero {
  margin-bottom: 40px;
  position: relative;
}

.hero .eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--white);
  background: var(--accent);
  padding: 6px 16px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: var(--fs-xl);
  letter-spacing: 0.02em;
  overflow-wrap: anywhere; /* 長いタイトルでも横にはみ出さない */
}

.hero .lead {
  margin-top: 16px;
  max-width: 34em;
  color: var(--sub);
  font-size: var(--fs-md);
}

/* ---------- カード / パネル ---------- */
.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(20px, 4vw, 36px);
}

.panel + .panel {
  margin-top: 28px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 20px;
}

.section-head .num {
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--accent);
  line-height: 1;
}

.section-head h2 {
  font-size: var(--fs-md);
}

.hint {
  color: var(--sub);
  font-size: var(--fs-sm);
}

/* ---------- フォーム ---------- */
.field {
  margin-bottom: 22px;
}

.field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 700;
  margin-bottom: 8px;
}

.field input[type="text"] {
  width: 100%;
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--text);
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.field input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(62, 107, 84, 0.15);
}

/* ---------- ボタン ---------- */
.btn {
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 999px;
  padding: 14px 30px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-ghost:hover {
  background: rgba(62, 107, 84, 0.08);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
}

/* ---------- カレンダー ---------- */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.cal-nav button {
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--accent);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  white-space: nowrap;
}

/* スマホ幅：年月表示は各カレンダーの見出しと重複するため隠し、
   ナビボタンが折り返さないよう小さくする */
@media (max-width: 600px) {
  .cal-nav {
    gap: 10px;
  }
  .cal-nav .range {
    display: none;
  }
  .cal-nav button {
    font-size: var(--fs-xs);
    padding: 8px 14px;
  }
}

.cal-nav button:hover {
  border-color: var(--accent);
}

.cal-nav .range {
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--sub);
}

.calendars {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

@media (min-width: 720px) {
  .calendars {
    grid-template-columns: 1fr 1fr;
  }
}

.month-title {
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
  font-size: var(--fs-md);
  margin-bottom: 12px;
  text-align: center;
}

.month-title .y {
  font-size: var(--fs-sm);
  color: var(--sub);
  margin-right: 6px;
}

.weekdays,
.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.weekdays {
  margin-bottom: 6px;
}

.weekdays span {
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--sub);
  padding: 4px 0;
}

.weekdays span.sun {
  color: var(--sun);
}

.weekdays span.sat {
  color: var(--sat);
}

.day {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  border-radius: 10px;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: default;
  position: relative;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.day.empty {
  visibility: hidden;
}

.day.past {
  color: #c3bfb6;
}

.day.sun {
  color: var(--sun);
}

.day.sat {
  color: var(--sat);
}

/* 選択可能（ホスト作成 / ゲスト回答時にタップできる） */
.day.selectable {
  cursor: pointer;
  border-color: var(--line);
  background: var(--white);
}

.day.selectable:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ホストが候補として選んだ状態（作成画面） */
.day.picked {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

/* ゲストが自分の参加可否として選んだ状態 */
.day.mine {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  font-weight: 700;
}

/* 集計ヒート（結果表示） */
.day.heat-1 {
  background: var(--heat-1);
  border-color: rgba(62, 107, 84, 0.3);
}

.day.heat-2 {
  background: var(--heat-2);
  border-color: rgba(62, 107, 84, 0.55);
  color: #23392e;
}

.day.heat-3 {
  background: var(--heat-3);
  border-color: var(--accent);
  color: var(--white);
}

.day .count {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.85;
}

/* ---------- 凡例 ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 22px;
  font-size: var(--fs-xs);
  color: var(--sub);
}

.legend .item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend .swatch {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--line);
}

.legend .swatch.s1 {
  background: var(--heat-1);
}
.legend .swatch.s2 {
  background: var(--heat-2);
}
.legend .swatch.s3 {
  background: var(--heat-3);
  border-color: var(--accent);
}

/* ---------- 共有URL ---------- */
.share {
  background: var(--warm);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-top: 8px;
}

.share .url {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.share input {
  flex: 1 1 240px;
  font-family: inherit;
  font-size: var(--fs-sm);
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
}

/* ---------- 参加者リスト ---------- */
.guests {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.guests li {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--warm);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 15px;
  max-width: 100%;
  overflow-wrap: anywhere; /* 長い名前でもはみ出さない */
}

.guests li.me {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.summary-best {
  margin-top: 20px;
  padding: 18px 20px;
  background: var(--warm);
  border-radius: 12px;
  font-size: var(--fs-sm);
}

.summary-best strong {
  color: var(--accent-ink);
}

/* ---------- 設定バナー / 通知 ---------- */
.banner {
  background: #fff8e6;
  border: 1.5px solid #e8d9a8;
  border-radius: 12px;
  padding: 20px 22px;
  font-size: var(--fs-sm);
}

.banner h2 {
  font-size: var(--fs-md);
  margin-bottom: 10px;
}

.banner code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.9em;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  max-width: calc(100vw - 40px);
  text-align: center;
  transform: translateX(-50%) translateY(20px);
  background: var(--dark);
  color: var(--white);
  font-size: var(--fs-sm);
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.error-box {
  background: #fdecea;
  border: 1.5px solid #f3c0bb;
  color: #8a2f27;
  border-radius: 12px;
  padding: 20px 22px;
  font-size: var(--fs-sm);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
