:root {
  color: #171717;
  background: #fff8e8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button,
a {
  min-height: 48px;
  border-radius: 8px;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.shell {
  min-height: 100dvh;
  overflow-x: hidden;
}

.versionBadge {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: 10px;
  z-index: 10;
  max-width: calc(100vw - 20px);
  min-height: 0;
  border: 1px solid rgba(23, 23, 23, 0.45);
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.78);
  color: #332e27;
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero {
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(255, 248, 232, 0.08), rgba(255, 248, 232, 0.28) 68%, #fff8e8 96%),
    url("/assets/background.png") center top / cover;
}

.heroInner,
.createCard,
.sectionHeader,
.feed {
  width: min(520px, 100%);
  margin: 0 auto;
}

.eyebrow {
  margin-bottom: 8px;
  color: #8c2f39;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 100%;
  font-size: clamp(40px, 11.5vw, 96px);
  line-height: 0.92;
  letter-spacing: 0;
  white-space: nowrap;
  word-break: keep-all;
}

h2 {
  font-size: clamp(22px, 7vw, 26px);
  line-height: 1.08;
  letter-spacing: 0;
}

.heroActions {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.heroActions > *,
.pickers > *,
.cameraActions > *,
.resultActions > * {
  min-width: 0;
}

.heroCredits {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin-top: 12px;
  color: #332e27;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  max-width: 100%;
}

.heroCredits p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  min-height: 32px;
  gap: 5px;
  border: 1px solid rgba(23, 23, 23, 0.65);
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.82);
  padding: 5px 7px;
  white-space: normal;
  overflow: hidden;
}

.heroCredits p,
.heroCredits a {
  text-overflow: ellipsis;
}

.heroCredits a {
  min-height: 0;
  border-radius: 0;
  color: #8c2f39;
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.brandLogo {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border-radius: 4px;
  object-fit: contain;
  background: #fffdf6;
}

.primary,
.secondary,
.pickers button,
.cameraActions button,
.galleryTabs button,
.resultHeader button,
.resultActions button,
.resultActions a,
.bragOverlay button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #171717;
  background: #fffdf6;
  color: #171717;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 850;
  max-width: 100%;
  min-width: 0;
  text-align: center;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.primary {
  background: #171717;
  color: #fffdf6;
}

.createSection {
  display: none;
  padding: 24px 14px 38px;
  background: #fff8e8;
}

.createSection.isOpen {
  display: block;
}

.createCard {
  display: grid;
  gap: 16px;
  padding: 14px;
  border: 1px solid #171717;
  border-radius: 8px;
  background: #fffdf6;
  box-shadow: 3px 3px 0 #171717;
}

.pickers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.cameraPanel {
  display: none;
  gap: 10px;
}

.cameraPanel.isOpen {
  display: grid;
}

.cameraPanel video {
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px solid #171717;
  border-radius: 8px;
  background: #171717;
  object-fit: cover;
}

.cameraActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cameraActions button {
  border: 1px solid #171717;
  background: #fff1b8;
  color: #171717;
  padding: 0 14px;
  font-weight: 850;
}

.hidden,
.hiddenField {
  display: none;
}

.hiddenField.isOpen {
  display: grid;
}

.field {
  gap: 8px;
}

.field span {
  color: #5f5142;
  font-size: 14px;
  font-weight: 800;
}

.field input {
  width: 100%;
  border: 1px solid #171717;
  border-radius: 8px;
  padding: 14px 12px;
  background: #fffdf6;
  color: #171717;
}

.previewBox {
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: clamp(210px, 70vw, 260px);
  border: 1px dashed #171717;
  border-radius: 8px;
  background: #fffdf6;
  color: #6a5d4f;
}

.previewBox img {
  width: 100%;
  height: 100%;
  min-height: clamp(210px, 70vw, 260px);
  object-fit: cover;
}

.generateButton {
  width: 100%;
}

.status {
  min-height: 22px;
  color: #6a3b18;
  font-size: 15px;
  font-weight: 750;
}

.status.isWaiting::after {
  content: "";
  display: inline-block;
  width: 1.4em;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75%,
  100% {
    content: "...";
  }
}

.gallerySection {
  padding: 38px 14px 58px;
  background: #f1ead8;
}

.sectionHeader {
  margin-bottom: 18px;
}

.galleryTabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: min(520px, 100%);
  margin: 0 auto 16px;
}

.galleryTabs button {
  border: 1px solid #171717;
  background: #fffdf6;
  color: #171717;
  font-weight: 850;
}

.galleryTabs button.isActive {
  background: #171717;
  color: #fffdf6;
}

.feed {
  display: grid;
  gap: 22px;
}

.feedItem {
  overflow: hidden;
  border: 1px solid #171717;
  border-radius: 8px;
  background: #fffdf6;
  box-shadow: 3px 3px 0 #171717;
}

.feedImageWrap {
  position: relative;
  background: #ece2c9;
}

.rankBadge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #171717;
  border-radius: 50%;
  background: #f6c744;
  box-shadow: 2px 2px 0 #171717;
}

