:root {
  --bg: #f2f2f0;
  --surface: #ffffff;
  --text: #0a0a0a;
  --muted: #666;
  --line: #e5e5e5;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.top-brand {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.top-brand img {
  width: 94px;
  height: auto;
  display: block;
}

.home-page {
  background: #ffffff;
}

.home-main {
  min-height: 100svh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 24px;
  padding: 56px 20px 20px;
}

.home-main h1 {
  margin: 0;
  font-size: clamp(2.2rem, 9vw, 5.2rem);
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.home-email {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
}

.home-nav {
  display: flex;
  gap: 10px;
}

.home-nav a {
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.admin-page {
  background: #f7f7f5;
}

.admin-main {
  min-height: 100svh;
  padding: 72px 14px 28px;
}

.admin-card {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-card h1 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.admin-card p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

.storage-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d8c98f;
  background: #fffbe8;
  color: #6c5600;
  font-size: 0.84rem;
  line-height: 1.5;
}

.upload-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.upload-field span {
  font-size: 0.92rem;
  font-weight: 700;
}

.upload-field input {
  width: 100%;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.preview-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.preview-item img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
}

.preview-item small {
  display: block;
  padding: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.admin-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-actions button,
.admin-actions a,
.post-row button,
.post-row a {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 12px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.admin-actions button {
  background: #0a0a0a;
  border-color: #0a0a0a;
  color: #fff;
}

.post-list {
  display: grid;
  gap: 10px;
}

.post-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.post-row strong {
  font-size: 0.95rem;
}

.post-row .meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.download-url-input {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.86rem;
}

.post-title-input {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.86rem;
}

.manage-photo-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.manage-photo-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.manage-photo-item img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
}

.manage-photo-controls {
  display: grid;
  grid-template-columns: 28px repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  align-items: center;
}

.manage-photo-controls small {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.manage-photo-controls button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.78rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
}

.post-page {
  background: #f2f2f0;
  overflow-x: hidden;
}

.post-main {
  padding-top: 56px;
}

.photo-stage {
  position: relative;
  min-height: calc(100svh - 56px);
  background: #ffffff;
}

.photo-slider {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.photo-slider::-webkit-scrollbar {
  display: none;
}

.photo-slide {
  width: 100%;
  min-height: calc(100svh - 56px);
  display: block;
  scroll-snap-align: start;
  user-select: none;
  -webkit-touch-callout: none;
}

.photo-slide img {
  width: 100%;
  height: calc(100svh - 56px);
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
}

.download-top {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 9;
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 700;
}

.download-top[hidden] {
  display: none;
}

.empty-gallery {
  min-height: calc(100svh - 56px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  background: #f4f4f2;
}

.empty-gallery[hidden] {
  display: none;
}

.photo-dots {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 6;
}

.photo-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
}

.photo-dots span.active {
  width: 16px;
  border-radius: 999px;
  background: #ffffff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%) translateY(10px);
  min-width: 140px;
  padding: 10px 14px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.86rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.86);
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 860px) {
  .photo-app,
  .post-main {
    width: min(480px, 100vw);
    margin: 0 auto;
  }
}
