:root {
  --bg: #f8f8f8;
  --gray: #939393;
  --text: #313131;
  --accent: #cd7400;
  --line: #e3e3e3;
  --card: #ffffff;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
a { color: var(--accent); }
h2 { font-size: 1.15rem; margin: 0 0 0.6em; }
h3 { font-size: 1rem; margin: 1em 0 0.4em; }
.note { color: var(--gray); font-size: 0.85rem; }
.error { color: #b3261e; font-size: 0.9rem; }
.w100 { width: 100%; }

.center-msg {
  max-width: 560px;
  margin: 0 auto;
  padding: 64px 20px;
  text-align: center;
}
.expired-title { font-size: 1.25rem; font-weight: bold; }

main { max-width: 880px; margin: 0 auto; padding: 0 16px 120px; }
.block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
}

/* カバー */
#cover { margin-top: 16px; text-align: center; }
.slideshow {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 70vh;
  overflow: hidden;
  border-radius: 12px;
  background: #eee;
}
.slideshow img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.8s ease;
}
.slideshow img.active { opacity: 1; }
.slideshow.no-fade img { transition: none; }
.slide-dots {
  position: absolute;
  left: 0; right: 0; bottom: 10px;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}
.slide-dots button {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1px solid #fff;
  background: rgba(255,255,255,.45);
  padding: 0;
  cursor: pointer;
}
.slide-dots button.active { background: #fff; }
.cover-text { padding: 14px 0 2px; }
.cover-name { font-size: 1.3rem; font-weight: bold; margin: 0; }
.countdown { color: var(--accent); font-weight: bold; margin: 4px 0 0; }

/* ボタン */
.btn-main, .btn-outline, .btn-line, .btn-sub {
  display: inline-block;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  margin: 4px 0;
}
.btn-main { background: var(--text); color: #fff; border: 1px solid var(--text); }
.btn-main.big { width: 100%; padding: 14px; font-size: 1.1rem; margin-top: 12px; }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--gray); }
.btn-line { background: #06c755; color: #fff; border: 1px solid #06c755; }
.btn-sub { background: #fff; color: var(--text); border: 1px solid var(--gray); }
button:disabled { opacity: .5; cursor: default; }

/* 保存ガイド */
.guide ol { padding-left: 1.4em; margin: 0.3em 0 0.8em; }

/* グリッド */
.grid-head { display: flex; justify-content: space-between; align-items: center; }
.grid-head h2 { margin: 0; }
.cols-ctl button {
  width: 40px; height: 40px;
  font-size: 1.2rem;
  border: 1px solid var(--gray);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.cell { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: #eee; cursor: pointer; }
.cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell img.mono { filter: grayscale(1); }
.badge {
  position: absolute;
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
  color: #fff;
  pointer-events: none;
}
.badge-saved { left: 4px; bottom: 4px; background: rgba(49,49,49,.75); }
.badge-ng { left: 4px; top: 4px; background: var(--accent); }
.badge-fav {
  right: 2px; top: 2px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.9);
  color: var(--accent);
  border-radius: 6px;
  font-size: 16px;
}

/* SNS */
.sns-status { font-weight: bold; }
.sns-choices { display: flex; flex-direction: column; gap: 8px; }
.steps { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .92rem; }
.sns-count { font-size: 1.25rem; font-weight: bold; text-align: center; }
.sns-bulk { display: flex; gap: 8px; }
.sns-bulk button { flex: 1; }

/* アンケート */
#survey-form label, #survey-form fieldset label { display: block; margin: 10px 0; }
#survey-form input[type="text"], #survey-form select, #survey-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--gray);
  border-radius: 8px;
  font-size: 1rem;
  margin-top: 4px;
  background: #fff;
}
.prefs { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; }
.prefs label { font-weight: normal; }
.confirm-list dt { font-weight: bold; margin-top: 8px; }
.confirm-list dd { margin: 0 0 4px; white-space: pre-wrap; }

/* メンション */
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-row code {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .95rem;
  flex: 1;
  min-width: 220px;
  word-break: break-all;
}

/* 案内枠・フッター */
.announce { border-color: var(--accent); text-align: center; }
.footer { text-align: center; color: var(--gray); margin-top: 32px; font-size: .9rem; }

/* 下部固定バー */
.save-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  z-index: 40;
}
.save-bar .btn-main, .save-bar .btn-outline { flex: 1; max-width: 320px; margin: 0; }
.sns-bar-count { flex: 1; text-align: center; font-size: 1.05rem; }

/* モーダル */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 60;
  padding: 16px;
}
.modal-card {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  width: 100%;
  max-width: 440px;
}
.size-btn { margin: 6px 0; }
.progress { background: var(--line); border-radius: 999px; height: 10px; overflow: hidden; }
#save-progress-bar { background: var(--accent); height: 100%; width: 0%; transition: width .2s; }

/* 拡大表示 */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(20,20,20,.97);
  z-index: 70;
  display: flex;
  flex-direction: column;
}
.lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-nav {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  color: #fff; padding: 6px;
}
.lb-nav button {
  width: 44px; height: 44px;
  font-size: 1.6rem;
  background: transparent; color: #fff;
  border: 1px solid #777; border-radius: 50%;
  cursor: pointer;
}
.lb-actions {
  display: flex; gap: 8px; justify-content: center;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  flex-wrap: wrap;
}
.lb-actions .btn-outline { background: transparent; color: #fff; border-color: #999; }

.toast {
  position: fixed;
  left: 50%; bottom: 96px;
  transform: translateX(-50%);
  background: rgba(49,49,49,.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 80;
  font-size: .95rem;
  max-width: 90vw;
  text-align: center;
}

/* 管理画面 */
.admin-wrap { max-width: 960px; margin: 0 auto; padding: 20px 16px 80px; }
.admin-wrap h1 { font-size: 1.3rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}
.card h2 { margin-top: 0; }
.album-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line); }
.album-row:last-child { border-bottom: none; }
.album-row .name { font-weight: bold; font-size: 1.05rem; }
.pill { font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.pill.open { color: #1a7f37; border-color: #1a7f37; }
.pill.closed { color: #b3261e; border-color: #b3261e; }
.admin-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.admin-photos .cell { cursor: default; }
.admin-photos .cell .del {
  position: absolute; right: 4px; bottom: 4px;
  background: rgba(255,255,255,.92); border: 1px solid var(--gray);
  border-radius: 6px; font-size: .75rem; padding: 3px 7px; cursor: pointer;
}
input[type="date"], input[type="password"], input[type="text"], textarea, select {
  font-size: 1rem; padding: 8px; border: 1px solid var(--gray); border-radius: 8px;
}
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.link-box { word-break: break-all; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: .9rem; }
.survey-item { border-bottom: 1px solid var(--line); padding: 10px 0; }
.survey-item:last-child { border-bottom: none; }
.survey-item .meta { color: var(--gray); font-size: .82rem; }
.survey-item .comment { white-space: pre-wrap; }

@media (min-width: 700px) {
  .sns-choices { flex-direction: row; }
  .sns-choices button { flex: 1; }
  .slideshow { aspect-ratio: 16 / 10; }
}
