:root {
  --bg: #faf7f4;
  --card: #ffffff;
  --accent: #b76e79;
  --accent-d: #9a5a64;
  --ink: #33292b;
  --muted: #8a7f80;
  --line: #ece3df;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent-d); }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.title { font-weight: 700; margin-left: auto; }
.title.big { font-size: 1.6rem; text-align: center; margin: 10px 0; }

.btn {
  display: inline-block; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  text-decoration: none; font-size: .92rem; cursor: pointer; text-align: center;
}
.btn-pseudo { background: #fff4f1; border-color: #f0d9d3; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-light { background: #f2ec ; }
.btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.disabled { opacity: .4; pointer-events: none; }

.viewnav {
  display: flex; gap: 8px; padding: 10px 14px; overflow-x: auto;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.viewnav .btn { white-space: nowrap; flex: 1 0 auto; }

main { padding: 16px 14px 40px; max-width: 1100px; margin: 0 auto; }

/* Upload */
.dropzone {
  display: block; border: 2px dashed #d9c7c1; border-radius: 18px;
  background: #fff; padding: 38px 16px; text-align: center; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.dropzone.drag { background: #fff1ec; border-color: var(--accent); }
.dz-icon { font-size: 2.6rem; }
.dz-text { font-weight: 600; margin-top: 8px; }
.dz-sub { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.hint { color: var(--muted); font-size: .9rem; text-align: center; }

.progress { margin-top: 16px; background: #eee; border-radius: 999px; height: 22px; position: relative; overflow: hidden; }
.progress-bar { background: var(--accent); height: 100%; width: 0; transition: width .2s; }
.progress-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .8rem; color: #333; }
.result { margin-top: 12px; text-align: center; }
.result .ok { color: #2c7a3f; }
.result .err { color: #b3261e; }
.hidden { display: none; }

/* Grid */
.grid {
  display: grid; gap: 10px; margin-top: 16px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.card { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card img, .card video { width: 100%; height: 150px; object-fit: cover; display: block; background: #000; }
figcaption { padding: 6px 8px; font-size: .78rem; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.cap-pseudo { font-weight: 600; }
.cap-time { color: var(--muted); margin-left: auto; }
.reattach { flex-basis: 100%; margin-top: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: #fff4f1; cursor: pointer; font-size: .76rem; }

.group-head { grid-column: 1 / -1; margin: 14px 0 0; padding-bottom: 4px; border-bottom: 2px solid var(--line); }

/* Pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.pageinfo { color: var(--muted); font-size: .85rem; }
.gallery-title { text-align: center; }
.count { color: var(--muted); font-weight: 400; }
.empty { text-align: center; color: var(--muted); }

/* Boxes */
.centerbox { max-width: 460px; margin: 30px auto; background: var(--card); padding: 22px; border-radius: 16px; border: 1px solid var(--line); text-align: center; }
.pseudo-form { display: flex; gap: 8px; margin: 14px 0; }
.pseudo-form input[type=text] { flex: 1; }
input[type=text] { padding: 11px 12px; border: 1px solid #d9c7c1; border-radius: 10px; font-size: 1rem; width: 100%; }
.token-input { text-transform: uppercase; letter-spacing: 4px; text-align: center; font-size: 1.4rem; margin: 12px 0; }
.error { color: #b3261e; }
