* { box-sizing: border-box; }

body {
  margin: 0;
  background: #111;
  color: #eee;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

/* ---- Login ---- */
.login-body {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 260px;
}

.login-box input {
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1c1c1c;
  color: #eee;
}

.login-box button {
  padding: 10px 12px;
  font-size: 15px;
  border: none;
  border-radius: 6px;
  background: #3a6df0;
  color: #fff;
  cursor: pointer;
}

.login-box button:hover {
  background: #2f5bd0;
}

.error {
  color: #ff6b6b;
  font-size: 13px;
  margin: 4px 0 0;
  text-align: center;
}

/* ---- Gallery ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #262626;
}

.logout {
  color: #9db4ff;
  text-decoration: none;
  font-size: 14px;
}

.logout:hover {
  text-decoration: underline;
}

/* Row-based layout (not CSS columns) because tile width needs to vary by
   orientation -- CSS multi-column can't do that, every item is forced to a
   single column's width. Each tile is sized to a fixed row height and its
   width follows naturally from its own aspect ratio, so portrait stays tall
   and narrow, landscape stays wide -- and landscape gets a taller target
   row height so it reads as visibly bigger. */
.grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
}

.tile {
  display: block;
  border-radius: 4px;
  overflow: hidden;
  background: #1a1a1a;
}

.tile img {
  display: block;
  height: 225px; /* portrait baseline: 180px * 1.25 */
  width: auto;
  transition: transform 0.15s ease;
}

.tile.landscape img {
  height: 281px; /* landscape: 225px * 1.25, so landscape reads ~25% bigger */
}

.tile:hover img {
  transform: scale(1.02);
}

@media (max-width: 600px) {
  .tile img { height: 130px; }
  .tile.landscape img { height: 163px; }
}

.empty {
  text-align: center;
  margin-top: 40px;
  color: #888;
}

/* ---- Single-photo view ---- */
.view-body {
  height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.view-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.view-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.view-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid #262626;
}

.filename {
  color: #fff;
  font-size: 14px;
}

.back-btn,
.download-btn {
  padding: 12px 32px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
}

.back-btn {
  background: #2a2a2a;
  color: #eee;
}

.back-btn:hover {
  background: #383838;
}

.download-btn {
  background: #3a6df0;
  color: #fff;
}

.download-btn:hover {
  background: #2f5bd0;
}
