:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ink: #211a18;
  --paper: #fff8ea;
  --muted: rgba(33, 26, 24, 0.62);
  --accent: #d84f3a;
  --footer: #26796f;
  --bg-a: #f8d96a;
  --bg-b: #f47f5b;
  --bg-c: #54b7a8;
  --shadow: rgba(92, 45, 36, 0.25);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100vh;
  min-height: 100lvh;
  margin: 0;
  overflow: hidden;
  background-color: #f47f5b;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 8% 9%, rgba(255,255,255,0.24), transparent 22%),
    radial-gradient(circle at 100% 92%, rgba(255,255,255,0.18), transparent 24%),
    linear-gradient(135deg, #f8d96a, #f47f5b 52%, #54b7a8);
  background-color: #f47f5b;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 -240px;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 8% 9%, rgba(255,255,255,0.24), transparent 22%),
    radial-gradient(circle at 100% 92%, rgba(255,255,255,0.18), transparent 24%),
    linear-gradient(135deg, #f8d96a, #f47f5b 52%, #54b7a8);
}

button {
  font: inherit;
}

.app {
  position: fixed;
  inset: 0;
  isolation: isolate;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: clamp(8px, 1.5vh, 16px);
  width: 100vw;
  min-height: 100vh;
  min-height: 100lvh;
  padding: calc(12px + var(--safe-top)) clamp(12px, 3.2vw, 28px) calc(10px + var(--safe-bottom));
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 9%, rgba(255,255,255,0.24), transparent 22%),
    radial-gradient(circle at 100% 92%, rgba(255,255,255,0.18), transparent 24%),
    linear-gradient(135deg, var(--bg-a), var(--bg-b) 52%, var(--bg-c));
  transition: background 280ms ease;
  background-color: var(--bg-b);
}

.app::before {
  content: "";
  position: fixed;
  inset: 0 0 -260px;
  z-index: -1;
  background:
    radial-gradient(circle at 8% 9%, rgba(255,255,255,0.24), transparent 22%),
    radial-gradient(circle at 100% 92%, rgba(255,255,255,0.18), transparent 24%),
    linear-gradient(135deg, var(--bg-a), var(--bg-b) 52%, var(--bg-c));
}


.theme-sunset {
  --bg-a: #f8d96a;
  --bg-b: #f47f5b;
  --bg-c: #54b7a8;
  --accent: #d84f3a;
  --footer: #26796f;
  --shadow: rgba(92, 45, 36, 0.25);
}

.theme-night {
  --bg-a: #202943;
  --bg-b: #725bc9;
  --bg-c: #e08a74;
  --accent: #cf4d3f;
  --footer: #247c73;
  --shadow: rgba(17, 22, 37, 0.42);
}

.theme-candy {
  --bg-a: #f7a8c8;
  --bg-b: #9d72df;
  --bg-c: #5ec6c5;
  --accent: #8b3f96;
  --footer: #236f74;
  --shadow: rgba(67, 34, 95, 0.3);
}

.theme-mint {
  --bg-a: #9ee7cf;
  --bg-b: #fff2a8;
  --bg-c: #f5a6b8;
  --accent: #16796e;
  --footer: #b64f6a;
  --shadow: rgba(25, 93, 85, 0.25);
}

.theme-wine {
  --bg-a: #461826;
  --bg-b: #a63d52;
  --bg-c: #f0b36a;
  --accent: #9d2e41;
  --footer: #80613a;
  --shadow: rgba(58, 14, 28, 0.34);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: rgba(255, 248, 234, 0.94);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
}

.eyebrow {
  margin: 0 0 3px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.78;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 248, 234, 0.36);
  border-radius: 50%;
  color: #fff8ea;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.stage {
  display: grid;
  min-height: 0;
  place-items: center;
}

.card {
  width: min(100%, 560px);
  height: min(100%, 66dvh, 700px);
  min-height: 440px;
  padding: clamp(10px, 2.5vw, 18px);
  border: 0;
  border-radius: clamp(34px, 8vw, 58px);
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 34px 80px var(--shadow);
  cursor: pointer;
  touch-action: pan-y;
  transform: translate3d(0, 0, 0) rotate(0deg);
  transition: transform 220ms ease, box-shadow 220ms ease;
  user-select: none;
}

.card:active {
  transform: scale(0.992);
}

.card.is-out-left {
  animation: outLeft 240ms ease forwards;
}

.card.is-out-right {
  animation: outRight 240ms ease forwards;
}

.card.is-in-next {
  animation: inFromRight 280ms cubic-bezier(.2,.8,.2,1) both;
}

.card.is-in-prev {
  animation: inFromLeft 280ms cubic-bezier(.2,.8,.2,1) both;
}

.card-border {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  padding: clamp(18px, 4vw, 30px);
  border: 4px solid rgba(33, 26, 24, 0.9);
  border-radius: clamp(24px, 6vw, 42px);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-bottom: clamp(12px, 2.4vh, 20px);
  border-bottom: 4px solid rgba(33, 26, 24, 0.13);
}

.card-title {
  color: var(--accent);
  font-size: clamp(1.35rem, 4.7vw, 2.35rem);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.counter {
  min-width: 72px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  font-size: clamp(0.9rem, 3vw, 1.15rem);
  font-weight: 900;
  text-align: center;
}

.question-wrap {
  display: grid;
  min-height: 0;
  place-items: center;
  padding: clamp(16px, 3.2vh, 32px) 0;
}

.question {
  width: 100%;
  max-height: 100%;
  margin: 0;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: manual;
  color: var(--ink);
  font-size: clamp(1.62rem, 5.95vw, 3.1rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
  text-align: center;
}

.controls {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 12px;
  width: min(100%, 560px);
  margin: 0 auto;
}

.primary-button,
.ghost-button {
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
}

.primary-button {
  color: var(--ink);
  background: #fff8ea;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}

.ghost-button {
  color: #fff8ea;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 248, 234, 0.3);
  backdrop-filter: blur(12px);
}

.ghost-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.hint {
  width: min(100%, 540px);
  margin: 0 auto;
  color: rgba(255, 248, 234, 0.82);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

@media (max-height: 680px) {
  .app {
    gap: 10px;
  }

  .eyebrow,
  .hint {
    display: none;
  }

  .card {
    height: 68dvh;
    min-height: 360px;
  }

  .card-border {
    padding: 16px;
  }

  .question {
    line-height: 1.06;
  }
}

@keyframes outLeft {
  to {
    opacity: 0;
    transform: translate3d(-34vw, 10px, 0) rotate(-7deg);
  }
}

@keyframes outRight {
  to {
    opacity: 0;
    transform: translate3d(34vw, 10px, 0) rotate(7deg);
  }
}

@keyframes inFromRight {
  from {
    opacity: 0;
    transform: translate3d(28vw, 8px, 0) rotate(5deg) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
}

@keyframes inFromLeft {
  from {
    opacity: 0;
    transform: translate3d(-28vw, 8px, 0) rotate(-5deg) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
}
