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

:root {
  --honey: #f0a92e;
  --honey-dark: #d68910;
  --cream: #fff6e3;
  --brown: #5f3d1e;
  --brown-soft: #8a6238;
  --pink: #e8566d;
  --green: #7cb342;
}

html, body {
  margin: 0; padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: 'Baloo 2', ui-rounded, -apple-system, sans-serif;
  background: linear-gradient(180deg, #ffe9bd 0%, var(--cream) 40%, #ffe3b3 100%);
  color: var(--brown);
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}

#app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  max-width: 520px; margin: 0 auto;
  overflow: hidden;
}

/* ---------- content screen ---------- */
.screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 18px 8px;
  display: flex; flex-direction: column;
  align-items: center;
  animation: screenIn .5s ease both;
}
.screen > * { flex-shrink: 0; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

h1 {
  font-size: 2rem; font-weight: 800; text-align: center;
  margin: .4em 0 .2em; color: var(--brown);
}
h2 { font-size: 1.35rem; font-weight: 700; text-align: center; margin: .3em 0; }
.subtitle { text-align: center; color: var(--brown-soft); margin: 0 0 12px; font-weight: 600; }

.card {
  background: #fffdf6;
  border-radius: 22px;
  box-shadow: 0 6px 18px rgba(95, 61, 30, .12);
  padding: 18px;
  width: 100%;
  margin-bottom: 12px;
}

/* ---------- buttons ---------- */
.btn {
  font-family: inherit; font-weight: 700; font-size: 1.1rem;
  color: #fff;
  background: linear-gradient(180deg, var(--honey), var(--honey-dark));
  border: none; border-radius: 999px;
  padding: 13px 30px;
  box-shadow: 0 5px 14px rgba(214, 137, 16, .45);
  cursor: pointer;
  transition: transform .15s;
}
.btn:active { transform: scale(.94); }
.btn.secondary {
  background: #fffdf6; color: var(--brown-soft);
  box-shadow: 0 3px 8px rgba(95,61,30,.15);
  font-size: .95rem; padding: 9px 20px;
}
.btn:disabled { opacity: .45; box-shadow: none; }

.choice-btn {
  display: block; width: 100%;
  font-family: inherit; font-weight: 600; font-size: 1.05rem;
  text-align: left;
  color: var(--brown);
  background: #fffdf6;
  border: 2.5px solid #f0dcb4;
  border-radius: 18px;
  padding: 14px 16px;
  margin: 8px 0;
  cursor: pointer;
  transition: transform .12s, border-color .2s, background .2s;
}
.choice-btn:active { transform: scale(.97); }
.choice-btn.correct { border-color: var(--green); background: #eef7e3; }
.choice-btn.wrong { border-color: var(--pink); background: #fdecef; animation: shake .4s; }
@keyframes shake { 0%,100%{transform:none} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

.skip-link {
  color: var(--brown-soft); font-size: .85rem; font-weight: 600;
  text-decoration: underline; background: none; border: none;
  font-family: inherit; margin: 6px 0; cursor: pointer;
}

/* ---------- inputs ---------- */
input[type=text], input[type=tel] {
  font-family: inherit; font-size: 1.6rem; font-weight: 700;
  text-align: center; color: var(--brown);
  background: #fffdf6;
  border: 2.5px solid #f0dcb4; border-radius: 16px;
  padding: 10px; width: 130px;
  outline: none;
}
input:focus { border-color: var(--honey); }

input[type=range] {
  width: 100%; margin: 18px 0 6px;
  accent-color: var(--honey);
  height: 34px;
}
.slider-value {
  font-size: 2.4rem; font-weight: 800; text-align: center;
  color: var(--honey-dark);
}

select {
  font-family: inherit; font-size: 1.05rem; font-weight: 600;
  color: var(--brown); background: #fffdf6;
  border: 2.5px solid #f0dcb4; border-radius: 14px;
  padding: 9px 12px; outline: none;
  -webkit-appearance: none; appearance: none;
}

/* ---------- bear zone ---------- */
#bear-zone {
  position: relative;
  flex-shrink: 0;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: linear-gradient(180deg, transparent, rgba(240, 169, 46, .18));
}

.bubble {
  position: relative;
  margin: 0 14px 6px;
  background: #fff;
  border-radius: 18px;
  padding: 10px 14px;
  font-size: .98rem; font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 4px 14px rgba(95,61,30,.15);
  transform-origin: 40% 100%;
  animation: bubblePop .35s cubic-bezier(.34,1.56,.64,1) both;
  z-index: 3;
}
.bubble::after {
  content: "";
  position: absolute; bottom: -9px; left: 42px;
  border: 10px solid transparent;
  border-top-color: #fff;
  border-bottom: none;
}
.bubble.hidden { display: none; }
@keyframes bubblePop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }

#bear-strip {
  position: relative;
  height: 96px;
}

.bear {
  position: absolute;
  left: 50%; bottom: 0;
  width: 84px; height: 105px;
  margin-left: -42px;
  transform: translateX(0);
  transition: transform 2s ease-in-out;
  will-change: transform;
  z-index: 2;
}
.bear-flip { width: 100%; height: 100%; transition: transform .3s; }
.bear.face-left .bear-flip { transform: scaleX(-1); }
#bear-svg { width: 100%; height: 100%; }

/* walking bob */
.bear.walking #bear-svg { animation: bob .35s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(0) rotate(-2.5deg); } to { transform: translateY(-4px) rotate(2.5deg); } }

/* happy hop (next to button) */
.bear.hopping #bear-svg { animation: hop .7s ease-in-out infinite; }
@keyframes hop {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-12px) rotate(-4deg); }
  60% { transform: translateY(0); }
}

