:root {
  --text: #3c2f2f;
  --muted: #6f5959;
  --pink: #d8a6a6;
  --pink-dark: #c98f8f;
  --pink-deep: #b97878;
  --pink-light: #f3dede;
  --cream: rgba(255, 248, 244, 0.78);
  --cream-strong: rgba(255, 248, 244, 0.92);
  --border: rgba(216, 166, 166, 0.48);
  --shadow: 0 20px 48px rgba(80, 45, 45, 0.16);
  --shadow-strong: 0 24px 64px rgba(80, 45, 45, 0.28);
  --chrome-gray: #736f6e;
  --danger: #9e3030;
  --bg-overlay: linear-gradient(
    180deg,
    rgba(255, 246, 242, 0.46),
    rgba(255, 246, 242, 0.2) 45%,
    rgba(255, 246, 242, 0.36)
  );
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    var(--bg-overlay),
    url("../assets/bg.jpg?v=37") center center / cover no-repeat var(--chrome-gray);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light only;
}

body {
  overflow-x: hidden;
}

body.lightbox-open {
  overflow: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    var(--bg-overlay),
    url("../assets/bg.jpg?v=37") center center / cover no-repeat var(--chrome-gray);
  pointer-events: none;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 18px max(72px, env(safe-area-inset-bottom));
}

.panel-glass {
  border: 1px solid var(--border);
  background: var(--cream);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px) saturate(118%);
  -webkit-backdrop-filter: blur(10px) saturate(118%);
}

.hero {
  width: min(100%, 820px);
  margin: 0 auto 26px;
  padding: 28px 20px 24px;
  border-radius: 28px;
  text-align: center;
}

.back-link {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
}

h1 {
  margin: 0 0 12px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(42px, 9vw, 84px);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.055em;
  text-align: center;
}

h2 {
  margin: 0 0 6px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

p {
  margin: 0 auto;
  max-width: 640px;
  color: var(--muted);
  line-height: 1.52;
  text-align: center;
}

.nav-buttons,
.single-session-actions,
.lightbox-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-buttons {
  margin: 22px auto 0;
}

button,
.nav-buttons a,
.pill-link,
.download-button,
.single-session-actions a,
.lightbox-actions a {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 999px;
  background: rgba(216, 166, 166, 0.72);
  color: var(--text);
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  user-select: none;
  box-shadow: 0 8px 24px rgba(80, 45, 45, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

button:hover,
.nav-buttons a:hover,
.pill-link:hover,
.download-button:hover,
.single-session-actions a:hover,
.lightbox-actions a:hover {
  transform: translateY(-1px);
  background: rgba(216, 166, 166, 0.88);
  border-color: rgba(255, 255, 255, 0.76);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(185, 120, 120, 0.35);
  outline-offset: 3px;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(100%, 620px);
  margin: 0 auto 24px;
  padding: 16px;
  border-radius: 22px;
}

.status-card strong,
.empty strong,
.error strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 16px;
}

.status-card p {
  margin: 0;
  text-align: left;
  font-size: 14px;
}

.spinner {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 3px solid rgba(216, 166, 166, 0.32);
  border-top-color: var(--pink-deep);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 18px;
  padding: 18px;
  border-radius: 24px;
}

.section-heading h2,
.section-heading p {
  text-align: left;
}

.subcopy {
  margin: 0;
  font-size: 15px;
  text-align: left;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 18px;
  align-items: start;
}

.card {
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--cream-strong);
  box-shadow: 0 14px 34px rgba(80, 45, 45, 0.14);
  color: inherit;
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(216, 166, 166, 0.72);
  box-shadow: var(--shadow);
}

.card a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card img {
  width: 100%;
  display: block;
  background: #fff;
}

.card-preview-button {
  width: calc(100% - 20px);
  min-height: 36px;
  margin: 10px 10px 0;
  padding: 8px 12px;
  font-size: 12px;
}

.card-meta {
  padding: 11px 12px 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.card-meta strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 13px;
}

.single-session {
  width: min(100%, 540px);
  margin: 0 auto 28px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--cream);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(10px) saturate(118%);
  -webkit-backdrop-filter: blur(10px) saturate(118%);
}

.single-session h2 {
  margin-bottom: 8px;
  text-align: center;
}

.single-session p {
  margin-bottom: 16px;
}

.single-session img {
  width: 100%;
  display: block;
  border: 1px solid rgba(216, 166, 166, 0.42);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(80, 45, 45, 0.18);
}

.receipt-image-button {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  cursor: zoom-in;
  box-shadow: none;
}

.receipt-image-button:hover {
  transform: none;
  background: transparent;
  box-shadow: none;
}

.single-session-actions {
  margin-top: 14px;
}

.empty,
.error {
  width: min(100%, 680px);
  margin: 24px auto 0;
  padding: 26px 20px;
  border-radius: 28px;
  text-align: center;
}

.empty p,
.error p {
  margin-bottom: 16px;
}

.error {
  border-color: rgba(158, 48, 48, 0.52);
}

.error strong {
  color: var(--danger);
}

.error code {
  padding: 2px 5px;
  border-radius: 7px;
  background: rgba(216, 166, 166, 0.18);
  color: var(--text);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(60, 47, 47, 0.38);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
}

.lightbox-card {
  width: min(100%, 560px);
  max-height: calc(100vh - 72px);
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-card img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 170px);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-strong);
}

.lightbox-card figcaption {
  margin: 12px 0 0;
  color: #fff8f4;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 10px rgba(60, 47, 47, 0.45);
}

.lightbox-close {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgba(216, 166, 166, 0.55);
  border-radius: 999px;
  background: rgba(255, 248, 244, 0.94);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(80, 45, 45, 0.18);
}

.lightbox-close:hover {
  background: rgba(255, 248, 244, 1);
}

.lightbox-actions {
  margin-top: 14px;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  html,
  body,
  .bg {
    background:
      var(--bg-overlay),
      url("../assets/bg.jpg?v=37") center center / cover no-repeat #000;
  }

  .page-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero {
    margin-bottom: 22px;
    padding: 24px 16px 20px;
  }

  .section-heading {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }

  .section-heading h2,
  .section-heading p,
  .subcopy {
    text-align: center;
  }

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

  .card {
    border-radius: 18px;
  }

  .card-meta {
    padding: 9px 8px 11px;
    font-size: 12px;
  }

  .status-card {
    align-items: flex-start;
  }

  .lightbox {
    padding: 14px;
  }

  .lightbox-card img {
    max-height: calc(100vh - 184px);
  }
}

@media (max-width: 430px) {
  .nav-buttons a,
  button,
  .pill-link,
  .download-button,
  .single-session-actions a,
  .lightbox-actions a {
    flex: 1 1 calc(50% - 8px);
    padding-left: 12px;
    padding-right: 12px;
  }

  .back-link {
    flex: 0 0 auto;
  }
}

@media (max-width: 360px) {
  .grid {
    gap: 10px;
  }

  .nav-buttons a,
  button,
  .pill-link,
  .download-button,
  .single-session-actions a,
  .lightbox-actions a {
    flex: 1 1 100%;
  }
}
