* { box-sizing: border-box; }

:root {
  --ink: #5c4b45;
  --ink-soft: #8a766e;
  --rose: #c98a95;
  --rose-deep: #b06478;
  --gold: #c8a24a;
  --cream: #fbf5ee;
  --cream-deep: #f4e9dd;
  --card: #fffaf4;
  --border: #ecd9c8;
  --green: #8fa888;
  --corner-flower: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%20120%20120%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%238fa888%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%3E%3Cpath%20d%3D%22M10%2060%20Q30%2030%2060%2020%20Q40%2045%2030%2070%20Q50%2055%2070%2035%22/%3E%3Cpath%20d%3D%22M15%2075%20Q35%2060%2045%2040%22/%3E%3C/g%3E%3Cg%20fill%3D%22%23c98a95%22%20opacity%3D%220.9%22%3E%3Ccircle%20cx%3D%2228%22%20cy%3D%2226%22%20r%3D%229%22/%3E%3Ccircle%20cx%3D%2216%22%20cy%3D%2234%22%20r%3D%228%22/%3E%3Ccircle%20cx%3D%2234%22%20cy%3D%2240%22%20r%3D%228.5%22/%3E%3Ccircle%20cx%3D%2220%22%20cy%3D%2246%22%20r%3D%226%22/%3E%3C/g%3E%3Cg%20fill%3D%22%23c8a24a%22%20opacity%3D%220.95%22%3E%3Ccircle%20cx%3D%2227%22%20cy%3D%2233%22%20r%3D%224.2%22/%3E%3C/g%3E%3Cg%20fill%3D%22%23e3aeb8%22%20opacity%3D%220.85%22%3E%3Ccircle%20cx%3D%2252%22%20cy%3D%2218%22%20r%3D%226%22/%3E%3Ccircle%20cx%3D%2260%22%20cy%3D%2212%22%20r%3D%225%22/%3E%3C/g%3E%3Cg%20fill%3D%22%23c8a24a%22%3E%3Ccircle%20cx%3D%2253%22%20cy%3D%2217%22%20r%3D%222.4%22/%3E%3Ccircle%20cx%3D%2260%22%20cy%3D%2212%22%20r%3D%222%22/%3E%3C/g%3E%3C/svg%3E");
}

body {
  margin: 0;
  font-family: "Zen Old Mincho", "Noto Serif JP", "Hiragino Mincho ProN", serif;
  background:
    radial-gradient(ellipse at top left, rgba(201,138,149,0.10), transparent 45%),
    radial-gradient(ellipse at bottom right, rgba(200,162,74,0.10), transparent 45%),
    var(--cream);
  color: var(--ink);
  min-height: 100vh;
}
a { color: var(--rose-deep); }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
  background: var(--card);
}
header h1 {
  font-size: 18px;
  margin: 0;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--ink);
}
header h1 .heart { color: var(--rose); font-size: 16px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
main { max-width: 720px; margin: 0 auto; padding: 32px 20px 70px; }

/* --- 装飾フローラルSVG --- */
.floral-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 26px;
  color: var(--rose);
}
.floral-divider::before, .floral-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  max-width: 140px;
}
.floral-divider svg { width: 26px; height: 26px; }

/* --- 招待状ページ: 写真を画面全体の背景にし、その上に招待状カードを置く --- */
body.invite-page {
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #131a2b;
}
.invite-stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.invite-header {
  position: relative;
  z-index: 2;
  padding: 13px 24px;
  background: rgba(255, 250, 244, 0.66);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(236, 217, 200, 0.5);
  flex-shrink: 0;
}
.invite-header h1 { font-size: 15px; }
.invite-header .login-btn { padding: 7px 14px; font-size: 12px; }

/* 写真: 画面全体の背景。下端基準でお二人の全身が必ず見えるようにする */
.stage-photo {
  position: fixed;
  inset: 0;
  background-size: cover;
  /* 右上のCongratulations文字と、下端の人物が両方フレームに入るように */
  background-position: right bottom;
  background-repeat: no-repeat;
  background-color: #131a2b;
  z-index: 0;
}

