:root {
  --bg: #ffffff;
  --bg-soft: #fff6ea;
  --card: #ffffff;
  --text: #191410;
  --text-sub: #7a6a5c;
  --line: #f0e2d2;
  --accent: #e8420c;
  --accent-text: #ffffff;
  --going: #1f9d55;
  --going-bg: #e5f6ec;
  --wait: #b7791f;
  --wait-bg: #fdf3e0;
  --notgoing: #6b7280;
  --notgoing-bg: #f0f0ef;
  --danger: #d64545;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] {
  --bg: #000000;
  --bg-soft: #2c231b;
  --card: #1c1712;
  --text: #f8f0e5;
  --text-sub: #b3a08d;
  --line: #3d3226;
  --accent: #ff6a35;
  --accent-text: #ffffff;
  --going: #3fce7f;
  --going-bg: #0f2b1a;
  --wait: #eab543;
  --wait-bg: #2f2708;
  --notgoing: #9ca3af;
  --notgoing-bg: #232326;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  max-width: 100%;
}

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

a { color: var(--accent); overflow-wrap: anywhere; }

/* 見出し・ボタン類は試作と同じ丸ゴシックで柔らかく */
.site-logo, .card h2, .hero .big, .event-title, .btn, .rsvp-btn,
.status-banner, .summary-box .num, .rsvp-guide, .cover-chip {
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
}

/* ---------- header / footer ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-logo { color: var(--text); text-decoration: none; font-weight: 800; font-size: 18px; white-space: nowrap; }
.header-actions { flex-shrink: 0; }
@media (max-width: 560px) {
  .site-header { padding: 8px 10px; }
  .site-logo { font-size: 15px; }
  .theme-toggle { padding: 5px 9px; font-size: 12px; }
  .header-create { padding: 6px 10px; font-size: 13px; }
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.header-create {
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 700;
}
.site-footer {
  text-align: center;
  color: var(--text-sub);
  font-size: 13px;
  padding: 28px 16px 90px;
}

/* ---------- layout ---------- */
.app-main { max-width: 640px; margin: 0 auto; padding: 16px 16px 40px; width: 100%; }
.loading, .muted { color: var(--text-sub); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 18px; }

