/* ═══════════════════════════════════════════════════
   TOKENS — 白×グレー ミニマルパレット
═══════════════════════════════════════════════════ */
:root {
  --bg:         #FAFAFA;
  --surface:    #FFFFFF;
  --border:     #ECECEC;
  --border-mid: #D8D8D8;
  --text:       #111111;
  --text-sub:   #555555;
  --text-muted: #999999;
  --accent:     #222222;
  --accent-hover: #000000;
  --radius:     8px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.08);
  --transition: .2s ease;
  --max-w:      1200px;
}

/* ═══════════════════════════════════════════════════
   RESET / BASE
═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { display: block; max-width: 100%; }
::selection { background: #D0D0D0; }

/* ═══════════════════════════════════════════════════
   LOGIN OVERLAY
═══════════════════════════════════════════════════ */
.login-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 48px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.login-logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 28px;
}
.login-logo-mark {
  font-size: 20px; font-weight: 700;
  color: #fff;
  font-family: 'Inter', sans-serif;
}
.login-title {
  font-size: 18px; font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.login-sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 28px;
}
.login-note {
  color: var(--text-sub);
  font-size: 13px;
  margin-bottom: 28px;
  line-height: 1.7;
}
.badge {
  display: inline-block;
  background: #F5F5F5;
  color: var(--text-sub);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
}
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  padding: 12px 18px;
  background: var(--accent);
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  color: #fff;
  transition: background var(--transition), opacity var(--transition);
}
.btn-google:hover { background: var(--accent-hover); }
.btn-google:disabled { opacity: .7; cursor: wait; }
.btn-google-text { display: flex; align-items: center; gap: 10px; }
.btn-google-loading { display: flex; align-items: center; gap: 8px; }
.login-btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}
.login-error {
  margin-top: 18px;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.6;
  text-align: left;
}

/* ═══════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════ */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: var(--max-w); margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-logo-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: #fff;
}
.header-title {
  font-size: 14px; font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.header-actions { display: flex; align-items: center; gap: 12px; }
.user-info { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
}
.user-name { color: var(--text-muted); font-size: 11px; }
.btn-logout {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px; font-weight: 500;
  transition: all var(--transition);
}
.btn-logout:hover { border-color: var(--border-mid); color: var(--text-sub); }

/* ═══════════════════════════════════════════════════
   ZIP BANNER
═══════════════════════════════════════════════════ */
.zip-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.zip-hero-inner {
  max-width: var(--max-w); margin: 0 auto;
  padding: 40px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px;
}
.zip-hero-eyebrow {
  font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.zip-hero-heading {
  font-size: 22px; font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.zip-hero-desc {
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.7;
  max-width: 400px;
}
.zip-hero-cta {
  display: flex; flex-direction: column; gap: 10px;
  flex-shrink: 0;
}
.btn-zip-hero {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  color: #fff;
  white-space: nowrap;
  transition: background var(--transition);
}
.btn-zip-hero:hover { background: var(--accent-hover); }
.btn-zip-icon { display: flex; align-items: center; }
.btn-zip-secondary {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-sub);
  font-size: 12px; font-weight: 500;
  background: transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-zip-secondary:hover:not(:disabled) {
  border-color: var(--border-mid);
  background: var(--surface);
}
.btn-zip-secondary:disabled { opacity: .3; cursor: not-allowed; }
.selected-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 99px;
  font-size: 10px; font-weight: 600;
  padding: 1px 7px;
  min-width: 18px; text-align: center;
}

/* ═══════════════════════════════════════════════════
   TOOLBAR
═══════════════════════════════════════════════════ */
.toolbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 52px; z-index: 90;
}
.toolbar-inner {
  max-width: var(--max-w); margin: 0 auto;
  padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; }
.total-count { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.btn-text {
  font-size: 12px; font-weight: 500;
  color: var(--text-sub);
  padding: 4px 10px;
  border-radius: 5px;
  transition: background var(--transition);
}
.btn-text:hover { background: var(--border); }
.search-box {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; font-family: inherit;
  width: 220px;
  outline: none;
  transition: border-color var(--transition);
  background: var(--surface);
  color: var(--text);
}
.search-box::placeholder { color: var(--text-muted); }
.search-box:focus { border-color: var(--border-mid); }

/* ═══════════════════════════════════════════════════
   GALLERY GRID
═══════════════════════════════════════════════════ */
.gallery-wrap {
  max-width: var(--max-w); margin: 0 auto;
  padding: 28px 24px 48px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.loading-state, .empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px;
  padding: 100px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── カード ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: var(--border-mid);
  box-shadow: var(--shadow-md);
}
.card.selected {
  border-color: var(--accent);
}
.card-thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #F0F0F0;
}
.card-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.card:hover .card-thumb { transform: scale(1.02); }
.card-checkbox {
  position: absolute; top: 10px; left: 10px;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  opacity: 0;
  transition: opacity .15s;
  z-index: 2;
  pointer-events: none;
  color: var(--text);
}
.card:hover .card-checkbox,
.card.selected .card-checkbox { opacity: 1; }
.card.selected .card-checkbox {
  background: var(--accent);
  color: #fff;
}
.card-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.35);
  opacity: 0;
  transition: opacity .2s;
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 10px;
}
.card:hover .card-overlay { opacity: 1; }
.card-dl-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  font-size: 11px; font-weight: 600;
  color: var(--text);
  transition: background .12s;
  pointer-events: all;
}
.card-dl-btn:hover { background: #fff; }
.card-footer {
  padding: 10px 12px;
}
.card-name {
  font-size: 11px; font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.lb-close {
  position: absolute; top: 20px; right: 24px;
  font-size: 18px; color: var(--text-muted);
  width: 40px; height: 40px;
  border-radius: 50%;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.lb-close:hover { color: var(--text); background: var(--border); }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 24px; color: var(--text-muted);
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.lb-nav:hover { color: var(--text); background: var(--border); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-content { display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 90vw; }
.lb-img {
  max-height: 72vh; max-width: 85vw;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: var(--shadow-lg);
}
.lb-bar { display: flex; align-items: center; gap: 20px; }
.lb-name { color: var(--text-muted); font-size: 12px; font-weight: 500; }
.btn-download-single {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  background: var(--accent);
  border-radius: var(--radius);
  font-size: 12px; font-weight: 600;
  color: #fff;
  transition: background var(--transition);
}
.btn-download-single:hover { background: var(--accent-hover); }

/* ═══════════════════════════════════════════════════
   ZIP TOAST
═══════════════════════════════════════════════════ */
.zip-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  box-shadow: var(--shadow-lg);
  min-width: 260px;
}
.zip-toast-inner { display: flex; align-items: center; gap: 14px; }
.zip-toast-spinner {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.zip-toast-title { color: var(--text); font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.zip-toast-msg   { color: var(--text-muted); font-size: 11px; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .zip-hero-inner { flex-direction: column; padding: 28px 20px; text-align: center; }
  .zip-hero-desc { max-width: none; }
  .zip-hero-cta { width: 100%; }
  .btn-zip-hero, .btn-zip-secondary { width: 100%; justify-content: center; }
  .toolbar-inner { padding: 10px 20px; }
  .gallery-wrap { padding: 20px; }
  .header-inner { padding: 0 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .search-box { width: 150px; }
  .lb-nav { display: none; }
  .login-card { margin: 20px; padding: 40px 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