.stage-content {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2vh 3% 16px;
}

.invite-card {
  width: min(900px, 70vw);
  max-height: 100%;
  overflow: auto;
  /* 背後のお二人が透けるよう半透明に。文字側は影で可読性を確保する */
  background: rgba(255, 250, 244, 0.66);
  backdrop-filter: blur(3px) saturate(1.15);
  border: 1px solid rgba(255, 250, 244, 0.7);
  border-radius: 24px;
  padding: 28px 44px 24px;
  box-shadow: 0 18px 44px rgba(20, 16, 30, 0.45);
  text-align: center;
}
.invite-card .invite-message,
.invite-card .stage-dl,
.invite-card .hero-couple,
.invite-card .hero-eyebrow,
.invite-card .stage-share-text {
  text-shadow: 0 1px 2px rgba(255, 252, 247, 0.95), 0 0 8px rgba(255, 252, 247, 0.8);
}
.invite-card .invite-message { color: #4a3a34; font-weight: 500; }
.invite-card .stage-dl dd { color: #4a3a34; font-weight: 500; }
.invite-card .stage-dl dt { color: #7a655c; }
.invite-card .hero-eyebrow { color: #a8801f; }
.invite-card .stage-share-text { color: #6b574f; }

.card-head { margin-bottom: 20px; }
.hero-eyebrow {
  margin: 0;
  font-family: "Cormorant Garamond", "Zen Old Mincho", serif;
  font-style: italic;
  font-size: 16px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
}
.hero-couple {
  margin: 8px 0 0;
  font-size: clamp(32px, 3.9vw, 46px);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--rose-deep);
  line-height: 1.25;
}
.card-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--rose);
  margin: 14px auto 0;
  max-width: 480px;
}
.card-ornament::before, .card-ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.card-ornament svg { width: 26px; height: 26px; flex-shrink: 0; }

.card-body { display: block; }
.card-col-main { text-align: center; }
.card-col-side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-top: 1px dashed var(--border);
  padding-top: 20px;
  margin-top: 22px;
}

.invite-message {
  /* 1行ずつ折り返さずに表示(サイズはJSで自動調整) */
  font-size: 19px;
  line-height: 2.0;
  color: var(--ink);
  white-space: pre;
  overflow: hidden;
  margin: 0 0 18px;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
}
.stage-dl {
  display: inline-grid;
  grid-template-columns: auto 1fr;
  gap: 11px 22px;
  margin: 0;
  text-align: left;
  font-size: clamp(16px, 1.25vw, 19px);
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
}
.stage-dl dt { color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.stage-dl dd { margin: 0; color: var(--ink); }

.card-cta {
  display: inline-block;
  width: auto;
  flex: 0 0 auto;
  font-size: 17px;
  padding: 16px 40px;
  margin: 0;
}
.stage-share {
  display: flex;
  align-items: center;
  gap: 14px;
}
.stage-share img {
  width: 94px;
  height: 94px;
  background: #fff;
  border-radius: 10px;
  padding: 5px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.stage-share-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  font-size: 14px;
  color: var(--ink-soft);
}
.stage-share-text .btn { font-size: 14px; padding: 10px 18px; }

/* 縦長(スマホ・タブレット): 写真は上部の帯、カードはその下に全幅で */
@media (max-aspect-ratio: 1/1) {
  body.invite-page { overflow: auto; height: auto; }
  .stage-photo {
    position: relative;
    inset: auto;
    width: 100%;
    /* 画像全体(右上のCongratulations文字を含む)を欠けさせずに表示 */
    height: calc(100vw * 0.572);
    max-height: 46vh;
    background-size: 100% auto;
    background-position: center bottom;
    flex-shrink: 0;
  }
  .stage-content { padding: 8px 12px 10px; display: block; }
  .invite-card {
    width: auto;
    max-height: none;
    overflow: visible;
    padding: 11px 18px 10px;
    border-radius: 20px;
    /* スマホでは背後に写真がないため不透明に */
    background: rgba(255, 250, 244, 0.96);
    backdrop-filter: none;
    border-color: rgba(236, 217, 200, 0.9);
  }
  .invite-card .invite-message,
  .invite-card .stage-dl,
  .invite-card .hero-couple,
  .invite-card .hero-eyebrow,
  .invite-card .stage-share-text { text-shadow: none; }
  .card-head { margin-bottom: 10px; }
  .hero-eyebrow { font-size: 12px; letter-spacing: 0.28em; }
  .hero-couple { font-size: clamp(24px, 7vw, 32px); }
  .card-ornament { margin-top: 8px; }
  .card-col-side {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-top: 12px;
    margin-top: 12px;
  }
  /* スマホ幅では1行に収まらないため通常の折り返しに戻す */
  .invite-message {
    white-space: pre-wrap;
    font-size: 15px !important;
    line-height: 1.5;
    margin-bottom: 9px;
  }
  .stage-dl { font-size: 15px; gap: 4px 16px; }
  .card-cta { display: block; width: 100%; padding: 12px 20px; }
  .stage-share { justify-content: center; }
  .stage-share img { width: 60px; height: 60px; }
}

/* 背の低い横向き画面: 圧縮して1画面に収める */
@media (min-aspect-ratio: 1/1) and (max-height: 620px) {
  .stage-content { padding: 10px 2%; }
  .invite-card { padding: 14px 24px 12px; }
  .card-head { margin-bottom: 8px; }
  .hero-eyebrow { font-size: 12px; }
  .hero-couple { font-size: clamp(22px, 2.7vw, 28px); }
  .card-ornament { margin-top: 6px; }
  .card-ornament svg { width: 18px; height: 18px; }
  .invite-message { line-height: 1.75; margin-bottom: 12px; }
  .stage-dl { font-size: 14px; gap: 6px 16px; }
  .card-col-side { padding-top: 12px; margin-top: 12px; gap: 16px; }
  .card-cta { font-size: 15px; padding: 12px 26px; }
  .stage-share img { width: 62px; height: 62px; }
  .stage-share-text { font-size: 12px; }
}

.event-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 30px 28px;
  margin-bottom: 26px;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(176, 100, 120, 0.06);
}
.event-card::before, .event-card::after {
  content: '';
  position: absolute;
  width: 92px;
  height: 92px;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.9;
  pointer-events: none;
}
.event-card::before {
  top: -14px; left: -14px;
  background-image: var(--corner-flower);
}
.event-card::after {
  bottom: -14px; right: -14px;
  background-image: var(--corner-flower);
  transform: rotate(180deg);
}
.event-card .couple {
  font-size: 30px;
  font-weight: 700;
  color: var(--rose-deep);
  letter-spacing: 0.06em;
  margin: 0 0 18px;
  position: relative;
  z-index: 1;
}
.event-card dl {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px 12px;
  margin: 0 auto;
  font-size: 14px;
  max-width: 320px;
  text-align: left;
  position: relative;
  z-index: 1;
}
.event-card dt { color: var(--ink-soft); font-weight: 600; }
.event-card dd { margin: 0; }
.event-card .note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--ink-soft);
  white-space: pre-wrap;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 26px;
  margin-bottom: 20px;
  box-shadow: 0 6px 18px rgba(176, 100, 120, 0.05);
}
.card h2 {
  font-size: 15px;
  margin: 0 0 18px;
  color: var(--rose-deep);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2::before { content: '❀'; color: var(--gold); font-size: 13px; }

label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
.field { margin-bottom: 16px; }
input[type="text"], input[type="number"], input[type="password"], textarea, select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 14px;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px rgba(201,138,149,0.15); }
textarea { resize: vertical; min-height: 70px; }

