:root {
  color-scheme: light;
  --background: #f7f5ef;
  --surface: #ffffff;
  --text: #1d2528;
  --muted: #637074;
  --line: #d8ddd8;
  --accent: #2d6a65;
  --daily-image-size: min(100%, 860px, calc(100svh - 230px));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

img {
  display: block;
  max-width: 100%;
}

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

.site-header {
  margin-bottom: 16px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.95;
}

.countdown {
  width: min(420px, 100%);
}

.countdown span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.generation-progress[hidden] {
  display: none;
}

.progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  margin: 0;
  background: var(--accent);
  transition: width 0.3s ease;
}

.daily-layout {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 12px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.daily-image {
  width: min(100%, var(--daily-image-size));
  max-width: var(--daily-image-size);
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.daily-image img {
  width: 100%;
  height: auto;
  max-height: var(--daily-image-size);
  aspect-ratio: 1;
  object-fit: contain;
}

.daily-meta {
  width: min(100%, var(--daily-image-size));
  padding: 0;
  justify-self: center;
}

.daily-meta time,
.history-card time {
  color: var(--muted);
  font-size: 0.9rem;
}

.daily-meta h2 {
  margin: 6px 0 0;
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  line-height: 1;
}

.empty-state {
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.history-section {
  padding-top: 36px;
}

.history-section > h2 {
  margin-bottom: 18px;
  font-size: 1.4rem;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.history-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.history-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.history-card div {
  padding: 12px;
}

.history-card h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 24px, 1120px);
    padding-top: 20px;
  }

  .daily-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .daily-image {
    width: min(100%, var(--daily-image-size));
    min-width: 0;
  }

  .daily-image img {
    max-height: var(--daily-image-size);
  }

  .daily-meta {
    width: min(100%, var(--daily-image-size));
    padding: 0 0 8px;
  }
}
