* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  background: #f5f5f7;
  color: #1d1d1f;
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; background: #fff; border-bottom: 1px solid #e5e5ea;
}
header h1 { margin: 0; font-size: 20px; }
.header-right { display: flex; align-items: center; gap: 16px; }
#userbar { font-size: 14px; color: #555; }
#userbar button { margin-left: 12px; }
.version { font-size: 12px; color: #888; font-family: ui-monospace, monospace; padding: 2px 6px; background: #f0f0f2; border-radius: 4px; }
main { max-width: 960px; margin: 24px auto; padding: 0 16px; }

.boot-loader { display: flex; justify-content: center; align-items: center; min-height: 50vh; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid #e5e5ea; border-top-color: #0071e3;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#auth-section { max-width: 360px; margin: 80px auto; background: #fff; padding: 32px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
#auth-form { display: flex; flex-direction: column; gap: 12px; }
#auth-form h2 { margin: 0 0 8px 0; }
input { padding: 10px 12px; border: 1px solid #ccc; border-radius: 8px; font-size: 14px; }
button { padding: 10px 14px; border: 0; background: #0071e3; color: #fff; border-radius: 8px; font-size: 14px; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: transparent; color: #0071e3; padding: 4px; font-size: 13px; }
.msg { font-size: 13px; color: #a00; min-height: 18px; margin: 4px 0 0 0; }
.msg.ok { color: #006b24; }

.upload { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
#gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo { position: relative; background: #fff; border-radius: 8px; overflow: hidden; aspect-ratio: 1 / 1; cursor: zoom-in; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.photo:hover img { transform: scale(1.04); }
.photo .name { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.5); color: #fff; padding: 4px 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; z-index: 1000; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 80px); object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,.4); cursor: default; }
.lightbox-caption { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,.6); color: #fff; padding: 6px 12px; border-radius: 20px; font-size: 13px; }
.lightbox-caption button { background: transparent; color: #fff; padding: 2px 6px; font-size: 14px; }
