/* やさしい・ナチュラル・温かい配色 */
:root {
  --bg: #faf8f5;
  --ink: #3a352f;
  --muted: #9a9188;
  --accent: #a98467;
  --accent-dark: #8f6e53;
  --card: #ffffff;
  --line: #eee7de;
  --danger: #b05c5c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.3rem; margin: 0.2em 0; }
h2 { font-size: 1.05rem; margin: 0 0 0.8em; padding-bottom: 0.4em; border-bottom: 1px solid var(--line); }
code { background: var(--bg); padding: 2px 8px; border-radius: 6px; font-size: 1.05em; }
hr { border: none; border-top: 1px solid var(--line); margin: 1.2em 0; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 16px; }
.between { display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--danger); }
.msg { font-size: 1.05rem; }
.center { text-align: center; }
.inline { display: inline; }
.grow { flex: 1; min-width: 180px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }

/* トップバー */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 0; }
.gallery-top { position: sticky; top: 0; z-index: 20; }
.gallery-top .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.g-title p { margin: 0; }

/* カード */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 1px 4px rgba(60, 50, 40, 0.04);
}
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.gate .card { width: 100%; max-width: 400px; padding: 32px 28px; }

/* フォーム */
input[type="text"], input[type="password"], input[type="date"], input:not([type]), textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
}
textarea { font-family: inherit; margin-bottom: 8px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* ボタン */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
.btn.ghost { background: transparent; color: var(--accent-dark); border: 1px solid var(--accent); }
.btn.ghost:hover { background: rgba(169, 132, 103, 0.08); }
.btn.small { padding: 6px 14px; font-size: 0.85rem; }
.btn.wide { width: 100%; margin-top: 10px; }
.linklike { background: none; border: none; color: var(--accent-dark); cursor: pointer; font-size: 0.9rem; padding: 0; text-decoration: underline; }
.danger { color: var(--danger); }

/* お知らせ */
.notice {
  border-radius: 12px;
  padding: 12px 16px;
  margin: 16px 0;
  background: #fdf3e7;
  border: 1px solid #f0dcc3;
  font-size: 0.92rem;
}
.notice.ok { background: #eef5ec; border-color: #d7e6d2; }
.notice.warn { background: #fdf0ee; border-color: #efd4cf; }
.notice .btn { margin-left: 8px; }

/* テーブル */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: normal; font-size: 0.85rem; }

/* 写真グリッド */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
.ph {
  margin: 0;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
  cursor: pointer;
}
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s;
}
body.selecting .ph .check { opacity: 1; }
.ph.sel .check { background: var(--accent); color: #fff; }
.ph.sel img { opacity: 0.75; }
.ph-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}
.ph-del:hover { background: var(--danger); }
.ph-cover {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  font-size: 13px;
}
.ph-cover.on { background: var(--accent); }
.heart {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: #cfc2b8;
  cursor: pointer;
  line-height: 1;
  font-size: 15px;
  box-shadow: 0 1px 3px rgba(60, 50, 40, 0.15);
}
.heart.on { color: #e0596e; }
.fav-on { color: #f2a3b1 !important; border-color: #f2a3b1 !important; }
.gate .cover {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 14px;
  display: block;
}

/* アップロード */
.drop {
  border: 2px dashed var(--accent);
  border-radius: 14px;
  padding: 36px 16px;
  text-align: center;
  color: var(--accent-dark);
  cursor: pointer;
  background: #fdfbf8;
}
.drop.over { background: #f5ede4; }
.bar { height: 8px; border-radius: 4px; background: var(--line); margin-top: 8px; overflow: hidden; }
.bar-in { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.zips { align-items: center; margin-bottom: 8px; }
.zips > div { display: flex; align-items: center; gap: 8px; }

/* 選択バー */
.select-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  z-index: 30;
  box-shadow: 0 -2px 10px rgba(60, 50, 40, 0.08);
}

/* ライトボックス */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 14, 0.94);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox img {
  max-width: 94vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 4px;
}
.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 2.2rem;
  cursor: pointer;
  padding: 10px 16px;
  z-index: 51;
}
.lb-close { top: 6px; right: 10px; }
.lb-prev { left: 0; top: 50%; transform: translateY(-50%); }
.lb-next { right: 0; top: 50%; transform: translateY(-50%); }
.lb-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 14px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}
