* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
  color: #edf2ff;
}

.app {
  min-height: 100vh;
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 12px 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 4px;
}

.eyebrow {
  margin: 0 0 2px;
  color: #9db4ff;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  margin: 0;
  font-size: 16px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.viewer-panel,
.album-panel,
.upload-panel,
.gallery-panel {
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid #253143;
  border-radius: 16px;
  padding: 12px;
  backdrop-filter: blur(6px);
}

.viewer-head,
.gallery-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.viewer {
  height: 46vh;
  min-height: 280px;
  max-height: 520px;
  border-radius: 12px;
  overflow: hidden;
  background: #050b18;
  border: 1px solid #1f2a3d;
}

#uploadForm {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#newAlbumInput,
#shareLinkInput {
  width: 100%;
  border: 1px solid #2b3a52;
  background: #0f172a;
  color: #edf2ff;
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
}

#fileInput {
  display: none;
}

.hint {
  color: #9ca9c8;
  font-size: 12px;
}

button {
  border: 1px solid #2a4e89;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: linear-gradient(180deg, #2057ce 0%, #1b46b2 100%);
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: #cde1ff;
  border: 1px solid #365a9b;
  background: #17325f;
}

button.secondary {
  border-color: #334155;
  background: #1f2937;
}

button.secondary:hover {
  background: #293548;
}

.status {
  min-height: 20px;
  margin: 8px 0 0;
  font-size: 13px;
  color: #b8c6e8;
}

.status.error {
  color: #ff9aa5;
}

.album-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.album-chip {
  border: 1px solid #324767;
  background: #1b2a41;
  color: #dbe8ff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
}

.album-chip.active {
  border-color: #6ea0ff;
  background: #20407a;
}

.new-album-form {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.new-album-form button {
  white-space: nowrap;
}

.share-box {
  border: 1px solid #2b3a52;
  border-radius: 12px;
  padding: 10px;
  background: #101b2f;
}

.share-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.public-mode .upload-panel,
.public-mode .delete-btn,
.public-mode .new-album-form,
.public-mode .share-actions {
  display: none;
}

.gallery-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gallery-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.open-btn {
  flex: 1;
  text-align: left;
  border-color: #2b3a52;
  background: #152033;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.open-btn.active {
  border-color: #5c8bff;
  box-shadow: 0 0 0 1px #5c8bff inset;
}

.file-name {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-btn {
  width: 44px;
  flex: 0 0 44px;
  border-color: #7f1d1d;
  background: #991b1b;
  font-size: 18px;
  line-height: 1;
}

.delete-btn:hover {
  background: #7f1d1d;
}

.viewer .placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  color: #93a3c4;
  text-align: center;
  padding: 16px;
}

.meta {
  display: block;
  font-size: 11px;
  color: #9fb2d6;
}

@media (min-width: 760px) {
  .app {
    padding: 20px;
  }

  .viewer {
    height: 54vh;
  }

  .gallery-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .gallery-item {
    min-height: 74px;
  }
}
