:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --text: #1d2528;
  --muted: #6a7478;
  --line: #d9dfdc;
  --accent: #2f6f68;
  --accent-strong: #1f5650;
  --danger: #a53b32;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.page.narrow {
  width: min(640px, calc(100% - 32px));
}

.topbar,
.album-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow,
.album-count,
.hint,
.album-nav span {
  color: var(--muted);
  font-size: 0.9rem;
}

.eyebrow {
  margin: 0 0 6px;
}

h1 {
  margin: 0 0 22px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.album-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.album-heading h1 {
  margin-bottom: 0;
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
  margin-bottom: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upload-panel.compact {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.inline-form {
  display: flex;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
}

.file-picker {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-strong);
}

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: #842d27;
}

.albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.album-card {
  display: grid;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.album-card img,
.empty-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: #dfe6e2;
}

.album-title {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.gallery {
  columns: 4 190px;
  column-gap: 12px;
}

.photo-tile {
  display: block;
  margin: 0 0 12px;
  break-inside: avoid;
}

.photo-tile img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.empty-state {
  color: var(--muted);
}

.error-message {
  color: var(--danger);
  font-weight: 700;
}

.text-link,
.album-nav a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 760px) {
  .upload-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .inline-form {
    flex-direction: column;
  }

  .file-picker,
  button {
    width: 100%;
  }

  .album-heading {
    display: grid;
  }
}