.bear.celebrate #bear-svg { animation: celebrate .5s ease-in-out 4; }
@keyframes celebrate {
  0%,100% { transform: rotate(0); }
  25% { transform: rotate(-8deg) translateY(-8px); }
  75% { transform: rotate(8deg) translateY(-8px); }
}

/* faces */
.face { opacity: 0; transition: opacity .15s; }
.bear[data-face="smile"] .face-smile,
.bear[data-face="grimace"] .face-grimace,
.bear[data-face="kiss"] .face-kiss { opacity: 1; }

.kiss-lips { transform-origin: 100px 108px; animation: pucker 1s ease-in-out infinite; }
@keyframes pucker { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }

.next-btn {
  position: absolute;
  right: 18px; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  z-index: 4;
  animation: btnIn .4s cubic-bezier(.34,1.56,.64,1) both, glowPulse 1.6s ease-in-out .4s infinite;
}
.next-btn.hidden { display: none; }
@keyframes btnIn { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: scale(1); } }
@keyframes glowPulse {
  0%,100% { box-shadow: 0 5px 14px rgba(214,137,16,.45); }
  50% { box-shadow: 0 5px 24px rgba(214,137,16,.8); }
}

/* ---------- photos ---------- */
.polaroid-stage {
  position: relative;
  width: 100%; max-width: 340px;
  aspect-ratio: 3/3.6;
  margin: 10px auto;
}
.polaroid {
  position: absolute; inset: 0;
  background: #fff;
  border-radius: 8px;
  padding: 12px 12px 44px;
  box-shadow: 0 8px 24px rgba(95,61,30,.25);
  transition: opacity .45s, transform .45s;
}
.polaroid img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 4px;
  pointer-events: none;
}
.polaroid .caption {
  position: absolute; bottom: 10px; left: 0; right: 0;
  text-align: center; font-size: 1.1rem;
}
.photo-count { text-align: center; color: var(--brown-soft); font-weight: 600; font-size: .9rem; }

