:root {
  --bg: #FAF7F2;
  --card: #ffffff;
  --ink: #3d3630;
  --muted: #a08d7d;
  --accent: #e59bbd;
  --accent-deep: #cf6f9c;
  --accent-soft: #fceef5;
  --pink-bg: #facfe2;
  --line: #e9e0d2;
  --ok: #6a9a5b;
  --danger: #c05b4d;
  --radius: 16px;
  --serif: "Cormorant Garamond", "Hiragino Mincho ProN", serif;
  --sans: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
header.brand {
  text-align: center;
  padding: 26px 16px 10px;
}
header.brand .logo {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--ink);
  line-height: 1.1;
}
header.brand .sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .42em;
  margin-top: 4px;
  text-transform: uppercase;
}
.en-label {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--accent-deep);
  text-align: center;
  margin: 0 0 2px;
}
main { max-width: 960px; margin: 0 auto; padding: 12px 16px 120px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(160, 130, 100, .05);
}
h1 { font-size: 20px; margin: 4px 0 10px; font-weight: 700; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type="text"], input[type="password"] {
  width: 100%; padding: 11px 12px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: #fffdf9; color: var(--ink);
}
input[type="text"]:focus, input[type="password"]:focus { outline: 2px solid var(--pink-bg); border-color: var(--accent); }
button {
  font-family: inherit; cursor: pointer; border-radius: 999px;
  padding: 11px 22px; font-size: 15px; font-weight: 700;
  background: #fff; color: var(--ink); border: 1px solid var(--ink);
  transition: background .15s, color .15s;
}
button:hover { background: var(--accent-soft); }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-primary:disabled { background: #d9cfc2; border-color: #d9cfc2; cursor: default; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid #ecc9c3; }
.btn-danger:hover { background: #f9e9e6; }
.btn-small { padding: 7px 14px; font-size: 13px; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; }
.note { color: var(--muted); font-size: 13px; line-height: 1.8; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* client grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 6px; } }
.ph {
  position: relative; border-radius: 12px; overflow: hidden; cursor: pointer;
  border: 3px solid transparent; background: #f1e7da; aspect-ratio: 1;
}
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.selected { border-color: var(--accent-deep); }
.ph .check {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-deep); color: #fff; display: none; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.ph.selected .check { display: flex; }
.ph .zoom {
  position: absolute; right: 6px; bottom: 22px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.92); border: none; padding: 0; font-size: 14px; line-height: 1;
}
.ph .fname {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; color: #fff;
  background: linear-gradient(transparent, rgba(61,54,48,.65)); padding: 10px 6px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stickybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.count-badge { font-size: 15px; font-weight: 700; color: var(--accent-deep); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; user-select: none; }
input[type="checkbox"] { accent-color: var(--accent-deep); width: 17px; height: 17px; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(50, 40, 35, .92); z-index: 100;
  display: none; flex-direction: column; align-items: center; justify-content: center; padding: 16px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 74vh; border-radius: 10px; }
.lightbox .lb-name { color: #f6e3ec; font-size: 13px; margin: 12px 0; }
.lightbox .row { justify-content: center; }

/* admin */
.album-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.album-item:last-child { border-bottom: none; }
.album-item .meta { min-width: 200px; }
.album-item .meta .t { font-weight: 700; }
.album-item .meta .s { font-size: 12px; color: var(--muted); }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); }
.badge.done { background: #e2efdb; color: var(--ok); }
.badge.wait { background: #f9e9e6; color: var(--danger); }
.linkbox {
  background: #fffdf9; border: 1px dashed var(--accent); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; word-break: break-all; line-height: 1.8;
}
.sel-list { font-size: 13px; line-height: 1.9; background: #fffdf9; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; max-height: 260px; overflow: auto; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.admin-grid .ph { cursor: default; aspect-ratio: 1; }
.admin-grid .ph .del {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--danger); border: none; padding: 0; font-size: 14px; line-height: 1;
}
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center;
  color: var(--muted); font-size: 14px; background: #fffdf9;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.hidden { display: none !important; }
.center { text-align: center; }
.big { font-size: 40px; }