.rankBadge::before,
.rankBadge::after {
  content: "";
  position: absolute;
  bottom: -11px;
  width: 11px;
  height: 18px;
  border: 1px solid #171717;
  background: #8c2f39;
}

.rankBadge::before {
  left: 9px;
  transform: rotate(12deg);
}

.rankBadge::after {
  right: 9px;
  transform: rotate(-12deg);
}

.rankBadge span {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 950;
}

.feedImageWrap img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.voteBurst {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ff3b30;
  font-size: clamp(48px, 18vw, 74px);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.75);
}

.feedItem.justVoted .voteBurst {
  animation: votePop 650ms ease-out;
}

@keyframes votePop {
  0% {
    opacity: 0;
    transform: scale(0.55);
  }
  30% {
    opacity: 1;
    transform: scale(1.12);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

.feedMeta {
  display: grid;
  padding: 12px;
}

.voteButton {
  justify-self: start;
  min-height: 36px;
  border: 1px solid #171717;
  border-radius: 8px;
  background: #fff1b8;
  color: #171717;
  padding: 0 10px;
  font-weight: 850;
}

.resultStage {
  display: none;
  gap: 12px;
  margin-top: 4px;
  border-top: 1px solid #171717;
  padding-top: 16px;
}

.resultStage.isOpen {
  display: grid;
}

.resultHeader {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.resultHeader h2 {
  font-size: 22px;
}

.resultHeader button {
  min-height: 38px;
  border: 1px solid #171717;
  background: #fff8e8;
  color: #171717;
  padding: 0 12px;
  font-weight: 850;
}

.resultBox {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid #171717;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #6a5d4f;
  background: #f1ead8;
}

.resultBox img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bragOverlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  gap: 12px;
  padding: 20px;
  background: rgba(23, 23, 23, 0.62);
  color: #fffdf6;
  text-align: center;
}

.bragOverlay.isOpen {
  display: grid;
}

.bragOverlay strong {
  font-size: 24px;
  line-height: 1.1;
}

.bragOverlay button {
  min-height: 44px;
  border: 1px solid #fffdf6;
  border-radius: 8px;
  background: #fffdf6;
  color: #171717;
  padding: 0 14px;
  font-weight: 850;
}

.resultActions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.resultActions button,
.resultActions a {
  min-height: 44px;
  border-color: #171717;
  background: #fff1b8;
  padding: 0 8px;
  font-size: 13px;
}

button:disabled,
.disabled {
  opacity: 0.5;
  pointer-events: none;
}

@media (max-width: 360px) {
  .hero {
    padding-left: 12px;
    padding-right: 12px;
  }

  h1 {
    font-size: 36px;
  }

  .primary,
  .secondary,
  .pickers button,
  .cameraActions button,
  .galleryTabs button,
  .resultHeader button,
  .resultActions button,
  .resultActions a,
  .bragOverlay button {
    padding-left: 10px;
    padding-right: 10px;
    font-size: 14px;
  }
}

@media (min-width: 760px) {
  .heroCredits {
    grid-template-columns: 1fr 1fr;
  }

  .heroActions,
  .pickers {
    grid-template-columns: 1fr 1fr;
  }

  .pickers {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero {
    padding: 42px;
  }

  .createSection,
  .gallerySection {
    padding-left: 32px;
    padding-right: 32px;
  }

  .createCard {
    padding: 18px;
    box-shadow: 4px 4px 0 #171717;
  }

  .feedItem {
    box-shadow: 4px 4px 0 #171717;
  }

  .resultBox {
    aspect-ratio: 4 / 5;
  }

  .resultActions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