/* ---------- honey pots ---------- */
.pots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  margin-top: 8px;
}
.pot {
  position: relative;
  background: #fffdf6;
  border: 2.5px solid #f0dcb4;
  border-radius: 20px;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  cursor: pointer;
  transition: transform .15s;
  box-shadow: 0 4px 10px rgba(95,61,30,.1);
}
.pot:active { transform: scale(.92); }
.pot.wiggle { animation: wiggle .5s ease-in-out 2; }
@keyframes wiggle { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-8deg)} 75%{transform:rotate(8deg)} }
.pot.opened { border-color: var(--honey); background: #fdf3dc; }
.pot .check {
  position: absolute; top: -8px; right: -8px;
  background: var(--green); color: #fff;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 15px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* letter overlay */
#overlay {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(95, 61, 30, .5);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  z-index: 50;
  padding: 24px;
}
#overlay.show { display: flex; }
.letter {
  background: #fffbee;
  border-radius: 6px;
  padding: 30px 22px;
  max-width: 340px; width: 100%;
  font-size: 1.15rem; font-weight: 600; line-height: 31px;
  text-align: center;
  box-shadow: 0 16px 50px rgba(0,0,0,.35);
  background-image: repeating-linear-gradient(#fffbee, #fffbee 30px, #f3e6c8 31px);
  animation: letterGrow .5s cubic-bezier(.34,1.56,.64,1) both;
  border-top: 10px solid var(--honey);
}
@keyframes letterGrow { from { transform: scale(.1) rotate(-10deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.letter .btn { display: block; margin: 18px auto 0; }

/* ---------- arukone ---------- */
#arukone-canvas {
  width: 100%; max-width: 340px;
  touch-action: none;
  border-radius: 18px;
  background: #fffdf6;
  box-shadow: 0 6px 18px rgba(95,61,30,.12);
}

/* ---------- timeguessr ---------- */
.tg-photo {
  width: 100%; border-radius: 16px;
  box-shadow: 0 6px 18px rgba(95,61,30,.2);
  margin-bottom: 10px;
}
#tg-map {
  width: 100%; height: 240px;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(95,61,30,.2);
  z-index: 1;
}
.tg-date-row {
  display: flex; gap: 10px; justify-content: center;
  margin: 12px 0;
}

/* ---------- wordle ---------- */
.wordle-grid {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
  margin: 8px 0;
}
.wordle-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wtile {
  width: 52px; height: 52px;
  border: 2.5px solid #e8d5ab;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800;
  background: #fffdf6;
  text-transform: uppercase;
  transition: transform .1s, background .3s, border-color .3s, color .3s;
}
.wtile.filled { border-color: var(--brown-soft); transform: scale(1.05); }
.wtile.g { background: var(--green); border-color: var(--green); color: #fff; }
.wtile.y { background: var(--honey); border-color: var(--honey); color: #fff; }
.wtile.x { background: #b8ab93; border-color: #b8ab93; color: #fff; }

.kb { width: 100%; max-width: 500px; margin-top: 4px; }
.kb-row { display: flex; justify-content: center; gap: 4px; margin-bottom: 5px; }
.kb button {
  font-family: inherit; font-weight: 700; font-size: .95rem;
  flex: 1; max-width: 40px;
  padding: 11px 0;
  border: none; border-radius: 8px;
  background: #f0e2c2; color: var(--brown);
  cursor: pointer;
}
.kb button.wide { max-width: 60px; flex: 1.6; font-size: .75rem; }
.kb button.g { background: var(--green); color: #fff; }
.kb button.y { background: var(--honey); color: #fff; }
.kb button.x { background: #b8ab93; color: #fff; }

/* ---------- final ---------- */
.final-text {
  font-size: 1.3rem; font-weight: 700; line-height: 1.6;
  text-align: center;
  padding: 10px;
}

/* floating hearts */
.fheart {
  position: fixed;
  font-size: 26px;
  pointer-events: none;
  z-index: 90;
  animation: floatUp 3s ease-in forwards;
}
@keyframes floatUp {
  from { transform: translateY(0) rotate(0); opacity: 1; }
  to { transform: translateY(-90vh) rotate(30deg); opacity: 0; }
}

/* ---------- kiss finale ---------- */
#kiss-stage {
  position: fixed; inset: 0;
  background: linear-gradient(180deg, #ffe9bd, #ffd28a);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#kiss-bear {
  width: 220px;
  transition: transform 1.6s cubic-bezier(.5, 0, .8, .4);
}
#kiss-bear.zoom { transform: scale(9) translateY(6%); }
.kiss-mark {
  position: fixed;
  left: 50%; top: 42%;
  font-size: 130px;
  transform: translate(-50%, -50%) scale(0) rotate(-15deg);
  z-index: 110;
  pointer-events: none;
}
.kiss-mark.stamp { animation: stamp .5s cubic-bezier(.34,1.56,.64,1) forwards; }
@keyframes stamp {
  to { transform: translate(-50%, -50%) scale(1) rotate(-15deg); }
}
.kiss-final-text {
  position: fixed;
  left: 0; right: 0; top: 58%;
  text-align: center;
  font-size: 1.6rem; font-weight: 800;
  color: var(--brown);
  z-index: 110;
  opacity: 0;
  transition: opacity 1s;
  padding: 0 30px;
}
.kiss-final-text.show { opacity: 1; }
.kiss-final-text .small { font-size: 1rem; font-weight: 600; color: var(--brown-soft); }

body.shake { animation: bodyShake .5s; }
@keyframes bodyShake {
  0%,100% { transform: none; }
  20% { transform: translate(-8px, 4px); }
  40% { transform: translate(8px, -4px); }
  60% { transform: translate(-6px, -3px); }
  80% { transform: translate(6px, 3px); }
}

.hidden { display: none !important; }
