:root {
  color-scheme: dark;
  --bg: #170b0d;
  --bg-deep: #0d0708;
  --card: rgba(43, 22, 18, 0.88);
  --card-strong: #331713;
  --cream: #fff0cf;
  --cream-muted: #e8cfa5;
  --gold: #f4bd5b;
  --gold-hot: #ffd88a;
  --red: #c73d34;
  --red-deep: #761f25;
  --shadow: rgba(5, 2, 2, 0.5);
  --line: rgba(255, 216, 138, 0.22);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --max-width: 760px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg-deep);
}

body {
  min-height: 100%;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 8%, rgba(244, 189, 91, 0.22), transparent 32rem),
    radial-gradient(circle at 15% 25%, rgba(199, 61, 52, 0.22), transparent 26rem),
    linear-gradient(145deg, var(--bg-deep), var(--bg) 48%, #210d10);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    radial-gradient(circle, rgba(255, 240, 207, 0.18) 0 1px, transparent 1px),
    radial-gradient(circle, rgba(244, 189, 91, 0.14) 0 1px, transparent 1px);
  background-position: 0 0, 20px 26px;
  background-size: 42px 42px, 58px 58px;
  mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
}

.app-shell {
  width: min(100%, var(--max-width));
  max-width: 100%;
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2.5rem);
  display: grid;
  align-content: center;
  gap: clamp(1rem, 3vw, 1.4rem);
  touch-action: manipulation;
}

.hero {
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--gold-hot);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(2.35rem, 10vw, 5.3rem);
  line-height: 0.9;
  text-wrap: balance;
  text-shadow: 0 8px 34px rgba(199, 61, 52, 0.42);
}

.subtitle,
.button-hint {
  color: var(--cream-muted);
}

.subtitle {
  margin-bottom: 0;
  font-size: clamp(1rem, 3vw, 1.25rem);
}

.tato-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(1rem, 4vw, 1.5rem);
  align-items: center;
  padding: clamp(1rem, 4vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 240, 207, 0.08), transparent 32%),
    linear-gradient(160deg, var(--card), rgba(78, 30, 23, 0.88));
  box-shadow: 0 28px 80px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card-shine {
  position: absolute;
  inset: -45% auto auto -20%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 216, 138, 0.22), transparent 62%);
}

.image-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;
  min-height: clamp(220px, 46vw, 340px);
  border: 1px solid rgba(255, 216, 138, 0.24);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 42%, rgba(244, 189, 91, 0.28), transparent 44%),
    linear-gradient(180deg, rgba(118, 31, 37, 0.38), rgba(20, 9, 9, 0.42));
}

.tato-image {
  position: relative;
  z-index: 1;
  width: min(92%, 310px);
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.48));
  transform-origin: 50% 85%;
}

.mystery-mark {
  display: grid;
  place-items: center;
  width: min(56vw, 220px);
  aspect-ratio: 1;
  border: 4px dashed rgba(255, 216, 138, 0.44);
  border-radius: 999px;
  color: var(--gold-hot);
  font-size: clamp(5rem, 26vw, 9rem);
  font-weight: 950;
  text-shadow: 0 8px 28px rgba(244, 189, 91, 0.32);
}

.is-hidden {
  display: none;
}