.attendance-choices { display: flex; gap: 10px; }
.attendance-choices label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 8px;
  cursor: pointer;
  font-size: 14px;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--ink);
  margin: 0;
  transition: border-color .15s, background .15s;
  background: #fff;
}
.attendance-choices input { display: none; }
.attendance-choices label:has(input:checked) { border-color: var(--rose); background: rgba(201,138,149,0.10); color: var(--rose-deep); font-weight: 700; }

.btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  background: var(--rose-deep);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.03em;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
}
.btn:hover { background: #9a5063; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary {
  background: transparent;
  color: var(--rose-deep);
  border: 1px solid var(--rose);
  font-weight: 600;
}
.btn.secondary:hover { background: rgba(201,138,149,0.08); }
.btn.small { padding: 7px 14px; font-size: 12px; }
.btn.danger { background: transparent; color: #b5555f; border: 1px solid #e3c3c3; }
.btn.danger:hover { background: rgba(181,85,95,0.08); }

.login-btn {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
  text-decoration: none;
  display: inline-block;
}
.login-btn:hover { border-color: var(--rose); color: var(--rose-deep); }

.login-overlay {
  position: fixed; inset: 0;
  background: rgba(92, 75, 69, 0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
.login-overlay[hidden] { display: none; }
.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 12px 30px rgba(92,75,69,0.15);
}
.login-box h2 { margin: 0 0 4px; font-size: 16px; color: var(--rose-deep); }
.login-error { color: #b5555f; font-size: 12px; min-height: 14px; font-family: -apple-system, sans-serif; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--rose-deep);
  color: #fff;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 4px;
}
.summary-tile {
  background: var(--cream-deep);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 10px;
  text-align: center;
}
.summary-tile .num { font-size: 26px; font-weight: 700; color: var(--rose-deep); line-height: 1.2; }
.summary-tile .label { font-size: 12px; color: var(--ink-soft); margin-top: 4px; font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif; }

table { width: 100%; border-collapse: collapse; font-size: 13px; font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--ink-soft); font-weight: 600; font-size: 12px; }
td.msg { color: var(--ink-soft); max-width: 220px; word-break: break-word; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tag.att-出席 { background: rgba(143, 168, 136, 0.18); color: #5f7a58; }
.tag.att-欠席 { background: rgba(181, 85, 95, 0.12); color: #b5555f; }
.tag.att-未定 { background: rgba(200, 162, 74, 0.18); color: #a3822f; }
.tag.src { background: var(--cream-deep); color: var(--ink-soft); }
.row-actions { display: flex; gap: 6px; }
.table-wrap { overflow-x: auto; }

.share-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.share-link-box {
  display: flex; gap: 8px; margin-top: 4px;
}
.share-link-box input { flex: 1; }
.qr-wrap { display: flex; align-items: center; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.qr-wrap img { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 8px; width: 160px; height: 160px; }
.share-preview {
  background: var(--cream-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  white-space: pre-wrap;
  color: var(--ink-soft);
  margin-top: 4px;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .field.full { grid-column: 1 / -1; }

.done-box { text-align: center; padding: 46px 20px; }
.done-box .icon { font-size: 42px; margin-bottom: 14px; }
.done-box h2 { color: var(--rose-deep); margin-bottom: 8px; }
.done-box p { color: var(--ink-soft); font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.settings-grid .field.full { grid-column: 1 / -1; }

footer.hint { text-align: center; color: var(--ink-soft); font-size: 12px; padding: 24px; font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif; opacity: 0.8; }

.message-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.message-item:last-child { border-bottom: none; }
.message-item .msg-name { font-weight: 700; color: var(--rose-deep); font-size: 13px; margin-bottom: 4px; font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif; }
.message-item .msg-text { font-size: 14px; color: var(--ink); white-space: pre-wrap; font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif; }
.empty-note { color: var(--ink-soft); font-size: 13px; padding: 8px 0; font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif; }

@media (max-width: 560px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .settings-grid { grid-template-columns: 1fr; }
  main { padding: 24px 14px 60px; }
  .event-card::before, .event-card::after { width: 60px; height: 60px; }
}
