:root {
  color-scheme: light;
  --red: #d9091d;
  --deep-red: #7a0613;
  --coral: #ff6048;
  --cream: #fff7d1;
  --sky: #55d8e3;
  --ink: #31070d;
  --shadow: 0 18px 40px rgba(122, 6, 19, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 96, 72, 0.2), transparent 28%),
    linear-gradient(135deg, #fff7d1 0%, #ffe4e1 38%, #cef8fa 100%);
  color: var(--ink);
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
}

.game-phone {
  width: min(100%, 430px);
  height: min(100dvh - 28px, 920px);
  min-height: 640px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
}

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

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--red);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--deep-red);
  font-size: 1.6rem;
  line-height: 1;
}

.icon-button,
.tap-button,
.overlay button {
  border: 0;
  cursor: pointer;
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 900;
}

.camera-panel {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 2px solid rgba(122, 6, 19, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 10px 28px rgba(122, 6, 19, 0.08);
}

.camera-preview {
  position: relative;
  width: 108px;
  height: 108px;
  overflow: hidden;
  border: 2px solid rgba(122, 6, 19, 0.26);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 247, 209, 0.18), transparent 36%),
    #3b1115;
}

#cameraVideo {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  clip-path: ellipse(34% 40% at 50% 58%);
  transform: scaleX(-1);
}

.camera-preview img {
  position: absolute;
  inset: -6% -34% auto -34%;
  width: 168%;
  height: auto;
  pointer-events: none;
}

.camera-copy {
  min-width: 0;
}

.camera-copy p {
  margin: 0 0 6px;
  color: #65101a;
  font-size: 0.8rem;
  font-weight: 850;
  line-height: 1.18;
}

.mouth-meter {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(122, 6, 19, 0.12);
}

.mouth-meter span {
  width: 0%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff6048, #fff176);
  transition: width 80ms linear;
}

#cameraButton {
  min-width: 74px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: #fff7d1;
  color: var(--deep-red);
  font-size: 0.86rem;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(122, 6, 19, 0.12);
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 4px solid var(--deep-red);
  border-radius: 8px;
  background: var(--sky);
  box-shadow: var(--shadow);
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 28px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 247, 209, 0.84), rgba(85, 216, 227, 0.72)),
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.95), transparent 36%);
}

.overlay.hidden {
  display: none;
}

.overlay img {
  width: min(48%, 180px);
  height: auto;
  filter: drop-shadow(0 12px 0 rgba(122, 6, 19, 0.12));
  animation: floaty 1.25s ease-in-out infinite alternate;
}

.overlay h2 {
  margin: 18px 0 8px;
  color: var(--deep-red);
  font-size: clamp(2rem, 9vw, 3.1rem);
  line-height: 0.95;
}

.overlay p {
  max-width: 280px;
  margin: 0 0 22px;
  color: #65101a;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.35;
}

.overlay button,
.tap-button {
  min-height: 52px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-weight: 950;
}

.overlay button {
  min-width: 144px;
  padding: 0 24px;
  font-size: 1.05rem;
}

.tap-button {
  width: 100%;
  padding: 0 10px;
  font-size: 0.88rem;
}

.tongue-button {
  background: #ff8d1a;
}

.kiss-button {
  background: #ff4fa0;
}

.icon-button:active,
.tap-button:active,
.overlay button:active {
  transform: translateY(1px);
}

@keyframes floaty {
  from {
    transform: translateY(0) rotate(-4deg);
  }
  to {
    transform: translateY(-10px) rotate(4deg);
  }
}

@media (min-width: 760px) {
  .game-phone {
    height: min(92dvh, 880px);
  }
}

@media (max-height: 700px) {
  .game-phone {
    min-height: 0;
  }

  .topbar,
  .camera-panel {
    display: none;
  }
}