/* ---------- forms ---------- */
.field { margin: 14px 0; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--text-sub); font-size: 12px; }
.field input[type="text"], .field input[type="number"], .field input[type="datetime-local"],
.field select, .field textarea {
  width: 100%;
  max-width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.field textarea { min-height: 76px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- buttons ---------- */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  margin: 10px 0;
}
.btn-accent { background: var(--accent); color: var(--accent-text); }
.btn-ghost { background: var(--bg-soft); color: var(--text); border: 1px solid var(--line); }
.btn-line { background: #06c755; color: #fff; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-small { padding: 9px 12px; font-size: 14px; border-radius: 10px; margin: 4px 0; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* RSVP big buttons */
.rsvp-btn {
  display: block;
  width: 100%;
  border-radius: 18px;
  font-weight: 900;
  cursor: pointer;
  text-align: center;
  border: 3px solid transparent;
  margin: 10px 0;
  padding: 20px 12px;
  font-size: 22px;
  min-height: 68px;
}
.rsvp-going {
  background: var(--theme, var(--accent));
  color: #fff;
  min-height: 78px;
  font-size: 25px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.rsvp-notgoing { background: var(--card); color: var(--text); border-color: var(--line); min-height: 58px; font-size: 19px; }
.rsvp-btn.selected { outline: 4px solid var(--theme, var(--accent)); outline-offset: 2px; }
.rsvp-btn:disabled { opacity: 0.6; }

/* ボタンの直上の誘導文：押す場所を一目で伝える */
.rsvp-guide {
  text-align: center;
  font-weight: 900;
  font-size: 17px;
  line-height: 1.5;
  margin: 2px 0 12px;
}
.rsvp-guide .arrow {
  display: inline-block;
  color: var(--theme, var(--accent));
  font-size: 21px;
  animation: bob 1.2s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
.rsvp-note { text-align: center; color: var(--text-sub); font-size: 12px; margin: 10px 0 0; }

/* ---------- event page ---------- */
.event-cover { text-align: center; padding: 18px 8px 4px; }
.event-emoji { font-size: 64px; line-height: 1.1; }
.event-type { color: var(--accent); font-weight: 800; font-size: 14px; letter-spacing: 0.08em; }
.event-title { font-size: 27px; font-weight: 900; margin: 8px 0 4px; overflow-wrap: anywhere; line-height: 1.3; }
.event-host { color: var(--text-sub); font-size: 14px; margin: 2px 0 0; }
.event-meta { font-weight: 700; color: var(--text-sub); font-size: 15px; margin: 2px 0 0; overflow-wrap: anywhere; }

/* 表紙ヒーロー：試作と同じく、テーマカラーのチップ付きで大きく見せる。
   ゲスト画面ではファーストビューにボタンを収めるため高さは控えめ。 */
.cover-hero { position: relative; margin: -16px -16px 6px; }
.cover-hero img { display: block; width: 100%; aspect-ratio: 16 / 7; object-fit: cover; }
.cover-chip {
  position: absolute;
  right: 12px;
  top: 12px;
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* 表紙・テーマカラーの選択UI（作成／編集フォーム） */
.picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.picker label, .theme-picker label { position: relative; cursor: pointer; }
.picker input, .theme-picker input { position: absolute; opacity: 0; pointer-events: none; }
.picker .cover-thumb { display: block; border: 3px solid transparent; border-radius: 14px; overflow: hidden; }
.picker .cover-thumb img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.picker label:has(input:checked) .cover-thumb { border-color: var(--accent); }
.picker .cover-cap { display: block; text-align: center; font-size: 12px; font-weight: 700; margin-top: 3px; }
.theme-picker { display: flex; gap: 12px; flex-wrap: wrap; padding: 4px 2px; }
.theme-picker .swatch { display: block; width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; }
.theme-picker label:has(input:checked) .swatch { border-color: var(--text); transform: scale(1.1); }
.meta-list { list-style: none; margin: 0; padding: 0; }
.meta-list li { padding: 9px 2px; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; }
.meta-list li:last-child { border-bottom: none; }
.meta-list .k { font-weight: 800; margin-right: 8px; white-space: nowrap; color: var(--theme, var(--accent)); }
.capacity-bar { background: var(--bg-soft); border-radius: 999px; height: 12px; overflow: hidden; margin: 8px 0 4px; }
.capacity-fill { background: var(--theme, var(--going)); height: 100%; }
.capacity-fill.full { background: var(--wait); }

.status-banner {
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 800;
  text-align: center;
  margin: 12px 0;
  font-size: 17px;
}
.status-going { background: var(--going-bg); color: var(--going); }
.status-wait { background: var(--wait-bg); color: var(--wait); }
.status-notgoing { background: var(--notgoing-bg); color: var(--notgoing); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 14px;
  cursor: pointer;
}
.attention {
  color: var(--danger);
  font-weight: 700;
  font-size: 14px;
  min-height: 1.2em;
  margin: 6px 0;
}
.shake { animation: shake 0.3s ease 2; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.guest-names { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.guest-name {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ---------- board ---------- */
.post-item { border-bottom: 1px solid var(--line); padding: 10px 2px; overflow-wrap: anywhere; }
.post-item:last-child { border-bottom: none; }
.post-name { font-weight: 800; font-size: 14px; }
.post-time { color: var(--text-sub); font-size: 12px; margin-left: 8px; }
.post-text { margin-top: 2px; white-space: pre-wrap; }

/* ---------- share / qr ---------- */
.link-box {
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  overflow-wrap: anywhere;
  user-select: all;
}
.invite-preview {
  background: var(--going-bg);
  border-radius: 14px;
  padding: 14px 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
}
.qr-wrap { text-align: center; }
.qr-wrap canvas { max-width: 100%; height: auto; }

/* ---------- admin ---------- */
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.summary-box { background: var(--bg-soft); border-radius: 12px; padding: 12px; text-align: center; }
.summary-box .num { font-size: 26px; font-weight: 900; }
.summary-box .lbl { font-size: 13px; color: var(--text-sub); }
.rsvp-row { border-bottom: 1px solid var(--line); padding: 12px 2px; }
.rsvp-row:last-child { border-bottom: none; }
.rsvp-row .nm { font-weight: 800; overflow-wrap: anywhere; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 800;
  margin-left: 8px;
  vertical-align: 2px;
}
.badge-going { background: var(--going-bg); color: var(--going); }
.badge-wait { background: var(--wait-bg); color: var(--wait); }
.badge-notgoing { background: var(--notgoing-bg); color: var(--notgoing); }
.rsvp-row .cm { color: var(--text-sub); font-size: 14px; overflow-wrap: anywhere; }
.rsvp-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.rsvp-actions button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- my events ---------- */
.my-event { border: 1px solid var(--line); border-radius: 20px; padding: 0; margin: 14px 0; overflow: hidden; overflow-wrap: anywhere; box-shadow: var(--shadow); }
.my-event img.cover { display: block; width: 100%; aspect-ratio: 16 / 8; object-fit: cover; }
.my-event .body { padding: 12px 14px; }
.my-event .t { font-weight: 800; font-size: 17px; }

/* ---------- sticky bar ---------- */
.sticky-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}
.sticky-bar[hidden] { display: none; }
.sticky-bar button {
  flex: 1;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 900;
  padding: 14px 8px;
  cursor: pointer;
  border: 3px solid transparent;
  min-height: 56px;
}
.sticky-bar .s-going { background: var(--theme, var(--accent)); color: #fff; }
.sticky-bar .s-notgoing { background: var(--card); color: var(--text); border-color: var(--line); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast[hidden] { display: none; }

.hero { text-align: left; padding: 10px 0 2px; }
.hero .big { font-size: 30px; font-weight: 900; margin: 4px 0; line-height: 1.35; }
.hero p { color: var(--text-sub); margin: 4px 0; line-height: 1.7; }

/* ---------- polish (2026-11-18) ----------
   方向性：温かいクリーム色の「紙の招待状」感はそのままに、
   写真と出欠ボタンを主役へ。余白・影・動きを整える。ライブラリなし。 */
::selection { background: var(--accent); color: #fff; }
body { transition: background-color 0.35s ease, color 0.35s ease; }
.site-header {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.hero {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 20px 16px;
  margin-top: 6px;
  box-shadow: var(--shadow);
}
.hero .big { font-size: 32px; letter-spacing: 0.01em; }
.btn, .rsvp-btn, .chip, .theme-toggle, .header-create, .sticky-bar button {
  transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.btn:active, .rsvp-btn:active, .sticky-bar button:active { transform: scale(0.98); }
.chip:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) {
  .btn-accent:hover, .rsvp-going:hover { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.20); }
  .my-event { transition: transform 0.2s ease, box-shadow 0.2s ease; }
  .my-event:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.13); }
  .picker .cover-thumb { transition: transform 0.15s ease, border-color 0.15s ease; }
  .picker label:hover .cover-thumb { transform: translateY(-2px); }
}
.cover-hero img { animation: cover-in 0.7s ease both; }
@keyframes cover-in { from { transform: scale(1.045); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }
.my-event img.cover, .picker .cover-thumb img { transition: transform 0.5s ease; }
.capacity-fill { transition: width 0.8s ease; }
.sticky-bar {
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.toast { animation: toast-in 0.25s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* スクロールでふわっと出す（motion.js が .rv を付け、見えたら .in） */
.rv { opacity: 0; transform: translateY(14px); }
.rv.in { opacity: 1; transform: none; transition: opacity 0.55s ease, transform 0.55s ease; }
@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; }
  .rv.in { transition: none; }
  .cover-hero img, .toast { animation: none; }
  .rsvp-guide .arrow { animation: none; }
  * { transition-duration: 0.01s !important; }
}
.error-box {
  background: var(--wait-bg);
  color: var(--text);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}