.card-content {
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-kicker {
  margin-bottom: 0.25rem;
  color: var(--gold-hot);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0.45rem;
  font-size: clamp(2rem, 7vw, 3.35rem);
  line-height: 0.95;
}

.tato-type {
  margin-bottom: 1rem;
  color: var(--cream-muted);
  font-size: clamp(1rem, 2.8vw, 1.15rem);
  font-weight: 700;
}

.result-details {
  display: grid;
  gap: 0.72rem;
  margin: 0;
}

.result-details div {
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(255, 216, 138, 0.14);
  border-radius: 16px;
  background: rgba(13, 7, 8, 0.32);
}

dt {
  margin-bottom: 0.22rem;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

dd {
  margin: 0;
  color: var(--cream);
  line-height: 1.42;
}

.reveal-button {
  justify-self: center;
  min-width: min(100%, 280px);
  min-height: 58px;
  padding: 0.95rem 1.4rem;
  border: 0;
  border-radius: 999px;
  color: #260d0b;
  background: linear-gradient(180deg, var(--gold-hot), var(--gold) 58%, #da853a);
  box-shadow: 0 16px 38px rgba(244, 189, 91, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  cursor: pointer;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  touch-action: manipulation;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.reveal-button:hover:not(:disabled),
.reveal-button:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.05);
  outline: 3px solid rgba(255, 240, 207, 0.72);
  outline-offset: 4px;
}

.reveal-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.reveal-button:disabled {
  cursor: wait;
  filter: saturate(0.8) brightness(0.82);
}

.button-hint {
  margin: -0.45rem 0 0;
  text-align: center;
  font-size: 0.92rem;
}

.tato-card.is-shuffling .tato-image {
  animation: shuffle-wiggle 160ms ease-in-out infinite alternate;
}

.tato-card.is-revealed {
  animation: card-pop 460ms cubic-bezier(0.2, 0.9, 0.2, 1.15);
}

@keyframes shuffle-wiggle {
  from {
    transform: rotate(-2deg) translateY(3px) scale(0.98);
  }
  to {
    transform: rotate(2deg) translateY(-3px) scale(1.02);
  }
}

@keyframes card-pop {
  0% {
    transform: scale(0.985);
  }
  55% {
    transform: scale(1.015);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 680px) {
  .app-shell {
    align-content: start;
    gap: 0.85rem;
    padding: 1.1rem 0.9rem 1.35rem;
  }

  h1 {
    font-size: clamp(2rem, 9vw, 3.25rem);
    line-height: 0.96;
  }

  .subtitle {
    font-size: clamp(0.95rem, 3.6vw, 1.08rem);
  }

  .tato-card {
    grid-template-columns: 1fr;
    gap: 0.9rem;
    padding: 0.9rem;
    border-radius: 24px;
  }

  .image-frame {
    min-height: clamp(180px, 52vw, 230px);
  }

  .tato-image {
    width: min(78%, 250px);
  }
}

@media (max-width: 480px) {
  :root {
    --radius-xl: 22px;
    --radius-lg: 17px;
  }

  .app-shell {
    min-height: 100svh;
    gap: 0.68rem;
    padding: 0.75rem 0.65rem 0.9rem;
  }

  .eyebrow {
    margin-bottom: 0.28rem;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
  }

  h1 {
    margin-bottom: 0.35rem;
    font-size: clamp(1.72rem, 8.8vw, 2.35rem);
    line-height: 1;
  }

  .subtitle {
    font-size: 0.92rem;
    line-height: 1.28;
  }

  .tato-card {
    gap: 0.72rem;
    padding: 0.68rem;
    box-shadow: 0 18px 46px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  .image-frame {
    min-height: clamp(150px, 47vw, 195px);
  }

  .mystery-mark {
    width: min(42vw, 154px);
    border-width: 3px;
    font-size: clamp(3.8rem, 20vw, 6.2rem);
  }

  .tato-image {
    width: min(70%, 205px);
  }

  .card-kicker {
    margin-bottom: 0.18rem;
    font-size: 0.65rem;
    letter-spacing: 0.11em;
  }

  h2 {
    margin-bottom: 0.32rem;
    font-size: clamp(1.45rem, 8vw, 2rem);
    line-height: 1;
  }

  .tato-type {
    margin-bottom: 0.65rem;
    font-size: 0.94rem;
    line-height: 1.3;
  }

  .result-details {
    gap: 0.5rem;
  }

  .result-details div {
    padding: 0.58rem 0.62rem;
    border-radius: 13px;
  }

  dt {
    margin-bottom: 0.16rem;
    font-size: 0.65rem;
  }

  dd {
    font-size: 0.92rem;
    line-height: 1.34;
  }

  .reveal-button {
    width: min(100%, 250px);
    min-height: 52px;
    padding: 0.78rem 1.05rem;
    font-size: 0.98rem;
  }

  .button-hint {
    margin-top: -0.3rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  .app-shell {
    gap: 0.55rem;
    padding-inline: 0.5rem;
  }

  h1 {
    font-size: clamp(1.58rem, 8.2vw, 2rem);
  }

  .image-frame {
    min-height: 145px;
  }

  .tato-image {
    width: min(68%, 185px);
  }

  h2 {
    font-size: clamp(1.32rem, 7.4vw, 1.75rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
